Compare commits
No commits in common. "9255f6bbe8725c14a2c20778aa86a7c1c6a2fcb8" and "bd0c4432609f4b36a5736f5cbeaab1ad57d2c37b" have entirely different histories.
9255f6bbe8
...
bd0c443260
@ -41,6 +41,8 @@ export default function CodeBlockEditor({
|
|||||||
editorCode = JSON.stringify(code, null, 2)
|
editorCode = JSON.stringify(code, null, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(editorCode)
|
||||||
|
|
||||||
// Map language to CodeMirror extension
|
// Map language to CodeMirror extension
|
||||||
const languageExtension = useMemo(() => {
|
const languageExtension = useMemo(() => {
|
||||||
switch (language.toLowerCase()) {
|
switch (language.toLowerCase()) {
|
||||||
@ -88,6 +90,7 @@ export default function CodeBlockEditor({
|
|||||||
|
|
||||||
const handleOnChange = (value) => {
|
const handleOnChange = (value) => {
|
||||||
if (typeof code == 'object' && language == 'json') {
|
if (typeof code == 'object' && language == 'json') {
|
||||||
|
console.log('Parsing object', JSON.parse(value))
|
||||||
onChange(JSON.parse(value))
|
onChange(JSON.parse(value))
|
||||||
} else {
|
} else {
|
||||||
onChange(value)
|
onChange(value)
|
||||||
|
|||||||
@ -113,7 +113,7 @@ const EditObjectForm = forwardRef(
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initialized == false && id && token != null) {
|
if (!initialized && id && token != null) {
|
||||||
setInitialized(true)
|
setInitialized(true)
|
||||||
handleFetchObject()
|
handleFetchObject()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -364,7 +364,7 @@ const NotesPanel = ({ _id, onNewNote, type }) => {
|
|||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
[fetchData, expandedNotes, userProfile, handleNewChildNote]
|
[loading, fetchData, expandedNotes, userProfile, handleNewChildNote]
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleNewNote = async () => {
|
const handleNewNote = async () => {
|
||||||
|
|||||||
@ -55,7 +55,7 @@ const ObjectSelect = ({
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[type, fetchObjectsByProperty, properties, filter, masterFilter]
|
[type, fetchObjectsByProperty, properties, filter]
|
||||||
)
|
)
|
||||||
|
|
||||||
// Convert the API response to AntD TreeSelect treeData
|
// Convert the API response to AntD TreeSelect treeData
|
||||||
@ -98,11 +98,10 @@ const ObjectSelect = ({
|
|||||||
const newFilterPath = filterPath.concat({ property, value: key })
|
const newFilterPath = filterPath.concat({ property, value: key })
|
||||||
return {
|
return {
|
||||||
title: <ObjectProperty type={property} value={key} />,
|
title: <ObjectProperty type={property} value={key} />,
|
||||||
value: parentKeys.concat(key).join('-'),
|
value: key,
|
||||||
filterValue: key,
|
key: parentKeys.concat(key).join(':'),
|
||||||
key: parentKeys.concat(key).join('-'),
|
|
||||||
property,
|
property,
|
||||||
parentKeys: parentKeys.concat(key || '-'),
|
parentKeys: parentKeys.concat(key || ':'),
|
||||||
filterPath: newFilterPath,
|
filterPath: newFilterPath,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
children: buildTreeData(
|
children: buildTreeData(
|
||||||
@ -132,7 +131,7 @@ const ObjectSelect = ({
|
|||||||
customFilter[property] = value
|
customFilter[property] = value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
customFilter[node.property] = node.filterValue
|
customFilter[node.property] = node.value
|
||||||
// Fetch children for this node
|
// Fetch children for this node
|
||||||
const data = await handleFetchObjectsProperties(customFilter)
|
const data = await handleFetchObjectsProperties(customFilter)
|
||||||
if (!data) return
|
if (!data) return
|
||||||
@ -142,14 +141,14 @@ const ObjectSelect = ({
|
|||||||
// If the API returns an object with multiple keys, get only the data for this node
|
// If the API returns an object with multiple keys, get only the data for this node
|
||||||
nodeSpecificData = data[node.value] || {}
|
nodeSpecificData = data[node.value] || {}
|
||||||
}
|
}
|
||||||
// Build new tree children only for this specific node
|
// Build new children only for this specific node
|
||||||
const treeChildren = buildTreeData(
|
const children = buildTreeData(
|
||||||
nodeSpecificData,
|
nodeSpecificData,
|
||||||
properties.indexOf(node.property) + 1,
|
properties.indexOf(node.property) + 1,
|
||||||
node.parentKeys || [],
|
node.parentKeys || [],
|
||||||
(node.filterPath || []).concat({
|
(node.filterPath || []).concat({
|
||||||
property: node.property,
|
property: node.property,
|
||||||
value: node.filterValue
|
value: node.value
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
// Update treeData with new children for this node only
|
// Update treeData with new children for this node only
|
||||||
@ -227,14 +226,7 @@ const ObjectSelect = ({
|
|||||||
handleFetchObjectsProperties()
|
handleFetchObjectsProperties()
|
||||||
setInitialized(true)
|
setInitialized(true)
|
||||||
}
|
}
|
||||||
}, [
|
}, [value, filter, properties, handleFetchObjectsProperties, initialized])
|
||||||
value,
|
|
||||||
filter,
|
|
||||||
properties,
|
|
||||||
handleFetchObjectsProperties,
|
|
||||||
initialized,
|
|
||||||
token
|
|
||||||
])
|
|
||||||
|
|
||||||
// --- Error UI ---
|
// --- Error UI ---
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@ -268,7 +268,7 @@ const ObjectTable = forwardRef(
|
|||||||
loadPreviousPage()
|
loadPreviousPage()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[loadNextPage, loadPreviousPage, hasMore, pages]
|
[lazyLoading, loadNextPage, loadPreviousPage, hasMore, pages]
|
||||||
)
|
)
|
||||||
|
|
||||||
const reload = useCallback(async () => {
|
const reload = useCallback(async () => {
|
||||||
@ -293,7 +293,7 @@ const ObjectTable = forwardRef(
|
|||||||
|
|
||||||
const newEventHandler = useCallback(() => {
|
const newEventHandler = useCallback(() => {
|
||||||
reload()
|
reload()
|
||||||
}, [reload])
|
}, [reload, type])
|
||||||
|
|
||||||
// Subscribe to real-time updates for all items
|
// Subscribe to real-time updates for all items
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -75,7 +75,7 @@ const PrintServerProvider = ({ children }) => {
|
|||||||
socketRef.current.disconnect()
|
socketRef.current.disconnect()
|
||||||
socketRef.current = null
|
socketRef.current = null
|
||||||
}
|
}
|
||||||
}, [token, messageApi, notificationApi])
|
}, [token, messageApi])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PrintServerContext.Provider
|
<PrintServerContext.Provider
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user