[ARVADOS] updated: 1.1.2-47-gd8a7800

Git user git at public.curoverse.com
Tue Jan 16 13:22:46 EST 2018


Summary of changes:
 .../app/assets/javascripts/components/edit_tags.js | 32 +++++++++-------------
 1 file changed, 13 insertions(+), 19 deletions(-)

       via  d8a7800b5ca3d50bcd62545711585681e2b9154b (commit)
      from  5a82b37499c717e62d899a633f548713c872307b (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 d8a7800b5ca3d50bcd62545711585681e2b9154b
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Tue Jan 16 13:19:59 2018 -0500

    12479: Use onupdate + stable vnode keys, let focus handle itself.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/apps/workbench/app/assets/javascripts/components/edit_tags.js b/apps/workbench/app/assets/javascripts/components/edit_tags.js
index b70fd09..6ac4a9b 100644
--- a/apps/workbench/app/assets/javascripts/components/edit_tags.js
+++ b/apps/workbench/app/assets/javascripts/components/edit_tags.js
@@ -18,11 +18,6 @@ window.SimpleInput = {
             },
         }, vnode.attrs.value)
     },
-    oncreate: function(vnode) {
-        if (vnode.attrs.setFocus) {
-            vnode.dom.focus()
-        }
-    }
 }
 
 window.SelectOrAutocomplete = {
@@ -37,7 +32,7 @@ window.SelectOrAutocomplete = {
         }, vnode.attrs.value)
     },
     oncreate: function(vnode) {
-        var awesomplete = new Awesomplete(vnode.dom, {
+        vnode.state.awesomplete = new Awesomplete(vnode.dom, {
             list: vnode.attrs.options,
             minChars: 0,
             autoFirst: true,
@@ -60,13 +55,13 @@ window.SelectOrAutocomplete = {
             if (!vnode.attrs.create && this.value === '') {
                 // minChars = 0 && evaluate() makes the list open without
                 // input events
-                awesomplete.evaluate()
+                vnode.state.awesomplete.evaluate()
             }
         })
-        if (vnode.attrs.setFocus) {
-            $(vnode.dom).focus()
-        }
-    }
+    },
+    onupdate: function(vnode) {
+        vnode.state.awesomplete.list = vnode.attrs.options
+    },
 }
 
 window.TagEditorRow = {
@@ -102,14 +97,13 @@ window.TagEditorRow = {
             // Tag key
             m("td", [
                 vnode.attrs.editMode ?
-                m("div", {key: 'key-'+vnode.attrs.name()}, [
+                m("div", {key: 'key'}, [
                     m(inputComponent, {
                         options: nameOpts,
                         value: vnode.attrs.name,
                         // Allow any tag name unless "strict" is set to true.
                         create: !vnode.attrs.vocabulary().strict,
                         placeholder: 'key',
-                        setFocus: false
                     })
                 ])
                 : vnode.attrs.name
@@ -117,7 +111,7 @@ window.TagEditorRow = {
             // Tag value
             m("td", [
                 vnode.attrs.editMode ?
-                m("div", {key: 'value-'+vnode.attrs.name()}, [
+                m("div", {key: 'value'}, [
                     m(inputComponent, {
                         options: valueOpts,
                         value: vnode.attrs.value,
@@ -129,8 +123,6 @@ window.TagEditorRow = {
                             || !vnode.attrs.vocabulary().tags[vnode.attrs.name()].values
                             || vnode.attrs.vocabulary().tags[vnode.attrs.name()].values.length === 0
                             || !vnode.attrs.vocabulary().tags[vnode.attrs.name()].strict,
-                        // Focus on tag value field when new tag name is set
-                        setFocus: vnode.attrs.name() !== '' && vnode.attrs.value() === ''
                     })
                 ])
                 : vnode.attrs.value
@@ -158,7 +150,7 @@ window.TagEditorTable = {
                 vnode.attrs.tags.length > 0
                 ? vnode.attrs.tags.map(function(tag, idx) {
                     return m(TagEditorRow, {
-                        key: idx,
+                        key: tag.rowKey,
                         removeTag: function() {
                             vnode.attrs.tags.splice(idx, 1)
                             vnode.attrs.dirty(true)
@@ -175,9 +167,11 @@ window.TagEditorTable = {
     }
 }
 
+var uniqueID = 1
+
 window.TagEditorApp = {
     appendTag: function(vnode, name, value) {
-        var tag = {name: m.stream(name), value: m.stream(value)}
+        var tag = {name: m.stream(name), value: m.stream(value), rowKey: uniqueID++}
         vnode.state.tags.push(tag)
         // Set dirty flag when any of name/value changes to non empty string
         tag.name.map(function(v) {
@@ -267,4 +261,4 @@ window.TagEditorApp = {
             })
         ]
     },
-}
\ No newline at end of file
+}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list