Commit 5374854a authored by Michael Lange's avatar Michael Lange
Browse files

Redo the logic around showing namespaces

Don't show namespaces if the only namespace is `default`
parent 91ed1d5f
Showing with 8 additions and 2 deletions
+8 -2
......@@ -4,6 +4,7 @@ import Sortable from 'nomad-ui/mixins/sortable';
const { Controller, computed, inject } = Ember;
export default Controller.extend(Sortable, {
system: inject.service(),
jobController: inject.controller('jobs.job'),
queryParams: {
......
......@@ -28,6 +28,11 @@ export default Service.extend({
return this.get('store').findAll('namespace');
}),
shouldShowNamespaces: computed('namespaces.[]', function() {
const namespaces = this.get('namespaces').toArray();
return namespaces.length && namespaces.some(namespace => namespace.get('id') !== 'default');
}),
activeNamespace: computed('namespaces.[]', {
get() {
const namespaceId = window.localStorage.nomadActiveNamespace || 'default';
......
......@@ -5,7 +5,7 @@
Workload
</p>
<ul class="menu-list">
{{#if system.namespaces.length}}
{{#if system.shouldShowNamespaces}}
<li>
<div class="menu-item">
{{#power-select
......
......@@ -20,7 +20,7 @@
<div class="boxed-section-body">
<span><strong>Type:</strong> {{model.type}} | </span>
<span><strong>Priority:</strong> {{model.priority}} </span>
{{#if model.namespace}}
{{#if (and model.namespace system.shouldShowNamespaces)}}
<span> | <strong>Namespace:</strong> {{model.namespace.name}}</span>
{{/if}}
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment