mirror of https://github.com/rancher/ui.git
Fix workload detail page issue
This commit is contained in:
parent
8538c0fa6f
commit
8adbe0d3be
|
|
@ -253,7 +253,6 @@ var Workload = Resource.extend(DisplayImage, StateCounts, EndpointPorts, {
|
|||
// @TODO-2.0 cleanup all these...
|
||||
isReal: true,
|
||||
hasPorts: true,
|
||||
hasImage: true,
|
||||
canUpgrade: true,
|
||||
canHaveLabels: true,
|
||||
canScale: computed('lcType', function() {
|
||||
|
|
|
|||
|
|
@ -1,146 +1,19 @@
|
|||
import { computed } from '@ember/object';
|
||||
import { oneWay } from '@ember/object/computed';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Controller, { inject as controller } from '@ember/controller';
|
||||
import { get, set } from '@ember/object';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import Controller from '@ember/controller';
|
||||
import { get } from '@ember/object';
|
||||
|
||||
export default Controller.extend({
|
||||
application: controller(),
|
||||
scope: service(),
|
||||
allWorkloads: service(),
|
||||
service: alias('model.workload'),
|
||||
|
||||
service: oneWay('model.workload'),
|
||||
namespace: "",
|
||||
sortBy: 'priority',
|
||||
fixedLaunchConfig: null,
|
||||
activeLaunchConfig: null,
|
||||
portSortBy: 'privatePort',
|
||||
init(){
|
||||
this._super(...arguments);
|
||||
let namespaceId = null;
|
||||
namespaceId = get(this, 'service.namespaceId');
|
||||
|
||||
if (namespaceId) {
|
||||
let namespace = get(this, 'clusterStore').getById('namespace', namespaceId);
|
||||
if (namespace) {
|
||||
set(this, 'namespace', namespace);
|
||||
}
|
||||
}
|
||||
},
|
||||
headers: [
|
||||
{
|
||||
name: 'priority',
|
||||
sort: ['priority'],
|
||||
translationKey: 'formBalancerRules.priority.label',
|
||||
width: 85,
|
||||
},
|
||||
{
|
||||
name: 'access',
|
||||
sort: ['access'],
|
||||
translationKey: 'formBalancerRules.access.label',
|
||||
width: 85,
|
||||
},
|
||||
{
|
||||
name: 'protocol',
|
||||
sort: ['protocol'],
|
||||
translationKey: 'formBalancerRules.protocol.label',
|
||||
width: 95
|
||||
},
|
||||
{
|
||||
name: 'hostname',
|
||||
sort: ['hostname'],
|
||||
translationKey: 'formBalancerRules.hostname.label',
|
||||
},
|
||||
{
|
||||
name: 'sourcePort',
|
||||
sort: ['sourcePort'],
|
||||
translationKey: 'formBalancerRules.sourcePort.label',
|
||||
width: 145
|
||||
},
|
||||
{
|
||||
name: 'path',
|
||||
sort: ['path'],
|
||||
translationKey: 'formBalancerRules.path.label',
|
||||
},
|
||||
{
|
||||
name: 'target',
|
||||
translationKey: 'formBalancerRules.target',
|
||||
},
|
||||
{
|
||||
name: 'targetPort',
|
||||
sort: ['targetPort'],
|
||||
translationKey: 'formBalancerRules.targetPort.label',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
name: 'backendName',
|
||||
sort: ['backendName'],
|
||||
translationKey: 'formBalancerRules.backendName.label',
|
||||
},
|
||||
],
|
||||
|
||||
portHeaders: [
|
||||
{
|
||||
name: 'publicIp',
|
||||
sort: ['ipAddress'],
|
||||
searchField: 'ipAddress',
|
||||
translationKey: 'generic.ipAddress',
|
||||
},
|
||||
{
|
||||
name: 'publicPort',
|
||||
sort: ['port'],
|
||||
searchField: 'port',
|
||||
translationKey: 'containerPage.portsTab.table.public',
|
||||
},
|
||||
],
|
||||
|
||||
actions: {
|
||||
selectMaster() {
|
||||
this.set('activeLaunchConfig', this.get('fixedLaunchConfig'));
|
||||
},
|
||||
selectSidekick(idx) {
|
||||
let service = this.get('model.workload');
|
||||
let configs = service.get('secondaryLaunchConfigs');
|
||||
|
||||
this.set('activeLaunchConfig', configs[idx]);
|
||||
},
|
||||
changeService(service) {
|
||||
var transitionTo = this.get('application.currentRouteName');
|
||||
|
||||
if (service.type === 'dnsService') {
|
||||
transitionTo = 'service.links';
|
||||
}
|
||||
|
||||
this.transitionToRoute(transitionTo, service.get('id'));
|
||||
}
|
||||
},
|
||||
launchConfig: null,
|
||||
|
||||
displayEnvironmentVars: computed('service.launchConfig.environment', function() {
|
||||
var envs = [];
|
||||
var environment = this.get('service.launchConfig.environment')||{};
|
||||
var environment = get(this, 'service.launchConfig.environment')||{};
|
||||
Object.keys(environment).forEach((key) => {
|
||||
envs.pushObject({key: key, value: environment[key]})
|
||||
});
|
||||
return envs;
|
||||
}),
|
||||
|
||||
serviceLinksNamed: computed('service.serviceLinks.[]', function() {
|
||||
let as = this.get('allWorkloads');
|
||||
|
||||
( this.get('service.serviceLinks') || []).forEach((link) => {
|
||||
if (link) {
|
||||
let matching = as.matching(link.name, this.get('model.stack'));
|
||||
|
||||
if (matching) {
|
||||
link.setProperties({
|
||||
service: matching
|
||||
})
|
||||
}
|
||||
}
|
||||
return link;
|
||||
});
|
||||
|
||||
return this.get('service.serviceLinks');
|
||||
|
||||
})
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ export default Route.extend({
|
|||
let lc = model.get('workload.containers.firstObject');
|
||||
|
||||
controller.setProperties({
|
||||
fixedLaunchConfig: lc,
|
||||
activeLaunchConfig: lc,
|
||||
launchConfig: lc,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
{{/if}}
|
||||
|
||||
<section>
|
||||
<div class="row banner bg-info basics mb-0" style="border-bottom: none;">
|
||||
<div class="row banner bg-info basics mb-0">
|
||||
<div class="vertical-middle">
|
||||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.multistat.namesapce'}}</label>
|
||||
{{service.namespace.displayName}}
|
||||
|
|
@ -38,15 +38,11 @@
|
|||
{{service.displayType}}
|
||||
</div>
|
||||
|
||||
{{#if service.hasImage}}
|
||||
<div class="vertical-middle">
|
||||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.multistat.image'}}</label>
|
||||
{{fixedLaunchConfig.image}} {{copy-to-clipboard clipboardText=fixedLaunchConfig.image size="small"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="vertical-middle">
|
||||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.multistat.image'}}</label>
|
||||
{{launchConfig.image}} {{copy-to-clipboard clipboardText=launchConfig.image size="small"}}
|
||||
</div>
|
||||
|
||||
<div class="row banner bg-info basics mt-0" style="border-top: none;">
|
||||
<div class="vertical-middle">
|
||||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.multistat.scale'}}</label>
|
||||
<span class="pr-5">
|
||||
|
|
@ -61,17 +57,6 @@
|
|||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.multistat.created'}}</label>
|
||||
{{date-calendar service.created}}
|
||||
</div>
|
||||
|
||||
{{#if service.externalIpAddresses}}
|
||||
<div class="vertical-middle">
|
||||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.external.externalIp' count=service.externalIpAddresses.length}}</label>
|
||||
{{join-array service.externalIpAddresses}}
|
||||
</div>
|
||||
{{else if service.hostname}}
|
||||
<div class="vertical-middle">
|
||||
<label class="acc-label vertical-middle p-0">{{t 'servicePage.external.externalHostname'}} </label> {{service.hostname}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
@ -96,7 +81,7 @@
|
|||
<hr class="mt-30 mb-30" />
|
||||
{{container/form-sources
|
||||
namespace=service.namespace
|
||||
sources=activeLaunchConfig.environmentFrom
|
||||
sources=launchConfig.environmentFrom
|
||||
editing=false
|
||||
}}
|
||||
{{/accordion-list-item}}
|
||||
|
|
@ -171,7 +156,7 @@
|
|||
}}
|
||||
|
||||
{{container/form-volumes
|
||||
launchConfig=activeLaunchConfig
|
||||
launchConfig=launchConfig
|
||||
workload=service
|
||||
namespace=service.namespace
|
||||
editing=false
|
||||
|
|
@ -182,9 +167,9 @@
|
|||
{{#if service.isReal}}
|
||||
{{container/form-command
|
||||
tagName=''
|
||||
instance=activeLaunchConfig
|
||||
instance=launchConfig
|
||||
service=model.workload
|
||||
initialLabels=activeLaunchConfig.labels
|
||||
initialLabels=launchConfig.labels
|
||||
editing=false
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
|
|
@ -193,7 +178,7 @@
|
|||
|
||||
{{container/form-networking
|
||||
classNames="accordion-wrapper"
|
||||
instance=activeLaunchConfig
|
||||
instance=launchConfig
|
||||
service=service
|
||||
editing=false
|
||||
expandAll=al.expandAll
|
||||
|
|
@ -210,7 +195,7 @@
|
|||
|
||||
{{#if service.canChangeSecurity}}
|
||||
{{container/form-security
|
||||
instance=activeLaunchConfig
|
||||
instance=launchConfig
|
||||
editing=false
|
||||
expandAll=al.expandAll
|
||||
expandFn=expandFn
|
||||
|
|
|
|||
Loading…
Reference in New Issue