Compare commits

...

2 Commits

Author SHA1 Message Date
oguzhankoral 1014c96543 Join strings 2025-01-21 00:06:55 +03:00
oguzhankoral 585883d94d Join strings 2025-01-20 17:02:14 +03:00
2 changed files with 37 additions and 18 deletions
+34 -18
View File
@@ -138,21 +138,32 @@ export function processMatrixView(
const objects: Record<string, string[]> = {}
let objectsString = ''
// NOTE: matrix view gave us already filtered out rows from tooltip data if it is assigned
matrixView.rows.root.children.forEach((obj) => {
// otherwise there is no point to collect objects
if (visualStore.viewerReloadNeeded) {
const id = obj.children[0].value as unknown as string
const value = (obj.value as unknown as string).slice(9)
const existingObjectId = Object.keys(objects).find((k) => id.includes(k))
if (!existingObjectId) {
objects[id] = [value]
} else {
objects[existingObjectId].push(value)
// const id = obj.children[0].value as unknown as string
if (visualStore.viewerReloadNeeded) {
const viewerDataValue = obj.value as unknown as string
if (!viewerDataValue.startsWith('z_')) {
objectsString += viewerDataValue.slice(9)
}
}
// before row optimization
// if (visualStore.viewerReloadNeeded) {
// const id = obj.children[0].value as unknown as string
// const value = (obj.value as unknown as string).slice(9)
// const existingObjectId = Object.keys(objects).find((k) => id.includes(k))
// if (!existingObjectId) {
// objects[id] = [value]
// } else {
// objects[existingObjectId].push(value)
// }
// }
const processedObjectIdLevels = processObjectIdLevel(obj, host, matrixView)
processedObjectIdLevels.forEach((objRes) => {
@@ -207,17 +218,22 @@ export function processMatrixView(
})
}
})
const jsonObjects: object[] = []
try {
// otherwise there is no point to join collected objects
if (visualStore.viewerReloadNeeded) {
for (const objs of Object.values(objects)) {
jsonObjects.push(JSON.parse(objs.join('')))
}
}
} catch (error) {
console.error(error)
let jsonObjects = []
if (visualStore.viewerReloadNeeded) {
jsonObjects = JSON.parse(objectsString)
}
// // const jsonObjects: object[] = JSON.parse(objectsString)
// try {
// // otherwise there is no point to join collected objects
// // if (visualStore.viewerReloadNeeded) {
// // for (const objs of Object.values(objects)) {
// // jsonObjects.push(JSON.parse(objs.join('')))
// // }
// // }
// jsonObjects = JSON.parse(objectsString)
// } catch (error) {
// console.error(error)
// }
previousPalette = host.colorPalette['colorPalette']
+3
View File
@@ -85,6 +85,9 @@ export class Visual implements IVisual {
// we first need to check which inputs user provided to decide our strategy
const validationResult = validateMatrixView(options)
visualStore.setFieldInputState(validationResult)
if (visualStore.dataInputStatus !== 'valid') {
throw new Error('Inputs are not completed!')
}
// read saved data from file if any
if (this.isFirstViewerLoad && options.dataViews[0].metadata.objects) {