[arvados-workbench2] updated: 2.4.0-365-g55608b93

git repository hosting git at public.arvados.org
Fri Dec 9 21:44:09 UTC 2022


Summary of changes:
 src/models/search-bar.ts                             |  2 ++
 src/services/api/filter-builder.ts                   |  9 +++++++--
 src/store/search-bar/search-bar-actions.ts           | 20 +++++++++++++-------
 src/store/search-bar/search-bar-tree-actions.ts      |  8 +++++---
 src/store/tree-picker/tree-picker-actions.ts         | 14 ++++++++------
 .../form-fields/search-bar-form-fields.tsx           | 20 ++++++--------------
 .../projects-tree-picker/projects-tree-picker.tsx    |  8 ++++----
 7 files changed, 45 insertions(+), 36 deletions(-)

       via  55608b9321ee5d257ccc702d370e42367ac71895 (commit)
       via  ff8a68b46a011c546f15d88281f842bbdee117ae (commit)
      from  d3c1b53b3190a0b61772e0c0c52d0671f11b1047 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 55608b9321ee5d257ccc702d370e42367ac71895
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Dec 9 16:43:50 2022 -0500

    19783: Fix advanced search "limit to project" option
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/models/search-bar.ts b/src/models/search-bar.ts
index b404496f..f9320a26 100644
--- a/src/models/search-bar.ts
+++ b/src/models/search-bar.ts
@@ -3,11 +3,13 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { ResourceKind } from 'models/resource';
+import { GroupResource } from './group';
 
 export type SearchBarAdvancedFormData = {
     type?: ResourceKind;
     cluster?: string;
     projectUuid?: string;
+    projectObject?: GroupResource;
     inTrash: boolean;
     pastVersions: boolean;
     dateFrom: string;
diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index 8b03ddd7..af40e86a 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -89,6 +89,9 @@ export const searchAdvancedData = (data: SearchBarAdvancedFormData) =>
 
 export const setSearchValueFromAdvancedData = (data: SearchBarAdvancedFormData, prevData?: SearchBarAdvancedFormData) =>
     (dispatch: Dispatch, getState: () => RootState) => {
+        if (data.projectObject) {
+            data.projectUuid = data.projectObject.uuid;
+        }
         const searchValue = getState().searchBar.searchValue;
         const value = getQueryFromAdvancedData({
             ...data,
@@ -98,8 +101,11 @@ export const setSearchValueFromAdvancedData = (data: SearchBarAdvancedFormData,
     };
 
 export const setAdvancedDataFromSearchValue = (search: string, vocabulary: Vocabulary) =>
-    async (dispatch: Dispatch) => {
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const data = getAdvancedDataFromQuery(search, vocabulary);
+        if (data.projectUuid) {
+            data.projectObject = await services.projectService.get(data.projectUuid);
+        }
         dispatch<any>(initialize(SEARCH_BAR_ADVANCED_FORM_NAME, data));
         if (data.projectUuid) {
             await dispatch<any>(activateSearchBarProject(data.projectUuid));
@@ -227,11 +233,11 @@ const searchGroups = (searchValue: string, limit: number, useCancel = false) =>
                         recursive: true
                     }, session, cancelTokens[index].token);
                 }));
-    
+
                 cancelTokens = [];
-    
+
                 const items = lists.reduce((items, list) => items.concat(list.items), [] as GroupContentsResource[]);
-    
+
                 if (lists.filter(list => !!(list as any).items).length !== lists.length) {
                     dispatch(searchBarActions.SET_SEARCH_RESULTS([]));
                 } else {
@@ -290,7 +296,7 @@ export const getQueryFromAdvancedData = (data: SearchBarAdvancedFormData, prevDa
         };
         (data.properties || []).forEach(p =>
             fo[`prop-"${p.keyID || p.key}":"${p.valueID || p.value}"`] = `"${p.valueID || p.value}"`
-            );
+        );
         return fo;
     };
 
@@ -308,9 +314,9 @@ export const getQueryFromAdvancedData = (data: SearchBarAdvancedFormData, prevDa
             [`has:"${p.keyID || p.key}"`, `prop-"${p.keyID || p.key}":"${p.valueID || p.value}"`]
         ));
 
