diff --git a/.changelog/13679.txt b/.changelog/13679.txt
new file mode 100644
index 000000000..2cef210de
--- /dev/null
+++ b/.changelog/13679.txt
@@ -0,0 +1,3 @@
+```release-note:improvement
+ui: Namespace filter query paramters are now isolated by route
+```
diff --git a/ui/app/controllers/csi/volumes/index.js b/ui/app/controllers/csi/volumes/index.js
index 43c30a226..7adee636f 100644
--- a/ui/app/controllers/csi/volumes/index.js
+++ b/ui/app/controllers/csi/volumes/index.js
@@ -1,4 +1,3 @@
-import { set } from '@ember/object';
import { inject as service } from '@ember/service';
import { action, computed } from '@ember/object';
import { alias, readOnly } from '@ember/object/computed';
@@ -64,7 +63,7 @@ export default class IndexController extends Controller.extend(
fuzzySearchEnabled = true;
- @computed('qpNamespace', 'model.namespaces.[]', 'system.cachedNamespace')
+ @computed('qpNamespace', 'model.namespaces.[]')
get optionsNamespaces() {
const availableNamespaces = this.model.namespaces.map((namespace) => ({
key: namespace.name,
@@ -81,7 +80,7 @@ export default class IndexController extends Controller.extend(
// eslint-disable-next-line ember/no-incorrect-calls-with-inline-anonymous-functions
scheduleOnce('actions', () => {
// eslint-disable-next-line ember/no-side-effects
- this.set('qpNamespace', this.system.cachedNamespace || '*');
+ this.set('qpNamespace', '*');
});
}
@@ -101,11 +100,6 @@ export default class IndexController extends Controller.extend(
@alias('listSorted') listToSearch;
@alias('listSearched') sortedVolumes;
- @action
- cacheNamespace(namespace) {
- set(this, 'system.cachedNamespace', namespace);
- }
-
setFacetQueryParam(queryParam, selection) {
this.set(queryParam, serialize(selection));
}
diff --git a/ui/app/controllers/jobs/index.js b/ui/app/controllers/jobs/index.js
index f47792c03..0332a9dc9 100644
--- a/ui/app/controllers/jobs/index.js
+++ b/ui/app/controllers/jobs/index.js
@@ -1,9 +1,8 @@
/* eslint-disable ember/no-incorrect-calls-with-inline-anonymous-functions */
-import { set } from '@ember/object';
import { inject as service } from '@ember/service';
import { alias, readOnly } from '@ember/object/computed';
import Controller from '@ember/controller';
-import { action, computed } from '@ember/object';
+import { computed } from '@ember/object';
import { scheduleOnce } from '@ember/runloop';
import intersection from 'lodash.intersection';
import Sortable from 'nomad-ui/mixins/sortable';
@@ -165,7 +164,7 @@ export default class IndexController extends Controller.extend(
}));
}
- @computed('qpNamespace', 'model.namespaces.[]', 'system.cachedNamespace')
+ @computed('qpNamespace', 'model.namespaces.[]')
get optionsNamespaces() {
const availableNamespaces = this.model.namespaces.map((namespace) => ({
key: namespace.name,
@@ -181,7 +180,7 @@ export default class IndexController extends Controller.extend(
if (!availableNamespaces.mapBy('key').includes(this.qpNamespace)) {
scheduleOnce('actions', () => {
// eslint-disable-next-line ember/no-side-effects
- this.set('qpNamespace', this.system.cachedNamespace || '*');
+ this.set('qpNamespace', '*');
});
}
@@ -252,11 +251,6 @@ export default class IndexController extends Controller.extend(
isShowingDeploymentDetails = false;
- @action
- cacheNamespace(namespace) {
- set(this, 'system.cachedNamespace', namespace);
- }
-
setFacetQueryParam(queryParam, selection) {
this.set(queryParam, serialize(selection));
}
diff --git a/ui/app/controllers/optimize.js b/ui/app/controllers/optimize.js
index 53331cc8f..f249c73cd 100644
--- a/ui/app/controllers/optimize.js
+++ b/ui/app/controllers/optimize.js
@@ -87,7 +87,7 @@ export default class OptimizeController extends Controller {
if (!availableNamespaces.mapBy('key').includes(this.qpNamespace)) {
scheduleOnce('actions', () => {
// eslint-disable-next-line ember/no-side-effects
- this.qpNamespace = this.system.cachedNamespace || '*';
+ this.qpNamespace = '*';
});
}
@@ -247,11 +247,6 @@ export default class OptimizeController extends Controller {
});
}
- @action
- cacheNamespace(namespace) {
- this.system.cachedNamespace = namespace;
- }
-
@action
setFacetQueryParam(queryParam, selection) {
this[queryParam] = serialize(selection);
diff --git a/ui/app/services/system.js b/ui/app/services/system.js
index 1859c701e..a9df19860 100644
--- a/ui/app/services/system.js
+++ b/ui/app/services/system.js
@@ -1,6 +1,5 @@
import Service, { inject as service } from '@ember/service';
import { computed } from '@ember/object';
-import { tracked } from '@glimmer/tracking';
import { alias } from '@ember/object/computed';
import PromiseObject from '../utils/classes/promise-object';
import PromiseArray from '../utils/classes/promise-array';
@@ -132,12 +131,6 @@ export default class SystemService extends Service {
);
}
- // The cachedNamespace is set on pages that have a namespaces filter.
- // It is set so other pages that have a namespaces filter can default to
- // what the previous namespaces filter page used rather than defaulting
- // to 'default' or '*'.
- @tracked cachedNamespace = null;
-
@task(function* () {
const emptyLicense = { License: { Features: [] } };
diff --git a/ui/app/templates/csi/volumes/index.hbs b/ui/app/templates/csi/volumes/index.hbs
index 95774663c..668772ddb 100644
--- a/ui/app/templates/csi/volumes/index.hbs
+++ b/ui/app/templates/csi/volumes/index.hbs
@@ -33,9 +33,7 @@
@label="Namespace"
@options={{this.optionsNamespaces}}
@selection={{this.qpNamespace}}
- @onSelect={{action
- (queue (action this.cacheNamespace) (action this.setFacetQueryParam "qpNamespace"))
- }}
+ @onSelect={{action this.setFacetQueryParam "qpNamespace"}}
/>
diff --git a/ui/app/templates/jobs/index.hbs b/ui/app/templates/jobs/index.hbs
index e08aa1335..3df484328 100644
--- a/ui/app/templates/jobs/index.hbs
+++ b/ui/app/templates/jobs/index.hbs
@@ -43,12 +43,7 @@
@label="Namespace"
@options={{this.optionsNamespaces}}
@selection={{this.qpNamespace}}
- @onSelect={{action
- (queue
- (action this.cacheNamespace)
- (action this.setFacetQueryParam "qpNamespace")
- )
- }}
+ @onSelect={{action this.setFacetQueryParam "qpNamespace"}}
/>
{{/if}}
{{/if}}
r.resource === 'CPU');
+ const currentTaskGroupHasMemoryRecommendation =
+ currentTaskGroup.tasks.models
+ .mapBy('recommendations.models')
+ .flat()
+ .find((r) => r.resource === 'MemoryMB');
+
// If no CPU recommendation, will not be able to accept recommendation with all memory recommendations turned off
if (!currentTaskGroupHasCPURecommendation) {
@@ -85,6 +91,13 @@ module('Acceptance | optimize', function (hooks) {
resource: 'CPU',
});
}
+ if (!currentTaskGroupHasMemoryRecommendation) {
+ const currentTaskGroupTask = currentTaskGroup.tasks.models[0];
+ this.server.create('recommendation', {
+ task: currentTaskGroupTask,
+ resource: 'MemoryMB',
+ });
+ }
await Optimize.visit();
diff --git a/ui/tests/acceptance/volumes-list-test.js b/ui/tests/acceptance/volumes-list-test.js
index 1172a6adf..80541899c 100644
--- a/ui/tests/acceptance/volumes-list-test.js
+++ b/ui/tests/acceptance/volumes-list-test.js
@@ -6,9 +6,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support';
import a11yAudit from 'nomad-ui/tests/helpers/a11y-audit';
import pageSizeSelect from './behaviors/page-size-select';
import VolumesList from 'nomad-ui/tests/pages/storage/volumes/list';
-import Layout from 'nomad-ui/tests/pages/layout';
import percySnapshot from '@percy/ember';
-
const assignWriteAlloc = (volume, alloc) => {
volume.writeAllocs.add(alloc);
volume.allocations.add(alloc);
@@ -193,19 +191,6 @@ module('Acceptance | volumes list', function (hooks) {
assert.equal(VolumesList.volumes.objectAt(0).name, volume2.id);
});
- test('the active namespace is carried over to the jobs pages', async function (assert) {
- server.createList('namespace', 2);
-
- const namespace = server.db.namespaces[1];
- await VolumesList.visit();
- await VolumesList.facets.namespace.toggle();
- await VolumesList.facets.namespace.options.objectAt(2).select();
-
- await Layout.gutter.visitJobs();
-
- assert.equal(currentURL(), `/jobs?namespace=${namespace.id}`);
- });
-
test('when accessing volumes is forbidden, a message is shown with a link to the tokens page', async function (assert) {
server.pretender.get('/v1/volumes', () => [403, {}, null]);