Skip to content

Commit 842b4bb

Browse files
lumburovskalinaanmarhindi
andauthored
Admin messages extension (#29)
* remove query references * remove mut references * remove apollo client * remove references * add check for currentWeakSupervisionRun * remove references * added Observable * fixes huddle data race * log check * msg change * removed msg change * udpate ref * Websockets logic moved to submodules * Updated logic for websocket and imports * build fix * Admin messages as part of the submodules * Submodules updated * Added display date as scheduled date * Submodule update * PR comments * PR comments * PR comments * Submodules merged --------- Co-authored-by: anmarhindi <[email protected]>
1 parent cca814c commit 842b4bb

File tree

64 files changed

+120
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+120
-493
lines changed

src/components/models-download/ModelsDownload.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import LoadingIcon from "../shared/loading/LoadingIcon";
99
import { openModal, setModalStates } from "@/src/reduxStore/states/modal";
1010
import { ModalEnum } from "@/src/types/shared/modal";
1111
import { selectIsAdmin, selectIsManaged } from "@/src/reduxStore/states/general";
12-
import { CurrentPage } from "@/src/types/shared/general";
1312
import { timer } from "rxjs";
1413
import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants";
1514
import AddModelDownloadModal from "./AddModelDownloadModal";
1615
import DeleteModelDownloadModal from "./DeleteModelDownloadModal";
17-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
16+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
1817
import { getModelProviderInfo } from "@/src/services/base/project";
18+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
1919

2020
export default function ModelsDownload() {
2121
const router = useRouter();
@@ -44,7 +44,7 @@ export default function ModelsDownload() {
4444
}
4545
}, []);
4646

47-
useWebsocket(CurrentPage.MODELS_DOWNLOAD, handleWebsocketNotification);
47+
useWebsocket(Application.REFINERY, CurrentPage.MODELS_DOWNLOAD, handleWebsocketNotification);
4848

4949
return (<div className="p-4 bg-gray-100 flex-1 flex flex-col h-[calc(100vh-4rem)] overflow-y-auto">
5050
<div className="flex flex-row items-center">

src/components/projects/ButtonsContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { useCallback, useEffect, useState } from "react";
99
import { useDispatch, useSelector } from "react-redux"
1010
import ModalUpload from "../shared/upload/ModalUpload";
1111
import SampleProjectsDropdown from "./SampleProjectsDropdown";
12-
import { CurrentPage, CurrentPageSubKey } from "@/src/types/shared/general";
13-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
12+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
13+
import { Application, CurrentPage, CurrentPageSubKey } from "@/submodules/react-components/hooks/web-socket/constants";
1414

1515
const BASE_OPTIONS = { reloadOnFinish: false, deleteProjectOnFail: true, closeModalOnClick: false, isModal: true, navigateToProject: true, showBadPasswordMsg: null };
1616

@@ -33,7 +33,7 @@ export default function ButtonsContainer() {
3333
}
3434
}, []);
3535

36-
useWebsocket(CurrentPage.PROJECTS, handleWebsocketNotification, null, CurrentPageSubKey.BUTTONS_CONTAINER);
36+
useWebsocket(Application.REFINERY, CurrentPage.PROJECTS, handleWebsocketNotification, null, CurrentPageSubKey.BUTTONS_CONTAINER);
3737

