mirror of
https://git.yoctoproject.org/poky
synced 2026-09-12 15:49:36 +02:00
bitbake: toaster: Update filter count labels when Add/Remove layers
When the user has added/removed a layer but no page reload/requery has happened we need to update the filter count labels client side. [YOCTO #6861] (Bitbake rev: d17e8425de6c609394b9a029afa2dcb455df0b3c) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
6cfd8aa148
commit
6f0496ef55
@@ -120,10 +120,21 @@ function _makeXHREditCall(data, onsuccess, onfail) {
|
||||
});
|
||||
}
|
||||
|
||||
function updateLayerCountLabels (amount) {
|
||||
/* Update the filter labels */
|
||||
var countLabel = $("#projectlayer__project\\:{{project.id}}_count");
|
||||
countLabel.text(Number(countLabel.text())+amount);
|
||||
|
||||
var countLabelRemaining = $("#projectlayer__project\\:NOT{{project.id}}_count");
|
||||
countLabelRemaining.text(Number(countLabelRemaining.text())-amount);
|
||||
}
|
||||
|
||||
|
||||
function layerDel(layerId, layerName, layerURL) {
|
||||
tooltipUpdateText = "1 layer deleted";
|
||||
_makeXHREditCall({ 'layerDel': layerId }, function () {
|
||||
updateLayerCountLabels(-1);
|
||||
|
||||
show_alert("You have deleted <strong>1</strong> layer from <a href=\"{% url 'project' project.id%}\">{{project.name}}</a>: <a href=\""+layerURL+"\">" + layerName +"</a>");
|
||||
});
|
||||
}
|
||||
@@ -187,6 +198,8 @@ function layerAdd(layerId, layerName, layerURL) {
|
||||
if (_data.error != "ok") {
|
||||
alert(_data.error);
|
||||
} else {
|
||||
updateLayerCountLabels(_data.list.length+1);
|
||||
|
||||
if (_data.list.length > 0) {
|
||||
show_dependencies_modal(layerId, layerName, layerURL, _data.list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user