summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2014-10-31 16:18:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-12 17:04:49 +0000
commit6f0496ef557cddda8fc8d71b414aa70e72e91aa8 (patch)
treed7a3beb6dd4631e50ccc2d4f422ffedff22c95f6
parent6cfd8aa148bbcbc268bc3cd9da8a30145e72f066 (diff)
downloadast2050-yocto-poky-6f0496ef557cddda8fc8d71b414aa70e72e91aa8.zip
ast2050-yocto-poky-6f0496ef557cddda8fc8d71b414aa70e72e91aa8.tar.gz
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>
-rw-r--r--bitbake/lib/toaster/toastergui/templates/filtersnippet.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layers.html13
-rw-r--r--bitbake/lib/toaster/toastergui/templates/targets.html10
3 files changed, 25 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/filtersnippet.html b/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
index 90ffd3d..fe70e71 100644
--- a/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
+++ b/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
@@ -18,10 +18,10 @@
{% for option in f.options %}
{% if option.2 %}
<label class="radio">
- <input type="radio" name="filter" {%if request.GET.filter == option.1 %}checked{%endif%} value="{{option.1}}"> {{option.0}} ({{option.2}})
+ <input type="radio" name="filter" {%if request.GET.filter == option.1 %}checked{%endif%} value="{{option.1}}"> {{option.0}} (<span id="{{option.1}}_count">{{option.2}}</span>)
{% else %}
<label class="radio muted">
- <input type="radio" name="filter" disabled {%if request.GET.filter == option.1 %}checked{%endif%} value="{{option.1}}"> {{option.0}} ({{option.2}})
+ <input type="radio" name="filter" disabled {%if request.GET.filter == option.1 %}checked{%endif%} value="{{option.1}}"> {{option.0}} (<span id="{{option.1}}_count">{{option.2}}</span>)
{% endif %}
{% if option.3 %}<i class="icon-question-sign get-help" data-placement="right" title="{{option.3}}"></i>{% endif %}
</label>
diff --git a/bitbake/lib/toaster/toastergui/templates/layers.html b/bitbake/lib/toaster/toastergui/templates/layers.html
index db34fe4..8cb079d 100644
--- a/bitbake/lib/toaster/toastergui/templates/layers.html
+++ b/bitbake/lib/toaster/toastergui/templates/layers.html
@@ -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);
}
diff --git a/bitbake/lib/toaster/toastergui/templates/targets.html b/bitbake/lib/toaster/toastergui/templates/targets.html
index 32a644a..8776a5d 100644
--- a/bitbake/lib/toaster/toastergui/templates/targets.html
+++ b/bitbake/lib/toaster/toastergui/templates/targets.html
@@ -182,6 +182,14 @@ function show_dependencies_modal(layerId, layerName, layerURL, dependencies) {
$('#dependencies_modal').modal('show');
}
+function updateLayerCountLabels (amount) {
+ /* Update the filter labels */
+ var countLabel = $("#layer_version__projectlayer__project\\:{{project.id}}_count");
+ countLabel.text(Number(countLabel.text())+amount);
+
+ var countLabelRemaining = $("#layer_version__projectlayer__project\\:NOT{{project.id}}_count");
+ countLabelRemaining.text(Number(countLabelRemaining.text())-amount);
+}
var pressedButton = undefined;
@@ -194,6 +202,8 @@ function layerAdd(layerId, layerName, layerURL, pressedButtonId) {
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);
}
OpenPOWER on IntegriCloud