From 01ee6745568b24e9c5c7ebc6561f60a56199cd73 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Fri, 2 Jun 2017 12:21:37 -0700 Subject: [PATCH 1/7] Add env variables and secrets to conatiner details rancher/rancher#8861 --- .../container/form-command/template.hbs | 15 +++++-- .../container/form-secrets/component.js | 22 +++++++--- .../container/form-secrets/template.hbs | 40 +++++++++++++------ app/container/template.hbs | 8 ++++ translations/en-us.yaml | 2 + 5 files changed, 66 insertions(+), 21 deletions(-) diff --git a/app/components/container/form-command/template.hbs b/app/components/container/form-command/template.hbs index 88ba59805..30807e68e 100644 --- a/app/components/container/form-command/template.hbs +++ b/app/components/container/form-command/template.hbs @@ -110,8 +110,8 @@ -
-
+
+
{{#input-or-display editable=editing value=instance.logConfig.driver}} {{input-suggest @@ -121,7 +121,7 @@ }} {{/input-or-display}}
-
+
{{form-key-value initialMap=instance.logConfig.config @@ -133,4 +133,13 @@ }}
+
+
+ + {{form-key-value + initialMap=instance.environment + editing=editing + }} +
+
{{/accordion-list-item}} diff --git a/app/components/container/form-secrets/component.js b/app/components/container/form-secrets/component.js index 676b2f97c..ac9e619f4 100644 --- a/app/components/container/form-secrets/component.js +++ b/app/components/container/form-secrets/component.js @@ -6,24 +6,34 @@ const DEFAULT_GID = '0'; const DEFAULT_MODE = '444'; export default Ember.Component.extend({ - intl: Ember.inject.service(), - secrets: null, + intl: Ember.inject.service(), + secrets: null, + editing: false, showPermissions: false, - allSecrets: null, - haveAny: Ember.computed.gte('allSecrets.length',1), + allSecrets: null, + haveAny: Ember.computed.gte('allSecrets.length',1), init: function() { this._super(...arguments); - this.set('allSecrets', this.get('store').all('secret')); - + let allSecrets = this.set('allSecrets', this.get('store').all('secret')); let secrets = this.get('secrets'); + let instance = this.get('instance'); + if ( !secrets ) { secrets = []; this.set('secrets', secrets); } + if (instance && instance.get('secrets.length')) { + instance.get('secrets').forEach((secret) => { + let selected = allSecrets.findBy('id', secret.secretId); + secret.alias = selected.get('name'); + secrets.push(secret); + }); + } + for ( var i = 0 ; i < secrets.get('length') ; i++ ) { let secret = secrets.objectAt(i); let uid = secret.get('uid'); diff --git a/app/components/container/form-secrets/template.hbs b/app/components/container/form-secrets/template.hbs index 95f21ddac..8c9abcf0e 100644 --- a/app/components/container/form-secrets/template.hbs +++ b/app/components/container/form-secrets/template.hbs @@ -7,10 +7,12 @@ expand=(action expandFn) }} {{#if haveAny}} - + {{#if editing}} + + {{/if}} {{#if secrets.length}} @@ -28,7 +30,11 @@ {{#each secrets as |row|}} {{#if showPermissions}} {{/if}} - + {{/each}}
- {{schema/input-secret selectClass="form-control input-sm" selected=row.secretId}} + {{#if editing}} + {{schema/input-secret selectClass="form-control input-sm" selected=row.secretId}} + {{else}} + {{row.alias}} + {{/if}} @@ -36,25 +42,35 @@ - {{input type="text" class="form-control input-sm" value=row.name placeholder=(t 'formSecrets.name.placeholder')}} + {{#input-or-display editable=editing value=row.name}} + {{input type="text" class="form-control input-sm" value=row.name placeholder=(t 'formSecrets.name.placeholder')}} + {{/input-or-display}} - {{input-integer type="text" class="form-control input-sm" value=row.uid placeholder=(t 'formSecrets.uid.placeholder')}} + {{#input-or-display editable=editing value=row.uid}} + {{input-integer type="text" class="form-control input-sm" value=row.uid placeholder=(t 'formSecrets.uid.placeholder')}} + {{/input-or-display}} - {{input-integer class="form-control input-sm" value=row.gid placeholder=(t 'formSecrets.gid.placeholder')}} + {{#input-or-display editable=editing value=row.gid}} + {{input-integer class="form-control input-sm" value=row.gid placeholder=(t 'formSecrets.gid.placeholder')}} + {{/input-or-display}} - {{input-integer class="form-control input-sm" value=row.mode placeholder=(t 'formSecrets.mode.placeholder')}} + {{#input-or-display editable=editing value=row.mode}} + {{input-integer class="form-control input-sm" value=row.mode placeholder=(t 'formSecrets.mode.placeholder')}} + {{/input-or-display}} - - + {{#if editing}} + + {{/if}} +
diff --git a/app/container/template.hbs b/app/container/template.hbs index 35783d124..3989c5e78 100644 --- a/app/container/template.hbs +++ b/app/container/template.hbs @@ -176,6 +176,14 @@ expandFn=expandFn }}
+
+ {{container/form-secrets + instance=model.container + editing=false + expandAll=al.expandAll + expandFn=expandFn + }} +
{{#accordion-list-item title=(t 'containerPage.volumesTab.header') diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 8c799f09f..4c9612e32 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1981,6 +1981,8 @@ formCommand: entryPoint: label: Entrypoint placeholder: e.g. /bin/sh + environment: + label: Environment Labels workingDir: label: Working Dir placeholder: e.g. /myapp From 7a242017cc9488260c9d3695de97ccc95076b582 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Mon, 5 Jun 2017 10:57:10 -0700 Subject: [PATCH 2/7] Add links to containers details page rancher/rancher#8866 --- .../form-container-links/component.js | 3 +- .../form-container-links/template.hbs | 2 +- app/container/route.js | 33 ++++++++++++++++--- app/container/template.hbs | 23 +++++++++++++ translations/en-us.yaml | 10 ++++++ 5 files changed, 64 insertions(+), 7 deletions(-) diff --git a/app/components/container/form-container-links/component.js b/app/components/container/form-container-links/component.js index fc3bc93fb..25a865262 100644 --- a/app/components/container/form-container-links/component.js +++ b/app/components/container/form-container-links/component.js @@ -52,8 +52,9 @@ export default Ember.Component.extend(ContainerChoices, { }); } + this.set('linksArray', out); + Ember.run.scheduleOnce('afterRender', () => { - this.set('linksArray', out); this.linksDidChange(); }); }, diff --git a/app/components/container/form-container-links/template.hbs b/app/components/container/form-container-links/template.hbs index 428976f9d..3d01a2063 100644 --- a/app/components/container/form-container-links/template.hbs +++ b/app/components/container/form-container-links/template.hbs @@ -14,7 +14,7 @@ {{#if linksArray.length}} - + diff --git a/app/container/route.js b/app/container/route.js index 92942a314..ee64babc7 100644 --- a/app/container/route.js +++ b/app/container/route.js @@ -2,17 +2,40 @@ import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { + return this.get('store').find('container', params.container_id).then((container) => { + return Ember.RSVP.hash({ - ports: container.followLink('ports'), - hosts: this.get('store').findAll('host') + ports: container.followLink('ports'), + hosts: this.get('store').findAll('host'), + instanceLinks: container.followLink('instanceLinks'), }).then((hash) => { + return { - container: container, - ports: hash.ports, - hosts: hash.hosts + container: container, + ports: hash.ports, + hosts: hash.hosts, + instanceLinks: hash.instanceLinks, }; }); }); }, + afterModel(model) { + var iLinks = model.instanceLinks; + var linkedInstances = []; + + iLinks.forEach((link) => { + linkedInstances.push(this.get('store').getById('container', link.get('targetInstanceId'))); + }); + + return Ember.RSVP.all(linkedInstances).then((instances) => { + + instances.forEach((instance) => { + let link = iLinks.findBy('targetInstanceId', instance.id); + link.set('linkedInstanceName', instance.name); + }); + + return model; + }) + }, }); diff --git a/app/container/template.hbs b/app/container/template.hbs index 3989c5e78..ca6c698bc 100644 --- a/app/container/template.hbs +++ b/app/container/template.hbs @@ -176,6 +176,29 @@ expandFn=expandFn }} +
+ {{#accordion-list-item + title=(t 'containerPage.linksTab.header') + detail=(t 'containerPage.linksTab.detail') + status=(t 'containerPage.linksTab.status' count=model.instanceLinks.length) + statusClass=(if model.instanceLinks.length 'bg-success' 'text-muted') + expandAll=al.expandAll + expand=(action expandFn) + }} + + + {{/accordion-list-item}} +
{{container/form-secrets instance=model.container diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 4c9612e32..451a0dfd5 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -489,6 +489,16 @@ containerPage: noData: This container has no ports noMatch: No ports match the current search hostPrimaryIp: '({ip})' + linksTab: + header: Links + detail: 'These properties show the links between containers in this container.' + status: | + {count, plural, + =0 {No links} + =1 {# link} + other {# links} + } + noData: No Links volumesTab: header: Volumes detail: 'These properties show the volumes attached to your container.' From 4f645619c93608dfa753b66d9fa54b537ad76a47 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Mon, 5 Jun 2017 11:21:13 -0700 Subject: [PATCH 3/7] Add missing headers for Storage and Ports on container deets rancher/rancher#8913 --- app/container/controller.js | 23 +++++++++++++++++++++-- app/container/template.hbs | 6 +++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/container/controller.js b/app/container/controller.js index b490c0f6e..e3f173c2a 100644 --- a/app/container/controller.js +++ b/app/container/controller.js @@ -8,11 +8,11 @@ export default Ember.Controller.extend({ this.transitionToRoute('container', container.get('id')); } }, - sortBy: 'privatePort', + portSortBy: 'privatePort', queryParams: ['sortBy'], searchText: '', - headers: [ + portHeaders: [ { name: 'publicIp', sort: ['displayPublicIp','privatePort','protocol'], @@ -38,4 +38,23 @@ export default Ember.Controller.extend({ translationKey: 'containerPage.portsTab.table.protocol', }, ], + storageSortBy: 'state', + storageHeaders: [ + { + name: 'state', + sort: ['stateSort','displayUri','id'], + translationKey: 'hostsPage.hostPage.storageTab.table.header.state', + width: 125, + }, + { + name: 'hostPath', + sort: ['displayUri','id'], + translationKey: 'hostsPage.hostPage.storageTab.table.header.hostPath', + }, + { + name: 'mounts', + sort: false, + translationKey: 'hostsPage.hostPage.storageTab.table.header.mounts', + }, + ], }); diff --git a/app/container/template.hbs b/app/container/template.hbs index ca6c698bc..627ab82f8 100644 --- a/app/container/template.hbs +++ b/app/container/template.hbs @@ -100,13 +100,13 @@ classNames="grid sortable-table" body=model.ports searchText=searchText - sortBy=sortBy + sortBy=portSortBy bulkActions=false rowActions=false stickyHeader=false pagingLabel="pagination.port" isVisible=parent.expanded - headers=headers as |sortable kind port dt|}} + headers=portHeaders as |sortable kind port dt|}} {{#if (eq kind "row")}}
+ + + + + + + + + + + + {{else if (eq kind "norows")}} + + + + {{/if}} + {{/component}} {{else}}
{{t 'formBalancerRules.noRules'}}
{{/if}} diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 50c3b8a47..4c514de4c 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1960,6 +1960,18 @@ formBalancerRules: addInstanceLabel: Add a Container addSelectorLabel: Add a Selector addTargetLabel: Add a Rule + access: + label: Access + public: Public + internal: Internal + protocol: + label: Protocol + sourceIp: + label: Host IP + placeholder: "e.g. 1.2.3.4; Default: All" + sourcePort: + label: Listening Port + placeholder: e.g. 80 path: label: Path placeholder: e.g. /foo
{{t 'formContainerLinks.targetInstance.label'}}   {{t 'formContainerLinks.name.label'}} {{#if (eq "0.0.0.0" port.displayPublicIp)}} @@ -227,7 +227,7 @@ stickyHeader=false pagingLabel="pagination.volume" isVisible=parent.expanded - headers=headers as |sortable kind mount dt|}} + headers=storageHeaders as |sortable kind mount dt|}} {{#if (eq kind "row")}} {{mount.displayVolumeName}} From 372d7c6963a293b3d6192150011e5bea87e73249 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Mon, 5 Jun 2017 14:29:09 -0700 Subject: [PATCH 4/7] remove unreachable code rancher/rancher#8858 --- app/mixins/cattle-transitioning-resource.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/mixins/cattle-transitioning-resource.js b/app/mixins/cattle-transitioning-resource.js index 6400bbb4f..bf6709ae8 100644 --- a/app/mixins/cattle-transitioning-resource.js +++ b/app/mixins/cattle-transitioning-resource.js @@ -370,9 +370,7 @@ export default Ember.Mixin.create({ if ( field.nullable ) { val = null; - if ( val !== null ) { - this.set(key, val); - } + this.set(key, val); } } } From 04e7d301d530c5ad8450b9628d777afda5a9e5de Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Tue, 6 Jun 2017 09:30:27 -0700 Subject: [PATCH 5/7] bugs --- .../container/form-networking/template.hbs | 2 +- .../container/form-secrets/component.js | 2 +- .../container/form-security/template.hbs | 84 ++++++++++--------- app/components/form-healthcheck/template.hbs | 21 +++-- app/container/template.hbs | 3 +- app/service/template.hbs | 3 +- translations/en-us.yaml | 4 +- 7 files changed, 62 insertions(+), 57 deletions(-) diff --git a/app/components/container/form-networking/template.hbs b/app/components/container/form-networking/template.hbs index 494bf50b4..b3e9b7f17 100644 --- a/app/components/container/form-networking/template.hbs +++ b/app/components/container/form-networking/template.hbs @@ -7,7 +7,7 @@ expand=(action expandFn) }}
-
+
{{#input-or-display editable=editing value=instance.networkMode}} {{new-select diff --git a/app/components/container/form-secrets/component.js b/app/components/container/form-secrets/component.js index ac9e619f4..28d10b73d 100644 --- a/app/components/container/form-secrets/component.js +++ b/app/components/container/form-secrets/component.js @@ -29,7 +29,7 @@ export default Ember.Component.extend({ if (instance && instance.get('secrets.length')) { instance.get('secrets').forEach((secret) => { let selected = allSecrets.findBy('id', secret.secretId); - secret.alias = selected.get('name'); + secret.set('alias', selected.get('name')); secrets.push(secret); }); } diff --git a/app/components/container/form-security/template.hbs b/app/components/container/form-security/template.hbs index e02f515f0..85b43c1b6 100644 --- a/app/components/container/form-security/template.hbs +++ b/app/components/container/form-security/template.hbs @@ -64,27 +64,27 @@
-
- -
-
- -
+ {{#input-or-display editable=editing value=memoryMode classesForDisplay="text-muted form-control-static"}} +
+ +
+
+ +
+ {{/input-or-display}}
- {{#if (eq memoryMode "unlimited")}} -
{{t 'formSecurity.swapLimit.unlimited'}}
- {{else}} + {{#input-or-display editable=editing value=swapMode classesForDisplay="text-muted form-control-static"}}
@@ -105,14 +105,12 @@
- {{/if}} + {{/input-or-display}}
- {{#if (eq swapMode "none")}} -

{{t 'generic.na'}}

- {{else}} + {{#input-or-display editable=editing value=swappinessMode classesForDisplay="text-muted form-control-static"}}
@@ -127,37 +125,41 @@
- {{/if}} + {{/input-or-display}}
-
-
+
+
-
- {{input-integer min="4" step="1" value=memoryReservationMb classNames="form-control" placeholder=(t 'formSecurity.memoryReservation.placeholder')}} -
{{t 'generic.mibibyte'}}
-
-
-
- - + {{#input-or-display editable=editing value=memoryReservationMb classesForDisplay="text-muted form-control-static"}}
- {{input-integer min="1" step="1" value=instance.milliCpuReservation classNames="form-control"}} -
{{t 'formSecurity.milliCpuReservation.unit'}}
+ {{input-integer min="4" step="1" value=memoryReservationMb classNames="form-control" placeholder=(t 'formSecurity.memoryReservation.placeholder')}} +
{{t 'generic.mibibyte'}}
-
+ {{/input-or-display}} +
+
+ + {{#input-or-display editable=editing value=instance.milliCpuReservation classesForDisplay="text-muted form-control-static"}} + +
+ {{input-integer min="1" step="1" value=instance.milliCpuReservation classNames="form-control"}} +
{{t 'formSecurity.milliCpuReservation.unit'}}
+
+
+ {{/input-or-display}}
-
-
+
+
{{#input-or-display editable=editing value=instance.cpuSet}} {{input type="text" value=instance.cpuSet classNames="form-control" placeholder=(t 'formSecurity.cpuPinning.placeholder')}} {{/input-or-display}}
-
+
{{#input-or-display editable=editing value=instance.cpuShares}} {{input-integer value=instance.cpuShares step=128 min=0 classNames="form-control" placeholder=(t 'formSecurity.shares.placeholder')}} @@ -165,8 +167,8 @@
-
-
+
+
{{#if editing}} diff --git a/app/components/form-healthcheck/template.hbs b/app/components/form-healthcheck/template.hbs index 27d577bf7..20aea6c79 100644 --- a/app/components/form-healthcheck/template.hbs +++ b/app/components/form-healthcheck/template.hbs @@ -21,7 +21,10 @@
{{else}} {{#if checkType}} -
{{checkType}}
+
+ + {{checkType}} +
{{else}}
{{t 'generic.none'}}
{{/if}} @@ -96,8 +99,8 @@
-
-
+
+
{{#input-or-display editable=editing value=healthCheck.healthyThreshold}}
@@ -106,8 +109,10 @@
{{/input-or-display}}
+
-
+
+
{{#input-or-display editable=editing value=healthCheck.unhealthyThreshold}}
@@ -120,8 +125,8 @@
-
-
+
+
{{#input-or-display editable=editing value=healthCheck.responseTimeout}}
@@ -130,7 +135,7 @@
{{/input-or-display}}
-
+
{{#input-or-display editable=editing value=healthCheck.initializingTimeout}}
@@ -139,7 +144,7 @@
{{/input-or-display}}
-
+
{{#input-or-display editable=editing value=healthCheck.reinitializingTimeout}}
diff --git a/app/container/template.hbs b/app/container/template.hbs index 627ab82f8..6d65e09c2 100644 --- a/app/container/template.hbs +++ b/app/container/template.hbs @@ -185,7 +185,6 @@ expandAll=al.expandAll expand=(action expandFn) }} -
    {{#each model.instanceLinks as |link|}}
  • @@ -194,7 +193,7 @@
  • {{else}} -
  • {{t 'containerPage.linksTab.noData'}}
  • +
  • {{t 'containerPage.linksTab.noData'}}
  • {{/each}}
{{/accordion-list-item}} diff --git a/app/service/template.hbs b/app/service/template.hbs index 231b6b846..607ff2e13 100644 --- a/app/service/template.hbs +++ b/app/service/template.hbs @@ -305,12 +305,11 @@ expandAll=al.expandAll expand=(action expandFn) }} -
    {{#each service.consumedServicesWithNames as |link|}}
  • {{consumed-service-link link=link stackId=service.stackId}}
  • {{else}} -
  • {{t 'servicePage.linksTab.noData'}}
  • +
  • {{t 'servicePage.linksTab.noData'}}
  • {{/each}}
{{/accordion-list-item}} diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 451a0dfd5..8550e0068 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -498,7 +498,7 @@ containerPage: =1 {# link} other {# links} } - noData: No Links + noData: This Container has no links volumesTab: header: Volumes detail: 'These properties show the volumes attached to your container.' @@ -1091,7 +1091,7 @@ servicePage: =1 {# link} other {# links} } - noData: No Links + noData: This Service has no links certsTab: title: Certificates detail: 'Certificates used for TLS-termination of requests.' From 917a57832fefff2f2668d90aab8186a303128fc3 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Tue, 6 Jun 2017 10:25:40 -0700 Subject: [PATCH 6/7] Change apps to live array and filter removedish stacks rancher/rancher#8973 --- app/apps-tab/index/controller.js | 10 ++++++++-- app/apps-tab/index/route.js | 2 +- translations/en-us.yaml | 7 +++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/apps-tab/index/controller.js b/app/apps-tab/index/controller.js index a28b16c41..b4e75cb1d 100644 --- a/app/apps-tab/index/controller.js +++ b/app/apps-tab/index/controller.js @@ -1,4 +1,5 @@ import Ember from 'ember'; +import C from 'ui/utils/constants'; import { tagsToArray } from 'ui/models/stack'; export default Ember.Controller.extend({ @@ -30,7 +31,12 @@ export default Ember.Controller.extend({ filteredStacks: function() { var needTags = tagsToArray(this.get('tags')); - var out = this.get('model.stacks').filterBy('isFromCatalog', true); + var out = this.get('model.stacks').filter((stack) => { + if (stack.get('isFromCatalog') && C.REMOVEDISH_STATES.indexOf(stack.get('state')) === -1) { + return true; + } + return false; + }); if ( !this.get('prefs.showSystemResources') ) { out = out.filterBy('system', false); @@ -41,5 +47,5 @@ export default Ember.Controller.extend({ } return out; - }.property('model.stacks.@each.{type,isFromCatalog,tags}','tags','prefs.showSystemResources'), + }.property('model.stacks.@each.{type,isFromCatalog,tags,state}','tags','prefs.showSystemResources'), }); diff --git a/app/apps-tab/index/route.js b/app/apps-tab/index/route.js index 512f5ce34..7f2efcf45 100644 --- a/app/apps-tab/index/route.js +++ b/app/apps-tab/index/route.js @@ -6,7 +6,7 @@ export default Ember.Route.extend({ catalog: Ember.inject.service(), model() { - return this.get('store').find('stack').then((stacks) => { + return this.get('store').findAll('stack').then((stacks) => { let deps = []; let catalog = this.get('catalog'); stacks = stacks.filterBy('isFromCatalog', true); diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 8550e0068..50c3b8a47 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1948,6 +1948,13 @@ formBalancerListeners: formBalancerRules: label: Target Rules + detail: Control the mapping of requests coming into the balancer to the desired target. + status: | + {count, plural, + =0 {No rules} + =1 {# rule} + other {# rules} + } noRules: No Rules addServiceLabel: Add a Service addInstanceLabel: Add a Container From 3492b0416c8cd976bfa8335c4d59cd3a21365793 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Tue, 6 Jun 2017 11:46:07 -0700 Subject: [PATCH 7/7] Fix target rules not showing up on LB's and change to sort table rancher/rancher#8974 --- app/service/controller.js | 54 +++++++++++- app/service/template.hbs | 173 +++++++++++++++++++------------------- translations/en-us.yaml | 12 +++ 3 files changed, 153 insertions(+), 86 deletions(-) diff --git a/app/service/controller.js b/app/service/controller.js index 80c492d00..678d1c5f2 100644 --- a/app/service/controller.js +++ b/app/service/controller.js @@ -4,7 +4,59 @@ export default Ember.Controller.extend({ service: Ember.computed.alias('model.service'), stack: Ember.computed.alias('model.stack'), application: Ember.inject.controller(), - rules: Ember.computed.alias('model.lbConfig.portRules'), + rules: Ember.computed.alias('service.lbConfig.portRules'), + sortBy: 'priority', + 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', + }, + ], actions: { changeService(service) { diff --git a/app/service/template.hbs b/app/service/template.hbs index 607ff2e13..7cae49ea9 100644 --- a/app/service/template.hbs +++ b/app/service/template.hbs @@ -114,100 +114,103 @@ {{#if service.isBalancer}} {{#accordion-list-item - title=(t 'formBalancerRules.label') - detail=(t 'formBalancerRules.detail') - status=(t 'formBalancerRules.status' count=(if rules.length rules.length 0)) - statusClass=(if rules.length 'bg-success' 'text-muted') - expandAll=al.expandAll - expand=(action expandFn) + title=(t 'formBalancerRules.label') + detail=(t 'formBalancerRules.detail') + status=(t 'formBalancerRules.status' count=(if rules.length rules.length 0)) + statusClass=(if rules.length 'bg-success' 'text-muted') + expandAll=al.expandAll + expand=(action expandFn) + componentName='sortable-table' + as | parent | }} {{#if rules.length}} - - + {{#component parent.intent + body=rules + bulkActions=false + classNames="grid fixed mb-0 sortable-table" + descending=descending + fullRows=true + headers=headers + paging=false + rowActions=false + search=true + sortBy=sortBy + stickyHeader=false + as |sortable kind rule| + }} + {{#if (eq kind "row")}} - - - - - - - - - - - + - - {{#each rules as |rule idx|}} - - + - + - - - - - - - - - - - - - - - {{/each}} - -
{{t 'formBalancerRules.priority.label'}}{{t 'formBalancerRules.access.label'}}{{t 'formBalancerRules.protocol.label'}}{{t 'formBalancerRules.hostname.label'}}{{t 'formBalancerRules.sourcePort.label'}}{{t 'formBalancerRules.path.label'}}{{t 'formBalancerRules.target'}}{{t 'formBalancerRules.targetPort.label'}}{{t 'formBalancerRules.backendName.label'}}
+ {{rule.priority}} +
- {{rule.priority}} - + {{uc-first rule.access}} + - {{uc-first rule.access}} - + {{upper-case rule.protocol}} + - {{upper-case rule.protocol}} - - {{#if rule.canHostname}} - {{#if rule.hostname}} - {{rule.hostname}} - {{else}} - {{t 'generic.none'}} - {{/if}} - {{else}} - {{t 'generic.na'}} - {{/if}} - - {{rule.sourcePort}} - - {{#if rule.canPath}} - {{#if rule.path}} - {{rule.path}} - {{else}} - {{t 'generic.none'}} - {{/if}} - {{else}} - {{t 'generic.na'}} - {{/if}} - - {{#if rule.selector}} - {{rule.selector}} - {{else}} - - {{#if (not-eq service.stackId rule.service.stackId)~}} - {{rule.service.displayStack}}/ - {{~/if~}} - {{~rule.service.displayName~}} - - {{~/if~}} - - {{rule.targetPort}} - - {{#if rule.backendName}} - {{rule.backendName}} + + {{#if rule.canHostname}} + {{#if rule.hostname}} + {{rule.hostname}} {{else}} {{t 'generic.none'}} {{/if}} -
+ {{else}} + {{t 'generic.na'}} + {{/if}} +
+ {{rule.sourcePort}} + + {{#if rule.canPath}} + {{#if rule.path}} + {{rule.path}} + {{else}} + {{t 'generic.none'}} + {{/if}} + {{else}} + {{t 'generic.na'}} + {{/if}} + + {{#if rule.selector}} + {{rule.selector}} + {{else}} + + {{#if (not-eq service.stackId rule.service.stackId)~}} + {{rule.service.displayStack}}/ + {{~/if~}} + {{~rule.service.displayName~}} + + {{~/if~}} + + {{rule.targetPort}} + + {{#if rule.backendName}} + {{rule.backendName}} + {{else}} + {{t 'generic.none'}} + {{/if}} +
{{t 'labelsSection.noData'}}