diff --git a/app/components/k8s/namespace-rcs/component.js b/app/components/k8s/namespace-rcs/component.js deleted file mode 100644 index 35fa90a7a..000000000 --- a/app/components/k8s/namespace-rcs/component.js +++ /dev/null @@ -1,15 +0,0 @@ -import Ember from 'ember'; -import FilterState from 'ui/mixins/filter-state'; - -export default Ember.Component.extend(FilterState, { - model: null, - single: false, - classNames: ['stack-section'], - - filtered: function() { - return (this.get('model.services')||[]).filter((row) => { - return row.get('kind').toLowerCase() === 'kubernetesreplicationcontroller' && - (['removing','removed','purging','purged'].indexOf(row.get('state')) === -1); - }); - }.property('model.services.@each.{kind,state}'), -}); diff --git a/app/components/k8s/namespace-rcs/template.hbs b/app/components/k8s/namespace-rcs/template.hbs deleted file mode 100644 index f5d4a0168..000000000 --- a/app/components/k8s/namespace-rcs/template.hbs +++ /dev/null @@ -1,64 +0,0 @@ -{{#unless single}} -
-
- -
-   -
- - -
-

- "{{model.name}}" Namespace -

- {{#if model.description}} -
{{model.description}}
- {{/if}} -
- -
- {{#link-to "k8s-tab.namespace.services.new" classNames="btn btn-default btn-sm"}}Add Service{{/link-to}} -
-
-{{/unless}} - -
- {{#if filtered.length}} - - - {{#each filtered as |service|}} - - - - - - - - - - - - - {{/each}} - -
- {{badge-state model=service}} - - {{#link-to "service" service.environmentId service.id}}{{service.displayName}}{{/link-to}} - - {{service.displayPorts}} - {{service.displaySelectors}} - - {{#if service.serviceType}} - {{service.serviceType}} - {{else}} - None? - {{/if}} - - {{action-menu model=service}} -
- {{else}} -
No Services
- {{/if}} -
- diff --git a/app/components/k8s/rc-instances/component.js b/app/components/k8s/rc-instances/component.js new file mode 100644 index 000000000..55dac36eb --- /dev/null +++ b/app/components/k8s/rc-instances/component.js @@ -0,0 +1,17 @@ +import Ember from 'ember'; +import FasterLinksAndMenus from 'ui/mixins/faster-links-and-menus'; +import FilterState from 'ui/mixins/filter-state'; + +export default Ember.Component.extend(FasterLinksAndMenus, FilterState, { + projects: Ember.inject.service(), + + detailBaseUrl: function() { + return `/env/${this.get('projects.current.id')}/infra/containers/`; + }.property('projects.current.id'), + + model: null, + single: false, + classNames: ['stack-section'], + + filterableContent: Ember.computed.alias('model.instances'), +}); diff --git a/app/components/k8s/rc-instances/template.hbs b/app/components/k8s/rc-instances/template.hbs new file mode 100644 index 000000000..633ba22bc --- /dev/null +++ b/app/components/k8s/rc-instances/template.hbs @@ -0,0 +1,48 @@ +
+
+ +
+   +
+ + +
+

+ {{model.name}} +

+ {{#if model.description}} +
{{model.description}}
+ {{/if}} +
+ +
+ {{action-menu model=model}} +
+
+ +
+ {{#if filtered.length}} + + + {{#each filtered as |inst|}} + + + + + + + + {{/each}} + +
+ {{badge-state model=inst}} + + {{inst.displayName}} + + {{action-menu model=inst}} +
+ {{else}} +
No Pods
+ {{/if}} +
+ diff --git a/app/k8s-tab/index/route.js b/app/k8s-tab/index/route.js index 5126ebe4d..da0d3d1e4 100644 --- a/app/k8s-tab/index/route.js +++ b/app/k8s-tab/index/route.js @@ -1,12 +1,21 @@ import Ember from 'ember'; +import C from 'ui/utils/constants'; export default Ember.Route.extend({ k8s: Ember.inject.service(), + 'tab-session': Ember.inject.service('tab-session'), redirect() { - if ( this.get('k8s.namespaces.length') ) + var all = this.get('k8s.namespaces')||[]; + var nsId = this.get(`tab-session.${C.TABSESSION.NAMESPACE}`); + + if ( all.filterBy('id', nsId).get('length') > 0 ) { - this.transitionTo('k8s-tab.namespace', this.get('k8s.namespaces.firstObject.id')); + this.transitionTo('k8s-tab.namespace', nsId); + } + else if ( all.get('length') ) + { + this.transitionTo('k8s-tab.namespace', all.objectAt(0).get('id')); } }, }); diff --git a/app/k8s-tab/namespace/rcs/index/template.hbs b/app/k8s-tab/namespace/rcs/index/template.hbs index 7937b8eeb..140229c22 100644 --- a/app/k8s-tab/namespace/rcs/index/template.hbs +++ b/app/k8s-tab/namespace/rcs/index/template.hbs @@ -4,24 +4,10 @@ {{#link-to "k8s-tab.namespace.rcs.new" classNames="btn btn-sm btn-primary"}}Add Replication Controller{{/link-to}} -
- - - - {{sortable-th sortable=this action="changeSort" name="state" width="125"}} - {{sortable-th sortable=this action="changeSort" name="name"}} - - - - - - - {{#each arranged as |services|}} - {{k8s/rc-row model=services}} - {{else}} - - {{/each}} - -
ReplicasImage 
You do not have any Replication Controllers yet.
+
+ {{#each arranged as |service|}} + {{k8s/rc-instances model=service}} + {{else}} + You do not have any Replication Controllers yet. + {{/each}}
- diff --git a/app/k8s-tab/namespace/rcs/route.js b/app/k8s-tab/namespace/rcs/route.js index 47783970e..c8c289f6b 100644 --- a/app/k8s-tab/namespace/rcs/route.js +++ b/app/k8s-tab/namespace/rcs/route.js @@ -2,6 +2,12 @@ import Ember from 'ember'; export default Ember.Route.extend({ model() { - return this.modelFor('k8s-tab.namespace'); + var ns = this.modelFor('k8s-tab.namespace'); + return this.get('store').find('service', null, {include: 'instances', filter: { environmentId: ns.get('id') } }).then((services) => { + return Ember.Object.create({ + ns: ns, + services: services, + }); + }); }, }); diff --git a/app/k8s-tab/namespace/route.js b/app/k8s-tab/namespace/route.js index 36718e8c4..866a789e0 100644 --- a/app/k8s-tab/namespace/route.js +++ b/app/k8s-tab/namespace/route.js @@ -1,10 +1,13 @@ import Ember from 'ember'; +import C from 'ui/utils/constants'; export default Ember.Route.extend({ k8s: Ember.inject.service(), + 'tab-session': Ember.inject.service('tab-session'), model(params) { return this.get('store').find('environment', params.namespace_id).then((ns) => { + this.set(`tab-session.${C.TABSESSION.NAMESPACE}`, ns.get('id')); this.set('k8s.namespace', ns); return ns; }).catch((/*err*/) => { diff --git a/app/utils/constants.js b/app/utils/constants.js index f39749689..f7ce19c16 100644 --- a/app/utils/constants.js +++ b/app/utils/constants.js @@ -150,6 +150,7 @@ var C = { // Ephemeral and unique for each browser tab TABSESSION: { PROJECT: 'projectId', + NAMESPACE: 'namespaceId', }, SETTING: {