3838
return (
3939
user && user.role === UserRole.ENGINEER ? (<div>

src/components/projects/ProjectsList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { selectInactiveOrganization, selectIsDemo, selectIsManaged, selectUser, setComments } from "@/src/reduxStore/states/general"
22
import { selectAllProjects, setAllProjects } from "@/src/reduxStore/states/project";
33
import { Project, ProjectStatistics } from "@/src/types/components/projects/projects-list";
4-
import { CurrentPage } from "@/src/types/shared/general";
54
import { percentRoundString } from "@/submodules/javascript-functions/general";
65
import { useCallback, useEffect, useState } from "react";
76
import { useDispatch, useSelector } from "react-redux";
@@ -14,9 +13,10 @@ import { setAllAttributes, setAllEmbeddings, setLabelingTasksAll } from "@/src/r
1413
import { setOverviewFilters } from "@/src/reduxStore/states/tmp";
1514
import { setDataSlices, setFullSearchStore, setSearchGroupsStore } from "@/src/reduxStore/states/pages/data-browser";
1615
import { SearchGroup } from "@/submodules/javascript-functions/enums/enums";
17-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
16+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
1817
import { getAllProjects } from "@/src/services/base/project";
1918
import { addUserToOrganization, createOrganization, getCanCreateLocalOrg, getOverviewStats } from "@/src/services/base/organization";
19+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
2020

2121
export default function ProjectsList() {
2222
const dispatch = useDispatch();
@@ -101,7 +101,7 @@ export default function ProjectsList() {
101101
}
102102
}, []);
103103

104-
useWebsocket(CurrentPage.PROJECTS, handleWebsocketNotification);
104+
useWebsocket(Application.REFINERY, CurrentPage.PROJECTS, handleWebsocketNotification);
105105

106106
return (
107107
<div>

src/components/projects/projectId/admin/ProjectAdmin.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { useCallback, useEffect, useState } from "react";
1010
import { useDispatch, useSelector } from "react-redux";
1111
import NewPersonalToken from "./NewPersonalTokenModal";
1212
import DeletePersonalToken from "./DeletePersonalTokenModal";
13-
import { CurrentPage } from "@/src/types/shared/general";
1413
import { useRouter } from "next/router";
1514
import { selectIsAdmin } from "@/src/reduxStore/states/general";
16-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
15+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
1716
import { getAccessTokens } from "@/src/services/base/project";
17+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
1818

1919
export default function ProjectAdmin() {
2020
const router = useRouter();
@@ -53,7 +53,7 @@ export default function ProjectAdmin() {
5353
}
5454
}, [accessTokens]);
5555

56-
useWebsocket(CurrentPage.ADMIN_PAGE, handleWebsocketNotification, projectId);
56+
useWebsocket(Application.REFINERY, CurrentPage.ADMIN_PAGE, handleWebsocketNotification, projectId);
5757

5858
return (<>
5959
{accessTokens && <div className="p-4 bg-gray-100 h-full overflow-y-auto flex-1 flex flex-col">

src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { selectAllLookupLists, setAllLookupLists } from "@/src/reduxStore/states
33
import { selectAttributes, selectVisibleAttributeAC, setAllAttributes, setLabelingTasksAll, updateAttributeById } from "@/src/reduxStore/states/pages/settings";
44
import { selectProjectId } from "@/src/reduxStore/states/project"
55
import { Attribute, AttributeState } from "@/src/types/components/projects/projectId/settings/data-schema";
6-
import { CurrentPage, DataTypeEnum } from "@/src/types/shared/general";
6+
import { DataTypeEnum } from "@/src/types/shared/general";
77
import { postProcessCurrentAttribute } from "@/src/util/components/projects/projectId/settings/attribute-calculation-helper";
88
import { ATTRIBUTES_VISIBILITY_STATES, DATA_TYPES, getTooltipVisibilityState } from "@/src/util/components/projects/projectId/settings/data-schema-helper";
99
import { copyToClipboard } from "@/submodules/javascript-functions/general";
@@ -27,13 +27,14 @@ import { CommentType } from "@/src/types/shared/comments";
2727
import BricksIntegrator from "@/src/components/shared/bricks-integrator/BricksIntegrator";
2828
import { AttributeCodeLookup } from "@/src/util/classes/attribute-calculation";
2929
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
30-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
30+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
3131
import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
3232
import { getAllComments } from "@/src/services/base/comment";
3333
import { getAttributes } from "@/src/services/base/attribute";
3434
import { getLookupListsByProjectId } from "@/src/services/base/lookup-lists";
3535
import { getLabelingTasksByProjectId, getProjectTokenization } from "@/src/services/base/project";
3636
import { getAttributeByAttributeId, updateAttribute } from "@/src/services/base/project-setting";
37+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
3738

3839
const EDITOR_OPTIONS = { theme: 'vs-light', language: 'python', readOnly: false };
3940

@@ -284,7 +285,7 @@ export default function AttributeCalculation() {
284285
}
285286
}, [projectId, currentAttribute]);
286287

287-
useWebsocket(CurrentPage.ATTRIBUTE_CALCULATION, handleWebsocketNotification, projectId);
288+
useWebsocket(Application.REFINERY, CurrentPage.ATTRIBUTE_CALCULATION, handleWebsocketNotification, projectId);
288289

289290
return (projectId && <div className={`bg-white p-4 overflow-y-auto min-h-full h-[calc(100vh-4rem)]`} onScroll={(e: any) => onScrollEvent(e)}>
290291
{currentAttribute && <div>

src/components/projects/projectId/data-browser/DataBrowser.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/
99
import { selectAllUsers, selectUser, setComments } from "@/src/reduxStore/states/general";
1010
import DataBrowserRecords from "./DataBrowserRecords";
1111
import { postProcessingEmbeddings } from "@/src/util/components/projects/projectId/settings/embeddings-helper";
12-
import { CurrentPage } from "@/src/types/shared/general";
1312
import { CommentType } from "@/src/types/shared/comments";
1413
import { CommentDataManager } from "@/src/util/classes/comments";
15-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
14+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
1615
import { getAllComments } from "@/src/services/base/comment";
1716
import { getAttributes } from "@/src/services/base/attribute";
1817
import { getDataSlices, getUniqueValuesByAttributes } from "@/src/services/base/dataSlices";
@@ -22,6 +21,7 @@ import { getAllUsersWithRecordCount } from "@/src/services/base/organization";
2221
import { getEmbeddings } from "@/src/services/base/embedding";
2322
import { parseFilterToExtended } from "@/src/util/components/projects/projectId/data-browser/filter-parser-helper";
2423
import { SearchGroup, Slice } from "@/submodules/javascript-functions/enums/enums";
24+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
2525

2626
const SEARCH_REQUEST = { offset: 0, limit: 20 };
2727

@@ -175,7 +175,7 @@ export default function DataBrowser() {
175175
}
176176
}, [projectId]);
177177

178-
useWebsocket(CurrentPage.DATA_BROWSER, handleWebsocketNotification, projectId);
178+
useWebsocket(Application.REFINERY, CurrentPage.DATA_BROWSER, handleWebsocketNotification, projectId);
179179

180180
return (<>
181181
{projectId && <div className="flex flex-row h-full">

src/components/projects/projectId/edit-records/EditRecords.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ import { selectSessionData } from "@/src/reduxStore/states/tmp";
55
import { Fragment, useCallback, useEffect, useState } from "react";
66
import { buildAccessKey, createDefaultEditRecordComponentData } from "@/src/util/components/projects/projectId/edit-records-helper";
77
import style from '@/src/styles/components/projects/projectId/edit-records.module.css';
8-
import { CurrentPage, DataTypeEnum } from "@/src/types/shared/general";
8+
import { DataTypeEnum } from "@/src/types/shared/general";
99
import { IconAlertCircle, IconAlertTriangle, IconAlertTriangleFilled, IconBallpen, IconBallpenOff } from "@tabler/icons-react";
1010
import { Tooltip } from "@nextui-org/react";
1111
import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants";
1212
import EditField from "./EditField";
1313
import { useRouter } from "next/router";
1414
import { ModalEnum } from "@/src/types/shared/modal";
1515
import { openModal } from "@/src/reduxStore/states/modal";
16-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
16+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
1717
import { scrollElementIntoView } from "@/submodules/javascript-functions/scrollHelper";
18+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
1819

1920
export default function EditRecords() {
2021
const dispatch = useDispatch();
@@ -71,7 +72,7 @@ export default function EditRecords() {
7172
setAlertLastVisible(Date.now());
7273
}, [alertLastVisible]);
7374

74-
useWebsocket(CurrentPage.EDIT_RECORDS, handleWebsocketNotification, projectId);
75+
useWebsocket(Application.REFINERY, CurrentPage.EDIT_RECORDS, handleWebsocketNotification, projectId);
7576

7677
return (<>{projectId && <div className="bg-white flex flex-col min-h-full h-[calc(100vh-4rem)]">
7778
<NavBarTopEditRecords erdData={erdData} setErdData={(erdData) => setErdData(erdData)} />

src/components/projects/projectId/heuristics/HeuristicsHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { selectProjectId } from '@/src/reduxStore/states/project';
77
import style from '@/src/styles/components/projects/projectId/heuristics/heuristics.module.css';
88
import { Heuristic, HeuristicsHeaderProps } from '@/src/types/components/projects/projectId/heuristics/heuristics';
99
import { LabelingTask } from '@/src/types/components/projects/projectId/settings/labeling-tasks';
10-
import { CurrentPage } from '@/src/types/shared/general';
1110
import { ModalEnum } from '@/src/types/shared/modal';
1211
import { Status } from '@/src/types/shared/statuses';
1312
import { ACTIONS_DROPDOWN_OPTIONS, NEW_HEURISTICS, checkSelectedHeuristics, postProcessCurrentWeakSupervisionRun } from '@/src/util/components/projects/projectId/heuristics/heuristics-helper';
@@ -21,10 +20,11 @@ import { useDispatch, useSelector } from 'react-redux';
2120
import LastWeakSupervisionModal from './modals/LastWeakSupervisionModal';
2221
import DeleteHeuristicsModal from './DeleteHeuristicsModal';
2322
import Dropdown2 from '@/submodules/react-components/components/Dropdown2';
24-
import { useWebsocket } from '@/src/services/base/web-sockets/useWebsocket';
23+
import { useWebsocket } from '@/submodules/react-components/hooks/web-socket/useWebsocket';
2524
import { createTask, getWeakSupervisionRun, setAllHeuristics } from "@/src/services/base/heuristic";
2625
import { initZeroShot } from "@/src/services/base/zero-shot";
2726
import { initWeakSupervision } from "@/src/services/base/weak-supervision";
27+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
2828

2929

3030
export default function HeuristicsHeader(props: HeuristicsHeaderProps) {
@@ -155,7 +155,7 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) {
155155
else if (msgParts[1] == 'weak_supervision_finished') setLoadingIconWS(false);
156156
}, []);
157157

158-
useWebsocket(CurrentPage.HEURISTICS, handleWebsocketNotification, projectId);
158+
useWebsocket(Application.REFINERY, CurrentPage.HEURISTICS, handleWebsocketNotification, projectId);
159159

160160
return (
161161
<div className="flex-shrink-0 block xl:flex justify-between items-center">

src/components/projects/projectId/heuristics/HeuristicsOverview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useDispatch, useSelector } from "react-redux";
33
import style from '@/src/styles/components/projects/projectId/heuristics/heuristics.module.css';
44
import { useCallback, useEffect, useState } from "react";
55
import { selectEmbeddings, selectUsableNonTextAttributes, setAllAttributes, setAllEmbeddings, setLabelingTasksAll } from "@/src/reduxStore/states/pages/settings";
6-
import { CurrentPage } from "@/src/types/shared/general";
76
import { LabelingTask } from "@/src/types/components/projects/projectId/settings/labeling-tasks";
87
import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
98
import { postProcessHeuristics } from "@/src/util/components/projects/projectId/heuristics/heuristics-helper";
@@ -19,12 +18,13 @@ import { CommentType } from "@/src/types/shared/comments";
1918
import { CommentDataManager } from "@/src/util/classes/comments";
2019
import { selectAllUsers, setBricksIntegrator, setComments } from "@/src/reduxStore/states/general";
2120
import { getEmptyBricksIntegratorConfig } from "@/src/util/shared/bricks-integrator-helper";
22-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
21+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
2322
import { getAllComments } from "@/src/services/base/comment";
2423
import { getAttributes } from "@/src/services/base/attribute";
2524
import { getInformationSourcesOverviewData } from "@/src/services/base/heuristic";
2625
import { getLabelingTasksByProjectId } from "@/src/services/base/project";
2726
import { getEmbeddings } from "@/src/services/base/embedding";
27+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
2828

2929
export function HeuristicsOverview() {
3030
const dispatch = useDispatch();
@@ -106,7 +106,7 @@ export function HeuristicsOverview() {
106106
}
107107
}, [projectId]);
108108

109-
useWebsocket(CurrentPage.HEURISTICS, handleWebsocketNotification, projectId);
109+
useWebsocket(Application.REFINERY, CurrentPage.HEURISTICS, handleWebsocketNotification, projectId);
110110

111111
return (projectId && <div className="p-4 bg-gray-100 h-full flex-1 flex flex-col">
112112
<div className="w-full h-full -mr-4">

src/components/projects/projectId/heuristics/heuristicId/active-learning/ActiveLearning.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import HeuristicStatistics from "../shared/HeuristicStatistics";
2121
import DangerZone from "@/src/components/shared/danger-zone/DangerZone";
2222
import { DangerZoneEnum } from "@/src/types/shared/danger-zone";
2323
import { getPythonClassName, getPythonClassRegExMatch } from "@/submodules/javascript-functions/python-functions-parser";
24-
import { CurrentPage } from "@/src/types/shared/general";
2524
import { selectAllUsers, setBricksIntegrator, setLabelsBricksIntegrator, setComments } from "@/src/reduxStore/states/general";
2625
import { CommentType } from "@/src/types/shared/comments";
2726
import { CommentDataManager } from "@/src/util/classes/comments";
@@ -30,11 +29,12 @@ import { InformationSourceCodeLookup, InformationSourceExamples } from "@/src/ut
3029
import { getInformationSourceTemplate } from "@/src/util/components/projects/projectId/heuristics/heuristics-helper";
3130
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
3231
import LoadingIcon from "@/src/components/shared/loading/LoadingIcon";
33-
import { useWebsocket } from "@/src/services/base/web-sockets/useWebsocket";
32+
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
3433
import { getAllComments } from "@/src/services/base/comment";
3534
import { getLabelingTasksByProjectId } from "@/src/services/base/project";
3635
import { getHeuristicByHeuristicId, getPayloadByPayloadId, updateHeuristicPost } from "@/src/services/base/heuristic";
3736
import { getEmbeddings } from "@/src/services/base/embedding";
37+
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
3838

3939
export default function ActiveLearning() {
4040
const dispatch = useDispatch();
@@ -204,7 +204,7 @@ export default function ActiveLearning() {
204204
});
205205
}
206206

207-
useWebsocket(CurrentPage.ACTIVE_LEARNING, handleWebsocketNotification, projectId);
207+
useWebsocket(Application.REFINERY, CurrentPage.ACTIVE_LEARNING, handleWebsocketNotification, projectId);
208208

209209
return (
210210
<HeuristicsLayout updateSourceCode={(code) => updateSourceCodeToDisplay(code)}>

0 commit comments

Comments
 (0)