diff --git a/src/components/Filters/types/String.js b/src/components/Filters/types/String.js index 00c93fc2..02a25365 100644 --- a/src/components/Filters/types/String.js +++ b/src/components/Filters/types/String.js @@ -1,6 +1,7 @@ import { observer } from "mobx-react"; import React from "react"; import { FilterInput } from "../FilterInput"; +import { VariantSelect } from "./List"; const BaseInput = observer(({ value, onChange, placeholder }) => { return ( @@ -45,4 +46,10 @@ export const StringFilter = [ valueType: "single", input: (props) => , }, + { + key: "similar_to", + label: "similar to", + valueType: "list", + input: (props) => , + }, ]; diff --git a/src/components/Filters/types/Utility.js b/src/components/Filters/types/Utility.js index c2db1213..d8445309 100644 --- a/src/components/Filters/types/Utility.js +++ b/src/components/Filters/types/Utility.js @@ -1,5 +1,6 @@ const EXCLUDED_FILTER_OPERATIONS = { "DE": ["contains", "not_contains", "regex"], + "dm": ["similar_to"], }; export const allowedFilterOperations = (operationsList, context = "") => { diff --git a/src/stores/Tabs/tab.js b/src/stores/Tabs/tab.js index b1b6298d..8b7924c1 100644 --- a/src/stores/Tabs/tab.js +++ b/src/stores/Tabs/tab.js @@ -15,7 +15,7 @@ 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 { StringOrNumberID } from "../types"; +import { CustomJSON, StringOrNumberID } from "../types"; export const Tab = types .model("View", { @@ -50,7 +50,7 @@ export const Tab = types locked: false, editable: true, deletable: true, - search_text: types.optional(types.maybeNull(types.string), null), + semantic_search: types.optional(types.array(CustomJSON), []), }) .volatile(() => { const defaultWidth = getComputedStyle(document.body).getPropertyValue("--menu-sidebar-width").replace("px", "").trim(); @@ -214,7 +214,7 @@ export const Tab = types columnsWidth: self.columnsWidth.toPOJO(), columnsDisplayType: self.columnsDisplayType.toPOJO(), gridWidth: self.gridWidth, - search_text: self.search_text, + semantic_search: self.semantic_search?.toJSON() ?? [], }; if (self.saved || apiVersion === 1) { @@ -301,9 +301,9 @@ export const Tab = types self.selected = ids; }, - setSearchText(searchText) { - self.search_text = searchText; - self.save(); + setSemanticSearch(semanticSearchList) { + self.semantic_search = semanticSearchList ?? []; + return self.save(); }, selectAll() {