diff options
author | Anna Tsyganova <ATSyganova@IBS.RU> | 2022-08-17 10:26:18 +0300 |
---|---|---|
committer | Anna Tsyganova <ATSyganova@IBS.RU> | 2022-08-17 10:26:18 +0300 |
commit | e7444631a3a0da657ae829c4da51b4d378ba32e8 (patch) | |
tree | e12ed86503195ca21eb7a7366075c07f3231618f /src/components | |
parent | c2010ac12e7cbf81e9c3e81589fd29e411de6b8d (diff) | |
parent | 0237b9c60425bbcd2417bf31000cbd74d0112645 (diff) | |
download | webui-vue-e7444631a3a0da657ae829c4da51b4d378ba32e8.tar.xz |
Merge branch 'sila' of git.sila.ru:pub/openbmc/webui-vue into sila
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/_sila/Global/Chart.vue | 206 |
1 files changed, 112 insertions, 94 deletions
diff --git a/src/components/_sila/Global/Chart.vue b/src/components/_sila/Global/Chart.vue index ac8fc325..01e54071 100644 --- a/src/components/_sila/Global/Chart.vue +++ b/src/components/_sila/Global/Chart.vue @@ -54,27 +54,6 @@ export default { yMax: null, minTickInterval: null, plotBands: null, - plotLines: [ - { - color: '#E11717', - dashStyle: 'solid', - value: this.warning, - zIndex: '1000', - width: 2, - label: { - text: this.$t('chart.thresholdWarning'), - align: 'right', - style: { - fontFamily: 'Inter, sans-serif', - fontSize: '12px', - fontStyle: 'normal', - fontWeight: '400', - lineHeight: '16px', - color: '#0C1C2999', - }, - }, - }, - ], }; }, computed: { @@ -200,20 +179,33 @@ export default { }, }; }, - }, - async created() { - this.setOptions(); - }, + plotLines() { + let plotLines = [ + { + color: '#E11717', + dashStyle: 'solid', + value: this.warning, + zIndex: '1000', + width: 2, + label: { + text: this.$t('chart.thresholdWarning'), + align: 'right', + style: { + fontFamily: 'Inter, sans-serif', + fontSize: '12px', + fontStyle: 'normal', + fontWeight: '400', + lineHeight: '16px', + color: '#0C1C2999', + }, + }, + }, + ]; - methods: { - setOptions() { switch (this.type) { case 'fans': - this.categories = this.setSpeed(10000); - this.minRange = 10000; - this.minTickInterval = 1000; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -232,54 +224,8 @@ export default { }, }); break; - case 'memory': - this.categories = this.setCategories(101, 'С°'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotBands = [ - { - color: '#F0AC0C1A', - dashStyle: 'solid', - from: this.notNormal, - to: this.critical, - }, - { - color: '#FF41411A', - dashStyle: 'solid', - from: this.critical, - to: this.warning, - }, - ]; - break; - case 'processors': - this.categories = this.setCategories(101, 'С°'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotBands = [ - { - color: '#F0AC0C1A', - dashStyle: 'solid', - from: this.notNormal, - to: this.critical, - }, - { - color: '#FF41411A', - dashStyle: 'solid', - from: this.critical, - to: this.warning, - }, - ]; - break; - case 'motherboard': - this.categories = this.setCategories(101, 'С°'); - this.yMax = 100; - this.minTickInterval = 25; - break; case 'power': - this.categories = this.setCategories(101, 'Вт'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -299,10 +245,7 @@ export default { }); break; case 'voltage-input': - this.categories = this.setCategories(251, 'В'); - this.yMax = 250; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -322,10 +265,7 @@ export default { }); break; case 'voltage-output': - this.categories = this.setCategories(101, 'В'); - this.yMax = 100; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -345,10 +285,7 @@ export default { }); break; case 'current': - this.categories = this.setCategories(11, 'A'); - this.yMax = 10; - this.minTickInterval = 2; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -368,10 +305,7 @@ export default { }); break; case 'psu-power': - this.categories = this.setCategories(126, 'Вт'); - this.yMax = 125; - this.minTickInterval = 25; - this.plotLines.push({ + plotLines.push({ color: '#1A3E5B', dashStyle: 'solid', value: this.shutdown, @@ -390,6 +324,90 @@ export default { }, }); } + return plotLines; + }, + }, + + async created() { + this.setOptions(); + }, + + methods: { + setOptions() { + switch (this.type) { + case 'fans': + this.categories = this.setSpeed(10000); + this.minRange = 10000; + this.minTickInterval = 1000; + break; + case 'memory': + this.categories = this.setCategories(101, 'С°'); + this.yMax = 100; + this.minTickInterval = 25; + this.plotBands = [ + { + color: '#F0AC0C1A', + dashStyle: 'solid', + from: this.notNormal, + to: this.critical, + }, + { + color: '#FF41411A', + dashStyle: 'solid', + from: this.critical, + to: this.warning, + }, + ]; + break; + case 'processors': + this.categories = this.setCategories(101, 'С°'); + this.yMax = 100; + this.minTickInterval = 25; + this.plotBands = [ + { + color: '#F0AC0C1A', + dashStyle: 'solid', + from: this.notNormal, + to: this.critical, + }, + { + color: '#FF41411A', + dashStyle: 'solid', + from: this.critical, + to: this.warning, + }, + ]; + break; + case 'motherboard': + this.categories = this.setCategories(101, 'С°'); + this.yMax = 100; + this.minTickInterval = 25; + break; + case 'power': + this.categories = this.setCategories(101, 'Вт'); + this.yMax = 100; + this.minTickInterval = 25; + break; + case 'voltage-input': + this.categories = this.setCategories(251, 'В'); + this.yMax = 250; + this.minTickInterval = 25; + break; + case 'voltage-output': + this.categories = this.setCategories(101, 'В'); + this.yMax = 100; + this.minTickInterval = 25; + break; + case 'current': + this.categories = this.setCategories(11, 'A'); + this.yMax = 10; + this.minTickInterval = 2; + break; + case 'psu-power': + this.categories = this.setCategories(126, 'Вт'); + this.yMax = 125; + this.minTickInterval = 25; + } }, setCategories(count, desc) { const arr = [...new Array(count)].map((i, k) => `${k} ${desc}`); |