Commit 2e87a198 authored by Alain Takoudjou's avatar Alain Takoudjou

erp5_web_mynij_search: fix changing build state when build has failed

When build fail, it will loop trying to build again, we just has to change the state to failed and user can decide to restart build when he see the failed notification.
parent ec253029
......@@ -63,14 +63,14 @@
if (entry.status && !build_dict[key].status)
entry = build_dict[key];
else if ((entry.status === "built" ||
entry.status === "built failed") &&
entry.status === "build failed") &&
(build_dict[key].status !== "built" &&
build_dict[key].status !== "built failed"))
build_dict[key].status !== "build failed"))
entry = build_dict[key];
}
}
if (entry && (entry.status === 'built' ||
entry.status === "built failed"))
entry.status === "build failed"))
return;
return entry;
});
......@@ -85,7 +85,8 @@
return gadget.getIndexToBuild()
.push(function (entry) {
var link_list,
tmp_element;
tmp_element,
failed = false;
if (!entry)
// wait 5s and check again if there is something to build
return RSVP.delay(5000);
......@@ -108,6 +109,7 @@
.push(undefined, function (my_error) {
showError(my_error);
gadget.state.current_build = undefined;
failed = true;
status = 'build failed';
return gadget.notifySubmitted({
message: "Index '" + entry.index_name + "' built failed!",
......@@ -116,25 +118,27 @@
})
.push(function () {
gadget.state.current_build = undefined;
return gadget.getSetting('build_dict', {});
return gadget.getSetting('build_dict', {})
})
.push(function (current) {
if (!current[entry.jio_key]) {
console.log("Error: cannot get key '" + entry.jio_key +
"' in build_dict");
"' in build Queue");
return;
}
current[entry.jio_key].status = status;
return gadget.setSetting('build_dict', current);
})
.push(function () {
if (failed)
return;
return gadget.state.model_gadget.updateIndexDoc(
entry.jio_key,
{status: 'built'}
);
})
.push(function () {
return gadget.state.model_gadget.pushIndex(entry.index_name);
)
.push(function () {
return gadget.state.model_gadget.pushIndex(entry.index_name);
});
});
}
})
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>989.8588.57452.32853</string> </value>
<value> <string>990.2089.59132.27426</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1610530616.84</float>
<float>1613386502.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -20,17 +20,18 @@
var return_submit_dict,
gadget = this,
list = parent_options.doc.links,
index_name = parent_options.doc.title;
index_name = parent_options.doc.title,
jio_key = parent_options.action_options.jio_key;
return gadget.getSetting("build_dict", {})
.push(function(build_dict){
build_dict[parent_options.action_options.jio_key] = {
links: list,
index_name: index_name,
jio_key: parent_options.action_options.jio_key,
id: Date.now()
};
return gadget.setSetting("build_dict", build_dict);
build_dict[jio_key] = {
links: list,
index_name: index_name,
jio_key: jio_key,
id: Date.now()
};
return gadget.setSetting("build_dict", build_dict);
})
.push(function(){
return_submit_dict = {
......@@ -40,7 +41,7 @@
},
redirect: {
command: "display",
options: {page : "ojs_local_controller"}
options: {page : "ojs_local_controller", jio_key: jio_key}
}
};
return return_submit_dict;
......
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