diff --git a/app/authenticated/clusters/index/template.hbs b/app/authenticated/clusters/index/template.hbs index 81615b6b1..0d13e210c 100644 --- a/app/authenticated/clusters/index/template.hbs +++ b/app/authenticated/clusters/index/template.hbs @@ -16,7 +16,7 @@ {{t 'clustersPage.newCluster'}} {{/link-to}} - {{#link-to "authenticated.clusters.new-project" class="btn bg-primary btn-sm icon-btn"}} + {{#link-to "authenticated.clusters.new-project" class="btn bg-primary btn-sm icon-btn" disabled=(eq model.clusters.length 0)}} {{t 'clustersPage.newProject'}} {{/link-to}} @@ -46,13 +46,19 @@ pagingLabel="pagination.cluster" headers=headers as |sortable kind inst dt| }} - {{cluster-row - model=inst - fullColspan=sortable.fullColspan - toggle=(action "toggleExpand" inst.id) - expanded=(array-includes expandedClusters inst.id) - dt=dt - }} + {{#if (eq kind "row")}} + {{cluster-row + model=inst + fullColspan=sortable.fullColspan + toggle=(action "toggleExpand" inst.id) + expanded=(array-includes expandedClusters inst.id) + dt=dt + }} + {{else if (eq kind "nomatch")}} + {{t 'clusterRow.noClusterMatch'}} + {{else if (eq kind "norows")}} + {{t 'clusterRow.noClusterData'}} + {{/if}} {{/sortable-table}} {{else}} {{project-table model=model.projects showCluster=true}} diff --git a/app/hosts/index/template.hbs b/app/hosts/index/template.hbs index d75ce3c0c..f1acb48cc 100644 --- a/app/hosts/index/template.hbs +++ b/app/hosts/index/template.hbs @@ -19,7 +19,9 @@ {{/if}} - {{#link-to "authenticated.clusters.cluster.host-templates.index" projects.currentCluster.id classNames="btn btn-sm bg-primary"}}{{t 'hostsPage.index.addHost'}}{{/link-to}} + {{#if projects.current.canAddHost}} + {{#link-to "authenticated.clusters.cluster.host-templates.index" projects.currentCluster.id classNames="btn btn-sm bg-primary"}}{{t 'hostsPage.index.addHost'}}{{/link-to}} + {{/if}} diff --git a/app/models/project.js b/app/models/project.js index 61738fc16..876681c4d 100644 --- a/app/models/project.js +++ b/app/models/project.js @@ -18,6 +18,9 @@ var Project = Resource.extend(PolledResource, { cluster: denormalizeId('clusterId'), + canAddHost: Ember.computed.notEmpty('cluster.registrationToken.hostCommand'), + canImport: Ember.computed.notEmpty('cluster.registrationToken.clusterCommand'), + actions: { edit: function() { this.get('router').transitionTo('authenticated.clusters.project', this.get('id')); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 6d28ba177..75e17e46a 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1310,9 +1310,11 @@ catalogSettings: placeholder: 'e.g. master' clusterRow: - noMatch: No environments match the current search + noMatch: No environments match the current search. noData: This cluster doesn't have any environments yet. noHosts: External cluster has no hosts + noClusterMatch: No clusters match the current search. + noClusterData: There are no clusters yet. addHost: Add Hosts importCluster: Use existing Kubernetes loginDefault: Login