-    const modified = getModifiedKeysValues(flatData(data), prevData ? flatData(prevData):{});
+    const modified = getModifiedKeysValues(flatData(data), prevData ? flatData(prevData) : {});
     value = buildQueryFromKeyMap(
-        {searchValue: data.searchValue, ...modified} as SearchBarAdvancedFormData, keyMap);
+        { searchValue: data.searchValue, ...modified } as SearchBarAdvancedFormData, keyMap);
 
     value = value.trim();
     return value;
diff --git a/src/store/search-bar/search-bar-tree-actions.ts b/src/store/search-bar/search-bar-tree-actions.ts
index 6ab25d6e..7d05a320 100644
--- a/src/store/search-bar/search-bar-tree-actions.ts
+++ b/src/store/search-bar/search-bar-tree-actions.ts
@@ -66,8 +66,10 @@ export const expandSearchBarTreeItem = (id: string) =>
     };
 
 export const activateSearchBarProject = (id: string) =>
-    async (dispatch: Dispatch, getState: () => RootState) => {
-        const { treePicker } = getState();
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+
+
+        /*const { treePicker } = getState();
         const node = getSearchBarTreeNode(id)(treePicker);
         if (node && node.status !== TreeNodeStatus.LOADED) {
             await dispatch<any>(loadSearchBarTreeProjects(id));
@@ -78,7 +80,7 @@ export const activateSearchBarProject = (id: string) =>
             ids: getSearchBarTreeNodeAncestorsIds(id)(treePicker),
             pickerId: SEARCH_BAR_ADVANCED_FORM_PICKER_ID
         }));
-        dispatch<any>(expandSearchBarTreeItem(id));
+        dispatch<any>(expandSearchBarTreeItem(id));*/
     };
 
 
diff --git a/src/views-components/form-fields/search-bar-form-fields.tsx b/src/views-components/form-fields/search-bar-form-fields.tsx
index 0a6b8795..6bd6b8c2 100644
--- a/src/views-components/form-fields/search-bar-form-fields.tsx
+++ b/src/views-components/form-fields/search-bar-form-fields.tsx
@@ -17,6 +17,7 @@ import { PropertyKeyField, } from 'views-components/resource-properties-form/pro
 import { PropertyValueField } from 'views-components/resource-properties-form/property-value-field';
 import { connect } from "react-redux";
 import { RootState } from "store/store";
+import { ProjectInput, ProjectCommandInputParameter } from 'views/run-process-panel/inputs/project-input';
 
 export const SearchBarTypeField = () =>
     <Field
@@ -50,20 +51,11 @@ export const SearchBarClusterField = connect(
     );
 
 export const SearchBarProjectField = () =>
-    <Field
-        name='projectUuid'
-        component={ProjectsPicker} />;
-
-const ProjectsPicker = (props: WrappedFieldProps) =>
-    <div style={{ height: '100px', display: 'flex', flexDirection: 'column', overflow: 'overlay' }}>
-        <HomeTreePicker
-            pickerId={SEARCH_BAR_ADVANCED_FORM_PICKER_ID}
-            toggleItemActive={
-                (_: any, { id }: TreeItem<ProjectsTreePickerItem>) => {
-                    props.input.onChange(id);
-                }
-            } />
-    </div>;
+    <ProjectInput input={{
+        id: "projectObject",
+        label: "Limit search to Project"
+    } as ProjectCommandInputParameter}
+        options={{ showOnlyOwned: false, showOnlyWritable: false }} />
 
 export const SearchBarTrashField = () =>
     <Field

commit ff8a68b46a011c546f15d88281f842bbdee117ae
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Dec 9 15:19:22 2022 -0500

    19783: Review updates
    
    Load fewer items to be more responsive & update message when not
    everything was listed.
    
    Use full text search instead of substring search on names.
    
    Tweak search box help text.
    
    Fix bug where collections used PDH instead of UUID as tree ids,
    resulting in collisions and weird behavior.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/services/api/filter-builder.ts b/src/services/api/filter-builder.ts
index da67935a..bb97665a 100644
--- a/src/services/api/filter-builder.ts
+++ b/src/services/api/filter-builder.ts
@@ -64,7 +64,7 @@ export class FilterBuilder {
         return this.addCondition("properties." + field, "exists", false, "", "", resourcePrefix);
     }
 
