From 0d433b1c8910e217b647aa98fa07ecca9d44b5a5 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 9 Jul 2020 17:01:34 -0700 Subject: [PATCH 1/2] Filter out new records from the job list page When a prefix is set and the run job button is clicked, the new job causes an error because it has no name yet. --- ui/app/controllers/jobs/index.js | 1 + ui/tests/acceptance/jobs-list-test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ui/app/controllers/jobs/index.js b/ui/app/controllers/jobs/index.js index c6312472fb4..c1cacfbcc18 100644 --- a/ui/app/controllers/jobs/index.js +++ b/ui/app/controllers/jobs/index.js @@ -163,6 +163,7 @@ export default class IndexController extends Controller.extend(Sortable, Searcha return this.model .compact() + .filter(job => !job.isNew) .filter(job => !hasNamespaces || job.get('namespace.id') === activeNamespace) .filter(job => !job.get('parent.content')); } diff --git a/ui/tests/acceptance/jobs-list-test.js b/ui/tests/acceptance/jobs-list-test.js index bf0d7b1a55a..ff5b438381c 100644 --- a/ui/tests/acceptance/jobs-list-test.js +++ b/ui/tests/acceptance/jobs-list-test.js @@ -452,5 +452,19 @@ module('Acceptance | jobs list', function(hooks) { 'URL has the correct query param key and value' ); }); + + test('the run job button works when filters are set', async function(assert) { + ['pre-one', 'pre-two', 'pre-three'].forEach(name => { + server.create('job', { name, createAllocations: false, childrenCount: 0 }); + }); + + await JobsList.visit(); + + await JobsList.facets.prefix.toggle(); + await JobsList.facets.prefix.options[0].toggle(); + + await JobsList.runJobButton.click(); + assert.equal(currentURL(), '/jobs/run'); + }); } }); From 8c3d514d0c89b36ecf9d5c55b1773469eded595c Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Fri, 10 Jul 2020 15:31:25 -0700 Subject: [PATCH 2/2] Changelog addition --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3884aec86f5..265d6ac68ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ BUG FIXES: * ui: Fixed order of column headers in client allocations table. [[GH-8409](https://github.com/hashicorp/nomad/pull/8409)] * ui: Fixed stale namespaces after changing acl tokens. [[GH-8413](https://github.com/hashicorp/nomad/issues/8413)] * ui: Fixed missing namespace query param after changing acl tokens [[GH-8413](https://github.com/hashicorp/nomad/issues/8413)] + * ui: Fixed runtime error when clicking "Run Job" while a prefix filter is set [[GH-8412](https://github.com/hashicorp/nomad/issues/8412)] * vault: Fixed a bug where vault identity policies not considered in permissions check [[GH-7732](https://github.com/hashicorp/nomad/issues/7732)] ## 0.12.0 (July 9, 2020)