Fix model for action-menu on hosts page

rancher/rancher#9009
This commit is contained in:
Westly Wright 2017-06-08 16:05:44 -07:00
parent a6932e7564
commit 50aa2c7edc
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
3 changed files with 23 additions and 17 deletions

View File

@ -3,11 +3,10 @@ import ContainerSparkStats from 'ui/mixins/container-spark-stats';
export default Ember.Controller.extend(ContainerSparkStats, {
application: Ember.inject.controller(),
host: Ember.computed.alias('model.host'),
host: Ember.computed.alias('model.host'),
queryParams: ['sortBy'],
sortBy: 'name',
// Dynamic sortby?
// sortBy: 'ip',
sortBy: 'name',
nonRootVolumes: function() {
return this.get('model.storagePools').filter(function(volume) {
return !volume.get('instanceId') && volume.get('state') !== 'purged';

View File

@ -3,15 +3,21 @@ import MultiStatsSocket from 'ui/utils/multi-stats';
export default Ember.Route.extend({
statsSocket: null,
model: function(params) {
var store = this.get('store');
return store.findAll('host').then((all) => {
return Ember.RSVP.hash({
host: store.find('host', params.host_id),
service: store.findAll('service'),
host: store.find('host', params.host_id),
service: store.findAll('service'),
instance: store.findAll('instance'),
}).then((hash) => {
return hash.host.followLink('storagePools').then((pools) => {
var out = [];
var promises = pools.map((pool) => {
return pool.followLink('volumes',{include: ['mounts']}).then((volumes) => {
@ -21,8 +27,8 @@ export default Ember.Route.extend({
return Ember.RSVP.all(promises).then(() => {
return Ember.Object.create({
all: all,
host: hash.host,
all: all,
host: hash.host,
storagePools: out
});
});
@ -36,6 +42,7 @@ export default Ember.Route.extend({
},
setupSocketConnection: function() {
if (this.get('statsSocket')) {
this.deactivate();
}

View File

@ -6,8 +6,8 @@
{{info-multi-stats model=host linkName="hostStats" largeTargetId="largeStats"}}
</div>
<div class="right-buttons">
{{badge-state model=model}}
{{action-menu model=model showPrimary=false classNames="ml-10 pull-right" size="sm"}}
{{badge-state model=host}}
{{action-menu model=host showPrimary=false classNames="ml-10 pull-right" size="sm"}}
</div>
</section>
@ -147,15 +147,15 @@
{{#accordion-list-item
title=(t 'hostsPage.hostPage.containersTab.header')
detail=(t 'hostsPage.hostPage.containersTab.detail')
status=(t 'hostsPage.hostPage.containersTab.status' count=model.host.arrangedInstances.length)
statusClass=(if model.host.arrangedInstances.length 'bg-success' 'text-muted')
status=(t 'hostsPage.hostPage.containersTab.status' count=host.arrangedInstances.length)
statusClass=(if host.arrangedInstances.length 'bg-success' 'text-muted')
expandAll=al.expandAll
expand=(action expandFn)
componentName='container-table'
as | parent |
}}
{{component parent.intent
body=model.host.arrangedInstances
body=host.arrangedInstances
sortBy=sortBy
bulkActions=true
search=true
@ -168,8 +168,8 @@
{{#accordion-list-item
title=(t 'hostsPage.hostPage.portsTab.header')
detail=(t 'hostsPage.hostPage.portsTab.detail')
status=(t 'containerPage.portsTab.status' count=model.host.displayEndpoints.length)
statusClass=(if model.host.displayEndpoints.length 'bg-success' 'text-muted')
status=(t 'containerPage.portsTab.status' count=host.displayEndpoints.length)
statusClass=(if host.displayEndpoints.length 'bg-success' 'text-muted')
expandAll=al.expandAll
expand=(action expandFn)
componentName='sortable-table'
@ -184,7 +184,7 @@
stickyHeader=false
descending=descending
headers=portHeaders
body=model.host.displayEndpoints
body=host.displayEndpoints
as |sortable kind port|
}}
{{#if (eq kind "row")}}
@ -219,7 +219,7 @@
{{/accordion-list-item}}
{{labels-section
model=model.host
model=host
tagName=''
expandAll=al.expandAll
expandFn=expandFn