From 55ebad8eef1c53b5d851ede9b32708605d063013 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 15:45:35 +0100 Subject: [PATCH 01/36] projectByProjectId --- .../attributeId/AttributeCalculations.tsx | 2 +- .../projectId/data-browser/DataBrowser.tsx | 4 +-- .../heuristics/HeuristicsOverview.tsx | 4 +-- .../active-learning/ActiveLearning.tsx | 4 +-- .../labeling-function/LabelingFunction.tsx | 2 +- .../main-component/LabelingMainComponent.tsx | 2 +- .../projectId/overview/ProjectOverview.tsx | 2 +- .../projectId/settings/ProjectSettings.tsx | 8 +++--- .../shared/export/ExportRecordsModal.tsx | 2 +- src/reduxStore/StoreManagerComponent.tsx | 2 +- .../settings/labeling-tasks-helper.ts | 25 ++++++------------- src/util/shared/export-helper.ts | 8 +++--- 12 files changed, 28 insertions(+), 37 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index 2153b96e..c457634e 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -227,7 +227,7 @@ export default function AttributeCalculation() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index 1a3e7e02..f530d9d3 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -117,14 +117,14 @@ export default function DataBrowser() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } function refetchEmbeddingsAndPostProcess() { getEmbeddings(projectId, (res) => { - const embeddings = postProcessingEmbeddings(res.data['projectByProjectId']['embeddings']['edges'].map((e) => e['node']), []); + const embeddings = postProcessingEmbeddings(res['embeddings'], []); dispatch(setAllEmbeddings(embeddings)); }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index 0010a2e0..2313669a 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -73,7 +73,7 @@ export function HeuristicsOverview() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } @@ -88,7 +88,7 @@ export function HeuristicsOverview() { function refetchEmbeddingsAndProcess() { getEmbeddings(projectId, (res) => { - const embeddingsFinal = postProcessingEmbeddings(res.data['projectByProjectId']['embeddings']['edges'].map((e) => e['node']), []); + const embeddingsFinal = postProcessingEmbeddings(res['embeddings'], []); dispatch(setAllEmbeddings(embeddingsFinal)); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx index 8dbb0425..8553160f 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx @@ -121,14 +121,14 @@ export default function ActiveLearning() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } function refetchEmbeddingsAndPostProcess() { getEmbeddings(projectId, (res) => { - const embeddings = postProcessingEmbeddings(res.data['projectByProjectId']['embeddings']['edges'].map((e) => e['node']), []); + const embeddings = postProcessingEmbeddings(res['embeddings'], []); dispatch(setAllEmbeddings(embeddings)); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx index 7cf349b5..2784277b 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx @@ -104,7 +104,7 @@ export default function LabelingFunction() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index e7eec796..edf5397f 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -285,7 +285,7 @@ export default function LabelingMainComponent() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); const labelingTasksProcessed = postProcessLabelingTasksSchema(labelingTasks); dispatch(setLabelingTasksAll(prepareTasksForRole(labelingTasksProcessed, userDisplayRole))); }); diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index d5b0d1a7..aaf0e108 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -83,7 +83,7 @@ export default function ProjectOverview() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index 4145a622..3a64577a 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -107,7 +107,7 @@ export default function ProjectSettings() { const copy = { ...task }; return copy; }) - dispatch(setAllEmbeddings(postProcessingEmbeddings(res.data['projectByProjectId']['embeddings']['edges'].map((e) => e['node']), queuedEmbeddings))); + dispatch(setAllEmbeddings(postProcessingEmbeddings(res['embeddings'], queuedEmbeddings))); }); }); } @@ -165,7 +165,7 @@ export default function ProjectSettings() { const copy = { ...task }; return copy; }) - const newEMbeddings = postProcessingEmbeddings(res.data['projectByProjectId']['embeddings']['edges'].map((e) => e['node']), queuedEmbeddings); + const newEMbeddings = postProcessingEmbeddings(res['embeddings'], queuedEmbeddings); for (let e of newEMbeddings) { if (e.id == msgParts[2]) { if (msgParts[3] == "state") { @@ -203,7 +203,7 @@ export default function ProjectSettings() { refetchAttributesAndPostProcess(); } else if (msgParts[1] == 'project_update' && msgParts[2] == project.id) { getProjectByProjectId(project.id, (res) => { - dispatch(setActiveProject(res.data["projectByProjectId"])); + dispatch(setActiveProject(res)); }) } else if (msgParts[1] == 'calculate_attribute') { @@ -231,7 +231,7 @@ export default function ProjectSettings() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(project.id, (res) => { - const labelingTasks = postProcessLabelingTasks(res['data']['projectByProjectId']['labelingTasks']['edges']); + const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/shared/export/ExportRecordsModal.tsx b/src/components/shared/export/ExportRecordsModal.tsx index f596c1ce..4db8f8f6 100644 --- a/src/components/shared/export/ExportRecordsModal.tsx +++ b/src/components/shared/export/ExportRecordsModal.tsx @@ -88,7 +88,7 @@ export default function ExportRecordsModal(props: ExportProps) { enumArraysCopy.set(ExportEnums.LabelSource, enumToArray(LabelSource, { nameFunction: labelSourceToString })); if (!force && enumArraysCopy[ExportEnums.Heuristics]) return; getRecordExportFromData(projectId, (res) => { - const postProcessedRes = postProcessExportRecordData(res['data']['projectByProjectId']); + const postProcessedRes = postProcessExportRecordData(res); enumArraysCopy.set(ExportEnums.Heuristics, postProcessedRes.informationSources); enumArraysCopy.set(ExportEnums.Attributes, postProcessedRes.attributes); enumArraysCopy.set(ExportEnums.LabelingTasks, postProcessedRes.labelingTasks); diff --git a/src/reduxStore/StoreManagerComponent.tsx b/src/reduxStore/StoreManagerComponent.tsx index f413f886..85ac6227 100644 --- a/src/reduxStore/StoreManagerComponent.tsx +++ b/src/reduxStore/StoreManagerComponent.tsx @@ -90,7 +90,7 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { const projectId = router.query.projectId as string; if (projectId) { getProjectByProjectId(projectId, (res) => { - dispatch(setActiveProject(res.data["projectByProjectId"])); + dispatch(setActiveProject(res)); }) } else { diff --git a/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts b/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts index 3bed3495..47953d40 100644 --- a/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts +++ b/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts @@ -7,24 +7,15 @@ let rPos = { pos: 9990 }; //as object to increase in private function export function postProcessLabelingTasks(labelingTasks: any[]): any[] { if (!labelingTasks) return []; const prepareLabelingTasks = labelingTasks.map((labelingTask: any) => { - const data = labelingTask.node; return { - id: data.id, - name: data.name, - taskTarget: data.taskTarget, - attribute: data.attribute, - taskType: data.taskType, - labels: !data.labels.edges - ? [] - : data.labels.edges.map((edge) => { - return edge.node; - }), - informationSources: !data.informationSources.edges - ? [] - : data.informationSources.edges.map((edge) => { - return edge.node; - }), - relativePosition: data.attribute?.relativePosition ?? rPos.pos++, + id: labelingTask.id, + name: labelingTask.name, + taskTarget: labelingTask.taskTarget, + attribute: labelingTask.attribute, + taskType: labelingTask.taskType, + labels: labelingTask.labels, + informationSources: !labelingTask.informationSources, + relativePosition: labelingTask.attribute?.relativePosition ?? rPos.pos++, }; }).sort((a, b) => (a.relativePosition - b.relativePosition) || a.name.localeCompare(b.name)); return prepareLabelingTasks; diff --git a/src/util/shared/export-helper.ts b/src/util/shared/export-helper.ts index f1a7de90..7ff74bab 100644 --- a/src/util/shared/export-helper.ts +++ b/src/util/shared/export-helper.ts @@ -12,10 +12,10 @@ export default function postProcessExportRecordData(data: any) { let x: any = { projectId: data.id, name: data.name, - labelingTasks: data.labelingTasks.edges.map((edge) => edge.node), - informationSources: data.informationSources.edges.map((edge) => edge.node), - attributes: data.attributes.edges.map((edge) => edge.node).filter((att) => [Status.UPLOADED, Status.USABLE, Status.AUTOMATICALLY_CREATED].includes(att.state)), - dataSlices: data.dataSlices.edges.map((edge) => edge.node), + labelingTasks: data.labelingTask, + informationSources: data.informationSources, + attributes: data.attributes.filter((att) => [Status.UPLOADED, Status.USABLE, Status.AUTOMATICALLY_CREATED].includes(att.state)), + dataSlices: data.dataSlices, } x.dataSlices.forEach(element => { if (element.sliceType == Slice.STATIC_OUTLIER) { From 859fe126b493b1de39a45ea6c45db9a66bc3b2cb Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 15:56:40 +0100 Subject: [PATCH 02/36] allProjects --- src/components/projects/ProjectsList.tsx | 3 +-- src/components/projects/new/NewProject.tsx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/projects/ProjectsList.tsx b/src/components/projects/ProjectsList.tsx index c4a14d5a..f7311596 100644 --- a/src/components/projects/ProjectsList.tsx +++ b/src/components/projects/ProjectsList.tsx @@ -49,8 +49,7 @@ export default function ProjectsList() { function refetchProjectsAndPostProcess() { getAllProjects((res) => { - const projects = res.data["allProjects"].edges.map((edge: any) => edge.node); - dispatch(setAllProjects(projects)); + dispatch(setAllProjects(res)); setDataLoaded(true); }); } diff --git a/src/components/projects/new/NewProject.tsx b/src/components/projects/new/NewProject.tsx index 3863cd44..e54452f8 100644 --- a/src/components/projects/new/NewProject.tsx +++ b/src/components/projects/new/NewProject.tsx @@ -19,8 +19,7 @@ export default function NewProject() { useEffect(() => { dispatch(setUploadFileType(COMPONENT_FILE_TYPE)); getAllProjects((res) => { - const projects = res.data["allProjects"].edges.map((edge: any) => edge.node); - dispatch(setAllProjects(projects)); + dispatch(setAllProjects(res)); }); }, []); From ff49ea07925836e2b170a8ae0a99792b5e1fa2a0 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 15:57:05 +0100 Subject: [PATCH 03/36] allProjects --- src/components/shared/header/Header.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/shared/header/Header.tsx b/src/components/shared/header/Header.tsx index 04ec798b..0f4c507e 100644 --- a/src/components/shared/header/Header.tsx +++ b/src/components/shared/header/Header.tsx @@ -52,8 +52,7 @@ export default function Header() { function openModalAndRefetchNotifications() { getAllProjects((res) => { - const projects = res.data["allProjects"].edges.map((edge: any) => edge.node); - dispatch(setAllProjects(projects)); + dispatch(setAllProjects(res)); getNotifications({ projectFilter: [], levelFilter: [], @@ -61,7 +60,7 @@ export default function Header() { userFilter: true, limit: 50 }, (res) => { - dispatch(setNotifications(postProcessNotifications(res.data['notifications'], arrayToDict(projects, 'id'), notificationId))); + dispatch(setNotifications(postProcessNotifications(res.data['notifications'], arrayToDict(res, 'id'), notificationId))); dispatch(openModal(ModalEnum.NOTIFICATION_CENTER)); }); }); From d2f486aaf54579957d52ec75eb393acb80c9c720 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:20:16 +0100 Subject: [PATCH 04/36] labelDistribution, generalProjectStats --- .../projects/projectId/overview/ProjectOverview.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index aaf0e108..e6417ffa 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -99,8 +99,7 @@ export default function ProjectOverview() { const dataSliceFindId = overviewFilters.dataSlice?.id; const dataSliceId = dataSliceFindId == "@@NO_SLICE@@" ? null : dataSliceFindId; getLabelDistribution(projectId, labelingTaskId, dataSliceId, (res) => { - if (res['data'] == null) return; - setLabelDistribution(postProcessLabelDistribution(res['data']['labelDistribution'], false)); + setLabelDistribution(postProcessLabelDistribution(res, false)); }); } @@ -114,7 +113,7 @@ export default function ProjectOverview() { getGeneralProjectStats(projectId, labelingTaskId, dataSliceId, (res) => { if (res['data'] == null) return; - setProjectStats(postProcessingStats(res['data']['generalProjectStats'])); + setProjectStats(postProcessingStats(res)); }); } From 918a2dbc31bd0d6e8a8dcf144ff907876de36ef7 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:24:11 +0100 Subject: [PATCH 05/36] projectTokenization --- .../projectId/attributes/attributeId/AttributeCalculations.tsx | 2 +- src/components/projects/projectId/settings/ProjectSettings.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index c457634e..6c511496 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -221,7 +221,7 @@ export default function AttributeCalculation() { function checkProjectTokenization() { getProjectTokenization(projectId, (res) => { - setTokenizationProgress(res.data['projectTokenization']?.progress); + setTokenizationProgress(res?.progress); }); } diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index 3a64577a..725dd03b 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -136,7 +136,7 @@ export default function ProjectSettings() { function checkProjectTokenization() { getProjectTokenization(project.id, (res) => { - setTokenizationProgress(res.data['projectTokenization']?.progress); + setTokenizationProgress(res?.progress); setIsAcRunning(checkIfAcRunning()); }); } From 4e82546629725555c9f427c949dc3329a4bb6006 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:24:20 +0100 Subject: [PATCH 06/36] projectTokenization --- .../projects/projectId/heuristics/HeuristicsOverview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index 2313669a..f1941fca 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -95,7 +95,7 @@ export function HeuristicsOverview() { function checkProjectTokenization() { getProjectTokenization(projectId, (res) => { - setTokenizationProgress(res.data['projectTokenization']?.progress); + setTokenizationProgress(res?.progress); }); } From 37ac11b8e7d7a672b1126ad6b1579a17e003e437 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:26:09 +0100 Subject: [PATCH 07/36] modelProviderInfo --- src/components/models-download/ModelsDownload.tsx | 2 +- .../projectId/settings/embeddings/AddNewEmbeddingModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/models-download/ModelsDownload.tsx b/src/components/models-download/ModelsDownload.tsx index b5f8d7d0..573aa3da 100644 --- a/src/components/models-download/ModelsDownload.tsx +++ b/src/components/models-download/ModelsDownload.tsx @@ -29,7 +29,7 @@ export default function ModelsDownload() { function refetchModels() { getModelProviderInfo((res) => { - dispatch(setModelsDownloaded(res.data['modelProviderInfo'])); + dispatch(setModelsDownloaded(res)); }); } diff --git a/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx b/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx index 2617c080..4e7e89ba 100644 --- a/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx +++ b/src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx @@ -341,7 +341,7 @@ function SuggestionsModel(props: SuggestionsProps) { useEffect(() => { //collect on mount (open modal) getModelProviderInfo((res) => { - setCachedModelInfo(postProcessingModelsDownload(res.data['modelProviderInfo'])); + setCachedModelInfo(postProcessingModelsDownload(res)); }); }, []) From 9e2c748cbe0a3419639bbd677f82ce62f72b0680 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:35:36 +0100 Subject: [PATCH 08/36] projectExportCredentials, uploadCredentialsAndId --- .../projectId/settings/ProjectSnapshotExportModal.tsx | 3 +-- src/components/shared/upload/Upload.tsx | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx b/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx index b568b58e..c7a73537 100644 --- a/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx +++ b/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx @@ -61,8 +61,7 @@ export default function ProjectSnapshotExportModal() { } function requestProjectExportCredentials() { - getLastProjectExportCredentials(projectId, (res) => { - const projectExportCredentials = res.data['lastProjectExportCredentials']; + getLastProjectExportCredentials(projectId, (projectExportCredentials) => { if (!projectExportCredentials) setProjectExportCredentials(null); else { const credentials = JSON.parse(projectExportCredentials); diff --git a/src/components/shared/upload/Upload.tsx b/src/components/shared/upload/Upload.tsx index 88bc5794..dcfe39ab 100644 --- a/src/components/shared/upload/Upload.tsx +++ b/src/components/shared/upload/Upload.tsx @@ -173,8 +173,8 @@ export default function Upload(props: UploadProps) { function finishUpUpload(finalFinalName: string, importOptionsPrep: string) { let keyToSend = key; if (!keyToSend) keyToSend = null; - getUploadCredentialsAndId(UploadHelper.getProjectId(), finalFinalName, uploadFileType, importOptionsPrep, UploadType.DEFAULT, keyToSend, (results) => { - const credentialsAndUploadId = JSON.parse(JSON.parse(results.data['uploadCredentialsAndId'])); + getUploadCredentialsAndId(UploadHelper.getProjectId(), finalFinalName, uploadFileType, importOptionsPrep, UploadType.DEFAULT, keyToSend, (res) => { + const credentialsAndUploadId = JSON.parse(JSON.parse(res)); uploadFileToMinio(credentialsAndUploadId, finalFinalName); }); } From 7ed8696736eecf85363423da30a9ab008753422f Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:40:55 +0100 Subject: [PATCH 09/36] createSampleProject, updateProjectStatus, updateProjectTokenizer --- src/components/projects/SampleProjectsDropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/projects/SampleProjectsDropdown.tsx b/src/components/projects/SampleProjectsDropdown.tsx index 152a4924..d6231180 100644 --- a/src/components/projects/SampleProjectsDropdown.tsx +++ b/src/components/projects/SampleProjectsDropdown.tsx @@ -40,7 +40,7 @@ export default function SampleProjectsDropdown() { dispatch(setSearchGroupsStore({})); createSampleProject({ name: projectNameFinal, projectType: projectTypeFinal }, (res) => { dispatch(closeModal(ModalEnum.SAMPLE_PROJECT_TITLE)); - const projectId = res['data']['createSampleProject']['project'].id; + const projectId = res['project'].id; dispatch(setProjectIdSampleProject(projectId)); }); }, [projects, projectNameInput, projectTypeInput, router]); From d21502d56bb385c38f361bfe7d26245cafcb6e09 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:46:26 +0100 Subject: [PATCH 10/36] createProject, deleteProject --- src/components/shared/upload/Upload.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/shared/upload/Upload.tsx b/src/components/shared/upload/Upload.tsx index dcfe39ab..eda4d0b7 100644 --- a/src/components/shared/upload/Upload.tsx +++ b/src/components/shared/upload/Upload.tsx @@ -117,14 +117,14 @@ export default function Upload(props: UploadProps) { return; } createProjectPost({ name: projectTitle, description: projectDescription }, (res) => { - const project = res.data.createProject['project']; + const project = res['project']; dispatch(extendAllProjects(project)); UploadHelper.setProjectId(project.id); executeUploadFile(); }) } else if (uploadFileType == UploadFileType.PROJECT) { createProjectPost({ name: props.uploadOptions.projectName, description: "Created during file upload " + selectedFile?.name }, (res) => { - const project = res.data.createProject['project']; + const project = res['project']; dispatch(extendAllProjects(project)); UploadHelper.setProjectId(project.id); executeUploadFile(); From 65402910e3e1c74dfc20423e9862a3535db5ee3b Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 6 Jan 2025 16:50:22 +0100 Subject: [PATCH 11/36] uploadTaskById, updateProjectNameDescription --- src/components/shared/upload/Upload.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/shared/upload/Upload.tsx b/src/components/shared/upload/Upload.tsx index eda4d0b7..d51fca65 100644 --- a/src/components/shared/upload/Upload.tsx +++ b/src/components/shared/upload/Upload.tsx @@ -74,8 +74,7 @@ export default function Upload(props: UploadProps) { if (msgParts[2] != uploadTask.id) return; if (msgParts[3] == 'state') { if (msgParts[4] == UploadStates.DONE) { - getUploadTaskById(projectId, uploadTask.id, (res) => { - const task = res.data['uploadTaskById']; + getUploadTaskById(projectId, uploadTask.id, (task) => { handleUploadTaskResult(task); }); } @@ -93,8 +92,7 @@ export default function Upload(props: UploadProps) { } } else if (msgParts[3] == 'progress') { if (msgParts[4] == "100") { - getUploadTaskById(projectId, uploadTask.id, (res) => { - const task = res.data['uploadTaskById']; + getUploadTaskById(projectId, uploadTask.id, (task) => { handleUploadTaskResult(task); }); } @@ -182,8 +180,7 @@ export default function Upload(props: UploadProps) { function uploadFileToMinio(credentialsAndUploadId: any, fileName: string) { setUploadStarted(true); setDoingSomething(true); - getUploadTaskById(UploadHelper.getProjectId(), credentialsAndUploadId.uploadTaskId, (res) => { - const task = res.data['uploadTaskById']; + getUploadTaskById(UploadHelper.getProjectId(), credentialsAndUploadId.uploadTaskId, (task) => { handleUploadTaskResult(task); uploadFile(credentialsAndUploadId, selectedFile, fileName).subscribe((progress) => { setProgressState(progress); From 283529c5b318556670c850a815970adeb4094700 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 09:37:38 +0100 Subject: [PATCH 12/36] attributes,embeddings, data slide --- .../attributes/attributeId/AttributeCalculations.tsx | 4 ++-- .../attributes/attributeId/ExecutionContainer.tsx | 2 +- .../projects/projectId/data-browser/DataBrowser.tsx | 8 ++++---- .../projects/projectId/data-browser/SearchGroups.tsx | 4 ++-- .../projects/projectId/heuristics/HeuristicsOverview.tsx | 2 +- .../heuristics/heuristicId/shared/HeuristicsLayout.tsx | 2 +- .../sessionId/main-component/LabelingMainComponent.tsx | 2 +- .../projects/projectId/overview/ProjectOverview.tsx | 4 ++-- .../projects/projectId/settings/ProjectSettings.tsx | 8 ++++---- src/reduxStore/StoreManagerComponent.tsx | 6 +++--- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index 6c511496..f15a7d4b 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -65,7 +65,7 @@ export default function AttributeCalculation() { if (!projectId) return; if (!currentAttribute || attributes.length == 0) { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); const currentAttribute = postProcessCurrentAttribute(attributes.find((attribute) => attribute.id === router.query.attributeId)); setCurrentAttribute(currentAttribute); setEditorValue(currentAttribute?.sourceCodeToDisplay); @@ -243,7 +243,7 @@ export default function AttributeCalculation() { setCurrentAttribute(currentAttributeCopy); } else { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); getAttributeByAttributeId(projectId, currentAttribute?.id, (res) => { const attribute = res.data['attributeByAttributeId']; diff --git a/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx b/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx index ea0e38ab..3b50a83d 100644 --- a/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx +++ b/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx @@ -37,7 +37,7 @@ export default function ExecutionContainer(props: ExecutionContainerProps) { if (requestedSomething) return; setRequestedSomething(true); getSampleRecords(projectId, props.currentAttribute.id, (res) => { - const sampleRecordsFinal = { ...res.data['calculateUserAttributeSampleRecords'] }; + const sampleRecordsFinal = { ...res }; setRequestedSomething(false); props.setEnabledButton(false); setRunOn10HasError(sampleRecordsFinal.calculatedAttributes.length > 0 ? false : true); diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index f530d9d3..d8574437 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -101,9 +101,9 @@ export default function DataBrowser() { function refetchDataSlicesAndProcess(dataSliceId?: string) { getDataSlices(projectId, null, (res) => { - dispatch(setDataSlices(res.data.dataSlices)); + dispatch(setDataSlices(res)); if (dataSliceId) { - const findSlice = res.data.dataSlices.find((slice) => slice.id == dataSliceId); + const findSlice = res.find((slice) => slice.id == dataSliceId); if (findSlice) dispatch(setActiveDataSlice(findSlice)); } }); @@ -111,7 +111,7 @@ export default function DataBrowser() { function refetchAttributesAndProcess() { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); } @@ -143,7 +143,7 @@ export default function DataBrowser() { function refetchUniqueValuesAndProcess() { getUniqueValuesByAttributes(projectId, (res) => { - dispatch(setUniqueValuesDict(postProcessUniqueValues(res.data['uniqueValuesByAttributes'], attributes))); + dispatch(setUniqueValuesDict(postProcessUniqueValues(res, attributes))); }); } diff --git a/src/components/projects/projectId/data-browser/SearchGroups.tsx b/src/components/projects/projectId/data-browser/SearchGroups.tsx index 6fdec082..37524978 100644 --- a/src/components/projects/projectId/data-browser/SearchGroups.tsx +++ b/src/components/projects/projectId/data-browser/SearchGroups.tsx @@ -135,12 +135,12 @@ export default function SearchGroups() { getRecordsByStaticSlice(projectId, activeSlice.id, options, (res) => { dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['recordsByStaticSlice'], labelingTasks))); staticDataSlicesCurrentCount(projectId, activeSlice.id, (res) => { - if (!res.data) { + if (!res) { dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', null)); return; } - dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', res['data']['staticDataSlicesCurrentCount'])); + dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', res)); }); }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index f1941fca..e1b34161 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -44,7 +44,7 @@ export function HeuristicsOverview() { checkProjectTokenization(); if (attributes.length == 0) { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); } }, [projectId]); diff --git a/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx b/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx index a77a0de7..e403cf8b 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx @@ -96,7 +96,7 @@ export default function HeuristicsLayout(props: any) { function refetchAttributesAndProcess() { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); } diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index edf5397f..77ebc6e4 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -279,7 +279,7 @@ export default function LabelingMainComponent() { function refetchAttributesAndProcess() { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); } diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index e6417ffa..2443f0b9 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -77,7 +77,7 @@ export default function ProjectOverview() { } function refetchAttributesAndProcess() { getAttributes(projectId, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); } @@ -90,7 +90,7 @@ export default function ProjectOverview() { function refetchDataSlicesAndProcess() { getDataSlices(projectId, null, (res) => { - dispatch(setDataSlices(res.data.dataSlices)); + dispatch(setDataSlices(res)); }); } diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index 725dd03b..be8e8fe7 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -66,7 +66,7 @@ export default function ProjectSettings() { if (!project) return; requestPKeyCheck(); getRecommendedEncoders(project.id, (res) => { - const encoderSuggestions = res['data']['recommendedEncoders'].filter(e => e.tokenizers.includes("all") || e.tokenizers.includes(project.tokenizer)); + const encoderSuggestions = res.filter(e => e.tokenizers.includes("all") || e.tokenizers.includes(project.tokenizer)); dispatch(setRecommendedEncodersAll(encoderSuggestions as RecommendedEncoder[])); dispatch(setAllRecommendedEncodersDict(postProcessingRecommendedEncoders(attributes, project.tokenizer, res['data']['recommendedEncoders']))); }); @@ -96,7 +96,7 @@ export default function ProjectSettings() { function refetchAttributesAndPostProcess() { getAttributes(project.id, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); }); } @@ -119,7 +119,7 @@ export default function ProjectSettings() { const tmpTimer = timer(500).subscribe(() => { getCheckCompositeKey(project.id, (res) => { setPKeyCheckTimer(null); - if (anyPKey()) setPKeyValid(res.data['checkCompositeKey']); + if (anyPKey()) setPKeyValid(res); else setPKeyValid(null); }); }); @@ -217,7 +217,7 @@ export default function ProjectSettings() { timer(5000).subscribe(() => checkProjectTokenization()); } else { getAttributes(project.id, ['ALL'], (res) => { - dispatch(setAllAttributes(res.data['attributesByProjectId'])); + dispatch(setAllAttributes(res)); setIsAcRunning(checkIfAcRunning()); }); if (msgParts[2] == 'finished') timer(5000).subscribe(() => checkProjectTokenization()); diff --git a/src/reduxStore/StoreManagerComponent.tsx b/src/reduxStore/StoreManagerComponent.tsx index 85ac6227..36ea80b3 100644 --- a/src/reduxStore/StoreManagerComponent.tsx +++ b/src/reduxStore/StoreManagerComponent.tsx @@ -57,7 +57,7 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { dispatch(setCache(CacheEnum.VERSION_OVERVIEW, postprocessVersionOverview(res.data['versionOverview']))); }); getEmbeddingPlatforms((res) => { - dispatch(setCache(CacheEnum.EMBEDDING_PLATFORMS, postProcessingEmbeddingPlatforms(res.data['embeddingPlatforms'], organization))) + dispatch(setCache(CacheEnum.EMBEDDING_PLATFORMS, postProcessingEmbeddingPlatforms(res, organization))) }); }, []); @@ -97,14 +97,14 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { dispatch(setActiveProject(null)); } getRecommendedEncoders(null, (resEncoders) => { - dispatch(setCache(CacheEnum.MODELS_LIST, postProcessingEncoders(resEncoders.data['recommendedEncoders']))) + dispatch(setCache(CacheEnum.MODELS_LIST, postProcessingEncoders(resEncoders))) }); }, [router.query.projectId]); useEffect(() => { if (!ConfigManager.isInit()) return; getAllTokenizerOptions((res) => { - dispatch(setCache(CacheEnum.TOKENIZER_VALUES, checkWhitelistTokenizer(res.data['languageModels']))); + dispatch(setCache(CacheEnum.TOKENIZER_VALUES, checkWhitelistTokenizer(res))); }) }, [ConfigManager.isInit()]); From 0d8e10bf05111a22f6f09f66dc55f3de3d23bf7e Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Tue, 7 Jan 2025 10:21:17 +0100 Subject: [PATCH 13/36] lt query rework --- .../attributeId/AttributeCalculations.tsx | 2 +- .../projectId/data-browser/DataBrowser.tsx | 2 +- .../heuristics/HeuristicsOverview.tsx | 2 +- .../active-learning/ActiveLearning.tsx | 2 +- .../labeling-function/LabelingFunction.tsx | 2 +- .../main-component/LabelingMainComponent.tsx | 2 +- .../projectId/overview/ProjectOverview.tsx | 2 +- .../projectId/settings/ProjectSettings.tsx | 2 +- .../settings/labeling-tasks-helper.ts | 23 ++++++++----------- 9 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index f15a7d4b..623ac550 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -227,7 +227,7 @@ export default function AttributeCalculation() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index d8574437..46900d3f 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -117,7 +117,7 @@ export default function DataBrowser() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index e1b34161..f8d7e2cc 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -73,7 +73,7 @@ export function HeuristicsOverview() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx index 8553160f..bfadaf1b 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx @@ -121,7 +121,7 @@ export default function ActiveLearning() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx index 2784277b..d94ed9ea 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx @@ -104,7 +104,7 @@ export default function LabelingFunction() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index 77ebc6e4..81f1ecb4 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -285,7 +285,7 @@ export default function LabelingMainComponent() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); const labelingTasksProcessed = postProcessLabelingTasksSchema(labelingTasks); dispatch(setLabelingTasksAll(prepareTasksForRole(labelingTasksProcessed, userDisplayRole))); }); diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index 2443f0b9..1f95e4a4 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -83,7 +83,7 @@ export default function ProjectOverview() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index be8e8fe7..5301820b 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -231,7 +231,7 @@ export default function ProjectSettings() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(project.id, (res) => { - const labelingTasks = postProcessLabelingTasks(res['labelingTasks']); + const labelingTasks = postProcessLabelingTasks(res); dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); }); } diff --git a/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts b/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts index 47953d40..0f90986e 100644 --- a/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts +++ b/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts @@ -1,23 +1,20 @@ import { Attribute } from "@/src/types/components/projects/projectId/settings/data-schema"; -import { LabelingTask, LabelingTaskTarget, LabelingTaskTaskType } from "@/src/types/components/projects/projectId/settings/labeling-tasks"; +import { LabelingTask, LabelingTaskTaskType } from "@/src/types/components/projects/projectId/settings/labeling-tasks"; import { LabelHelper } from "@/src/util/classes/label-helper"; -let rPos = { pos: 9990 }; //as object to increase in private function export function postProcessLabelingTasks(labelingTasks: any[]): any[] { if (!labelingTasks) return []; - const prepareLabelingTasks = labelingTasks.map((labelingTask: any) => { + const prepareLabelingTasks = labelingTasks.map((data: any) => { return { - id: labelingTask.id, - name: labelingTask.name, - taskTarget: labelingTask.taskTarget, - attribute: labelingTask.attribute, - taskType: labelingTask.taskType, - labels: labelingTask.labels, - informationSources: !labelingTask.informationSources, - relativePosition: labelingTask.attribute?.relativePosition ?? rPos.pos++, + id: data.id, + name: data.name, + taskTarget: data.taskTarget, + taskType: data.taskType, + labels: data.labels, + informationSources: data.informationSources, }; - }).sort((a, b) => (a.relativePosition - b.relativePosition) || a.name.localeCompare(b.name)); + }); return prepareLabelingTasks; } @@ -28,8 +25,6 @@ export function postProcessLabelingTasksSchema(labelingTasks: LabelingTask[]): L LabelHelper.labelingTaskColors.set(task.id, task.labels.map((label) => label.color)); task.labels = task.labels.map((label) => LabelHelper.extendLabelForColor({ ...label })); task.nameOpen = false; - task.targetId = task.taskTarget == LabelingTaskTarget.ON_ATTRIBUTE ? task.attribute.id : ""; - task.targetName = task.taskTarget == LabelingTaskTarget.ON_ATTRIBUTE ? task.attribute.name : "Full Record"; LabelHelper.labelMap.set(task.id, task.labels); prepareLabelingTasks.push(task); }); From f38b4def50e0c33205faad45a229050b4d81f562 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 10:24:54 +0100 Subject: [PATCH 14/36] comment, data browser, heuristic --- .../attributes/attributeId/AttributeCalculations.tsx | 2 +- .../projects/projectId/data-browser/DataBrowser.tsx | 8 ++++---- .../projects/projectId/data-browser/SearchGroups.tsx | 6 +++--- .../data-browser/modals/SimilaritySeachModal.tsx | 2 +- .../projects/projectId/heuristics/HeuristicsHeader.tsx | 2 +- .../projectId/heuristics/HeuristicsOverview.tsx | 4 ++-- .../heuristicId/active-learning/ActiveLearning.tsx | 6 +++--- .../heuristicId/labeling-function/LabelingFunction.tsx | 10 +++++----- .../heuristics/modals/AddActiveLearnerModal.tsx | 2 +- .../heuristics/modals/AddLabelingFunctionModal.tsx | 2 +- .../sessionId/main-component/LabelingMainComponent.tsx | 6 +++--- .../projectId/lookup-lists/LookupListsOverview.tsx | 2 +- .../lookup-lists/lookupListId/LookupListsDetails.tsx | 2 +- .../projects/projectId/overview/ProjectOverview.tsx | 2 +- .../projects/projectId/settings/ProjectSettings.tsx | 2 +- src/components/shared/comments/Comments.tsx | 4 ++-- 16 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index f15a7d4b..6b6bfa0f 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -136,7 +136,7 @@ export default function AttributeCalculation() { CommentDataManager.registerCommentRequests(CurrentPage.ATTRIBUTE_CALCULATION, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index d8574437..337f609b 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -64,12 +64,12 @@ export default function DataBrowser() { getRecordsByStaticSlice(projectId, activeSlice.id, { offset: searchRequest.offset, limit: searchRequest.limit }, (res) => { - dispatch(expandRecordList(postProcessRecordsExtended(res.data['recordsByStaticSlice'], labelingTasks))); + dispatch(expandRecordList(postProcessRecordsExtended(res, labelingTasks))); }); } else { const filterData = parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, fullSearchStore[SearchGroup.DRILL_DOWN]) searchRecordsExtended(projectId, filterData, searchRequest.offset, searchRequest.limit, (res) => { - const parsedRecordData = postProcessRecordsExtended(res.data['searchRecordsExtended'], labelingTasks); + const parsedRecordData = postProcessRecordsExtended(res, labelingTasks); dispatch(expandRecordList(parsedRecordData)); refetchRecordCommentsAndProcess(parsedRecordData.recordList); }); @@ -93,7 +93,7 @@ export default function DataBrowser() { CommentDataManager.registerCommentRequests(CurrentPage.DATA_BROWSER, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(users); dispatch(setComments(CommentDataManager.currentDataOrder)); }); @@ -133,7 +133,7 @@ export default function DataBrowser() { const currentRecordIds = parsedRecordData?.map((record) => record.id); if (!currentRecordIds || currentRecordIds.length == 0) return; getRecordComments(projectId, currentRecordIds, (res) => { - dispatch(setRecordComments(res.data['getRecordComments'])); + dispatch(setRecordComments(res)); }); } diff --git a/src/components/projects/projectId/data-browser/SearchGroups.tsx b/src/components/projects/projectId/data-browser/SearchGroups.tsx index 37524978..5cf9fa32 100644 --- a/src/components/projects/projectId/data-browser/SearchGroups.tsx +++ b/src/components/projects/projectId/data-browser/SearchGroups.tsx @@ -112,7 +112,7 @@ export default function SearchGroups() { dispatch(updateAdditionalDataState('loading', true)); const refetchTimer = setTimeout(() => { searchRecordsExtended(projectId, parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, fullSearchStore[SearchGroup.DRILL_DOWN]), 0, 20, (res) => { - dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['searchRecordsExtended'], labelingTasks))); + dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res, labelingTasks))); dispatch(updateAdditionalDataState('loading', false)); }); }, 500); @@ -133,7 +133,7 @@ export default function SearchGroups() { options.limit = 20; } getRecordsByStaticSlice(projectId, activeSlice.id, options, (res) => { - dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['recordsByStaticSlice'], labelingTasks))); + dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res, labelingTasks))); staticDataSlicesCurrentCount(projectId, activeSlice.id, (res) => { if (!res) { dispatch(updateAdditionalDataState('staticDataSliceCurrentCount', null)); @@ -569,7 +569,7 @@ export default function SearchGroups() { if (res == null) { setCurrentWeakSupervisionRun({ state: Status.NOT_YET_RUN }); } else { - setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res['data']['currentWeakSupervisionRun'])); + setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res)); } }); } diff --git a/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx b/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx index 7c7df516..bc15e9da 100644 --- a/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx +++ b/src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx @@ -45,7 +45,7 @@ export default function SimilaritySearchModal() { function getSimilarRecords(hasFilter: boolean = false) { const attFilter = hasFilter ? prepareAttFilter(filterAttributesForm, attributes) : null; getRecordsBySimilarity(projectId, selectedEmbedding.id, modalSS.recordId, attFilter, null, (res) => { - dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res.data['searchRecordsBySimilarity'], labelingTasks))); + dispatch(setSearchRecordsExtended(postProcessRecordsExtended(res, labelingTasks))); dispatch(setRecordsInDisplay(true)); }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx b/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx index 0897cda1..b01f7849 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx @@ -60,7 +60,7 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) { if (res == null) { setCurrentWeakSupervisionRun({ state: Status.NOT_YET_RUN }); } else { - setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res['data']['currentWeakSupervisionRun'])); + setCurrentWeakSupervisionRun(postProcessCurrentWeakSupervisionRun(res)); } }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index e1b34161..bb84299a 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -65,7 +65,7 @@ export function HeuristicsOverview() { CommentDataManager.registerCommentRequests(CurrentPage.HEURISTICS, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); @@ -80,7 +80,7 @@ export function HeuristicsOverview() { function refetchHeuristicsAndProcess() { getInformationSourcesOverviewData(projectId, (res) => { - const heuristics = postProcessHeuristics(res['data']['informationSourcesOverviewData'], projectId); + const heuristics = postProcessHeuristics(res, projectId); dispatch(setAllHeuristics(heuristics)); setFilteredList(heuristics); }); diff --git a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx index 8553160f..32056824 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx @@ -88,7 +88,7 @@ export default function ActiveLearning() { CommentDataManager.registerCommentRequests(CurrentPage.ACTIVE_LEARNING, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); @@ -101,13 +101,13 @@ export default function ActiveLearning() { return; } getPayloadByPayloadId(projectId, currentHeuristic.lastTask.id, (res) => { - setLastTaskLogs(postProcessLastTaskLogs((res['data']['payloadByPayloadId']))); + setLastTaskLogs(postProcessLastTaskLogs(res)); }); } function refetchCurrentHeuristicAndProcess() { getHeuristicByHeuristicId(projectId, router.query.heuristicId as string, (res) => { - dispatch(setActiveHeuristics(postProcessCurrentHeuristic(res['data']['informationSourceBySourceId'], labelingTasks))); + dispatch(setActiveHeuristics(postProcessCurrentHeuristic(res, labelingTasks))); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx index 2784277b..2cb100f6 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx @@ -90,7 +90,7 @@ export default function LabelingFunction() { CommentDataManager.registerCommentRequests(CurrentPage.LABELING_FUNCTION, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); @@ -98,7 +98,7 @@ export default function LabelingFunction() { function refetchCurrentHeuristicAndProcess() { getHeuristicByHeuristicId(projectId, router.query.heuristicId as string, (res) => { - dispatch(setActiveHeuristics(postProcessCurrentHeuristic(res['data']['informationSourceBySourceId'], labelingTasks))); + dispatch(setActiveHeuristics(postProcessCurrentHeuristic(res, labelingTasks))); }); } @@ -129,7 +129,7 @@ export default function LabelingFunction() { return; } getPayloadByPayloadId(projectId, currentHeuristic.lastPayload.id, (res) => { - setLastTaskLogs(postProcessLastTaskLogs((res['data']['payloadByPayloadId']))); + setLastTaskLogs(postProcessLastTaskLogs(res)); }); } @@ -138,8 +138,8 @@ export default function LabelingFunction() { setRunOn10IsRunning(true); getLabelingFunctionOn10Records(projectId, currentHeuristic.id, (res) => { setRunOn10IsRunning(false); - setSampleRecords(postProcessSampleRecords(res['data']['getLabelingFunctionOn10Records'], labelingTasks, currentHeuristic.labelingTaskId)); - setLastTaskLogs(parseContainerLogsData(res['data']['getLabelingFunctionOn10Records']['containerLogs'])) + setSampleRecords(postProcessSampleRecords(res, labelingTasks, currentHeuristic.labelingTaskId)); + setLastTaskLogs(parseContainerLogsData(res['containerLogs'])) }); } diff --git a/src/components/projects/projectId/heuristics/modals/AddActiveLearnerModal.tsx b/src/components/projects/projectId/heuristics/modals/AddActiveLearnerModal.tsx index 9d8cf811..49b42c28 100644 --- a/src/components/projects/projectId/heuristics/modals/AddActiveLearnerModal.tsx +++ b/src/components/projects/projectId/heuristics/modals/AddActiveLearnerModal.tsx @@ -47,7 +47,7 @@ export default function AddActiveLeanerModal() { const codeData = getInformationSourceTemplate(matching, heuristicType, embedding.name); if (!codeData) return; createHeuristicPost(projectId, labelingTask.id, codeData.code, name, description, heuristicType, (res) => { - let id = res['data']?.['createInformationSource']?.['informationSource']?.['id']; + let id = res?.id; if (id) { router.push(getRouterLinkHeuristic(heuristicType, projectId, id)) } else { diff --git a/src/components/projects/projectId/heuristics/modals/AddLabelingFunctionModal.tsx b/src/components/projects/projectId/heuristics/modals/AddLabelingFunctionModal.tsx index 48d6c8a5..c236793b 100644 --- a/src/components/projects/projectId/heuristics/modals/AddLabelingFunctionModal.tsx +++ b/src/components/projects/projectId/heuristics/modals/AddLabelingFunctionModal.tsx @@ -32,7 +32,7 @@ export default function AddLabelingFunctionModal() { const codeData = getInformationSourceTemplate(matching, heuristicType, ''); if (!codeData) return; createHeuristicPost(projectId, labelingTask.id, codeData.code, name, description, heuristicType, (res) => { - let id = res['data']?.['createInformationSource']?.['informationSource']?.['id']; + let id = res?.id; if (id) { router.push(getRouterLinkHeuristic(heuristicType, projectId, id)) } else { diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index 77ebc6e4..67414fef 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -186,7 +186,7 @@ export default function LabelingMainComponent() { CommentDataManager.registerCommentRequests(CurrentPage.LABELING, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); @@ -203,7 +203,7 @@ export default function LabelingMainComponent() { return; } getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); @@ -221,7 +221,7 @@ export default function LabelingMainComponent() { return; } getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); diff --git a/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx b/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx index 2f5ef054..a214b87f 100644 --- a/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx +++ b/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx @@ -51,7 +51,7 @@ export default function LookupListsOverview() { CommentDataManager.registerCommentRequests(CurrentPage.LOOKUP_LISTS_OVERVIEW, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); diff --git a/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx b/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx index 2c8c7ec4..037c0984 100644 --- a/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx +++ b/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx @@ -68,7 +68,7 @@ export default function LookupListsDetails() { CommentDataManager.registerCommentRequests(CurrentPage.LOOKUP_LISTS_DETAILS, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index 2443f0b9..30010057 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -70,7 +70,7 @@ export default function ProjectOverview() { CommentDataManager.registerCommentRequests(CurrentPage.PROJECT_OVERVIEW, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index be8e8fe7..c555fbee 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -88,7 +88,7 @@ export default function ProjectSettings() { CommentDataManager.registerCommentRequests(CurrentPage.PROJECT_SETTINGS, requests); const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); diff --git a/src/components/shared/comments/Comments.tsx b/src/components/shared/comments/Comments.tsx index ff79492a..d775681a 100644 --- a/src/components/shared/comments/Comments.tsx +++ b/src/components/shared/comments/Comments.tsx @@ -45,7 +45,7 @@ export default function Comments() { if (somethingToRerequest) { const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); if (allUsers.length == 0) { getOrganizationUsers((res) => { dispatch(setAllUsers(res.data["allUsers"])); @@ -83,7 +83,7 @@ export default function Comments() { if (somethingToRerequest) { const requestJsonString = CommentDataManager.buildRequestJSON(); getAllComments(requestJsonString, (res) => { - CommentDataManager.parseCommentData(res.data['getAllComments']); + CommentDataManager.parseCommentData(res); CommentDataManager.parseToCurrentData(allUsers); dispatch(setComments(CommentDataManager.currentDataOrder)); }); From bd58769bca37f908bd36f43b5e227eade39247f3 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 10:36:10 +0100 Subject: [PATCH 15/36] settings --- src/components/projects/projectId/settings/ProjectSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index fc50501f..2ad4f628 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -68,7 +68,7 @@ export default function ProjectSettings() { getRecommendedEncoders(project.id, (res) => { const encoderSuggestions = res.filter(e => e.tokenizers.includes("all") || e.tokenizers.includes(project.tokenizer)); dispatch(setRecommendedEncodersAll(encoderSuggestions as RecommendedEncoder[])); - dispatch(setAllRecommendedEncodersDict(postProcessingRecommendedEncoders(attributes, project.tokenizer, res['data']['recommendedEncoders']))); + dispatch(setAllRecommendedEncodersDict(postProcessingRecommendedEncoders(attributes, project.tokenizer, res))); }); }, [attributes]); From d12ce29695936a435df41603b7d243d7dd8e3794 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 11:07:11 +0100 Subject: [PATCH 16/36] labeling, lookup --- .../attributeId/AttributeCalculations.tsx | 4 ++-- .../heuristicId/shared/HeuristicsLayout.tsx | 2 +- .../main-component/LabelingMainComponent.tsx | 13 +++++-------- .../main-component/NavigationBarTop.tsx | 3 +-- .../lookup-lists/LookupListsOverview.tsx | 6 +++--- .../lookupListId/LookupListOperations.tsx | 4 ++-- .../lookupListId/LookupListsDetails.tsx | 8 ++++---- src/services/base/labeling.ts | 19 ------------------- 8 files changed, 18 insertions(+), 41 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index 14a7b489..24891ffa 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -73,7 +73,7 @@ export default function AttributeCalculation() { } if (lookupLists.length == 0) { getLookupListsByProjectId(projectId, (res) => { - dispatch(setAllLookupLists(res.data['knowledgeBasesByProjectId'])); + dispatch(setAllLookupLists(res)); }); } refetchLabelingTasksAndProcess(); @@ -256,7 +256,7 @@ export default function AttributeCalculation() { } } else if (['knowledge_base_updated', 'knowledge_base_deleted', 'knowledge_base_created'].includes(msgParts[1])) { getLookupListsByProjectId(projectId, (res) => { - dispatch(setAllLookupLists(res.data['knowledgeBasesByProjectId'])); + dispatch(setAllLookupLists(res)); }); } else if (msgParts[1] == 'tokenization' && msgParts[2] == 'docbin') { if (msgParts[3] == 'progress') { diff --git a/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx b/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx index e403cf8b..4d81a917 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/shared/HeuristicsLayout.tsx @@ -102,7 +102,7 @@ export default function HeuristicsLayout(props: any) { function refetchLookupListsAndProcess() { getLookupListsByProjectId(projectId, (res) => { - dispatch(setAllLookupLists(res.data['knowledgeBasesByProjectId'])); + dispatch(setAllLookupLists(res)); }); } diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index bfb61b18..3e0217a3 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -83,8 +83,7 @@ export default function LabelingMainComponent() { dispatch(setDisplayUserRole(user.role)); return; } - getLinkLocked(projectId, { linkRoute: router.asPath }, (result) => { - const lockedLink = result['data']['linkLocked']; + getLinkLocked(projectId, { linkRoute: router.asPath }, (lockedLink) => { if (lockedLink) { setAbsoluteWarning('This link is locked, contact your supervisor to request access'); if (router.query.type == LabelingLinkType.HEURISTIC) { @@ -152,7 +151,7 @@ export default function LabelingMainComponent() { if (SessionManager.currentRecordId !== null) { setTimeout(() => { getTokenizedRecord({ recordId: SessionManager.currentRecordId }, (res) => { - dispatch(updateRecordRequests('token', res.data.tokenizeRecord)); + dispatch(updateRecordRequests('token', res)); }); getRecordByRecordId(projectId, SessionManager.currentRecordId, (res) => { dispatch(updateRecordRequests('record', res.data.recordByRecordId)); @@ -231,8 +230,7 @@ export default function LabelingMainComponent() { function requestHuddleData(huddleId: string) { if (hasRequestedHuddleData.current === true) return; hasRequestedHuddleData.current = true; - getHuddleData(projectId, { huddleId: huddleId, huddleType: SessionManager.labelingLinkData.linkType }, (result) => { - const huddleData = result['data']['requestHuddleData']; + getHuddleData(projectId, { huddleId: huddleId, huddleType: SessionManager.labelingLinkData.linkType }, (huddleData) => { if (huddleId == DUMMY_HUDDLE_ID) { SessionManager.labelingLinkData.huddleId = huddleData.huddleId; } @@ -269,8 +267,7 @@ export default function LabelingMainComponent() { function collectAvailableLinks() { if (userDisplayRole?.role == UserRole.ENGINEER) return; const heuristicId = SessionManager.labelingLinkData.linkType == LabelingLinkType.HEURISTIC ? SessionManager.labelingLinkData.huddleId : null; - getAvailableLinks(projectId, user?.role, heuristicId, (result) => { - const availableLinks = result['data']['availableLinks']; + getAvailableLinks(projectId, user?.role, heuristicId, (availableLinks) => { dispatch(setAvailableLinks(availableLinks)); const linkRoute = router.asPath.split("?")[0]; dispatch(setSelectedLink(availableLinks.find(link => link.link.split("?")[0] == linkRoute))); @@ -319,7 +316,7 @@ export default function LabelingMainComponent() { const recordId = SessionManager.currentRecordId ?? record.id; if (msgParts[2] == recordId) { getRecordLabelAssociations(projectId, recordId, (rla) => { - const rlas = rla['data']?.['recordByRecordId']?.['recordLabelAssociations']['edges'].map(e => e.node); + const rlas = rla?.recordLabelAssociations; dispatch(updateRecordRequests('rla', prepareRLADataForRole(rlas, user, userDisplayId, userDisplayRole))); }); } diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/NavigationBarTop.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/NavigationBarTop.tsx index 84f667a7..ad2f7d97 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/NavigationBarTop.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/NavigationBarTop.tsx @@ -30,8 +30,7 @@ export default function NavigationBarTop(props: NavigationBarTopProps) { useEffect(() => { if (userDisplayRole?.role == UserRole.ENGINEER || !SessionManager.labelingLinkData) return; const heuristicId = SessionManager.labelingLinkData.linkType == LabelingLinkType.HEURISTIC ? SessionManager.labelingLinkData.huddleId : null; - getAvailableLinks(projectId, userDisplayRole?.role, heuristicId, (result) => { - const availableLinks = result['data']['availableLinks']; + getAvailableLinks(projectId, userDisplayRole?.role, heuristicId, (availableLinks) => { dispatch(setAvailableLinks(availableLinks)); const linkRoute = router.asPath.split("?")[0]; dispatch(setSelectedLink(availableLinks.find(link => link.link.split("?")[0] == linkRoute))); diff --git a/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx b/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx index a214b87f..e09eacc8 100644 --- a/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx +++ b/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx @@ -60,13 +60,13 @@ export default function LookupListsOverview() { useEffect(() => { if (!projectId) return; getLookupListsByProjectId(projectId, (res) => { - dispatch(setAllLookupLists(res.data["knowledgeBasesByProjectId"])); + dispatch(setAllLookupLists(res)); }); }, [projectId]); function createLookupList() { createKnowledgeBase(projectId, (res) => { - const lookupList = res.data?.createKnowledgeBase["knowledgeBase"]; + const lookupList = res?.knowledgeBase; dispatch(extendAllLookupLists(lookupList)); router.push(`/projects/${projectId}/lookup-lists/${lookupList.id}`); }); @@ -109,7 +109,7 @@ export default function LookupListsOverview() { const handleWebsocketNotification = useCallback((msgParts: string[]) => { if (['knowledge_base_updated', 'knowledge_base_deleted', 'knowledge_base_created'].includes(msgParts[1])) { getLookupListsByProjectId(projectId, (res) => { - dispatch(setAllLookupLists(res.data["knowledgeBasesByProjectId"])); + dispatch(setAllLookupLists(res)); }); } }, [projectId]); diff --git a/src/components/projects/projectId/lookup-lists/lookupListId/LookupListOperations.tsx b/src/components/projects/projectId/lookup-lists/lookupListId/LookupListOperations.tsx index 472e7d74..477432f6 100644 --- a/src/components/projects/projectId/lookup-lists/lookupListId/LookupListOperations.tsx +++ b/src/components/projects/projectId/lookup-lists/lookupListId/LookupListOperations.tsx @@ -38,9 +38,9 @@ export default function LookupListOperations(props: LookupListOperationsProps) { setDownloadMessage(DownloadState.PREPARATION); getExportLookupList(projectId, router.query.lookupListId, (res) => { setDownloadMessage(DownloadState.DOWNLOAD); - const downloadContent = JSON.parse(res.data['exportKnowledgeBase']); + const downloadContent = JSON.parse(res); downloadByteData(downloadContent, 'lookup_list.json'); - const timerTime = Math.max(2000, res.data['exportKnowledgeBase'].length * 0.0001); + const timerTime = Math.max(2000, res.length * 0.0001); timer(timerTime).subscribe(() => setDownloadMessage(DownloadState.NONE)); }); } diff --git a/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx b/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx index 037c0984..8924c06f 100644 --- a/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx +++ b/src/components/projects/projectId/lookup-lists/lookupListId/LookupListsDetails.tsx @@ -42,7 +42,7 @@ export default function LookupListsDetails() { useEffect(() => { if (!projectId || !router.query.lookupListId) return; getLookupListsByLookupListId(projectId, router.query.lookupListId as string, (res) => { - setLookupList(postProcessLookupList(res.data['knowledgeBaseByKnowledgeBaseId'])); + setLookupList(postProcessLookupList(res)); }); refetchTerms(); }, [projectId, router.query.lookupListId]); @@ -76,8 +76,8 @@ export default function LookupListsDetails() { function refetchTerms() { getTermsByLookupListId(projectId, router.query.lookupListId as string, (res) => { - setFinalSize(res.data['termsByKnowledgeBaseId'].length); - setTerms(postProcessTerms(res.data['termsByKnowledgeBaseId'])); + setFinalSize(res.length); + setTerms(postProcessTerms(res)); }); } @@ -128,7 +128,7 @@ export default function LookupListsDetails() { if (msgParts[2] == router.query.lookupListId) { if (msgParts[1] == 'knowledge_base_updated') { getLookupListsByLookupListId(projectId, router.query.lookupListId as string, (res) => { - setLookupList(postProcessLookupList(res.data['knowledgeBaseByKnowledgeBaseId'])); + setLookupList(postProcessLookupList(res)); }); } else if (msgParts[1] == 'knowledge_base_deleted') { alert('Lookup list was deleted'); diff --git a/src/services/base/labeling.ts b/src/services/base/labeling.ts index 4758fae1..4eb5a1d8 100644 --- a/src/services/base/labeling.ts +++ b/src/services/base/labeling.ts @@ -41,25 +41,6 @@ export function getLinkLocked(projectId: string, options: { jsonFetchWrapper(finalUrl, FetchType.POST, onResult, JSON.stringify(convertCamelToSnakeCase(options))); } -export function generateAccessLinkPost(projectId: string, options: { - type: string, id: string, -}, onResult: (result: any) => void) { - const finalUrl = `${labelingEndpoint}/${projectId}/generate-access-link`; - jsonFetchWrapper(finalUrl, FetchType.POST, onResult, JSON.stringify(convertCamelToSnakeCase(options))); -} - -export function removeAccessLinkPost(projectId: string, linkId: string, onResult: (result: any) => void) { - const finalUrl = `${labelingEndpoint}/${projectId}/remove-access-link`; - jsonFetchWrapper(finalUrl, FetchType.DELETE, onResult, JSON.stringify({ "value": linkId })); -} - -export function lockAccessLink(projectId: string, options: { - linkId: string, lockState: boolean -}, onResult: (result: any) => void) { - const finalUrl = `${labelingEndpoint}/${projectId}/lock-access-link`; - jsonFetchWrapper(finalUrl, FetchType.PUT, onResult, JSON.stringify(convertCamelToSnakeCase(options))); -} - export function addClassificationLabels(projectId: string, recordId: string, labelingTaskId: string, labelId: string, asGoldStar: boolean, sourceId: string, onResult: (result: any) => void) { const finalUrl = `${labelingEndpoint}/${projectId}/add-classification-labels`; const body = { From 76ffa0494380068647b9f3b0549653efb71f5025 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 13:11:03 +0100 Subject: [PATCH 17/36] fixes, clean up --- .../attributeId/AttributeCalculations.tsx | 5 ++--- .../projectId/data-browser/DataBrowser.tsx | 5 ++--- .../projectId/heuristics/HeuristicsOverview.tsx | 5 ++--- .../active-learning/ActiveLearning.tsx | 5 ++--- .../labeling-function/LabelingFunction.tsx | 5 ++--- .../main-component/LabelingMainComponent.tsx | 5 ++--- .../projectId/overview/ProjectOverview.tsx | 5 ++--- .../projectId/settings/ProjectSettings.tsx | 5 ++--- .../projectId/settings/labeling-tasks-helper.ts | 16 ---------------- 9 files changed, 16 insertions(+), 40 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index 24891ffa..e7c65394 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -27,7 +27,7 @@ import { CommentType } from "@/src/types/shared/comments"; import { AttributeCodeLookup } from "@/src/util/classes/attribute-calculation"; import KernDropdown from "@/submodules/react-components/components/KernDropdown"; import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { getAllComments } from "@/src/services/base/comment"; import { getAttributes } from "@/src/services/base/attribute"; import { getLookupListsByProjectId } from "@/src/services/base/lookup-lists"; @@ -227,8 +227,7 @@ export default function AttributeCalculation() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index 62e83030..73f14c32 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -5,7 +5,7 @@ import { useCallback, useEffect, useState } from "react"; import { expandRecordList, selectActiveSearchParams, selectActiveSlice, selectConfiguration, selectFullSearchStore, selectRecords, setActiveDataSlice, setDataSlices, setRecordComments, setUniqueValuesDict, updateAdditionalDataState } from "@/src/reduxStore/states/pages/data-browser"; import { postProcessRecordsExtended, postProcessUniqueValues } from "@/src/util/components/projects/projectId/data-browser/data-browser-helper"; import { selectAttributes, selectLabelingTasksAll, setAllAttributes, setAllEmbeddings, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { selectAllUsers, selectOrganizationId, selectUser, setComments } from "@/src/reduxStore/states/general"; import DataBrowserRecords from "./DataBrowserRecords"; import { postProcessingEmbeddings } from "@/src/util/components/projects/projectId/settings/embeddings-helper"; @@ -117,8 +117,7 @@ export default function DataBrowser() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index ad6cca0c..5904c786 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -4,7 +4,7 @@ import style from '@/src/styles/components/projects/projectId/heuristics/heurist import { useCallback, useEffect, useState } from "react"; import { selectEmbeddings, selectUsableNonTextAttributes, setAllAttributes, setAllEmbeddings, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings"; import { LabelingTask } from "@/src/types/components/projects/projectId/settings/labeling-tasks"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { postProcessHeuristics } from "@/src/util/components/projects/projectId/heuristics/heuristics-helper"; import { selectHeuristicsAll, setAllHeuristics } from "@/src/reduxStore/states/pages/heuristics"; import GridCards from "@/src/components/shared/grid-cards/GridCards"; @@ -73,8 +73,7 @@ export function HeuristicsOverview() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx index 8067d197..a7fbf7e1 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx @@ -8,7 +8,7 @@ import { getClassLine, postProcessCurrentHeuristic, postProcessLastTaskLogs } fr import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants"; import { Tooltip } from "@nextui-org/react"; import { selectEmbeddings, selectEmbeddingsFiltered, selectLabelingTasksAll, selectVisibleAttributesHeuristics, setAllEmbeddings, setFilteredEmbeddings, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { postProcessingEmbeddings } from "@/src/util/components/projects/projectId/settings/embeddings-helper"; import { embeddingRelevant } from "@/src/util/components/projects/projectId/heuristics/heuristicId/labeling-functions-helper"; import { Embedding } from "@/src/types/components/projects/projectId/settings/embeddings"; @@ -121,8 +121,7 @@ export default function ActiveLearning() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx index 852211b4..32d07374 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/labeling-function/LabelingFunction.tsx @@ -7,7 +7,7 @@ import { selectHeuristic, setActiveHeuristics, updateHeuristicsState } from "@/s import { postProcessCurrentHeuristic, postProcessLastTaskLogs } from "@/src/util/components/projects/projectId/heuristics/heuristicId/heuristics-details-helper"; import { Tooltip } from "@nextui-org/react"; import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { selectVisibleAttributesHeuristics, selectLabelingTasksAll, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings"; import HeuristicsEditor from "../shared/HeuristicsEditor"; import DangerZone from "@/src/components/shared/danger-zone/DangerZone"; @@ -104,8 +104,7 @@ export default function LabelingFunction() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index 3e0217a3..ab39ff52 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -18,7 +18,7 @@ import LabelingSuiteTaskHeader from "../sub-components/LabelingSuiteTaskHeader"; import LabelingSuiteOverviewTable from "../sub-components/LabelingSuiteOverviewTable"; import LabelingSuiteLabeling from "../sub-components/LabelingSuiteLabeling"; import { setAllAttributes, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { CommentDataManager } from "@/src/util/classes/comments"; import { CommentType } from "@/src/types/shared/comments"; import { LabelingTask } from "@/src/types/components/projects/projectId/settings/labeling-tasks"; @@ -282,8 +282,7 @@ export default function LabelingMainComponent() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - const labelingTasksProcessed = postProcessLabelingTasksSchema(labelingTasks); + const labelingTasksProcessed = postProcessLabelingTasksSchema(res); dispatch(setLabelingTasksAll(prepareTasksForRole(labelingTasksProcessed, userDisplayRole))); }); } diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index b4e7cb04..90333fc8 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -6,7 +6,7 @@ import { getEmptyProjectStats, postProcessLabelDistribution, postProcessingStats import ProjectOverviewCards from './ProjectOverviewCards'; import { ProjectStats } from '@/src/types/components/projects/projectId/project-overview/project-overview'; import style from '@/src/styles/components/projects/projectId/project-overview.module.css'; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from '@/src/util/components/projects/projectId/settings/labeling-tasks-helper'; +import { postProcessLabelingTasksSchema } from '@/src/util/components/projects/projectId/settings/labeling-tasks-helper'; import { selectLabelingTasksAll, setAllAttributes, setLabelingTasksAll } from '@/src/reduxStore/states/pages/settings'; import { setDataSlices } from '@/src/reduxStore/states/pages/data-browser'; import { selectOverviewFilters } from '@/src/reduxStore/states/tmp'; @@ -83,8 +83,7 @@ export default function ProjectOverview() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(projectId, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index 2ad4f628..ba8ee724 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -24,7 +24,7 @@ import { CommentType } from "@/src/types/shared/comments"; import { CommentDataManager } from "@/src/util/classes/comments"; import CreateNewAttributeModal from "./CreateNewAttributeModal"; import ProjectSnapshotExportModal from "./ProjectSnapshotExportModal"; -import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; +import { postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper"; import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket"; import { getLabelingTasksByProjectId, getProjectByProjectId, getProjectTokenization } from "@/src/services/base/project"; import { getAllComments } from "@/src/services/base/comment"; @@ -231,8 +231,7 @@ export default function ProjectSettings() { function refetchLabelingTasksAndProcess() { getLabelingTasksByProjectId(project.id, (res) => { - const labelingTasks = postProcessLabelingTasks(res); - dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(labelingTasks))); + dispatch(setLabelingTasksAll(postProcessLabelingTasksSchema(res))); }); } diff --git a/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts b/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts index 0f90986e..0615ca52 100644 --- a/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts +++ b/src/util/components/projects/projectId/settings/labeling-tasks-helper.ts @@ -2,22 +2,6 @@ import { Attribute } from "@/src/types/components/projects/projectId/settings/da import { LabelingTask, LabelingTaskTaskType } from "@/src/types/components/projects/projectId/settings/labeling-tasks"; import { LabelHelper } from "@/src/util/classes/label-helper"; - -export function postProcessLabelingTasks(labelingTasks: any[]): any[] { - if (!labelingTasks) return []; - const prepareLabelingTasks = labelingTasks.map((data: any) => { - return { - id: data.id, - name: data.name, - taskTarget: data.taskTarget, - taskType: data.taskType, - labels: data.labels, - informationSources: data.informationSources, - }; - }); - return prepareLabelingTasks; -} - export function postProcessLabelingTasksSchema(labelingTasks: LabelingTask[]): LabelingTask[] { const prepareLabelingTasks = []; labelingTasks.forEach((task) => { From 889ca59207fceee3b65dee8dd92019605f9302b0 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 13:15:05 +0100 Subject: [PATCH 18/36] fix stats load --- src/components/projects/projectId/overview/ProjectOverview.tsx | 2 +- .../projects/projectId/overview/ProjectOverviewCards.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/projects/projectId/overview/ProjectOverview.tsx b/src/components/projects/projectId/overview/ProjectOverview.tsx index 90333fc8..48f3978e 100644 --- a/src/components/projects/projectId/overview/ProjectOverview.tsx +++ b/src/components/projects/projectId/overview/ProjectOverview.tsx @@ -111,7 +111,7 @@ export default function ProjectOverview() { const dataSliceId = dataSliceFindId == "@@NO_SLICE@@" ? null : dataSliceFindId; getGeneralProjectStats(projectId, labelingTaskId, dataSliceId, (res) => { - if (res['data'] == null) return; + if (!res) return; setProjectStats(postProcessingStats(res)); }); } diff --git a/src/components/projects/projectId/overview/ProjectOverviewCards.tsx b/src/components/projects/projectId/overview/ProjectOverviewCards.tsx index 28ac2f8d..325e4f61 100644 --- a/src/components/projects/projectId/overview/ProjectOverviewCards.tsx +++ b/src/components/projects/projectId/overview/ProjectOverviewCards.tsx @@ -16,7 +16,6 @@ const CARDS_DATA = [ export default function ProjectOverviewCards(props: ProjectOverviewCardsProps) { const router = useRouter(); const projectId = useSelector(selectProjectId); - return (
{CARDS_DATA.map((card: CardStats) => ( From b010a3dde6f0a7dd57c14bab4d8942397bc34f18 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 13:52:49 +0100 Subject: [PATCH 19/36] notifications, record, settings --- .../attributes/attributeId/AttributeCalculations.tsx | 6 ++---- .../attributes/attributeId/ExecutionContainer.tsx | 2 +- .../data-browser/modals/SaveDataSliceModal.tsx | 2 +- .../projectId/edit-records/SyncRecordsModal.tsx | 3 +-- .../projectId/settings/CreateNewAttributeModal.tsx | 2 +- .../projects/projectId/settings/ProjectSettings.tsx | 4 ++-- .../settings/ProjectSnapshotExportModal.tsx | 4 ++-- .../settings/labeling-tasks/RenameLabelModal.tsx | 3 +-- src/components/shared/export/ExportRecordsModal.tsx | 4 ++-- src/components/shared/header/Header.tsx | 2 +- src/components/shared/layout/Layout.tsx | 2 +- src/services/base/project-setting.ts | 12 ------------ 12 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index e7c65394..0f22ea6b 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -244,8 +244,7 @@ export default function AttributeCalculation() { getAttributes(projectId, ['ALL'], (res) => { dispatch(setAllAttributes(res)); }); - getAttributeByAttributeId(projectId, currentAttribute?.id, (res) => { - const attribute = res.data['attributeByAttributeId']; + getAttributeByAttributeId(projectId, currentAttribute?.id, (attribute) => { if (attribute == null) setCurrentAttribute(null); else setCurrentAttribute(postProcessCurrentAttribute(attribute)); }); @@ -387,8 +386,7 @@ export default function AttributeCalculation() { setEnableButton(value)} refetchCurrentAttribute={() => { - getAttributeByAttributeId(projectId, currentAttribute?.id, (res) => { - const attribute = res.data['attributeByAttributeId']; + getAttributeByAttributeId(projectId, currentAttribute?.id, (attribute) => { if (attribute == null) setCurrentAttribute(null); else setCurrentAttribute(postProcessCurrentAttribute(attribute)); }); diff --git a/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx b/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx index 3b50a83d..5caa22bc 100644 --- a/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx +++ b/src/components/projects/projectId/attributes/attributeId/ExecutionContainer.tsx @@ -53,7 +53,7 @@ export default function ExecutionContainer(props: ExecutionContainerProps) { function recordByRecordId(recordId: string) { getRecordByRecordId(projectId, recordId, (res) => { - dispatch(setModalStates(ModalEnum.VIEW_RECORD_DETAILS, { record: postProcessRecordByRecordId(res.data['recordByRecordId']) })); + dispatch(setModalStates(ModalEnum.VIEW_RECORD_DETAILS, { record: postProcessRecordByRecordId(res) })); }); } diff --git a/src/components/projects/projectId/data-browser/modals/SaveDataSliceModal.tsx b/src/components/projects/projectId/data-browser/modals/SaveDataSliceModal.tsx index 7bf040fd..05c9d687 100644 --- a/src/components/projects/projectId/data-browser/modals/SaveDataSliceModal.tsx +++ b/src/components/projects/projectId/data-browser/modals/SaveDataSliceModal.tsx @@ -37,7 +37,7 @@ export default function SaveDataSliceModal(props: { fullSearch: {} }) { filterRaw: getRawFilterForSave(props.fullSearch), filterData: parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, props.fullSearch[SearchGroup.DRILL_DOWN].value) }, (res) => { - const id = res["data"]["createDataSlice"]["id"]; + const id = res?.id; const slice = { id: id, name: modalSaveDataSlice.sliceName, static: isStatic, filterRaw: getRawFilterForSave(props.fullSearch), filterData: parseFilterToExtended(activeSearchParams, attributes, configuration, labelingTasks, user, props.fullSearch[SearchGroup.DRILL_DOWN].value), color: getColorStruct(isStatic), diff --git a/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx b/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx index 2256c07c..49f1053b 100644 --- a/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx +++ b/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx @@ -28,8 +28,7 @@ export default function SyncRecordsModal(props: SyncRecordsModalProps) { erdDataCopy.errors = null; const changes = jsonCopy(erdDataCopy.cachedRecordChanges); for (const key in changes) delete changes[key].display; - syncEditedRecords(projectId, changes, (res) => { - const tmp = res?.data?.editRecords; + syncEditedRecords(projectId, changes, (tmp) => { if (tmp?.ok) { erdDataCopy.data.records = jsonCopy(erdDataCopy.displayRecords); erdDataCopy.cachedRecordChanges = {}; diff --git a/src/components/projects/projectId/settings/CreateNewAttributeModal.tsx b/src/components/projects/projectId/settings/CreateNewAttributeModal.tsx index 11d2442b..4e34be4c 100644 --- a/src/components/projects/projectId/settings/CreateNewAttributeModal.tsx +++ b/src/components/projects/projectId/settings/CreateNewAttributeModal.tsx @@ -31,7 +31,7 @@ export default function CreateNewAttributeModal() { const createUserAttribute = useCallback(() => { createAttribute(projectId, attributeName, attributeType.value, (res) => { - const id = res?.data?.createUserAttribute.attributeId; + const id = res?.attributeId; if (id) { localStorage.setItem('isNewAttribute', "X"); dispatch(setCurrentPage(CurrentPage.ATTRIBUTE_CALCULATION)); diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index ba8ee724..5c99cb6a 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -103,7 +103,7 @@ export default function ProjectSettings() { function refetchEmbeddingsAndPostProcess() { getEmbeddings(project.id, (res) => { getQueuedTasks(project.id, "EMBEDDING", (queuedTasks) => { - const queuedEmbeddings = queuedTasks.data['queuedTasks'].map((task) => { + const queuedEmbeddings = queuedTasks?.map((task) => { const copy = { ...task }; return copy; }) @@ -161,7 +161,7 @@ export default function ProjectSettings() { getEmbeddings(project.id, (res) => { getQueuedTasks(project.id, "EMBEDDING", (queuedTasks) => { - const queuedEmbeddings = queuedTasks.data['queuedTasks'].map((task) => { + const queuedEmbeddings = queuedTasks?.map((task) => { const copy = { ...task }; return copy; }) diff --git a/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx b/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx index c7a73537..272a384e 100644 --- a/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx +++ b/src/components/projects/projectId/settings/ProjectSnapshotExportModal.tsx @@ -55,8 +55,8 @@ export default function ProjectSnapshotExportModal() { function requestProjectSize() { getProjectSize(projectId, (res) => { - setProjectSize(res.data['projectSize']); - setProjectExportArray(postProcessingFormGroups(res.data['projectSize'], embeddings)); + setProjectSize(res); + setProjectExportArray(postProcessingFormGroups(res, embeddings)); }); } diff --git a/src/components/projects/projectId/settings/labeling-tasks/RenameLabelModal.tsx b/src/components/projects/projectId/settings/labeling-tasks/RenameLabelModal.tsx index 6c4225a9..a471213a 100644 --- a/src/components/projects/projectId/settings/labeling-tasks/RenameLabelModal.tsx +++ b/src/components/projects/projectId/settings/labeling-tasks/RenameLabelModal.tsx @@ -58,8 +58,7 @@ export default function RenameLabelModal() { const [acceptButtonRename, setAcceptButtonRename] = useState(ACCEPT_BUTTON); function checkRenameLabel() { - getCheckRenameLabel(projectId, modalRenameLabel.label.id, renameLabelData.newLabelName, res => { - const result = res.data['checkRenameLabel']; + getCheckRenameLabel(projectId, modalRenameLabel.label.id, renameLabelData.newLabelName, result => { const renameLabelDataCopy = { ...renameLabelData }; result.warnings.forEach(e => { e.open = false; diff --git a/src/components/shared/export/ExportRecordsModal.tsx b/src/components/shared/export/ExportRecordsModal.tsx index 4db8f8f6..184a9451 100644 --- a/src/components/shared/export/ExportRecordsModal.tsx +++ b/src/components/shared/export/ExportRecordsModal.tsx @@ -68,7 +68,7 @@ export default function ExportRecordsModal(props: ExportProps) { function requestRecordsExportCredentials() { getLastRecordExportCredentials(projectId, (res) => { - const recordExportCredentials = res.data['lastRecordExportCredentials']; + const recordExportCredentials = res; if (!recordExportCredentials) setRecordExportCredentials(null); else { const credentials = JSON.parse(recordExportCredentials); @@ -213,7 +213,7 @@ export default function ExportRecordsModal(props: ExportProps) { let keyToSend = key; if (!keyToSend) keyToSend = null; prepareRecordExport(projectId, { exportOptions: jsonString, key: keyToSend }, (res) => { - if (!res.data) { + if (!res!.ok) { ExportHelper.error.push("Something went wrong in the backend:"); ExportHelper.error.push(res.error); setPrepareErrors(ExportHelper.error); diff --git a/src/components/shared/header/Header.tsx b/src/components/shared/header/Header.tsx index 0f4c507e..ab8ac7ee 100644 --- a/src/components/shared/header/Header.tsx +++ b/src/components/shared/header/Header.tsx @@ -60,7 +60,7 @@ export default function Header() { userFilter: true, limit: 50 }, (res) => { - dispatch(setNotifications(postProcessNotifications(res.data['notifications'], arrayToDict(res, 'id'), notificationId))); + dispatch(setNotifications(postProcessNotifications(res, arrayToDict(res, 'id'), notificationId))); dispatch(openModal(ModalEnum.NOTIFICATION_CENTER)); }); }); diff --git a/src/components/shared/layout/Layout.tsx b/src/components/shared/layout/Layout.tsx index b2093cc6..c41abd15 100644 --- a/src/components/shared/layout/Layout.tsx +++ b/src/components/shared/layout/Layout.tsx @@ -78,7 +78,7 @@ export default function Layout({ children }) { function refetchNotificationsAndProcess() { getNotificationsByUser((res) => { - setNotificationsState(postProcessNotificationsUser(res['data']['notificationsByUserId'], notificationsState)); + setNotificationsState(postProcessNotificationsUser(res, notificationsState)); }); } diff --git a/src/services/base/project-setting.ts b/src/services/base/project-setting.ts index ef757eaf..835037f3 100644 --- a/src/services/base/project-setting.ts +++ b/src/services/base/project-setting.ts @@ -48,11 +48,6 @@ export function getProjectSize(projectId: string, onResult: (result: any) => voi jsonFetchWrapper(finalUrl, FetchType.GET, onResult); } -export function createLabels(projectId: string, labelingTaskId: string, labels: string[], onResult: (result: any) => void) { - const finalUrl = `${projectSettingEndpoint}/${projectId}/create-labels`; - jsonFetchWrapper(finalUrl, FetchType.POST, onResult, JSON.stringify({ labelingTaskId, labels })); -} - export function createAttribute(projectId: string, name: string, dataType: string, onResult: (result: any) => void) { const finalUrl = `${projectSettingEndpoint}/${projectId}/create-attribute`; jsonFetchWrapper(finalUrl, FetchType.POST, onResult, JSON.stringify(convertCamelToSnakeCase({ name, dataType }))); @@ -68,11 +63,4 @@ export function calculateUserAttributeAllRecordsPost(projectId: string, options: }, onResult: (result: any) => void) { const finalUrl = `${projectSettingEndpoint}/${projectId}/calculate-user-attribute-all-records`; jsonFetchWrapper(finalUrl, FetchType.POST, onResult, JSON.stringify(convertCamelToSnakeCase(options))); -} - -export function createTaskAndLabels(projectId: string, options: { - labelingTaskName: string, labelingTaskType: string, labelingTaskTargetId: string, labels: string[] -}, onResult: (result: any) => void) { - const finalUrl = `${projectSettingEndpoint}/${projectId}/create-task-and-labels`; - jsonFetchWrapper(finalUrl, FetchType.POST, onResult, JSON.stringify(convertCamelToSnakeCase(options))); } \ No newline at end of file From 502abd49465182106d98f1938c104c38033fb124 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Tue, 7 Jan 2025 16:26:57 +0100 Subject: [PATCH 20/36] fixing small stuff --- .../attributes/attributeId/AttributeCalculations.tsx | 3 ++- .../labeling/sessionId/main-component/DeleteRecordModal.tsx | 2 +- .../sessionId/main-component/LabelingMainComponent.tsx | 5 ++--- src/components/shared/sidebar/Sidebar.tsx | 2 +- src/reduxStore/StoreManagerComponent.tsx | 6 +++--- .../projects/projectId/data-browser/search-groups-helper.ts | 2 +- src/util/shared/export-helper.ts | 4 ++-- submodules/javascript-functions | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx index 0f22ea6b..454140c3 100644 --- a/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx +++ b/src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx @@ -244,8 +244,9 @@ export default function AttributeCalculation() { getAttributes(projectId, ['ALL'], (res) => { dispatch(setAllAttributes(res)); }); + if (msgParts[2] == 'deleted') return getAttributeByAttributeId(projectId, currentAttribute?.id, (attribute) => { - if (attribute == null) setCurrentAttribute(null); + if (!attribute) setCurrentAttribute(null); else setCurrentAttribute(postProcessCurrentAttribute(attribute)); }); if (msgParts[2] == "finished") { diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/DeleteRecordModal.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/DeleteRecordModal.tsx index 0b31c24b..294898ca 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/DeleteRecordModal.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/DeleteRecordModal.tsx @@ -21,7 +21,7 @@ export default function DeleteRecordModal() { const deleteRecord = useCallback(() => { const recordId = record.id; deleteRecordById(projectId, recordId, (r) => { - if (r['data']['deleteRecord']) { + if (r) { SessionManager.setCurrentRecordDeleted(); dispatch(updateRecordRequests('record', null)); LabelingSuiteManager.somethingLoading = false; diff --git a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx index ab39ff52..1498c142 100644 --- a/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx +++ b/src/components/projects/projectId/labeling/sessionId/main-component/LabelingMainComponent.tsx @@ -154,11 +154,10 @@ export default function LabelingMainComponent() { dispatch(updateRecordRequests('token', res)); }); getRecordByRecordId(projectId, SessionManager.currentRecordId, (res) => { - dispatch(updateRecordRequests('record', res.data.recordByRecordId)); + dispatch(updateRecordRequests('record', res)); }); getRecordLabelAssociations(projectId, SessionManager.currentRecordId, (rla) => { - const rlas = rla['data']?.['recordByRecordId']?.['recordLabelAssociations']['edges'].map(e => e.node); - dispatch(updateRecordRequests('rla', prepareRLADataForRole(rlas, user, userDisplayId, userDisplayRole))); + dispatch(updateRecordRequests('rla', prepareRLADataForRole(rla?.recordLabelAssociations, user, userDisplayId, userDisplayRole))); }); }, 100); } diff --git a/src/components/shared/sidebar/Sidebar.tsx b/src/components/shared/sidebar/Sidebar.tsx index f3b81dd6..e307ded8 100644 --- a/src/components/shared/sidebar/Sidebar.tsx +++ b/src/components/shared/sidebar/Sidebar.tsx @@ -65,7 +65,7 @@ export default function Sidebar() { dispatch(openModal(ModalEnum.VERSION_OVERVIEW)); if (versionOverviewData) { getHasUpdates(res => { - setHasUpdates(res.data["hasUpdates"]); + setHasUpdates(res); }); } } diff --git a/src/reduxStore/StoreManagerComponent.tsx b/src/reduxStore/StoreManagerComponent.tsx index 36ea80b3..ff7594d6 100644 --- a/src/reduxStore/StoreManagerComponent.tsx +++ b/src/reduxStore/StoreManagerComponent.tsx @@ -28,8 +28,8 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { const [dataLoaded, setDataLoaded] = useState(false); useEffect(() => { - getIsAdmin((data) => { - dispatch(setIsAdmin(data.data.isAdmin)); + getIsAdmin((isAdmin) => { + dispatch(setIsAdmin(isAdmin)); }); getUserInfo((res) => { @@ -54,7 +54,7 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { // Set cache getVersionOverview((res) => { - dispatch(setCache(CacheEnum.VERSION_OVERVIEW, postprocessVersionOverview(res.data['versionOverview']))); + dispatch(setCache(CacheEnum.VERSION_OVERVIEW, postprocessVersionOverview(res))); }); getEmbeddingPlatforms((res) => { dispatch(setCache(CacheEnum.EMBEDDING_PLATFORMS, postProcessingEmbeddingPlatforms(res, organization))) diff --git a/src/util/components/projects/projectId/data-browser/search-groups-helper.ts b/src/util/components/projects/projectId/data-browser/search-groups-helper.ts index 28a71ed3..c18a9549 100644 --- a/src/util/components/projects/projectId/data-browser/search-groups-helper.ts +++ b/src/util/components/projects/projectId/data-browser/search-groups-helper.ts @@ -152,7 +152,7 @@ export function labelingTasksCreateSearchGroup(item, task: LabelingTask, globalS group: item.group, groupKey: item.groupKey, type: item.type, - taskTarget: task.taskTarget == LabelingTaskTarget.ON_ATTRIBUTE ? task.attribute.name : 'Full Record', + taskTarget: task.targetName, taskId: task.id, active: false, manualLabels: labelingTaskLabelArray(task), diff --git a/src/util/shared/export-helper.ts b/src/util/shared/export-helper.ts index 7ff74bab..022bd66f 100644 --- a/src/util/shared/export-helper.ts +++ b/src/util/shared/export-helper.ts @@ -10,9 +10,9 @@ let rPos = { pos: 9990 }; export default function postProcessExportRecordData(data: any) { let x: any = { - projectId: data.id, + projectId: data.projectId, name: data.name, - labelingTasks: data.labelingTask, + labelingTasks: data.labelingTasks, informationSources: data.informationSources, attributes: data.attributes.filter((att) => [Status.UPLOADED, Status.USABLE, Status.AUTOMATICALLY_CREATED].includes(att.state)), dataSlices: data.dataSlices, diff --git a/submodules/javascript-functions b/submodules/javascript-functions index 3bd200a3..e2e09c5f 160000 --- a/submodules/javascript-functions +++ b/submodules/javascript-functions @@ -1 +1 @@ -Subproject commit 3bd200a34cc3531519d0b3e48fca5910a10b19e3 +Subproject commit e2e09c5fe580120dacd7958603c98dd886ea274d From 23d6e1460df73b4afa994f4e64549d56eb1defb5 Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Tue, 7 Jan 2025 16:57:06 +0100 Subject: [PATCH 21/36] Org queries first part --- src/components/projects/ProjectsList.tsx | 2 +- src/reduxStore/StoreManagerComponent.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/projects/ProjectsList.tsx b/src/components/projects/ProjectsList.tsx index f7311596..35381d1d 100644 --- a/src/components/projects/ProjectsList.tsx +++ b/src/components/projects/ProjectsList.tsx @@ -56,7 +56,7 @@ export default function ProjectsList() { function refetchStatsAndPostProcess() { getOverviewStats((res) => { - const stats = res.data["overviewStats"]; + const stats = res; const statsDict = {}; if (stats == null) return; stats.forEach((stat: ProjectStatistics) => { diff --git a/src/reduxStore/StoreManagerComponent.tsx b/src/reduxStore/StoreManagerComponent.tsx index ff7594d6..080beacc 100644 --- a/src/reduxStore/StoreManagerComponent.tsx +++ b/src/reduxStore/StoreManagerComponent.tsx @@ -33,19 +33,19 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { }); getUserInfo((res) => { - const userInfo = { ...res.data["userInfo"] }; - userInfo.avatarUri = getUserAvatarUri(res.data["userInfo"]); + const userInfo = { ...res }; + userInfo.avatarUri = getUserAvatarUri(res); dispatch(setUser(userInfo)); - dispatch(setDisplayUserRole(res.data["userInfo"].role)); + dispatch(setDisplayUserRole(res.role)); }); getOrganization((res) => { - if (res.data["userOrganization"]) { + if (res?.id) { if (WebSocketsService.getConnectionOpened()) return; WebSocketsService.setConnectionOpened(true); WebSocketsService.initWsNotifications(); setDataLoaded(true); - dispatch(setOrganization(res.data["userOrganization"])); + dispatch(setOrganization(res)); } else { dispatch(setOrganization(null)); timer(60000).subscribe(() => location.reload()) From 19ccd621cea3d082ec41d0c1d2cdf5495bea50a6 Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Wed, 8 Jan 2025 09:38:59 +0100 Subject: [PATCH 22/36] More org endpoints --- src/components/shared/comments/Comments.tsx | 4 ++-- src/reduxStore/StoreManagerComponent.tsx | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/shared/comments/Comments.tsx b/src/components/shared/comments/Comments.tsx index d775681a..7ff202cc 100644 --- a/src/components/shared/comments/Comments.tsx +++ b/src/components/shared/comments/Comments.tsx @@ -48,8 +48,8 @@ export default function Comments() { CommentDataManager.parseCommentData(res); if (allUsers.length == 0) { getOrganizationUsers((res) => { - dispatch(setAllUsers(res.data["allUsers"])); - CommentDataManager.parseToCurrentData(res.data["allUsers"]); + dispatch(setAllUsers(res)); + CommentDataManager.parseToCurrentData(res); }); } else { CommentDataManager.parseToCurrentData(allUsers); diff --git a/src/reduxStore/StoreManagerComponent.tsx b/src/reduxStore/StoreManagerComponent.tsx index 080beacc..427da7b1 100644 --- a/src/reduxStore/StoreManagerComponent.tsx +++ b/src/reduxStore/StoreManagerComponent.tsx @@ -63,9 +63,7 @@ export function GlobalStoreDataComponent(props: React.PropsWithChildren) { useEffect(() => { if (!organization) return; - getOrganizationUsers((res) => { - dispatch(setAllUsers(res.data["allUsers"])); - }); + getOrganizationUsers((res) => dispatch(setAllUsers(res))); }, [organization]); useEffect(() => { From f46de7ffbe7980edac9595326a01a66f892bc2de Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Wed, 8 Jan 2025 09:45:23 +0100 Subject: [PATCH 23/36] More org endpoints --- src/components/shared/layout/Layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/shared/layout/Layout.tsx b/src/components/shared/layout/Layout.tsx index c41abd15..ad811b3c 100644 --- a/src/components/shared/layout/Layout.tsx +++ b/src/components/shared/layout/Layout.tsx @@ -83,7 +83,7 @@ export default function Layout({ children }) { } function refetchAdminMessagesAndProcess() { - getAllActiveAdminMessages((res) => setActiveAdminMessages(postProcessAdminMessages(res['data']['allActiveAdminMessages']))); + getAllActiveAdminMessages((res) => setActiveAdminMessages(postProcessAdminMessages(res))); } function unsubscribeDeletionTimer(deletionTimer) { From 2c3740bb9897e6c0f7fadc46c4cdbf6b34c21d65 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Wed, 8 Jan 2025 15:52:05 +0100 Subject: [PATCH 24/36] stats fix --- .../heuristics/heuristicId/heuristics-details-helper.ts | 2 +- .../projects/projectId/heuristics/shared-helper.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/components/projects/projectId/heuristics/heuristicId/heuristics-details-helper.ts b/src/util/components/projects/projectId/heuristics/heuristicId/heuristics-details-helper.ts index 4eaeaae5..d6ea0080 100644 --- a/src/util/components/projects/projectId/heuristics/heuristicId/heuristics-details-helper.ts +++ b/src/util/components/projects/projectId/heuristics/heuristicId/heuristics-details-helper.ts @@ -12,7 +12,7 @@ export function postProcessCurrentHeuristic(heuristic: Heuristic, labelingTasks: prepareHeuristic.labelSource = LabelSource.INFORMATION_SOURCE; prepareHeuristic.informationSourceType = InformationSourceType[heuristic['type']]; prepareHeuristic.selected = heuristic['isSelected']; - prepareHeuristic.stats = mapInformationSourceStats(heuristic['sourceStatistics']['edges']); + prepareHeuristic.stats = mapInformationSourceStats(heuristic['sourceStatistics']); prepareHeuristic.stats.forEach((stat) => { stat.color = getColorStruct(stat.color); }); diff --git a/src/util/components/projects/projectId/heuristics/shared-helper.ts b/src/util/components/projects/projectId/heuristics/shared-helper.ts index 7f40af44..54b2a212 100644 --- a/src/util/components/projects/projectId/heuristics/shared-helper.ts +++ b/src/util/components/projects/projectId/heuristics/shared-helper.ts @@ -30,9 +30,9 @@ function convertStatDataGlobal(data = null) { } } -export function mapInformationSourceStats(edges) { - if (edges.length) { - return edges.map((wrapper) => { +export function mapInformationSourceStats(sourceStatistics) { + if (sourceStatistics.length) { + return sourceStatistics.map((wrapper) => { return convertStatData(wrapper['node']) }) } else { From 2569101b9e53ee0b42db3a9c60b3824526148327 Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Thu, 9 Jan 2025 13:33:43 +0100 Subject: [PATCH 25/36] Adjust response consumption for syncEditedRecords --- .../projects/projectId/edit-records/SyncRecordsModal.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx b/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx index 49f1053b..1a5e1f52 100644 --- a/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx +++ b/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx @@ -28,13 +28,13 @@ export default function SyncRecordsModal(props: SyncRecordsModalProps) { erdDataCopy.errors = null; const changes = jsonCopy(erdDataCopy.cachedRecordChanges); for (const key in changes) delete changes[key].display; - syncEditedRecords(projectId, changes, (tmp) => { - if (tmp?.ok) { + syncEditedRecords(projectId, changes, (res) => { + if (res?.ok) { erdDataCopy.data.records = jsonCopy(erdDataCopy.displayRecords); erdDataCopy.cachedRecordChanges = {}; dispatch(setModalStates(ModalEnum.SYNC_RECORDS, { syncModalAmount: Object.keys(erdDataCopy.cachedRecordChanges).length })); } else { - if (tmp) erdDataCopy.errors = tmp.errors; + if (res) erdDataCopy.errors = JSON.parse(res); else erdDataCopy.errors = ["Request didn't go through"]; } setSyncing(false); From f62d8e44aadcd10d480d69dfdde0c59310274b91 Mon Sep 17 00:00:00 2001 From: andhreljaKern Date: Thu, 9 Jan 2025 13:36:52 +0100 Subject: [PATCH 26/36] perf: eliminate payload transform in overview-stats --- src/components/projects/ProjectsList.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/projects/ProjectsList.tsx b/src/components/projects/ProjectsList.tsx index 35381d1d..00dc2f67 100644 --- a/src/components/projects/ProjectsList.tsx +++ b/src/components/projects/ProjectsList.tsx @@ -56,16 +56,8 @@ export default function ProjectsList() { function refetchStatsAndPostProcess() { getOverviewStats((res) => { - const stats = res; - const statsDict = {}; - if (stats == null) return; - stats.forEach((stat: ProjectStatistics) => { - const statCopy = { ...stat }; - stat.manuallyLabeled = percentRoundString(statCopy.numDataScaleManual / statCopy.numDataScaleUploaded, 2); - stat.weaklySupervised = percentRoundString(statCopy.numDataScaleProgrammatical / statCopy.numDataScaleUploaded, 2); - statsDict[stat.projectId] = stat; - }); - setProjectStatisticsById(statsDict); + if (res == null) return; + setProjectStatisticsById(res); }); } From cb64bd4011025ca46ecc5e429137acfcb88a3a13 Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Thu, 9 Jan 2025 15:36:02 +0100 Subject: [PATCH 27/36] fix: prepareRecordExport handle --- src/components/shared/export/ExportRecordsModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/shared/export/ExportRecordsModal.tsx b/src/components/shared/export/ExportRecordsModal.tsx index 184a9451..5b34e53d 100644 --- a/src/components/shared/export/ExportRecordsModal.tsx +++ b/src/components/shared/export/ExportRecordsModal.tsx @@ -213,9 +213,9 @@ export default function ExportRecordsModal(props: ExportProps) { let keyToSend = key; if (!keyToSend) keyToSend = null; prepareRecordExport(projectId, { exportOptions: jsonString, key: keyToSend }, (res) => { - if (!res!.ok) { + if (!res!.prepared) { ExportHelper.error.push("Something went wrong in the backend:"); - ExportHelper.error.push(res.error); + ExportHelper.error.push(res.message); setPrepareErrors(ExportHelper.error); } setDownloadState(DownloadState.DOWNLOAD); From 9c9633dfe34aa6e035c6a23578d030891c98ca2c Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Thu, 9 Jan 2025 15:54:40 +0100 Subject: [PATCH 28/36] remove unused --- src/services/base/heuristic.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/services/base/heuristic.ts b/src/services/base/heuristic.ts index ba37fe9a..32807553 100644 --- a/src/services/base/heuristic.ts +++ b/src/services/base/heuristic.ts @@ -29,11 +29,6 @@ export function getLabelingFunctionOn10Records(projectId: string, heuristicId: s jsonFetchWrapper(finalUrl, FetchType.GET, onResult); } -export function getAccessLink(projectId: string, linkId: string, onResult: (result: any) => void) { - const finalUrl = `${heuristicEndpoint}/${projectId}/access-link?link_id=${linkId}`; - jsonFetchWrapper(finalUrl, FetchType.GET, onResult); -} - export function toggleHeuristicById(projectId: string, heuristicId: string, onResult: (result: any) => void) { const finalUrl = `${heuristicEndpoint}/${projectId}/${heuristicId}/toggle-heuristic`; jsonFetchWrapper(finalUrl, FetchType.POST, onResult); From ee710ef3b59750881ace9e657eecd4583fc1278f Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Thu, 9 Jan 2025 15:57:09 +0100 Subject: [PATCH 29/36] fix ok --- .../projects/projectId/edit-records/SyncRecordsModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx b/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx index 1a5e1f52..a79aa10e 100644 --- a/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx +++ b/src/components/projects/projectId/edit-records/SyncRecordsModal.tsx @@ -29,7 +29,7 @@ export default function SyncRecordsModal(props: SyncRecordsModalProps) { const changes = jsonCopy(erdDataCopy.cachedRecordChanges); for (const key in changes) delete changes[key].display; syncEditedRecords(projectId, changes, (res) => { - if (res?.ok) { + if (res) { erdDataCopy.data.records = jsonCopy(erdDataCopy.displayRecords); erdDataCopy.cachedRecordChanges = {}; dispatch(setModalStates(ModalEnum.SYNC_RECORDS, { syncModalAmount: Object.keys(erdDataCopy.cachedRecordChanges).length })); From b03d3bcee3d1ca69dfc8033d05245e8a7fb45acc Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Thu, 9 Jan 2025 16:30:31 +0100 Subject: [PATCH 30/36] Remove API button --- src/components/shared/sidebar/Sidebar.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/components/shared/sidebar/Sidebar.tsx b/src/components/shared/sidebar/Sidebar.tsx index e307ded8..c5a59be8 100644 --- a/src/components/shared/sidebar/Sidebar.tsx +++ b/src/components/shared/sidebar/Sidebar.tsx @@ -8,7 +8,7 @@ import { useState } from 'react'; import AppSelectionDropdown from '@/submodules/react-components/components/AppSelectionDropdown'; import { ModalEnum } from '@/src/types/shared/modal'; import { openModal } from '@/src/reduxStore/states/modal'; -import { IconAlertCircle, IconApi, IconBulb, IconChartPie, IconMaximize, IconMinimize, IconTag, IconTriangleSquareCircle } from '@tabler/icons-react'; +import { IconAlertCircle, IconBulb, IconChartPie, IconMaximize, IconMinimize, IconTag, IconTriangleSquareCircle } from '@tabler/icons-react'; import { IconSettings } from '@tabler/icons-react'; import { useRouter } from 'next/router'; import { TOOLTIPS_DICT } from '@/src/util/tooltip-constants'; @@ -154,14 +154,6 @@ export default function Sidebar() {
} ) : (<>)} -
- - - - - -
{!isFullScreen &&
From 260883866cffc3df5cca9a910d765df8de3f5e46 Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Mon, 13 Jan 2025 10:19:01 +0100 Subject: [PATCH 31/36] Change condition --- src/components/shared/export/ExportRecordsModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/shared/export/ExportRecordsModal.tsx b/src/components/shared/export/ExportRecordsModal.tsx index 5b34e53d..405b503b 100644 --- a/src/components/shared/export/ExportRecordsModal.tsx +++ b/src/components/shared/export/ExportRecordsModal.tsx @@ -213,7 +213,7 @@ export default function ExportRecordsModal(props: ExportProps) { let keyToSend = key; if (!keyToSend) keyToSend = null; prepareRecordExport(projectId, { exportOptions: jsonString, key: keyToSend }, (res) => { - if (!res!.prepared) { + if (!res?.prepared) { ExportHelper.error.push("Something went wrong in the backend:"); ExportHelper.error.push(res.message); setPrepareErrors(ExportHelper.error); From 11989c4b2a9773d389a839ec924a5b4909e516bc Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Mon, 13 Jan 2025 10:57:29 +0100 Subject: [PATCH 32/36] Fix: file size estimate --- .../projects/projectId/settings/project-export-helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/components/projects/projectId/settings/project-export-helper.ts b/src/util/components/projects/projectId/settings/project-export-helper.ts index 50fe0c84..86ff72b3 100644 --- a/src/util/components/projects/projectId/settings/project-export-helper.ts +++ b/src/util/components/projects/projectId/settings/project-export-helper.ts @@ -29,7 +29,7 @@ export function postProcessingFormGroups(projectSize: any, embeddings: Embedding moveRight: getMoveRight(element.table), name: element.table, desc: hasGdpr ? null : element.description, - sizeNumber: element.byteSize, + sizeNumber: parseFloat(element.byteSize), sizeReadable: element.byteReadable, }; projectExportArray.push(group); From c99d5f986c902766db35c5e7adb6782977ce38bf Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 13 Jan 2025 11:47:23 +0100 Subject: [PATCH 33/36] PR --- src/components/projects/SampleProjectsDropdown.tsx | 2 +- .../projects/projectId/lookup-lists/LookupListsOverview.tsx | 5 ++--- src/components/shared/upload/Upload.tsx | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/projects/SampleProjectsDropdown.tsx b/src/components/projects/SampleProjectsDropdown.tsx index d6231180..07f0283c 100644 --- a/src/components/projects/SampleProjectsDropdown.tsx +++ b/src/components/projects/SampleProjectsDropdown.tsx @@ -40,7 +40,7 @@ export default function SampleProjectsDropdown() { dispatch(setSearchGroupsStore({})); createSampleProject({ name: projectNameFinal, projectType: projectTypeFinal }, (res) => { dispatch(closeModal(ModalEnum.SAMPLE_PROJECT_TITLE)); - const projectId = res['project'].id; + const projectId = res?.id; dispatch(setProjectIdSampleProject(projectId)); }); }, [projects, projectNameInput, projectTypeInput, router]); diff --git a/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx b/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx index e09eacc8..3873310b 100644 --- a/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx +++ b/src/components/projects/projectId/lookup-lists/LookupListsOverview.tsx @@ -66,9 +66,8 @@ export default function LookupListsOverview() { function createLookupList() { createKnowledgeBase(projectId, (res) => { - const lookupList = res?.knowledgeBase; - dispatch(extendAllLookupLists(lookupList)); - router.push(`/projects/${projectId}/lookup-lists/${lookupList.id}`); + dispatch(extendAllLookupLists(res)); + router.push(`/projects/${projectId}/lookup-lists/${res?.id}`); }); } diff --git a/src/components/shared/upload/Upload.tsx b/src/components/shared/upload/Upload.tsx index d51fca65..321ca5cc 100644 --- a/src/components/shared/upload/Upload.tsx +++ b/src/components/shared/upload/Upload.tsx @@ -172,8 +172,7 @@ export default function Upload(props: UploadProps) { let keyToSend = key; if (!keyToSend) keyToSend = null; getUploadCredentialsAndId(UploadHelper.getProjectId(), finalFinalName, uploadFileType, importOptionsPrep, UploadType.DEFAULT, keyToSend, (res) => { - const credentialsAndUploadId = JSON.parse(JSON.parse(res)); - uploadFileToMinio(credentialsAndUploadId, finalFinalName); + uploadFileToMinio(res, finalFinalName); }); } From a4cc1b68b5eef76c9fba9c361450f4d35a10079a Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 13 Jan 2025 11:56:26 +0100 Subject: [PATCH 34/36] embed --- .../projects/projectId/data-browser/DataBrowser.tsx | 2 +- .../projects/projectId/heuristics/HeuristicsOverview.tsx | 2 +- .../heuristics/heuristicId/active-learning/ActiveLearning.tsx | 2 +- .../projects/projectId/settings/ProjectSettings.tsx | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/projects/projectId/data-browser/DataBrowser.tsx b/src/components/projects/projectId/data-browser/DataBrowser.tsx index 73f14c32..48ed77ae 100644 --- a/src/components/projects/projectId/data-browser/DataBrowser.tsx +++ b/src/components/projects/projectId/data-browser/DataBrowser.tsx @@ -123,7 +123,7 @@ export default function DataBrowser() { function refetchEmbeddingsAndPostProcess() { getEmbeddings(projectId, (res) => { - const embeddings = postProcessingEmbeddings(res['embeddings'], []); + const embeddings = postProcessingEmbeddings(res, []); dispatch(setAllEmbeddings(embeddings)); }); } diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index 5904c786..4fd03ee5 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -87,7 +87,7 @@ export function HeuristicsOverview() { function refetchEmbeddingsAndProcess() { getEmbeddings(projectId, (res) => { - const embeddingsFinal = postProcessingEmbeddings(res['embeddings'], []); + const embeddingsFinal = postProcessingEmbeddings(res, []); dispatch(setAllEmbeddings(embeddingsFinal)); }); } diff --git a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx index a7fbf7e1..7ddcbae7 100644 --- a/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx +++ b/src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx @@ -127,7 +127,7 @@ export default function ActiveLearning() { function refetchEmbeddingsAndPostProcess() { getEmbeddings(projectId, (res) => { - const embeddings = postProcessingEmbeddings(res['embeddings'], []); + const embeddings = postProcessingEmbeddings(res, []); dispatch(setAllEmbeddings(embeddings)); }); } diff --git a/src/components/projects/projectId/settings/ProjectSettings.tsx b/src/components/projects/projectId/settings/ProjectSettings.tsx index 5c99cb6a..5bf061d5 100644 --- a/src/components/projects/projectId/settings/ProjectSettings.tsx +++ b/src/components/projects/projectId/settings/ProjectSettings.tsx @@ -107,7 +107,7 @@ export default function ProjectSettings() { const copy = { ...task }; return copy; }) - dispatch(setAllEmbeddings(postProcessingEmbeddings(res['embeddings'], queuedEmbeddings))); + dispatch(setAllEmbeddings(postProcessingEmbeddings(res, queuedEmbeddings))); }); }); } @@ -165,7 +165,7 @@ export default function ProjectSettings() { const copy = { ...task }; return copy; }) - const newEMbeddings = postProcessingEmbeddings(res['embeddings'], queuedEmbeddings); + const newEMbeddings = postProcessingEmbeddings(res, queuedEmbeddings); for (let e of newEMbeddings) { if (e.id == msgParts[2]) { if (msgParts[3] == "state") { From c4903e7483e875045ec5b55a03961e971e690b13 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 13 Jan 2025 14:20:37 +0100 Subject: [PATCH 35/36] fix labeling bug --- .../sessionId/sub-components/LabelingSuiteLabeling.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx b/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx index 05af6ab6..74d8aa5a 100644 --- a/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx +++ b/src/components/projects/projectId/labeling/sessionId/sub-components/LabelingSuiteLabeling.tsx @@ -170,7 +170,7 @@ export default function LabelingSuiteLabeling() { attribute: null, }; for (const task of labelingTasks) { - const attributeKey = task.attribute ? task.attribute.id : FULL_RECORD_ID; + const attributeKey = task.targetId || FULL_RECORD_ID; const taskCopy = { ...task }; taskCopy.displayLabels = task.labels.slice(0, settings.labeling.showNLabelButton); lVarsCopy.taskLookup[attributeKey].lookup.push({ @@ -427,7 +427,7 @@ export default function LabelingSuiteLabeling() { if (task.taskType == LabelingTaskTaskType.MULTICLASS_CLASSIFICATION) { addLabelToTask(task.id, labelId); } else { - addLabelToSelection(task.attribute.id, task.id, labelId); + addLabelToSelection(task.targetId, task.id, labelId); } if (settings.labeling.closeLabelBoxAfterLabel) { setActiveTasksFuncRef.current([]); From ad2e54fba9a19954f5f7d3167349050070116373 Mon Sep 17 00:00:00 2001 From: LennartSchmidtKern Date: Mon, 13 Jan 2025 15:04:41 +0100 Subject: [PATCH 36/36] javascript --- submodules/javascript-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/javascript-functions b/submodules/javascript-functions index e2e09c5f..12bf29c1 160000 --- a/submodules/javascript-functions +++ b/submodules/javascript-functions @@ -1 +1 @@ -Subproject commit e2e09c5fe580120dacd7958603c98dd886ea274d +Subproject commit 12bf29c1966fe1bfeb716d4e6f4dc9112e7c1ee4