15067: When adding/updating a property, use IDs when available.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 11 Nov 2019 19:12:27 +0000 (16:12 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 11 Nov 2019 19:12:27 +0000 (16:12 -0300)
The tag editor will populate the IDs when the tags belong to a predefined
vocabulary.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

src/models/tag.ts
src/store/collection-panel/collection-panel-action.ts
src/views/collection-panel/collection-tag-form.tsx

index 9c229affe85cf720e19513d3c8b121527b4b1e58..f4e5854ad109a26fd2b46908484e2b0ad6c6ba0c 100644 (file)
@@ -11,7 +11,9 @@ export interface TagResource extends LinkResource {
 
 export interface TagProperty {
     key: string;
+    keyID?: string;
     value: string;
+    valueID?: string;
 }
 
 export enum TagTailType {
index 159fb27de8cd57ae25efb9f9caad1327b265949c..540b8c6a011b6ab80b2163b52000db20a050b6af 100644 (file)
@@ -49,11 +49,11 @@ export const createCollectionTag = (data: TagProperty) =>
                     uuid, {
                         properties: {
                             ...JSON.parse(JSON.stringify(item.properties)),
-                            [data.key]: data.value
+                            [data.keyID || data.key]: data.valueID || data.value
                         }
                     }
                 );
-                item.properties[data.key] = data.value;
+                item.properties = updatedCollection.properties;
                 dispatch(resourcesActions.SET_RESOURCES([updatedCollection]));
                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Tag has been successfully added.", hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
                 return updatedCollection;
index 768f4cb88bb2af900232160622e0304cfe2d0b06..fd4f0880a2abf9007d0a1e8d0db94704d20d16e2 100644 (file)
@@ -12,7 +12,6 @@ const Form = withStyles(({ spacing }) => ({ container: { marginBottom: spacing.u
 export const CollectionTagForm = reduxForm<ResourcePropertiesFormData>({
     form: COLLECTION_TAG_FORM_NAME,
     onSubmit: (data, dispatch) => {
-        console.log('FORM SUBMIT: ', data);
         dispatch<any>(createCollectionTag(data));
         dispatch(reset(COLLECTION_TAG_FORM_NAME));
     }