mirror of https://github.com/rancher/ui.git
Show k8s insstances
This commit is contained in:
parent
0e48746ad5
commit
c410bbce01
|
|
@ -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}'),
|
||||
});
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
{{#unless single}}
|
||||
<div class="clearfix well r-p0 r-m0">
|
||||
<div class="stack-state {{model.stateBackground}}"><i class="{{model.stateIcon}}"></i></div>
|
||||
|
||||
<div class="header-left collapser">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="header-left name {{if model.description 'with-description'}}">
|
||||
<h4 class="divider clip">
|
||||
"{{model.name}}" Namespace
|
||||
</h4>
|
||||
{{#if model.description}}
|
||||
<div class="text-muted clip">{{model.description}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="header-right stack-template">
|
||||
{{#link-to "k8s-tab.namespace.services.new" classNames="btn btn-default btn-sm"}}Add Service{{/link-to}}
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
<div class="stack-body {{if single 'single-body'}}">
|
||||
{{#if filtered.length}}
|
||||
<table class="grid fixed" style="margin-bottom: 0">
|
||||
<tbody>
|
||||
{{#each filtered as |service|}}
|
||||
<tr>
|
||||
<td class="state">
|
||||
{{badge-state model=service}}
|
||||
</td>
|
||||
|
||||
<td class="force-wrap">
|
||||
{{#link-to "service" service.environmentId service.id}}{{service.displayName}}{{/link-to}}
|
||||
</td>
|
||||
|
||||
|
||||
<td class="force-wrap service-detail">
|
||||
{{service.displayPorts}}
|
||||
{{service.displaySelectors}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{#if service.serviceType}}
|
||||
{{service.serviceType}}
|
||||
{{else}}
|
||||
<span class="text-muted">None?</span>
|
||||
{{/if}}
|
||||
</td>
|
||||
|
||||
<td class="actions wide">
|
||||
{{action-menu model=service}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<div class="text-muted text-center r-p10">No Services</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
|
|
@ -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'),
|
||||
});
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<div class="clearfix well r-p0 r-m0">
|
||||
<div class="stack-state {{model.stateBackground}}"><i class="{{model.stateIcon}}"></i></div>
|
||||
|
||||
<div class="header-left collapser">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="header-left name {{if model.description 'with-description'}}">
|
||||
<h4 class="divider clip">
|
||||
{{model.name}}
|
||||
</h4>
|
||||
{{#if model.description}}
|
||||
<div class="text-muted clip">{{model.description}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div class="header-right stack-template">
|
||||
{{action-menu model=model}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stack-body">
|
||||
{{#if filtered.length}}
|
||||
<table class="grid fixed" style="margin-bottom: 0">
|
||||
<tbody>
|
||||
{{#each filtered as |inst|}}
|
||||
<tr>
|
||||
<td class="state">
|
||||
{{badge-state model=inst}}
|
||||
</td>
|
||||
|
||||
<td class="force-wrap">
|
||||
<a href="{{detailBaseUrl}}{{inst.id}}" data-transition-link="true">{{inst.displayName}}</a>
|
||||
</td>
|
||||
|
||||
<td class="actions wide">
|
||||
{{action-menu model=inst}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<div class="text-muted text-center r-p10">No Pods</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
|
|
@ -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'));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,24 +4,10 @@
|
|||
{{#link-to "k8s-tab.namespace.rcs.new" classNames="btn btn-sm btn-primary"}}Add Replication Controller{{/link-to}}
|
||||
</section>
|
||||
|
||||
<section class="well instances">
|
||||
<table class="grid fixed" style="margin-bottom: 0;">
|
||||
<thead>
|
||||
<tr>
|
||||
{{sortable-th sortable=this action="changeSort" name="state" width="125"}}
|
||||
{{sortable-th sortable=this action="changeSort" name="name"}}
|
||||
<th>Replicas</th>
|
||||
<th>Image</th>
|
||||
<th class="actions" width="100"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each arranged as |services|}}
|
||||
{{k8s/rc-row model=services}}
|
||||
{{else}}
|
||||
<tr><td colspan="5" class="text-center text-muted">You do not have any Replication Controllers yet.</td></tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<section>
|
||||
{{#each arranged as |service|}}
|
||||
{{k8s/rc-instances model=service}}
|
||||
{{else}}
|
||||
<span class="text-muted text-center">You do not have any Replication Controllers yet.</span>
|
||||
{{/each}}
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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*/) => {
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ var C = {
|
|||
// Ephemeral and unique for each browser tab
|
||||
TABSESSION: {
|
||||
PROJECT: 'projectId',
|
||||
NAMESPACE: 'namespaceId',
|
||||
},
|
||||
|
||||
SETTING: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue