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

Commit 17e7dcd

Browse files
feat: DIA-99: [FE] Create range slider frontend component and add to Semantic Search (#255)
1 parent 123befd commit 17e7dcd

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/stores/Tabs/tab.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ import { TabHiddenColumns } from "./tab_hidden_columns";
1515
import { TabSelectedItems } from "./tab_selected_items";
1616
import { History } from '../../utils/history';
1717
import { FF_DEV_1470, FF_LOPS_12, isFF } from "../../utils/feature-flags";
18-
import { CustomJSON, StringOrNumberID } from "../types";
18+
import { CustomJSON, StringOrNumberID, ThresholdType } from "../types";
19+
20+
const DEFAULT_THRESHOLD = { min: 0, max: 1 };
1921

2022
export const Tab = types
2123
.model("View", {
@@ -51,6 +53,7 @@ export const Tab = types
5153
editable: true,
5254
deletable: true,
5355
semantic_search: types.optional(types.array(CustomJSON), []),
56+
threshold: types.optional(ThresholdType, DEFAULT_THRESHOLD),
5457
})
5558
.volatile(() => {
5659
const defaultWidth = getComputedStyle(document.body).getPropertyValue("--menu-sidebar-width").replace("px", "").trim();
@@ -215,6 +218,7 @@ export const Tab = types
215218
columnsDisplayType: self.columnsDisplayType.toPOJO(),
216219
gridWidth: self.gridWidth,
217220
semantic_search: self.semantic_search?.toJSON() ?? [],
221+
threshold: self.threshold?.toJSON() ?? DEFAULT_THRESHOLD,
218222
};
219223

220224
if (self.saved || apiVersion === 1) {
@@ -305,6 +309,11 @@ export const Tab = types
305309
self.semantic_search = semanticSearchList ?? [];
306310
return self.save();
307311
},
312+
313+
setSemanticSearchThreshold(min, max) {
314+
self.threshold = { min, max };
315+
return self.save();
316+
},
308317

309318
selectAll() {
310319
self.selected.toggleSelectedAll();

src/stores/types.js

+5
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@ export const HtmlOrReact = types.custom({
5555
getValidationMessage() {
5656
return "is not a valid element";
5757
},
58+
});
59+
60+
export const ThresholdType = types.model("ThresholdType", {
61+
min: types.number,
62+
max: types.number,
5863
});

0 commit comments

Comments
 (0)