17426: Add dialog box with form to example plugin.
[arvados-workbench2.git] / src / models / vocabulary.ts
index ebef70f025defdfd8573da8d85a1779ddcd09742..03f28c07bf9c5edc21de1e1996c52f28156c5f89 100644 (file)
@@ -25,8 +25,8 @@ export interface Tag {
 }
 
 export interface PropFieldSuggestion {
-    "id": string;
-    "label": string;
+    id: string;
+    label: string;
 }
 
 const VOCABULARY_VALIDATORS = [
@@ -68,7 +68,7 @@ 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
+            tagValueID => tag.values![tagValueID].labels && tag.values![tagValueID].labels.length > 0
                 ? tag.values![tagValueID].labels.map(
                     lbl => Object.assign({}, {"id": tagValueID, "label": lbl.label}))
                 : [{"id": tagValueID, "label": tagValueID}])
@@ -81,7 +81,7 @@ export const getTagValues = (tagKeyID: string, vocabulary: Vocabulary) => {
 export const getTags = ({ tags }: Vocabulary) => {
     const ret = tags && Object.keys(tags)
         ? Object.keys(tags).map(
-            tagID => tags[tagID].labels
+            tagID => tags[tagID].labels && tags[tagID].labels.length > 0
                 ? tags[tagID].labels.map(
                     lbl => Object.assign({}, {"id": tagID, "label": lbl.label}))
                 : [{"id": tagID, "label": tagID}])