Skip to content

Commit 18ee0f6

Browse files
authored
Merge pull request #45 from code-kern-ai/release-v-1-17-0
v1.17.0
2 parents e53e2df + 7e53045 commit 18ee0f6

File tree

7 files changed

+31
-37
lines changed

7 files changed

+31
-37
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) {
4444
const [currentWeakSupervisionRun, setCurrentWeakSupervisionRun] = useState(null);
4545
const [loadingIconWS, setLoadingIconWS] = useState(false);
4646

47-
4847
useEffect(() => {
4948
if (!heuristics) return;
5049
setAreHeuristicsSelected(checkSelectedHeuristics(heuristics, false));
@@ -201,7 +200,8 @@ export default function HeuristicsHeader(props: HeuristicsHeaderProps) {
201200
{areValidHeuristicsSelected ? (
202201
<Tooltip content={TOOLTIPS_DICT.HEURISTICS.WEAK_SUPERVISION} color="invert" placement="top">
203202
<button onClick={startWeakSupervision}
204-
className="bg-indigo-700 flex items-center text-white text-xs font-semibold mr-3 px-4 py-2 rounded-md border hover:bg-indigo-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
203+
disabled={props.tokenizationProgress < 1}
204+
className="bg-indigo-700 flex items-center text-white text-xs font-semibold mr-3 px-4 py-2 rounded-md border hover:bg-indigo-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed">
205205
Weak supervision
206206
</button>
207207
</Tooltip>

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

+23-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/use
2020
import { getAllComments } from "@/src/services/base/comment";
2121
import { getAttributes } from "@/src/services/base/attribute";
2222
import { getInformationSourcesOverviewData } from "@/src/services/base/heuristic";
23-
import { getLabelingTasksByProjectId } from "@/src/services/base/project";
23+
import { getLabelingTasksByProjectId, getProjectTokenization } from "@/src/services/base/project";
2424
import { getEmbeddings } from "@/src/services/base/embedding";
2525
import { Application, CurrentPage } from "@/submodules/react-components/hooks/web-socket/constants";
26+
import { timer } from "rxjs";
2627

2728
export function HeuristicsOverview() {
2829
const dispatch = useDispatch();
@@ -33,12 +34,15 @@ export function HeuristicsOverview() {
3334
const attributes = useSelector(selectUsableNonTextAttributes);
3435
const allUsers = useSelector(selectAllUsers);
3536
const [filteredList, setFilteredList] = useState([]);
37+
const [tokenizationProgress, setTokenizationProgress] = useState(null);
38+
3639

3740
useEffect(() => {
3841
if (!projectId || !embeddings || !attributes) return;
3942
refetchLabelingTasksAndProcess();
4043
refetchHeuristicsAndProcess();
4144
refetchEmbeddingsAndProcess();
45+
checkProjectTokenization();
4246
if (attributes.length == 0) {
4347
getAttributes(projectId, ['ALL'], (res) => {
4448
dispatch(setAllAttributes(res.data['attributesByProjectId']));
@@ -91,6 +95,12 @@ export function HeuristicsOverview() {
9195
});
9296
}
9397

98+
function checkProjectTokenization() {
99+
getProjectTokenization(projectId, (res) => {
100+
setTokenizationProgress(res.data['projectTokenization']?.progress);
101+
});
102+
}
103+
94104
const handleWebsocketNotification = useCallback((msgParts: string[]) => {
95105
if (['labeling_task_updated', 'labeling_task_created'].includes(msgParts[1])) {
96106
refetchLabelingTasksAndProcess();
@@ -102,14 +112,25 @@ export function HeuristicsOverview() {
102112
} else if (msgParts[1] == 'embedding_deleted' || (msgParts[1] == 'embedding' && msgParts[3] == 'state')) {
103113
refetchEmbeddingsAndProcess();
104114
}
115+
116+
if (msgParts[1] == 'tokenization') {
117+
if (msgParts[3] == 'progress') {
118+
setTokenizationProgress(Number(msgParts[4]));
119+
} else if (msgParts[3] == 'state') {
120+
if (msgParts[4] == 'IN_PROGRESS') setTokenizationProgress(0);
121+
else if (msgParts[4] == 'FINISHED') {
122+
timer(5000).subscribe(() => checkProjectTokenization());
123+
}
124+
}
125+
}
105126
}, [projectId]);
106127

107128
const orgId = useSelector(selectOrganizationId);
108129
useWebsocket(orgId, Application.REFINERY, CurrentPage.HEURISTICS, handleWebsocketNotification, projectId);
109130

110131
return (projectId && <div className="p-4 bg-gray-100 h-full flex-1 flex flex-col">
111132
<div className="w-full h-full -mr-4">
112-
<HeuristicsHeader refetch={refetchHeuristicsAndProcess}
133+
<HeuristicsHeader refetch={refetchHeuristicsAndProcess} tokenizationProgress={tokenizationProgress}
113134
filterList={(labelingTask: LabelingTask) => setFilteredList(labelingTask != null ? heuristics.filter((heuristic) => heuristic.labelingTaskId === labelingTask.id) : heuristics)} />
114135

115136
{heuristics && heuristics.length == 0 ? (

src/components/shared/bricks-integrator/PageSearch.tsx

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import { selectBricksIntegrator, setBricksIntegrator } from "@/src/reduxStore/states/general";
22
import { IntegratorPage, PageSearchProps } from "@/src/types/shared/bricks-integrator";
3-
import { IconAlertCircle, IconBrandGithub, IconChevronsDown, IconLoader, IconSearch } from "@tabler/icons-react";
3+
import { IconAlertCircle, IconBrandGithub, IconChevronsDown, IconSearch } from "@tabler/icons-react";
44
import { useDispatch, useSelector } from "react-redux"
55
import LoadingIcon from "../loading/LoadingIcon";
66
import { useState } from "react";
77
import style from '@/src/styles/shared/bricks-integrator.module.css';
88
import { jsonCopy } from "@/submodules/javascript-functions/general";
9-
import * as TablerIcons from '@tabler/icons-react';
10-
import { getIconName } from "@/src/util/shared/bricks-integrator-helper";
11-
129
export default function PageSearch(props: PageSearchProps) {
1310
const dispatch = useDispatch();
1411

@@ -72,7 +69,6 @@ export default function PageSearch(props: PageSearchProps) {
7269
{config.search.results.map((result: any, i: number) => (
7370
<li key={result.id} onClick={() => props.selectSearchResult(result.id)}
7471
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">
75-
<SVGIcon icon={result.attributes.tablerIcon} size={24} strokeWidth={2} color={"black"} />
7672
<div className="ml-2 flex-auto">
7773
<p className="text-sm font-semibold text-gray-700">{result.attributes.name}</p>
7874
<p className="text-sm text-gray-500">{result.attributes.description}</p>
@@ -83,27 +79,3 @@ export default function PageSearch(props: PageSearchProps) {
8379
</div>}
8480
</>)
8581
}
86-
87-
function SVGIcon({ icon, size, strokeWidth, color }) {
88-
const Icon = TablerIcons['Icon' + icon];
89-
if (Icon) {
90-
return (
91-
<Icon
92-
size={size}
93-
strokeWidth={strokeWidth}
94-
color={color}
95-
/>
96-
)
97-
} else {
98-
const Icon = TablerIcons['Icon' + getIconName(icon)];
99-
if (Icon) {
100-
return (
101-
<Icon
102-
size={size}
103-
strokeWidth={strokeWidth}
104-
color={color}
105-
/>
106-
)
107-
}
108-
}
109-
}

src/components/shared/export/ExportRecordsModal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ export default function ExportRecordsModal(props: ExportProps) {
213213
let keyToSend = key;
214214
if (!keyToSend) keyToSend = null;
215215
prepareRecordExport(projectId, { exportOptions: jsonString, key: keyToSend }, (res) => {
216-
if (res.data['prepareRecordExport'] != "") {
216+
if (!res.data) {
217217
ExportHelper.error.push("Something went wrong in the backend:");
218-
ExportHelper.error.push(res.data['prepareRecordExport']);
218+
ExportHelper.error.push(res.error);
219219
setPrepareErrors(ExportHelper.error);
220220
}
221221
setDownloadState(DownloadState.DOWNLOAD);

src/components/shared/sidebar/Sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export default function Sidebar() {
213213
<Tooltip placement="right" trigger="hover" color="invert" content={TOOLTIPS_DICT.SIDEBAR.VERSION_OVERVIEW}>
214214
<div onClick={requestVersionOverview} id="refineryVersion"
215215
className="z-50 tooltip tooltip-right cursor-pointer select-none text-white flex items-center mr-1">
216-
v1.16.0
216+
v1.17.0
217217
{hasUpdates && <Tooltip placement="right" trigger="hover" color="invert" content={TOOLTIPS_DICT.SIDEBAR.NEWER_VERSION_AVAILABLE} >
218218
<IconAlertCircle className="h-5 w-5 text-yellow-700" />
219219
</Tooltip>}

src/types/components/projects/projectId/heuristics/heuristics.ts

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export type Color = {
6868
export type HeuristicsHeaderProps = {
6969
filterList: (labelingTask: LabelingTask) => void;
7070
refetch: () => void;
71+
tokenizationProgress: number;
7172
}
7273

7374
export type CurrentWeakSupervision = {

0 commit comments

Comments
 (0)