-    public addFullTextSearch(value: string) {
+    public addFullTextSearch(value: string, table?: string) {
         const regex = /"[^"]*"/;
         const matches: any[] = [];
 
@@ -76,10 +76,15 @@ export class FilterBuilder {
             match = value.match(regex);
         }
 
+        let searchIn = 'any';
+        if (table) {
+            searchIn = table + ".any";
+        }
+
         const terms = value.trim().split(/(\s+)/).concat(matches);
         terms.forEach(term => {
             if (term !== " ") {
-                this.addCondition("any", "ilike", term, "%", "%");
+                this.addCondition(searchIn, "ilike", term, "%", "%");
             }
         });
         return this;
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index cabc9f72..460a23e3 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -136,24 +136,26 @@ export const loadProject = (params: LoadProjectParamsWithId) =>
         const state = getState();
 
         if (state.treePickerSearch.collectionFilterValues[pickerId]) {
-            filterB = filterB.addILike('collections.name', state.treePickerSearch.collectionFilterValues[pickerId]);
+            filterB = filterB.addFullTextSearch(state.treePickerSearch.collectionFilterValues[pickerId], 'collections');
         } else {
             filterB = filterB.addNotIn("collections.properties.type", ["intermediate", "log"]);
         }
 
         if (searchProjects && state.treePickerSearch.projectSearchValues[pickerId]) {
-            filterB = filterB.addILike('groups.name', state.treePickerSearch.projectSearchValues[pickerId]);
+            filterB = filterB.addFullTextSearch(state.treePickerSearch.projectSearchValues[pickerId], 'groups');
         }
 
         const filters = filterB.getFilters();
 
-        const { items, itemsAvailable } = await services.groupsService.contents((loadShared || searchProjects) ? '' : id, { filters, excludeHomeProject: loadShared || undefined, limit: 1000 });
+        const itemLimit = 200;
 
-        if (itemsAvailable > 1000) {
+        const { items, itemsAvailable } = await services.groupsService.contents((loadShared || searchProjects) ? '' : id, { filters, excludeHomeProject: loadShared || undefined, limit: itemLimit });
+
+        if (itemsAvailable > itemLimit) {
             items.push({
                 uuid: "more-items-available",
                 kind: ResourceKind.WORKFLOW,
-                name: "*** Not all items were loaded (limit 1000 items) ***",
+                name: `*** Not all items listed (${items.length} out of ${itemsAvailable}), reduce item count with search or filter ***`,
                 description: "",
                 definition: "",
                 ownerUuid: "",
@@ -208,7 +210,7 @@ export const loadCollection = (id: string, pickerId: string) =>
 
             const node = getNode(id)(picker);
             if (node && 'kind' in node.value && node.value.kind === ResourceKind.COLLECTION) {
-                const files = await services.collectionService.files(node.value.portableDataHash);
+                const files = await services.collectionService.files(node.value.uuid);
                 const tree = createCollectionFilesTree(files);
                 const sorted = sortFilesTree(tree);
                 const filesTree = mapTreeValues(services.collectionService.extendFileURL)(sorted);
diff --git a/src/views-components/projects-tree-picker/projects-tree-picker.tsx b/src/views-components/projects-tree-picker/projects-tree-picker.tsx
index de7362d9..2711c777 100644
--- a/src/views-components/projects-tree-picker/projects-tree-picker.tsx
+++ b/src/views-components/projects-tree-picker/projects-tree-picker.tsx
@@ -81,7 +81,7 @@ type CssRules = 'pickerHeight' | 'searchFlex' | 'scrolledBox';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     pickerHeight: {
-        height: "70vh"
+        height: "calc(70vh - 100px)"
     },
     searchFlex: {
         display: "flex",
@@ -89,7 +89,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         paddingBottom: "1em"
     },
     scrolledBox: {
-        height: "100%",
+        height: "calc(100% - 50px)",
         overflow: "scroll"
     }
 });
@@ -142,9 +142,9 @@ export const ProjectsTreePicker = connect(mapStateToProps, mapDispatchToProps)(
                 };
                 return <div className={this.props.classes.pickerHeight} >
                     <span className={this.props.classes.searchFlex}>
-                        <SearchInput value="" label="Search all Projects" selfClearProp='' onSearch={onProjectSearch} debounce={200} />
+                        <SearchInput value="" label="Search for a Project" selfClearProp='' onSearch={onProjectSearch} debounce={200} />
                         {this.props.includeCollections &&
-                            <SearchInput value="" label="Filter Collections inside Projects" selfClearProp='' onSearch={onCollectionFilter} debounce={200} />}
+                            <SearchInput value="" label="Filter Collections list in Projects" selfClearProp='' onSearch={onCollectionFilter} debounce={200} />}
                     </span>
 
                     <div className={this.props.classes.scrolledBox}>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list