diff --git a/src/index-template.html b/src/index-template.html
index bf91b64..1df212d 100644
--- a/src/index-template.html
+++ b/src/index-template.html
@@ -194,6 +194,9 @@
{{ 'Resume Paused' | translate }}
+
+ {{ 'Purge Paused' | translate }}
+
{{ 'Purge Completed' | translate }}
diff --git a/src/js/ctrls/nav.js b/src/js/ctrls/nav.js
index 9c6d09b..ecb7860 100644
--- a/src/js/ctrls/nav.js
+++ b/src/js/ctrls/nav.js
@@ -143,6 +143,34 @@ export default angular
translate.use(langkey);
};
+ scope.purgeAllPaused = function() {
+ // offset, limit, like sql
+ // count
+ var fetch = function(off, count) {
+ rpc.once("tellWaiting", [off, count], function(data) {
+ var errors = _.filter(data[0], function(d) {
+ return d["status"] == "paused";
+ });
+ console.log("remove paused: " + errors.length);
+ _.forEach(errors, function(d) {
+ rpc.once('remove', [d.gid]);
+ });
+
+ var offset = off;
+ if (errors.length == 0) {
+ offset = off + count;
+ }
+
+ if (data[0].length == count) {
+ fetch(offset, count);
+ } else {
+ console.log("end");
+ }
+ });
+ };
+ fetch(0, 100);
+ };
+
scope.shutDownServer = function() {
rpc.once("shutdown", []);
};