[ARVADOS-WORKBENCH2] updated: 1.4.1-104-g45ee419f

Git user git at public.curoverse.com
Tue Nov 12 12:44:50 UTC 2019


Summary of changes:
 public/vocabulary-example.json                     |  15 +-
 src/common/config.ts                               |  68 +++++-
 src/common/regexp.ts                               |   6 +
 src/common/url.ts                                  |   9 +
 src/components/form-dialog/form-dialog.tsx         |   2 +-
 src/index.tsx                                      |   3 +
 src/models/resource.ts                             |   4 +-
 src/models/session.ts                              |   3 +-
 src/models/vocabulary.ts                           |  57 ++++-
 src/routes/routes.ts                               |  11 +-
 src/services/auth-service/auth-service.ts          |  20 +-
 src/services/groups-service/groups-service.ts      |   1 +
 src/store/auth/auth-action-session.ts              | 267 ++++++++++++++-------
 src/store/auth/auth-action.test.ts                 |  21 +-
 src/store/auth/auth-action.ts                      |  32 +--
 src/store/auth/auth-reducer.test.ts                |   3 +
 src/store/auth/auth-reducer.ts                     |   8 +-
 .../link-account-panel-actions.ts                  |  30 ++-
 src/store/navigation/navigation-action.ts          |   8 +-
 src/store/search-bar/search-bar-actions.ts         |   9 +-
 .../search-results-middleware-service.ts           |  55 ++---
 .../search-results-panel-actions.ts                |  13 +-
 src/views-components/add-session/add-session.tsx   |  26 ++
 src/views-components/data-explorer/renderers.tsx   |  22 +-
 .../main-app-bar/anonymous-menu.tsx                |   2 +-
 src/views-components/main-app-bar/main-app-bar.tsx |   3 +-
 .../property-field-common.tsx                      |   7 +-
 .../property-key-field.tsx                         |  26 +-
 .../property-value-field.tsx                       |  40 +--
 src/views/collection-panel/collection-panel.tsx    |  18 +-
 src/views/inactive-panel/inactive-panel.tsx        |  57 ++---
 .../link-account-panel/link-account-panel-root.tsx | 228 +++++++++---------
 .../link-account-panel/link-account-panel.tsx      |   7 +-
 src/views/login-panel/login-panel.tsx              |  41 ++--
 src/views/main-panel/main-panel-root.tsx           |  13 +-
 src/views/main-panel/main-panel.tsx                |   3 +-
 .../search-results-panel-view.tsx                  |  54 +++--
 .../site-manager-panel/site-manager-panel-root.tsx |  47 ++--
 .../site-manager-panel/site-manager-panel.tsx      |  11 +-
 src/views/workbench/fed-login.tsx                  |   5 +-
 40 files changed, 791 insertions(+), 464 deletions(-)
 create mode 100644 src/common/regexp.ts
 create mode 100644 src/views-components/add-session/add-session.tsx

       via  45ee419ff7952fc722a139666c327a321a92cc81 (commit)
       via  e7916d508b495a1fd2be51bd3da2125cc8eb7467 (commit)
       via  8dd64fbb819524cb3f86f5313b44fe228a20165d (commit)
       via  dec81d42222814723ff0386665928045ff41eac8 (commit)
       via  087d49d5c43866c8a20e8ac830ccc9b12188408f (commit)
       via  a1cfba8c2407131a8c5d6c21dc741d6319f8648a (commit)
       via  63bcd4762a60500b6a445b16b33ea31533fdf25d (commit)
       via  ceb4f50aeca2bb6b0354a7bd96a599b4a14147fe (commit)
       via  d6538e3ec3a545258ff9073ef88501fe2c75a4f0 (commit)
       via  d4afb5d44f63394461ff1571039a74b3462d8ae6 (commit)
       via  d6d283b6be9a614915b63e1ca66572a3aaf9d41e (commit)
       via  d75bc00b51e9c8db81e91e8ab28d915d7cbd4768 (commit)
       via  563d8f1121c966ca15f4b2b2751ba4e8978bb16e (commit)
       via  2996372d4b0507e712e2b1a07f9032adff73a227 (commit)
       via  2ef3823ee2205b76af73f3fa4440395bdb3aac5d (commit)
       via  9b64c487d252309c9b9dae513f32d53f1a6c5cb6 (commit)
       via  88fc1bb0d6d8fd479cd4183385bcdc4f8584ef80 (commit)
       via  fb9e1c37cd3686f71140763202208dea17d7cd73 (commit)
       via  99a99d1b9da187562407aebe144ac8140603d684 (commit)
       via  c541910768512998c6e7b31d7f128837772b4ed1 (commit)
       via  80aedc2f5a81de82d946e8fe9622ff194bb63cdb (commit)
       via  ba71587fc2058276b9b70c342b990aa6508690a9 (commit)
       via  e5551bf01ddaff04ca0494013b7bab1a0978f7d1 (commit)
       via  fd4b10d0bd74546ebac751287b256ad32452a7b1 (commit)
       via  4afb565c2c72fdde73cefba6f6c968d97f0b1aa8 (commit)
       via  4f1347018edbddff73c8bc1c82f4ff963c11dd1f (commit)
       via  b70fb34feb137d347f1e9e9a85163981fe888622 (commit)
       via  5adf51b5e01fdc72fd51c82ad05bf07fd55f519f (commit)
       via  df4133dde10614e53a41b16a5c6062c3d1777059 (commit)
       via  0ac34fb81d10d664c7b7994612504f989d1c3d29 (commit)
       via  589629e80967dc1f318561fbe6a4174e1da231a6 (commit)
       via  a8223b83cc9ae48174718d124a38a504d5312651 (commit)
       via  a34ed98858d0a43904715e62a09d6de118073701 (commit)
       via  cfeff7ff252c475975587a740e25ee419a515d3c (commit)
       via  634d3b05179258468f53427356b5218d97257072 (commit)
       via  5df95741b820e18db893c8ce1fac67b921b7fafc (commit)
       via  0bdf4669744c1ad68507a158bca8285e672399ab (commit)
       via  ae044d06880a54d847c73fbcf88884d21f0d6621 (commit)
       via  bfd0188773272d62ac8b9196c3a445d83a5719aa (commit)
       via  badcb86fb7d0e2ab87c7dcef230072db2e2ae95e (commit)
       via  d866a8ad7d9d8f48c761fa7ea8ea96b17cbfdb2f (commit)
       via  640e9ba2d458a1bdaadea09dfe2c92816601709d (commit)
       via  5f77228e7c601fa2fb9154d54769fd6f08a463ce (commit)
       via  bd1f778b16ab0bc2219c1314880ad4be6452a22c (commit)
       via  29c0944feb7932889a5b6fcaf208eef9f5864a29 (commit)
       via  04446cedce14583b0ad11f6f0d989bf834a27d04 (commit)
      from  ec2c868ff4c0f974ae5f7ca126fe43c02b91d564 (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 45ee419ff7952fc722a139666c327a321a92cc81
Merge: e7916d50 8dd64fbb
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Nov 12 09:44:03 2019 -0300

    Merge branch 'master' into 15067-tag-editing-by-ids

diff --cc src/common/config.ts
index e755f0da,7d974342..cbac7b19
--- a/src/common/config.ts
+++ b/src/common/config.ts
@@@ -102,20 -125,8 +125,11 @@@ remove the entire ${varName} entry fro
                  else {
                      vocabularyUrl = clusterConfigJSON.Workbench.VocabularyURL || "/vocabulary-example.json";
                  }
 +                // FIXME: The following line is for dev testing purposes
 +                vocabularyUrl = "/vocabulary-example.json";
 +
                  config.vocabularyUrl = vocabularyUrl;
  
-                 config.rootUrl = clusterConfigJSON.Services.Controller.ExternalURL;
-                 config.baseUrl = `${config.rootUrl}/${ARVADOS_API_PATH}`;
-                 config.uuidPrefix = clusterConfigJSON.ClusterID;
-                 config.websocketUrl = clusterConfigJSON.Services.Websocket.ExternalURL;
-                 config.workbench2Url = clusterConfigJSON.Services.Workbench2.ExternalURL;
-                 config.workbenchUrl = clusterConfigJSON.Services.Workbench1.ExternalURL;
-                 config.keepWebServiceUrl = clusterConfigJSON.Services.WebDAV.ExternalURL;
-                 mapRemoteHosts(clusterConfigJSON, config);
- 
                  return { config, apiHost: workbenchConfig.API_HOST };
              });
          });
