From 673df747ea1e1ef0218ebd52d948b5b54c5c183a Mon Sep 17 00:00:00 2001 From: n313893254 Date: Fri, 18 Jan 2019 15:08:41 +0800 Subject: [PATCH 1/2] Show current count/scale in Workload view https://github.com/rancher/rancher/issues/17246 --- app/models/workload.js | 6 ++++++ app/styles/components/_banners.scss | 3 +++ app/workload/template.hbs | 3 +++ translations/en-us.yaml | 1 + translations/zh-hans.yaml | 1 + 5 files changed, 14 insertions(+) diff --git a/app/models/workload.js b/app/models/workload.js index ef5a3a559..2dd1b28e6 100644 --- a/app/models/workload.js +++ b/app/models/workload.js @@ -195,6 +195,12 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts return !!workloadAnnotations[C.LABEL.CREATOR_ID]; }), + currentScale: computed('pods.@each.state', 'scale', function() { + const { pods = [] } = this + + return pods.filter((p) => p.state === 'running').length + }), + actions: { activate() { return this.doAction('activate'); diff --git a/app/styles/components/_banners.scss b/app/styles/components/_banners.scss index 86bcafccf..7d7f36311 100644 --- a/app/styles/components/_banners.scss +++ b/app/styles/components/_banners.scss @@ -194,5 +194,8 @@ $banner-color : $secondary !default; } } + .block .text-small { + font-size: 0.7em; + } } } diff --git a/app/workload/template.hbs b/app/workload/template.hbs index c7b5c42fa..809738d2d 100644 --- a/app/workload/template.hbs +++ b/app/workload/template.hbs @@ -53,6 +53,9 @@ +
+ {{t 'servicePage.multistat.currentScale' count=service.currentScale}} +
diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 998253fd5..3a285ff23 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -1347,6 +1347,7 @@ servicePage: namespace: 'Namespace' created: 'Created' daemonSetScale: '1 per node' + currentScale: 'Ready Scale: {count}' serviceType: deployment: Deployment replicaSet: Replica Set diff --git a/translations/zh-hans.yaml b/translations/zh-hans.yaml index 8659a86be..e27d595d0 100644 --- a/translations/zh-hans.yaml +++ b/translations/zh-hans.yaml @@ -1271,6 +1271,7 @@ servicePage: namespace: '命名空间' created: '创建时间' daemonSetScale: '每主机1个Pod' + currentScale: '可用副本数: {count}' serviceType: deployment: Deployment replicaSet: 副本集 From e1fc62bdd0d8607d2e54b7d9092f1e0be01dc4be Mon Sep 17 00:00:00 2001 From: n313893254 Date: Wed, 23 Jan 2019 16:41:27 +0800 Subject: [PATCH 2/2] Update for review --- app/styles/base/_helpers.scss | 6 ++++ app/styles/components/_banners.scss | 4 +++ app/workload/template.hbs | 56 +++++++++++++++++------------ translations/en-us.yaml | 2 +- translations/zh-hans.yaml | 4 +-- 5 files changed, 46 insertions(+), 26 deletions(-) diff --git a/app/styles/base/_helpers.scss b/app/styles/base/_helpers.scss index 2fccf194f..f1e8a1b66 100755 --- a/app/styles/base/_helpers.scss +++ b/app/styles/base/_helpers.scss @@ -136,6 +136,12 @@ display:flex; } +.center { + display:flex !important; + justify-content:center; + align-items: center; +} + .inline{ display: inline; } diff --git a/app/styles/components/_banners.scss b/app/styles/components/_banners.scss index 7d7f36311..9cb43a151 100644 --- a/app/styles/components/_banners.scss +++ b/app/styles/components/_banners.scss @@ -186,6 +186,10 @@ $banner-color : $secondary !default; &:last-child { border: 0; } + + .hr { + border-bottom: 1px dashed #78C9CF; + } } &.basics-stack-detail { span[class*='tag-'] { diff --git a/app/workload/template.hbs b/app/workload/template.hbs index 809738d2d..e0b6ed33e 100644 --- a/app/workload/template.hbs +++ b/app/workload/template.hbs @@ -34,32 +34,42 @@