Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
refactor: OPTIC-469: fflag_feat_front_lops_12_label_ops_ui_short removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Raul Martin committed Feb 22, 2024
1 parent d93fbbf commit 8432bd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 66 deletions.
60 changes: 17 additions & 43 deletions src/components/DataManager/DataManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { inject, observer } from "mobx-react";
import React from "react";
import { LSPlus } from "../../assets/icons";
import { Block, Elem } from "../../utils/bem";
import { FF_LOPS_12, isFF } from "../../utils/feature-flags";
import { Interface } from "../Common/Interface";
import { Space } from "../Common/Space/Space";
import { Spinner } from "../Common/Spinner";
Expand All @@ -21,27 +20,15 @@ const injector = inject(({ store }) => {
});

const summaryInjector = inject(({ store }) => {
const { project, taskStore, SDK } = store;

if (isFF(FF_LOPS_12) && SDK?.type === 'labelops') {
return {
total: taskStore?.total ?? 0,
coverage: taskStore?.coverage ?? 'N/A',
precision: taskStore?.precision ?? 'N/A',
confidence: taskStore?.confidence ?? 'N/A',
cloudSync: project.target_syncing ?? project.source_syncing ?? false,
SDK,
};
} else {
return {
totalTasks: project?.task_count ?? project?.task_number ?? 0,
totalFoundTasks: taskStore?.total ?? 0,
totalAnnotations: taskStore?.totalAnnotations ?? 0,
totalPredictions: taskStore?.totalPredictions ?? 0,
cloudSync: project.target_syncing ?? project.source_syncing ?? false,
};
}
const { project, taskStore } = store;

return {
totalTasks: project?.task_count ?? project?.task_number ?? 0,
totalFoundTasks: taskStore?.total ?? 0,
totalAnnotations: taskStore?.totalAnnotations ?? 0,
totalPredictions: taskStore?.totalPredictions ?? 0,
cloudSync: project.target_syncing ?? project.source_syncing ?? false,
};
});

const switchInjector = inject(({ store }) => {
Expand All @@ -65,28 +52,15 @@ const ProjectSummary = summaryInjector((props) => {
<Spinner size="small" />
</Space>
)}
{isFF(FF_LOPS_12) && props.SDK?.type === 'labelops' ? (
<span style={{ display: "flex", alignItems: "center", fontSize: 12 }}>
<Space size="compact">
<span>
Total: {props.total}
</span>
<span>GT coverage: {props.coverage}</span>
<span>Precision: {props.precision}</span>
<span>Confidence: {props.confidence}</span>
</Space>
</span>
) : (
<span style={{ display: "flex", alignItems: "center", fontSize: 12 }}>
<Space size="compact">
<span>
Tasks: {props.totalFoundTasks} / {props.totalTasks}
</span>
<span>Annotations: {props.totalAnnotations}</span>
<span>Predictions: {props.totalPredictions}</span>
</Space>
</span>
)}
<span style={{ display: "flex", alignItems: "center", fontSize: 12 }}>
<Space size="compact">
<span>
Tasks: {props.totalFoundTasks} / {props.totalTasks}
</span>
<span>Annotations: {props.totalAnnotations}</span>
<span>Predictions: {props.totalPredictions}</span>
</Space>
</span>
</Space>
);
});
Expand Down
17 changes: 0 additions & 17 deletions src/stores/Tabs/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { TabFilter } from "./tab_filter";
import { TabHiddenColumns } from "./tab_hidden_columns";
import { TabSelectedItems } from "./tab_selected_items";
import { History } from '../../utils/history';
import { FF_LOPS_12, isFF } from "../../utils/feature-flags";
import { CustomJSON, StringOrNumberID, ThresholdType } from "../types";
import { clamp } from "../../utils/helpers";

Expand Down Expand Up @@ -396,8 +395,6 @@ export const Tab = types
}
if (self.virtual) {
yield self.dataStore.reload({ query: self.query, interaction });
} else if (isFF(FF_LOPS_12) && self.root.SDK?.type === 'labelops') {
yield self.dataStore.reload({ query: self.query, interaction });
}

getRoot(self).SDK?.invoke?.("tabReloaded", self);
Expand Down Expand Up @@ -437,20 +434,6 @@ export const Tab = types
localStorage.setItem(`virtual-tab-${projectId}`, JSON.stringify(snapshot));
}

History.navigate({ tab: self.key }, true);
self.reload({ interaction });
} else if (isFF(FF_LOPS_12) && self.root.SDK?.type === 'labelops') {
const snapshot = self.serialize();

self.key = self.parent.snapshotToUrl(snapshot);

const projectId = self.root.SDK.projectId;

// Save the virtual tab of the project to local storage to persist between page navigations
if (projectId) {
localStorage.setItem(`virtual-tab-${projectId}`, JSON.stringify(snapshot));
}

History.navigate({ tab: self.key }, true);
self.reload({ interaction });
} else {
Expand Down
6 changes: 0 additions & 6 deletions src/utils/feature-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ export const FF_DEV_3734 = 'fflag_fix_front_dev_3734_hide_task_counter_131222_sh
*/
export const FF_DEV_4008 = "feat_front_dev_4008_quick_task_open_short";

/**
* Support for LabelOps functionality.
* @link https://app.launchdarkly.com/default/branch/features/fflag_feat_front_lops_12_label_ops_ui_short
*/
export const FF_LOPS_12 = "fflag_feat_front_lops_12_label_ops_ui_short";

/**
* Support for Datasets functionality.
*/
Expand Down

0 comments on commit 8432bd8

Please sign in to comment.