Commit 1debbe3c authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Do not call changeState recursively, or it blocks the UI

parent 8ae8f1f5
...@@ -98,6 +98,27 @@ ...@@ -98,6 +98,27 @@
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
.declareJob('detachChangeState', function (value_uid, catalog_index) {
var gadget = this;
return gadget.jio_allDocs({
"query": Query.objectToSearchText(new SimpleQuery({
key: "catalog.uid",
value: value_uid
})),
"limit": [0, 1],
"select_list": [catalog_index]
})
.push(function (result) {
return gadget.changeState({
value_text: result.data.rows[0]
.value[catalog_index]
});
})
.push(function () {
return gadget.notifyChange();
});
})
.onStateChange(function (modification_dict) { .onStateChange(function (modification_dict) {
var gadget = this, var gadget = this,
queue = new RSVP.Queue(), queue = new RSVP.Queue(),
...@@ -145,20 +166,8 @@ ...@@ -145,20 +166,8 @@
// User selected a document from a listbox // User selected a document from a listbox
if ((gadget.state.value_uid) && (!gadget.state.value_text)) { if ((gadget.state.value_uid) && (!gadget.state.value_text)) {
plane.className = SEARCHING_CLASS_STR; plane.className = SEARCHING_CLASS_STR;
return gadget.jio_allDocs({ return gadget.detachChangeState(gadget.state.value_uid,
"query": Query.objectToSearchText(new SimpleQuery({ gadget.state.catalog_index);
key: "catalog.uid",
value: gadget.state.value_uid,
limit: [0, 1]
})),
"select_list": [gadget.state.catalog_index]
})
.push(function (result) {
return gadget.changeState({
value_text: result.data.rows[0]
.value[gadget.state.catalog_index]
});
});
} }
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.62393.33328.52019</string> </value> <value> <string>958.2831.13618.12219</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1481711639.59</float> <float>1489675175.72</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment