summaryrefslogtreecommitdiffstats
path: root/bitbake
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 /bitbake
parent6cfd8aa148bbcbc268bc3cd9da8a30145e72f066 (diff)
downloadpoky-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>
Diffstat (limited to 'bitbake')
-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 90ffd3de6c..fe70e7143e 100644
--- a/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
+++ b/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
@@ -18,10 +18,10 @@
18 {% for option in f.options %} 18 {% for option in f.options %}
19 {% if option.2 %} 19 {% if option.2 %}
20 <label class="radio"> 20 <label class="radio">
21 <input type="radio" name="filter" {%if request.GET.filter == option.1 %}checked{%endif%} value="{{option.1}}"> {{option.0}} ({{option.2}}) 21 <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>)
22 {% else %} 22 {% else %}
23 <label class="radio muted"> 23 <label class="radio muted">
24 <input type="radio" name="filter" disabled {%if request.GET.filter == option.1 %}checked{%endif%} value="{{option.1}}"> {{option.0}} ({{option.2}}) 24 <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>)
25 {% endif %} 25 {% endif %}
26 {% if option.3 %}<i class="icon-question-sign get-help" data-placement="right" title="{{option.3}}"></i>{% endif %} 26 {% if option.3 %}<i class="icon-question-sign get-help" data-placement="right" title="{{option.3}}"></i>{% endif %}
27 </label> 27 </label>
diff --git a/bitbake/lib/toaster/toastergui/templates/layers.html b/bitbake/lib/toaster/toastergui/templates/layers.html
index db34fe4818..8cb079d0a3 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) {
120 }); 120 });
121} 121}
122 122
123function updateLayerCountLabels (amount) {
124 /* Update the filter labels */
125 var countLabel = $("#projectlayer__project\\:{{project.id}}_count");
126 countLabel.text(Number(countLabel.text())+amount);
127
128 var countLabelRemaining = $("#projectlayer__project\\:NOT{{project.id}}_count");
129 countLabelRemaining.text(Number(countLabelRemaining.text())-amount);
130}
131
123 132
124function layerDel(layerId, layerName, layerURL) { 133function layerDel(layerId, layerName, layerURL) {
125 tooltipUpdateText = "1 layer deleted"; 134 tooltipUpdateText = "1 layer deleted";
126 _makeXHREditCall({ 'layerDel': layerId }, function () { 135 _makeXHREditCall({ 'layerDel': layerId }, function () {
136 updateLayerCountLabels(-1);
137
127 show_alert("You have deleted <strong>1</strong> layer from <a href=\"{% url 'project' project.id%}\">{{project.name}}</a>: <a href=\""+layerURL+"\">" + layerName +"</a>"); 138 show_alert("You have deleted <strong>1</strong> layer from <a href=\"{% url 'project' project.id%}\">{{project.name}}</a>: <a href=\""+layerURL+"\">" + layerName +"</a>");
128 }); 139 });
129} 140}
@@ -187,6 +198,8 @@ function layerAdd(layerId, layerName, layerURL) {
187 if (_data.error != "ok") { 198 if (_data.error != "ok") {
188 alert(_data.error); 199 alert(_data.error);
189 } else { 200 } else {
201 updateLayerCountLabels(_data.list.length+1);
202
190 if (_data.list.length > 0) { 203 if (_data.list.length > 0) {
191 show_dependencies_modal(layerId, layerName, layerURL, _data.list); 204 show_dependencies_modal(layerId, layerName, layerURL, _data.list);
192 } 205 }
diff --git a/bitbake/lib/toaster/toastergui/templates/targets.html b/bitbake/lib/toaster/toastergui/templates/targets.html
index 32a644a743..8776a5d548 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) {
182 $('#dependencies_modal').modal('show'); 182 $('#dependencies_modal').modal('show');
183} 183}
184 184
185function updateLayerCountLabels (amount) {
186 /* Update the filter labels */
187 var countLabel = $("#layer_version__projectlayer__project\\:{{project.id}}_count");
188 countLabel.text(Number(countLabel.text())+amount);
189
190 var countLabelRemaining = $("#layer_version__projectlayer__project\\:NOT{{project.id}}_count");
191 countLabelRemaining.text(Number(countLabelRemaining.text())-amount);
192}
185 193
186var pressedButton = undefined; 194var pressedButton = undefined;
187 195
@@ -194,6 +202,8 @@ function layerAdd(layerId, layerName, layerURL, pressedButtonId) {
194 if (_data.error != "ok") { 202 if (_data.error != "ok") {
195 alert(_data.error); 203 alert(_data.error);
196 } else { 204 } else {
205 updateLayerCountLabels(_data.list.length+1);
206
197 if (_data.list.length > 0) { 207 if (_data.list.length > 0) {
198 show_dependencies_modal(layerId, layerName, layerURL, _data.list); 208 show_dependencies_modal(layerId, layerName, layerURL, _data.list);
199 } 209 }