diff --cc src/views-components/resource-properties-form/property-key-field.tsx
index ff665df2,686c858e..f91b6a62
--- a/src/views-components/resource-properties-form/property-key-field.tsx
+++ b/src/views-components/resource-properties-form/property-key-field.tsx
@@@ -3,16 -3,15 +3,17 @@@
  // SPDX-License-Identifier: AGPL-3.0
  
  import * as React from 'react';
 -import { WrappedFieldProps, Field } from 'redux-form';
 +import { change, WrappedFieldProps, WrappedFieldMetaProps, WrappedFieldInputProps, Field } from 'redux-form';
  import { memoize } from 'lodash';
  import { Autocomplete } from '~/components/autocomplete/autocomplete';
 -import { Vocabulary } from '~/models/vocabulary';
 +import { Vocabulary, getTags, getTagKeyID, PropFieldSuggestion } from '~/models/vocabulary';
  import { connectVocabulary, VocabularyProp, buildProps } from '~/views-components/resource-properties-form/property-field-common';
  import { TAG_KEY_VALIDATION } from '~/validators/validators';
 +import { COLLECTION_TAG_FORM_NAME } from '~/store/collection-panel/collection-panel-action';
+ import { escapeRegExp } from '~/common/regexp.ts';
  
  export const PROPERTY_KEY_FIELD_NAME = 'key';
 +export const PROPERTY_KEY_FIELD_ID = 'keyID';
  
  export const PropertyKeyField = connectVocabulary(
      ({ vocabulary }: VocabularyProp) =>
@@@ -50,26 -40,10 +51,28 @@@ const matchTags = (vocabulary: Vocabula
              ? undefined
              : 'Incorrect key';
  
- const getSuggestions = (value: string, vocabulary: Vocabulary) =>
-     getTags(vocabulary).filter(tag => tag.label.toLowerCase().includes(value.toLowerCase()));
+ const getSuggestions = (value: string, vocabulary: Vocabulary) => {
+     const re = new RegExp(escapeRegExp(value), "i");
 -    return getTagsList(vocabulary).filter(tag => re.test(tag) && tag !== value);
++    return getTags(vocabulary).filter(tag => re.test(tag.label) && tag.label !== value);
+ };
  
 -const getTagsList = ({ tags }: Vocabulary) =>
 -    Object.keys(tags);
 +// Attempts to match a manually typed key label with a key ID, when the user
 +// doesn't select the key from the suggestions list.
 +const handleBlur = (
 +    { dispatch }: WrappedFieldMetaProps,
 +    { onBlur, value }: WrappedFieldInputProps,
 +    vocabulary: Vocabulary) =>
 +    () => {
 +        dispatch(change(COLLECTION_TAG_FORM_NAME, PROPERTY_KEY_FIELD_ID, getTagKeyID(value, vocabulary)));
 +        onBlur(value);
 +    };
 +
 +// When selecting a property key, save its ID for later usage.
 +const handleSelect = (
 +    { onChange }: WrappedFieldInputProps,
 +    { dispatch }: WrappedFieldMetaProps) => {
 +        return (item:PropFieldSuggestion) => {
 +            onChange(item.label);
 +            dispatch(change(COLLECTION_TAG_FORM_NAME, PROPERTY_KEY_FIELD_ID, item.id));
 +    };
 +};
diff --cc src/views-components/resource-properties-form/property-value-field.tsx
index 32109ef4,c8634acf..959b98ec
--- a/src/views-components/resource-properties-form/property-value-field.tsx
+++ b/src/views-components/resource-properties-form/property-value-field.tsx
@@@ -3,14 -3,14 +3,15 @@@
  // SPDX-License-Identifier: AGPL-3.0
  
  import * as React from 'react';
 -import { WrappedFieldProps, Field, formValues } from 'redux-form';
 +import { change, WrappedFieldProps, WrappedFieldMetaProps, WrappedFieldInputProps, Field, formValues } from 'redux-form';
  import { compose } from 'redux';
  import { Autocomplete } from '~/components/autocomplete/autocomplete';
 -import { Vocabulary } from '~/models/vocabulary';
 -import { PROPERTY_KEY_FIELD_NAME } from '~/views-components/resource-properties-form/property-key-field';
 +import { Vocabulary, getTagValueID, isStrictTag, getTagValues, PropFieldSuggestion } from '~/models/vocabulary';
 +import { PROPERTY_KEY_FIELD_ID } from '~/views-components/resource-properties-form/property-key-field';
  import { VocabularyProp, connectVocabulary, buildProps } from '~/views-components/resource-properties-form/property-field-common';
  import { TAG_VALUE_VALIDATION } from '~/validators/validators';
 +import { COLLECTION_TAG_FORM_NAME } from '~/store/collection-panel/collection-panel-action';
+ import { escapeRegExp } from '~/common/regexp.ts';
  
  interface PropertyKeyProp {
      propertyKey: string;
@@@ -59,27 -49,17 +60,29 @@@ const matchTagValues = ({ vocabulary, p
              ? undefined
              : 'Incorrect value';
  
- const getSuggestions = (value: string, tagKey: string, vocabulary: Vocabulary) =>
-     getTagValues(tagKey, vocabulary).filter(v => v.label.toLowerCase().includes(value.toLowerCase()));
+ const getSuggestions = (value: string, tagName: string, vocabulary: Vocabulary) => {
+     const re = new RegExp(escapeRegExp(value), "i");
 -    return getTagValues(tagName, vocabulary).filter(v => re.test(v) && v !== value);
++    return getTagValues(tagName, vocabulary).filter(v => re.test(v.label) && v.label !== value);
+ };
  
 -const isStrictTag = (tagName: string, vocabulary: Vocabulary) => {
 -    const tag = vocabulary.tags[tagName];
 -    return tag ? tag.strict : false;
 -};
 +// Attempts to match a manually typed value label with a value ID, when the user
 +// doesn't select the value from the suggestions list.
 +const handleBlur = (
 +    { dispatch }: WrappedFieldMetaProps,
 +    { onBlur, value }: WrappedFieldInputProps,
 +    vocabulary: Vocabulary,
 +    tagKeyID: string) =>
 +        () => {
 +            dispatch(change(COLLECTION_TAG_FORM_NAME, PROPERTY_VALUE_FIELD_ID, getTagValueID(tagKeyID, value, vocabulary)));
 +            onBlur(value);
 +        };
  
 -const getTagValues = (tagName: string, vocabulary: Vocabulary) => {
 -    const tag = vocabulary.tags[tagName];
 -    return tag && tag.values ? tag.values : [];
 +// When selecting a property value, save its ID for later usage.
 +const handleSelect = (
 +    { onChange }: WrappedFieldInputProps,
 +    { dispatch }: WrappedFieldMetaProps) => {
 +        return (item:PropFieldSuggestion) => {
 +            onChange(item.label);
 +            dispatch(change(COLLECTION_TAG_FORM_NAME, PROPERTY_VALUE_FIELD_ID, item.id));
 +    };
  };

commit e7916d508b495a1fd2be51bd3da2125cc8eb7467
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Nov 12 09:31:59 2019 -0300

    15067: Tag key/value suggestions show all available labels.
    
    Also:
    * Moved all vocabulary related functions on the model file.
    * Return an alphabetic ordered list of suggestions.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>

diff --git a/public/vocabulary-example.json b/public/vocabulary-example.json
index 4859b5d6..59d4de7a 100644
--- a/public/vocabulary-example.json
+++ b/public/vocabulary-example.json
@@ -57,27 +57,32 @@
         "IDTAGANIMALS": {
             "strict": false,
             "labels": [
-                {"label": "Animal" }
+                {"label": "Animal" },
+                {"label": "Creature"}
             ],
             "values": {
                 "IDVALANIMALS1": {
                     "labels": [
-                        {"label": "Human"}
+                        {"label": "Human"},
+                        {"label": "Homo sapiens"}
                     ]
                 },
                 "IDVALANIMALS2": {
                     "labels": [
-                        {"label": "Dog"}
+                        {"label": "Dog"},
+                        {"label": "Canis lupus familiaris"}
                     ]
                 },
                 "IDVALANIMALS3": {
                     "labels": [
-                        {"label": "Elephant"}
+                        {"label": "Elephant"},
+                        {"label": "Loxodonta"}
                     ]
                 },
                 "IDVALANIMALS4": {
                     "labels": [
-                        {"label": "Eagle"}
+                        {"label": "Eagle"},
+                        {"label": "Haliaeetus leucocephalus"}
                     ]
                 }
             }
diff --git a/src/models/vocabulary.ts b/src/models/vocabulary.ts
index 173c8371..158d8058 100644
--- a/src/models/vocabulary.ts
+++ b/src/models/vocabulary.ts
@@ -24,6 +24,11 @@ export interface Tag {
     values?: Record<string, TagValue>;
 }
 
+export interface PropFieldSuggestion {
+    "id": string;
+    "label": string;
+}
+
 const VOCABULARY_VALIDATORS = [
     isObject,
     has('strict_tags'),
@@ -31,4 +36,54 @@ const VOCABULARY_VALIDATORS = [
 ];
 
 export const isVocabulary = (value: any) =>
-    every(validator => validator(value), VOCABULARY_VALIDATORS);
\ No newline at end of file
+    every(validator => validator(value), VOCABULARY_VALIDATORS);
+
+export const isStrictTag = (tagKeyID: string, vocabulary: Vocabulary) => {
+    const tag = vocabulary.tags[tagKeyID];
+    return tag ? tag.strict : false;
+};
+
+export const getTagValueID = (tagKeyID:string, tagValueLabel:string, vocabulary: Vocabulary) =>
+    (tagKeyID && vocabulary.tags[tagKeyID] && vocabulary.tags[tagKeyID].values)
+    ? Object.keys(vocabulary.tags[tagKeyID].values!).find(
+        k => vocabulary.tags[tagKeyID].values![k].labels.find(
+            l => l.label === tagValueLabel) !== undefined) || ''
+    : '';
+
+const compare = (a: PropFieldSuggestion, b: PropFieldSuggestion) => {
+    if (a.label < b.label) {return -1;}
+    if (a.label > b.label) {return 1;}
+    return 0;
+};
+
+export const getTagValues = (tagKeyID: string, vocabulary: Vocabulary) => {
+    const tag = vocabulary.tags[tagKeyID];
+    const ret = tag && tag.values
+        ? Object.keys(tag.values).map(
+            tagValueID => tag.values![tagValueID].labels
+                ? tag.values![tagValueID].labels.map(
+                    lbl => Object.assign({}, {"id": tagValueID, "label": lbl.label}))
+                : [{"id": tagValueID, "label": tagValueID}])
+            .reduce((prev, curr) => [...prev, ...curr], [])
+            .sort(compare)
+        : [];
+    return ret;
+};
+
+export const getTags = ({ tags }: Vocabulary) => {
+    const ret = tags && Object.keys(tags)
+        ? Object.keys(tags).map(
+            tagID => tags[tagID].labels
+                ? tags[tagID].labels.map(
+                    lbl => Object.assign({}, {"id": tagID, "label": lbl.label}))
+                : [{"id": tagID, "label": tagID}])
+            .reduce((prev, curr) => [...prev, ...curr], [])
+            .sort(compare)
+        : [];
+    return ret;
+};
+
+export const getTagKeyID = (tagKeyLabel:string, vocabulary: Vocabulary) =>
+    Object.keys(vocabulary.tags).find(
+        k => vocabulary.tags[k].labels.find(
+            l => l.label === tagKeyLabel) !== undefined) || '';
diff --git a/src/views-components/resource-properties-form/property-field-common.tsx b/src/views-components/resource-properties-form/property-field-common.tsx
index a0f5800f..a90ce923 100644
--- a/src/views-components/resource-properties-form/property-field-common.tsx
+++ b/src/views-components/resource-properties-form/property-field-common.tsx
@@ -4,7 +4,7 @@
 
 import { connect } from 'react-redux';
 import { WrappedFieldMetaProps, WrappedFieldInputProps, WrappedFieldProps } from 'redux-form';
-import { Vocabulary } from '~/models/vocabulary';
+import { Vocabulary, PropFieldSuggestion } from '~/models/vocabulary';
 import { RootState } from '~/store/store';
 import { getVocabulary } from '~/store/vocabulary/vocabulary-selectors';
 
@@ -43,8 +43,3 @@ export const buildProps = ({ input, meta }: WrappedFieldProps) => {
         helperText: getErrorMsg(meta),
     };
 };
-
-export interface PropFieldSuggestion {
-    "id": string;
-    "label": string;
-}
diff --git a/src/views-components/resource-properties-form/property-key-field.tsx b/src/views-components/resource-properties-form/property-key-field.tsx
index 5c8c875b..ff665df2 100644
--- a/src/views-components/resource-properties-form/property-key-field.tsx
+++ b/src/views-components/resource-properties-form/property-key-field.tsx
@@ -6,8 +6,8 @@ import * as React from 'react';
 import { change, WrappedFieldProps, WrappedFieldMetaProps, WrappedFieldInputProps, Field } from 'redux-form';
 import { memoize } from 'lodash';
 import { Autocomplete } from '~/components/autocomplete/autocomplete';
-import { Vocabulary } from '~/models/vocabulary';
-import { connectVocabulary, VocabularyProp, buildProps, PropFieldSuggestion } from '~/views-components/resource-properties-form/property-field-common';
+import { Vocabulary, getTags, getTagKeyID, PropFieldSuggestion } from '~/models/vocabulary';
+import { connectVocabulary, VocabularyProp, buildProps } from '~/views-components/resource-properties-form/property-field-common';
 import { TAG_KEY_VALIDATION } from '~/validators/validators';
 import { COLLECTION_TAG_FORM_NAME } from '~/store/collection-panel/collection-panel-action';
 
@@ -46,27 +46,12 @@ const getValidation = memoize(
 
 const matchTags = (vocabulary: Vocabulary) =>
     (value: string) =>
-        getTagsList(vocabulary).find(tag => tag.label === value)
+        getTags(vocabulary).find(tag => tag.label === value)
             ? undefined
             : 'Incorrect key';
 
 const getSuggestions = (value: string, vocabulary: Vocabulary) =>
-    getTagsList(vocabulary).filter(tag => tag.label.toLowerCase().includes(value.toLowerCase()));
-
-const getTagsList = ({ tags }: Vocabulary) => {
-    const ret = tags && Object.keys(tags)
-        ? Object.keys(tags).map(
-            tagID => tags[tagID].labels
-                ? {"id": tagID, "label": tags[tagID].labels[0].label}
-                : {"id": tagID, "label": tagID})
-        : [];
-    return ret;
-};
-
-const getTagKeyID = (tagKeyLabel:string, vocabulary: Vocabulary) =>
-    Object.keys(vocabulary.tags).find(
-        k => vocabulary.tags[k].labels.find(
-            l => l.label === tagKeyLabel) !== undefined) || '';
+    getTags(vocabulary).filter(tag => tag.label.toLowerCase().includes(value.toLowerCase()));
 
 // Attempts to match a manually typed key label with a key ID, when the user
 // doesn't select the key from the suggestions list.
diff --git a/src/views-components/resource-properties-form/property-value-field.tsx b/src/views-components/resource-properties-form/property-value-field.tsx
index 910a095a..32109ef4 100644
--- a/src/views-components/resource-properties-form/property-value-field.tsx
+++ b/src/views-components/resource-properties-form/property-value-field.tsx
@@ -6,9 +6,9 @@ import * as React from 'react';
 import { change, WrappedFieldProps, WrappedFieldMetaProps, WrappedFieldInputProps, Field, formValues } from 'redux-form';
 import { compose } from 'redux';
 import { Autocomplete } from '~/components/autocomplete/autocomplete';
-import { Vocabulary } from '~/models/vocabulary';
+import { Vocabulary, getTagValueID, isStrictTag, getTagValues, PropFieldSuggestion } from '~/models/vocabulary';
 import { PROPERTY_KEY_FIELD_ID } from '~/views-components/resource-properties-form/property-key-field';
-import { VocabularyProp, connectVocabulary, buildProps, PropFieldSuggestion } from '~/views-components/resource-properties-form/property-field-common';
+import { VocabularyProp, connectVocabulary, buildProps } from '~/views-components/resource-properties-form/property-field-common';
 import { TAG_VALUE_VALIDATION } from '~/validators/validators';
 import { COLLECTION_TAG_FORM_NAME } from '~/store/collection-panel/collection-panel-action';
 
@@ -62,29 +62,6 @@ const matchTagValues = ({ vocabulary, propertyKey }: PropertyValueFieldProps) =>
 const getSuggestions = (value: string, tagKey: string, vocabulary: Vocabulary) =>
     getTagValues(tagKey, vocabulary).filter(v => v.label.toLowerCase().includes(value.toLowerCase()));
 
-const isStrictTag = (tagKey: string, vocabulary: Vocabulary) => {
-    const tag = vocabulary.tags[tagKey];
-    return tag ? tag.strict : false;
-};
-
-const getTagValues = (tagKey: string, vocabulary: Vocabulary) => {
-    const tag = vocabulary.tags[tagKey];
-    const ret = tag && tag.values
-        ? Object.keys(tag.values).map(
-            tagValueID => tag.values![tagValueID].labels
-                ? {"id": tagValueID, "label": tag.values![tagValueID].labels[0].label}
-                : {"id": tagValueID, "label": tagValueID})
-        : [];
-    return ret;
-};
-
-const getTagValueID = (tagKeyID:string, tagValueLabel:string, vocabulary: Vocabulary) =>
-    (tagKeyID && vocabulary.tags[tagKeyID] && vocabulary.tags[tagKeyID].values)
-    ? Object.keys(vocabulary.tags[tagKeyID].values!).find(
-        k => vocabulary.tags[tagKeyID].values![k].labels.find(
-            l => l.label === tagValueLabel) !== undefined) || ''
-    : '';
-
 // Attempts to match a manually typed value label with a value ID, when the user
 // doesn't select the value from the suggestions list.
 const handleBlur = (
@@ -92,10 +69,10 @@ const handleBlur = (
     { onBlur, value }: WrappedFieldInputProps,
     vocabulary: Vocabulary,
     tagKeyID: string) =>
-    () => {
-        dispatch(change(COLLECTION_TAG_FORM_NAME, PROPERTY_VALUE_FIELD_ID, getTagValueID(tagKeyID, value, vocabulary)));
-        onBlur(value);
-    };
+        () => {
+            dispatch(change(COLLECTION_TAG_FORM_NAME, PROPERTY_VALUE_FIELD_ID, getTagValueID(tagKeyID, value, vocabulary)));
+            onBlur(value);
+        };
 
 // When selecting a property value, save its ID for later usage.
 const handleSelect = (

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list