Merge "Add counts to Task headers" into stable-2.16
diff --git a/gr-task-plugin/gr-task-plugin.html b/gr-task-plugin/gr-task-plugin.html
index 7125ee1..c5c04ff 100644
--- a/gr-task-plugin/gr-task-plugin.html
+++ b/gr-task-plugin/gr-task-plugin.html
@@ -46,10 +46,11 @@
<template is="dom-if" if="[[_expand_all]]">
<gr-button
on-tap="_show_all_tap"
- disabled="[[_is_show_all(_show_all)]]"> Show All </gr-button>
+ disabled="[[_is_show_all(_show_all)]]"> Show All ([[_all_count]]) </gr-button>
<gr-button
on-tap="_needs_and_blocked_tap"
- disabled="[[!_is_show_all(_show_all)]]"> Needs + Blocked</gr-button>
+ disabled="[[!_is_show_all(_show_all)]]">
+ Needs + Blocked ([[_ready_count]], [[_fail_count]]) </gr-button>
</template>
</div>
</div>
diff --git a/gr-task-plugin/gr-task-plugin.js b/gr-task-plugin/gr-task-plugin.js
index a58623c..3f284de 100644
--- a/gr-task-plugin/gr-task-plugin.js
+++ b/gr-task-plugin/gr-task-plugin.js
@@ -51,6 +51,24 @@
notify: true,
value: true,
},
+
+ _all_count: {
+ type: Number,
+ notify: true,
+ value: 0,
+ },
+
+ _ready_count: {
+ type: Number,
+ notify: true,
+ value: 0,
+ },
+
+ _fail_count: {
+ type: Number,
+ notify: true,
+ value: 0,
+ },
},
_is_show_all(show_all) {
@@ -122,12 +140,25 @@
return false;
},
+ _compute_counts(task) {
+ this._all_count++;
+ switch (task.status) {
+ case 'FAIL':
+ this._fail_count++;
+ break;
+ case 'READY':
+ this._ready_count++;
+ break;
+ }
+ },
+
_addTasks(tasks) { // rename to process, remove DOM bits
if (!tasks) return [];
tasks.forEach(task => {
task.message = task.hint || task.name;
task.icon = this._computeIcon(task);
task.showOnFilter = this._computeShowOnNeedsAndBlockedFilter(task);
+ this._compute_counts(task);
this._addTasks(task.sub_tasks);
});
return tasks;