From fe9b637630e8a58a68721d8ade914eff81936a5f Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Tue, 16 Aug 2022 18:42:20 +0300 Subject: SILABMC-256: add fields for motherboard --- src/components/_sila/Global/Chart.vue | 206 ++++++++++++++++++---------------- 1 file changed, 112 insertions(+), 94 deletions(-) (limited to 'src/components') 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}`); -- cgit v1.2.3