diff --git a/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx b/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx index 036a8cf6..c018f801 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsHeader.tsx @@ -44,7 +44,6 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) { const [currentWeakSupervisionRun, setCurrentWeakSupervisionRun] = useState(null); const [loadingIconWS, setLoadingIconWS] = useState(false); - useEffect(() => { if (!heuristics) return; setAreHeuristicsSelected(checkSelectedHeuristics(heuristics, false)); @@ -201,7 +200,8 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) { {areValidHeuristicsSelected ? ( diff --git a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx index d678e55e..60d9ffb2 100644 --- a/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx +++ b/src/components/projects/projectId/heuristics/HeuristicsOverview.tsx @@ -20,9 +20,10 @@ import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/use import { getAllComments } from "@/src/services/base/comment"; import { getAttributes } from "@/src/services/base/attribute"; import { getInformationSourcesOverviewData } from "@/src/services/base/heuristic"; -import { getLabelingTasksByProjectId } from "@/src/services/base/project"; +import { getLabelingTasksByProjectId, getProjectTokenization } from "@/src/services/base/project"; import { getEmbeddings } from "@/src/services/base/embedding"; import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants"; +import { timer } from "rxjs"; export function HeuristicsOverview() { const dispatch = useDispatch(); @@ -33,12 +34,15 @@ export function HeuristicsOverview() { const attributes = useSelector(selectUsableNonTextAttributes); const allUsers = useSelector(selectAllUsers); const [filteredList, setFilteredList] = useState([]); + const [tokenizationProgress, setTokenizationProgress] = useState(null); + useEffect(() => { if (!projectId || !embeddings || !attributes) return; refetchLabelingTasksAndProcess(); refetchHeuristicsAndProcess(); refetchEmbeddingsAndProcess(); + checkProjectTokenization(); if (attributes.length == 0) { getAttributes(projectId, ['ALL'], (res) => { dispatch(setAllAttributes(res.data['attributesByProjectId'])); @@ -91,6 +95,12 @@ export function HeuristicsOverview() { }); } + function checkProjectTokenization() { + getProjectTokenization(projectId, (res) => { + setTokenizationProgress(res.data['projectTokenization']?.progress); + }); + } + const handleWebsocketNotification = useCallback((msgParts: string[]) => { if (['labeling_task_updated', 'labeling_task_created'].includes(msgParts[1])) { refetchLabelingTasksAndProcess(); @@ -102,6 +112,17 @@ export function HeuristicsOverview() { } else if (msgParts[1] == 'embedding_deleted' || (msgParts[1] == 'embedding' && msgParts[3] == 'state')) { refetchEmbeddingsAndProcess(); } + + if (msgParts[1] == 'tokenization') { + if (msgParts[3] == 'progress') { + setTokenizationProgress(Number(msgParts[4])); + } else if (msgParts[3] == 'state') { + if (msgParts[4] == 'IN_PROGRESS') setTokenizationProgress(0); + else if (msgParts[4] == 'FINISHED') { + timer(5000).subscribe(() => checkProjectTokenization()); + } + } + } }, [projectId]); const orgId = useSelector(selectOrganizationId); @@ -109,7 +130,7 @@ export function HeuristicsOverview() { return (projectId &&
- setFilteredList(labelingTask != null ? heuristics.filter((heuristic) => heuristic.labelingTaskId === labelingTask.id) : heuristics)} /> {heuristics && heuristics.length == 0 ? ( diff --git a/src/components/shared/bricks-integrator/PageSearch.tsx b/src/components/shared/bricks-integrator/PageSearch.tsx index 79662928..69c5e821 100644 --- a/src/components/shared/bricks-integrator/PageSearch.tsx +++ b/src/components/shared/bricks-integrator/PageSearch.tsx @@ -1,14 +1,11 @@ import { selectBricksIntegrator, setBricksIntegrator } from "@/src/reduxStore/states/general"; import { IntegratorPage, PageSearchProps } from "@/src/types/shared/bricks-integrator"; -import { IconAlertCircle, IconBrandGithub, IconChevronsDown, IconLoader, IconSearch } from "@tabler/icons-react"; +import { IconAlertCircle, IconBrandGithub, IconChevronsDown, IconSearch } from "@tabler/icons-react"; import { useDispatch, useSelector } from "react-redux" import LoadingIcon from "../loading/LoadingIcon"; import { useState } from "react"; import style from '@/src/styles/shared/bricks-integrator.module.css'; import { jsonCopy } from "@/submodules/javascript-functions/general"; -import * as TablerIcons from '@tabler/icons-react'; -import { getIconName } from "@/src/util/shared/bricks-integrator-helper"; - export default function PageSearch(props: PageSearchProps) { const dispatch = useDispatch(); @@ -72,7 +69,6 @@ export default function PageSearch(props: PageSearchProps) { {config.search.results.map((result: any, i: number) => (
  • props.selectSearchResult(result.id)} className={`text-left group flex flex-row items-center cursor-pointer select-none rounded-xl p-3 hover:bg-gray-100 relative ${!result.searchVisible || !result.groupVisible ? 'hidden' : ''}`} id="option-1" role="option"> -

    {result.attributes.name}

    {result.attributes.description}

    @@ -83,27 +79,3 @@ export default function PageSearch(props: PageSearchProps) {
    } ) } - -function SVGIcon({ icon, size, strokeWidth, color }) { - const Icon = TablerIcons['Icon' + icon]; - if (Icon) { - return ( - - ) - } else { - const Icon = TablerIcons['Icon' + getIconName(icon)]; - if (Icon) { - return ( - - ) - } - } -} \ No newline at end of file diff --git a/src/components/shared/export/ExportRecordsModal.tsx b/src/components/shared/export/ExportRecordsModal.tsx index 1260d7cc..f596c1ce 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.data['prepareRecordExport'] != "") { + if (!res.data) { ExportHelper.error.push("Something went wrong in the backend:"); - ExportHelper.error.push(res.data['prepareRecordExport']); + ExportHelper.error.push(res.error); setPrepareErrors(ExportHelper.error); } setDownloadState(DownloadState.DOWNLOAD); diff --git a/src/components/shared/sidebar/Sidebar.tsx b/src/components/shared/sidebar/Sidebar.tsx index 7308f6b3..6275c543 100644 --- a/src/components/shared/sidebar/Sidebar.tsx +++ b/src/components/shared/sidebar/Sidebar.tsx @@ -213,7 +213,7 @@ export default function Sidebar() {
    - v1.16.0 + v1.17.0 {hasUpdates && } diff --git a/src/types/components/projects/projectId/heuristics/heuristics.ts b/src/types/components/projects/projectId/heuristics/heuristics.ts index 31889bff..acdb3e35 100644 --- a/src/types/components/projects/projectId/heuristics/heuristics.ts +++ b/src/types/components/projects/projectId/heuristics/heuristics.ts @@ -68,6 +68,7 @@ export type Color = { export type HeuristicsHeaderProps = { filterList: (labelingTask: LabelingTask) => void; refetch: () => void; + tokenizationProgress: number; } export type CurrentWeakSupervision = { diff --git a/submodules/react-components b/submodules/react-components index 42f1af8d..5c230212 160000 --- a/submodules/react-components +++ b/submodules/react-components @@ -1 +1 @@ -Subproject commit 42f1af8d2534bd1c82094fce4cc70d193344cfb8 +Subproject commit 5c230212f0a872dd03335e786512f824a4af61d3