diff --git a/package-lock.json b/package-lock.json index e2c7b52e..78d2ff10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5753,8 +5753,6 @@ }, "node_modules/npm/node_modules/ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", "dev": true, "inBundle": true, "license": "MIT", @@ -6027,9 +6025,7 @@ } }, "node_modules/npm/node_modules/cli-table3/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "5.0.0", "dev": true, "inBundle": true, "license": "MIT", @@ -7626,9 +7622,7 @@ } }, "node_modules/npm/node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "version": "6.5.2", "dev": true, "inBundle": true, "license": "BSD-3-Clause", @@ -7973,9 +7967,7 @@ } }, "node_modules/npm/node_modules/string-width/node_modules/ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "version": "3.0.0", "dev": true, "inBundle": true, "license": "MIT", @@ -14863,8 +14855,6 @@ }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", "bundled": true, "dev": true }, @@ -15060,9 +15050,7 @@ }, "dependencies": { "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "version": "5.0.0", "bundled": true, "dev": true }, @@ -16215,9 +16203,7 @@ "dev": true }, "qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "version": "6.5.2", "bundled": true, "dev": true }, @@ -16458,9 +16444,7 @@ }, "dependencies": { "ansi-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", - "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "version": "3.0.0", "bundled": true, "dev": true }, diff --git a/src/server/views/dashboard/queueJobsByState.js b/src/server/views/dashboard/queueJobsByState.js index 3dfc84a1..6b3817d2 100644 --- a/src/server/views/dashboard/queueJobsByState.js +++ b/src/server/views/dashboard/queueJobsByState.js @@ -102,6 +102,7 @@ async function _html(req, res) { const page = parseInt(req.query.page, 10) || 1; const pageSize = parseInt(req.query.pageSize, 10) || 100; const order = req.query.order || 'desc'; + const wildcard = req.query.wildcard || null; const startId = (page - 1) * pageSize; const endId = startId + pageSize - 1; @@ -123,7 +124,18 @@ async function _html(req, res) { jobs = jobs.filter((job) => job); } else { const stateTypes = state === 'waiting' ? ['wait', 'paused'] : state; - jobs = await queue.getJobs(stateTypes, startId, endId, order === 'asc'); + jobs = await queue.getJobs( + stateTypes, + startId, + endId, + order === 'asc', + {}, + wildcard + ); + if (wildcard) { + const regex = new RegExp(wildcard.replace(/\*/g, '.*')); + jobs = jobs.filter((job) => regex.test(job.id)); + } } for (let i = 0; i < jobs.length; i++) { @@ -178,6 +190,8 @@ async function _html(req, res) { pageSize, lastPage: _.last(pages), order, + totalJobs: _.size(jobs), + wildcard, }); } diff --git a/src/server/views/dashboard/templates/queueDetails.hbs b/src/server/views/dashboard/templates/queueDetails.hbs index 396baadb..559184b0 100644 --- a/src/server/views/dashboard/templates/queueDetails.hbs +++ b/src/server/views/dashboard/templates/queueDetails.hbs @@ -104,4 +104,62 @@ window.arenaInitialPayload = { queueHost: "{{ queueHost }}", queueName: "{{ queueName }}" }; -{{/contentFor}} \ No newline at end of file +{{/contentFor}} + +
+ + + +
+ diff --git a/src/server/views/dashboard/templates/queueJobsByState.hbs b/src/server/views/dashboard/templates/queueJobsByState.hbs index d41dfa8d..2eff2881 100644 --- a/src/server/views/dashboard/templates/queueJobsByState.hbs +++ b/src/server/views/dashboard/templates/queueJobsByState.hbs @@ -1,190 +1,126 @@ -

Queue {{ queueHost }}/{{ queueName }}

- -

{{capitalize state}} Jobs

-
-
- {{#unless disablePagination}} - + {{else}} + Bee-queue does not support pagination for {{ state }} queues — currently displaying up to {{ pageSize }} + jobs. To change count, use "Size" dropdown. + {{/unless}} +
+
+ + Dump jobs to JSON (limited to 1000) + + + {{#unless disableClean}} + + {{/unless}} + {{#unless disableRetry}} + + {{/unless}} + {{#unless disablePromote}} + + {{/unless}} -
-
- - {{#unless disableOrdering}} -
- -
- {{/unless}}
-
-
- -
-
-
- -
-
- -

- Hint: + Click to select a range of - jobs. -

- -{{#contentFor 'sidebar'}} -
  • Queues Overview
  • -
  • Queue - {{ queueHost }}/{{ queueName }}
  • -
  • {{capitalize state}} Jobs
  • -{{#if hasFlows}} -
  • Flows Overview
  • -{{/if}} -{{/contentFor}} \ No newline at end of file diff --git a/src/server/views/helpers/queueHelpers.js b/src/server/views/helpers/queueHelpers.js index 75b0e3bd..49936699 100644 --- a/src/server/views/helpers/queueHelpers.js +++ b/src/server/views/helpers/queueHelpers.js @@ -31,12 +31,35 @@ function formatBytes(num) { return (neg ? '-' : '') + numStr + ' ' + unit; } +function splitInfo(res) { + if (typeof res !== 'string') { + return {}; + } + + const serverInfo = {}; + const lines = res.split('\r\n'); + for (let i = 0; i < lines.length; ++i) { + if (lines[i]) { + const line = lines[i].trim(); + if (!line.startsWith('#')) { + const idx = line.indexOf(':'); + if (idx > 0) { + serverInfo[line.substring(0, idx)] = line.substring(idx + 1); + } + } + } + } + + return serverInfo; +} + const Helpers = { getStats: async function (queue) { const client = await queue.client; - await client.info(); // update queue.client.serverInfo + const info = await client.info(); // In node-redis this will update queue.client.serverInfo - const stats = _.pickBy(client.serverInfo, (value, key) => + // In ioredis we need to parse this information: + const stats = _.pickBy(client.serverInfo || splitInfo(info), (value, key) => _.includes(this._usefulMetrics, key) ); stats.used_memory = formatBytes(parseInt(stats.used_memory, 10)); @@ -81,7 +104,6 @@ const Helpers = { */ BULLMQ_STATES: [ 'waiting', - 'prioritized', 'active', 'completed', 'failed',