[ARVADOS-WORKBENCH2] created: 1.4.1-453-g3b0c193f

Git user git at public.arvados.org
Wed Oct 7 14:06:38 UTC 2020


        at  3b0c193f12f1bac68b1fa708988369111799e33a (commit)


commit 3b0c193f12f1bac68b1fa708988369111799e33a
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Oct 7 11:05:47 2020 -0300

    16718: Shows collection status info as "old version" or "current" on search.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 90d8d977..8afa4532 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -17,7 +17,7 @@ import { getProcess, Process, getProcessStatus, getProcessStatusColor, getProces
 import { ArvadosTheme } from '~/common/custom-theme';
 import { compose, Dispatch } from 'redux';
 import { WorkflowResource } from '~/models/workflow';
-import { ResourceStatus } from '~/views/workflow-panel/workflow-panel-view';
+import { ResourceStatus as WorkflowStatus } from '~/views/workflow-panel/workflow-panel-view';
 import { getUuidPrefix, openRunProcess } from '~/store/workflow-panel/workflow-panel-actions';
 import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions';
 import { UserResource } from '~/models/user';
@@ -358,9 +358,9 @@ export const ResourceRunProcess = connect(
 
 const renderWorkflowStatus = (uuidPrefix: string, ownerUuid?: string) => {
     if (ownerUuid === getPublicUuid(uuidPrefix)) {
-        return renderStatus(ResourceStatus.PUBLIC);
+        return renderStatus(WorkflowStatus.PUBLIC);
     } else {
-        return renderStatus(ResourceStatus.PRIVATE);
+        return renderStatus(WorkflowStatus.PRIVATE);
     }
 };
 
@@ -442,6 +442,22 @@ export const ResourceType = connect(
         return { type: resource ? resource.kind : '' };
     })((props: { type: string }) => renderType(props.type));
 
+export const ResourceStatus = connect((state: RootState, props: { uuid: string }) => {
+        return { resource: getResource<GroupContentsResource>(props.uuid)(state.resources) };
+    })((props: { resource: GroupContentsResource }) =>
+        (props.resource && props.resource.kind === ResourceKind.COLLECTION)
+        ? <CollectionStatus uuid={props.resource.uuid} />
+        : <ProcessStatus uuid={props.resource.uuid} />
+    );
+
+export const CollectionStatus = connect((state: RootState, props: { uuid: string }) => {
+        return { collection: getResource<CollectionResource>(props.uuid)(state.resources) };
+    })((props: { collection: CollectionResource }) =>
+        (props.collection.uuid !== props.collection.currentVersionUuid)
+        ? <Typography>old version</Typography>
+        : <Typography>current</Typography>
+    );
+
 export const ProcessStatus = compose(
     connect((state: RootState, props: { uuid: string }) => {
         return { process: getProcess(props.uuid)(state.resources) };
diff --git a/src/views/search-results-panel/search-results-panel-view.tsx b/src/views/search-results-panel/search-results-panel-view.tsx
index 8bc5419b..ebe5a826 100644
--- a/src/views/search-results-panel/search-results-panel-view.tsx
+++ b/src/views/search-results-panel/search-results-panel-view.tsx
@@ -11,11 +11,12 @@ import { ContainerRequestState } from '~/models/container-request';
 import { SEARCH_RESULTS_PANEL_ID } from '~/store/search-results-panel/search-results-panel-actions';
 import { DataExplorer } from '~/views-components/data-explorer/data-explorer';
 import {
-    ProcessStatus, ResourceCluster,
+    ResourceCluster,
     ResourceFileSize,
     ResourceLastModifiedDate,
     ResourceName,
     ResourceOwner,
+    ResourceStatus,
     ResourceType
 } from '~/views-components/data-explorer/renderers';
 import { createTree } from '~/models/tree';
@@ -78,7 +79,7 @@ export const searchResultsPanelColumns: DataColumns<string> = [
         selected: true,
         configurable: true,
         filters: createTree(),
-        render: uuid => <ProcessStatus uuid={uuid} />
+        render: uuid => <ResourceStatus uuid={uuid} />
     },
     {
         name: SearchResultsPanelColumnNames.TYPE,

commit a7812342b6c07116acda6ce154e8dc6ed9d1c1c1
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Oct 6 15:21:39 2020 -0300

    16718: Adds unit test cases for the new is:pastVersion search term.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/store/search-bar/search-bar-actions.test.ts b/src/store/search-bar/search-bar-actions.test.ts
index a579183c..194ca2d7 100644
--- a/src/store/search-bar/search-bar-actions.test.ts
+++ b/src/store/search-bar/search-bar-actions.test.ts
@@ -8,13 +8,13 @@ import { ResourceKind } from "~/models/resource";
 describe('search-bar-actions', () => {
     describe('getAdvancedDataFromQuery', () => {
         it('should correctly build advanced data record from query #1', () => {
-            const r = getAdvancedDataFromQuery('val0 has:"file size":"100mb" val2 has:"user":"daniel" is:starred val2 val0 is:trashed');
+            const r = getAdvancedDataFromQuery('val0 has:"file size":"100mb" val2 has:"user":"daniel" is:starred val2 val0');
             expect(r).toEqual({
                 searchValue: 'val0 val2',
                 type: undefined,
                 cluster: undefined,
                 projectUuid: undefined,
-                inTrash: true,
+                inTrash: false,
                 pastVersions: false,
                 dateFrom: '',
                 dateTo: '',
@@ -31,14 +31,14 @@ describe('search-bar-actions', () => {
         });
 
         it('should correctly build advanced data record from query #2', () => {
-            const r = getAdvancedDataFromQuery('document from:2017-08-01 pdf has:"filesize":"101mb" is:trashed type:arvados#collection cluster:c97qx');
+            const r = getAdvancedDataFromQuery('document from:2017-08-01 pdf has:"filesize":"101mb" is:trashed type:arvados#collection cluster:c97qx is:pastVersion');
             expect(r).toEqual({
                 searchValue: 'document pdf',
                 type: ResourceKind.COLLECTION,
                 cluster: 'c97qx',
                 projectUuid: undefined,
                 inTrash: true,
-                pastVersions: false,
+                pastVersions: true,
                 dateFrom: '2017-08-01',
                 dateTo: '',
                 properties: [{
@@ -73,6 +73,27 @@ describe('search-bar-actions', () => {
             expect(q).toBe('document pdf type:arvados#collection cluster:c97qx is:trashed from:2017-08-01 has:"file size":"101mb" has:"Species":"Human" has:"Species":"Canine"');
         });
 
+        it('should build query from advanced data #2', () => {
+            const q = getQueryFromAdvancedData({
+                searchValue: 'document pdf',
+                type: ResourceKind.COLLECTION,
+                cluster: 'c97qx',
+                projectUuid: undefined,
+                inTrash: false,
+                pastVersions: true,
+                dateFrom: '2017-08-01',
+                dateTo: '',
+                properties: [
+                    { key: 'file size', value: '101mb' },
+                    { key: 'Species', value: 'Human' },
+                    { key: 'Species', value: 'Canine' },
+                ],
+                saveQuery: false,
+                queryName: ''
+            });
+            expect(q).toBe('document pdf type:arvados#collection cluster:c97qx is:pastVersion from:2017-08-01 has:"file size":"101mb" has:"Species":"Human" has:"Species":"Canine"');
+        });
+
         it('should add has:"key":"value" expression to query from same property key', () => {
             const searchValue = 'document pdf has:"file size":"101mb" has:"Species":"Canine"';
             const prevData = {

commit dc10e586102b4aad5d3c82d6b6cf799a9277a929
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Mon Oct 5 13:13:52 2020 -0300

    16718: Adds option to search for collection's past versions.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/models/search-bar.ts b/src/models/search-bar.ts
index c71faf2f..09b8b6b7 100644
--- a/src/models/search-bar.ts
+++ b/src/models/search-bar.ts
@@ -9,6 +9,7 @@ export type SearchBarAdvancedFormData = {
     cluster?: string;
     projectUuid?: string;
     inTrash: boolean;
+    pastVersions: boolean;
     dateFrom: string;
     dateTo: string;
     saveQuery: boolean;
diff --git a/src/store/search-bar/search-bar-actions.test.ts b/src/store/search-bar/search-bar-actions.test.ts
index 68804dfb..a579183c 100644
--- a/src/store/search-bar/search-bar-actions.test.ts
+++ b/src/store/search-bar/search-bar-actions.test.ts
@@ -15,6 +15,7 @@ describe('search-bar-actions', () => {
                 cluster: undefined,
                 projectUuid: undefined,
                 inTrash: true,
+                pastVersions: false,
                 dateFrom: '',
                 dateTo: '',
                 properties: [{
@@ -37,6 +38,7 @@ describe('search-bar-actions', () => {
                 cluster: 'c97qx',
                 projectUuid: undefined,
                 inTrash: true,
+                pastVersions: false,
                 dateFrom: '2017-08-01',
                 dateTo: '',
                 properties: [{
@@ -57,6 +59,7 @@ describe('search-bar-actions', () => {
                 cluster: 'c97qx',
                 projectUuid: undefined,
                 inTrash: true,
+                pastVersions: false,
                 dateFrom: '2017-08-01',
                 dateTo: '',
                 properties: [
@@ -78,6 +81,7 @@ describe('search-bar-actions', () => {
                 cluster: undefined,
                 projectUuid: undefined,
                 inTrash: false,
+                pastVersions: false,
                 dateFrom: '',
                 dateTo: '',
                 properties: [
@@ -107,6 +111,7 @@ describe('search-bar-actions', () => {
                 cluster: undefined,
                 projectUuid: undefined,
                 inTrash: false,
+                pastVersions: false,
                 dateFrom: '',
                 dateTo: '',
                 properties: [
@@ -134,6 +139,7 @@ describe('search-bar-actions', () => {
                 cluster: undefined,
                 projectUuid: undefined,
                 inTrash: false,
+                pastVersions: false,
                 dateFrom: '',
                 dateTo: '',
                 properties: [
diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index d9dc0a64..b010af14 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -268,6 +268,7 @@ export const getQueryFromAdvancedData = (data: SearchBarAdvancedFormData, prevDa
             cluster: data.cluster,
             projectUuid: data.projectUuid,
             inTrash: data.inTrash,
+            pastVersions: data.pastVersions,
             dateFrom: data.dateFrom,
             dateTo: data.dateTo,
         };
@@ -282,6 +283,7 @@ export const getQueryFromAdvancedData = (data: SearchBarAdvancedFormData, prevDa
         ['cluster', 'cluster'],
         ['project', 'projectUuid'],
         [`is:${parser.States.TRASHED}`, 'inTrash'],
+        [`is:${parser.States.PAST_VERSION}`, 'pastVersions'],
         ['from', 'dateFrom'],
         ['to', 'dateTo']
     ];
@@ -307,6 +309,7 @@ export const getAdvancedDataFromQuery = (query: string, vocabulary?: Vocabulary)
         cluster: getValue(Keywords.CLUSTER),
         projectUuid: getValue(Keywords.PROJECT),
         inTrash: parser.isTrashed(tokens),
+        pastVersions: parser.isPastVersion(tokens),
         dateFrom: getValue(Keywords.FROM) || '',
         dateTo: getValue(Keywords.TO) || '',
         properties: vocabulary
diff --git a/src/store/search-bar/search-query/arv-parser.ts b/src/store/search-bar/search-query/arv-parser.ts
index c9b7024b..1d0618c6 100644
--- a/src/store/search-bar/search-query/arv-parser.ts
+++ b/src/store/search-bar/search-query/arv-parser.ts
@@ -20,7 +20,8 @@ export enum Keywords {
 }
 
 export enum States {
-    TRASHED = 'trashed'
+    TRASHED = 'trashed',
+    PAST_VERSION = 'pastVersion'
 }
 
 const keyValuePattern = (key: string) => new RegExp(`${key}:([^ ]*)`);
@@ -60,12 +61,16 @@ export const getProperties = (tokens: string[]) =>
     }, [] as Property[]);
 
 
-export const isTrashed = (tokens: string[]) => {
+export const isTrashed = (tokens: string[]) => isSomeState(States.TRASHED, tokens);
+
+export const isPastVersion = (tokens: string[]) => isSomeState(States.PAST_VERSION, tokens);
+
+const isSomeState = (state: string, tokens: string[]) => {
     for (const token of tokens) {
         const match = token.match(keyValuePattern(Keywords.IS)) || ['', ''];
         if (match) {
             const [, value] = match;
-            if(value === States.TRASHED) {
+            if(value === state) {
                 return true;
             }
         }
diff --git a/src/store/search-results-panel/search-results-middleware-service.ts b/src/store/search-results-panel/search-results-middleware-service.ts
index f054a4e4..6d2dce7c 100644
--- a/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/src/store/search-results-panel/search-results-middleware-service.ts
@@ -77,7 +77,8 @@ const getParams = (dataExplorer: DataExplorer, query: string, apiRevision: numbe
         typeFilters(dataExplorer.columns)
     ),
     order: getOrder(dataExplorer),
-    includeTrash: getAdvancedDataFromQuery(query).inTrash
+    includeTrash: getAdvancedDataFromQuery(query).inTrash,
+    includeOldVersions: getAdvancedDataFromQuery(query).pastVersions
 });
 
 const getOrder = (dataExplorer: DataExplorer) => {
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 837f13cb..2eea38c4 100644
--- a/src/views-components/form-fields/search-bar-form-fields.tsx
+++ b/src/views-components/form-fields/search-bar-form-fields.tsx
@@ -71,6 +71,12 @@ export const SearchBarTrashField = () =>
         component={CheckboxField}
         label="In trash" />;
 
+export const SearchBarPastVersionsField = () =>
+    <Field
+        name='pastVersions'
+        component={CheckboxField}
+        label="Past versions" />;
+
 export const SearchBarDateFromField = () =>
     <Field
         name='dateFrom'
diff --git a/src/views-components/search-bar/search-bar-advanced-view.tsx b/src/views-components/search-bar/search-bar-advanced-view.tsx
index 71d32ad7..9f9688c3 100644
--- a/src/views-components/search-bar/search-bar-advanced-view.tsx
+++ b/src/views-components/search-bar/search-bar-advanced-view.tsx
@@ -17,7 +17,7 @@ import { SearchBarAdvancedFormData } from '~/models/search-bar';
 import {
     SearchBarTypeField, SearchBarClusterField, SearchBarProjectField, SearchBarTrashField,
     SearchBarDateFromField, SearchBarDateToField, SearchBarPropertiesField,
-    SearchBarSaveSearchField, SearchBarQuerySearchField
+    SearchBarSaveSearchField, SearchBarQuerySearchField, SearchBarPastVersionsField
 } from '~/views-components/form-fields/search-bar-form-fields';
 import { treePickerActions } from "~/store/tree-picker/tree-picker-actions";
 
@@ -141,6 +141,9 @@ export const SearchBarAdvancedView = compose(
                                 <Grid item xs={5}>
                                     <SearchBarTrashField />
                                 </Grid>
+                                <Grid item xs={5}>
+                                    <SearchBarPastVersionsField />
+                                </Grid>
                             </Grid>
                             <IconButton onClick={closeAdvanceView} className={classes.closeIcon}>
                                 <CloseIcon />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list