diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-08 12:23:04 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-08 12:23:04 +0300 |
commit | fec3022f369f7b61637fb6f97d4957d81b8a3d50 (patch) | |
tree | 6e6fd1782a15a1b966f10f6c6018f765402d8e3e /src/views/_sila/Power/Dynamic/CurrentOutput.vue | |
parent | 7e74f9412c80e5462798b2d9b62a12f570aa9c95 (diff) | |
parent | bf78f95baa9f6a1c190d1bc0907acbcb2c76c00b (diff) | |
download | webui-vue-fec3022f369f7b61637fb6f97d4957d81b8a3d50.tar.xz |
Merge branch 'sila' of git.sila.ru:pub/openbmc/webui-vue into sila
Diffstat (limited to 'src/views/_sila/Power/Dynamic/CurrentOutput.vue')
-rw-r--r-- | src/views/_sila/Power/Dynamic/CurrentOutput.vue | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/src/views/_sila/Power/Dynamic/CurrentOutput.vue b/src/views/_sila/Power/Dynamic/CurrentOutput.vue new file mode 100644 index 00000000..a27a5a57 --- /dev/null +++ b/src/views/_sila/Power/Dynamic/CurrentOutput.vue @@ -0,0 +1,170 @@ +<template> + <collapse + id="collapse_OutputCur" + default-open + :title="$t('pagePowerSup.OutputCurrent')" + > + <template #image> + <img src="@/assets/images/_sila/collapsed/current.svg" /> + </template> + <page-section> + <b-row class="align-items-end p-2"> + <b-col xs="12" md="6" lg="4" class="pt-2"> + <b-form-group :label="$t('pagePowerSup.labels.warning')"> + <b-form-input + v-model="warning" + type="number" + :min="0" + :max="shutdown" + ></b-form-input> + </b-form-group> + </b-col> + <b-col xs="12" md="6" lg="4" class="pt-2"> + <b-form-group :label="$t('pagePowerSup.labels.shutdown')"> + <b-form-input + v-model="shutdown" + type="number" + :min="warning" + :max="10" + > + </b-form-input> + </b-form-group> + </b-col> + <b-col xs="12" md="6" lg="3" class="pt-2"> + <b-button variant="primary" style="height: 35px"> + {{ $t('global.action.save') }} + </b-button> + </b-col> + </b-row> + <chart + type="current" + :time-scale="timeScale" + :data="filteredItems" + float + :colors="colors" + :warning="+warning" + :shutdown="+shutdown" + ></chart> + <b-table + responsive="md" + show-empty + table-variant="accessory" + hover + :items="items" + :fields="fields" + :empty-text="$t('global.table.emptyMessage')" + :busy="isBusy" + > + <template #cell(name)="{ value, index }"> + <div + class="item-color" + :style="`background-color: ${colors[index]}`" + ></div> + {{ value }} + </template> + <template #cell(minDate)="{ value }"> + <span style="color: rgb(12, 28, 41)"> + {{ value.time }} + </span> + <span> + {{ value.date }} + </span> + </template> + <template #cell(maxDate)="{ value }"> + <span style="color: rgb(12, 28, 41)"> + {{ value.time }} + </span> + <span> + {{ value.date }} + </span> + </template> + </b-table> + </page-section> + </collapse> +</template> +<script> +import Chart from '@/components/_sila/Global/Chart'; +import PageSection from '@/components/Global/PageSection'; + +import DataFormatterMixin from '@/components/_sila/Mixins/DataFormatterMixin'; +import LoadingBarMixin from '@/components/_sila/Mixins/LoadingBarMixin'; +import TableFilterMixin from '@/components/_sila/Mixins/TableFilterMixin'; +import Collapse from '@/components/_sila/Global/Collapse'; + +import { getItems } from '@/utilities/_sila/metricProperties'; +import { psuFilter } from '@/utilities/_sila/psuFilter'; + +export default { + components: { PageSection, Chart, Collapse }, + mixins: [DataFormatterMixin, LoadingBarMixin, TableFilterMixin], + props: { + timeScale: { + type: String, + default: 'hour', + }, + }, + data() { + return { + warning: 7, + shutdown: 8, + isBusy: true, + fields: [ + { + key: 'name', + label: this.$t('pagePowerSup.table.nameModule'), + thStyle: { width: '25%' }, + }, + { + key: 'current', + label: this.$t('pagePowerSup.table.currentCurrent'), + }, + { + key: 'min', + label: this.$t('pagePowerSup.table.minCurrent'), + }, + { + key: 'minDate', + label: this.$t('pagePowerSup.table.minDate'), + }, + { + key: 'max', + label: this.$t('pagePowerSup.table.maxCurrent'), + }, + { + key: 'maxDate', + label: this.$t('pagePowerSup.table.maxDate'), + }, + ], + }; + }, + + computed: { + items() { + return getItems(this.filteredItems); + }, + + filteredItems() { + return psuFilter(this.allSensors, 'Output'); + }, + + allSensors() { + return this.timeScale === 'hour' + ? this.$store.getters['powerSupply/psuCurrentLastHour'] + : this.$store.getters['powerSupply/psuCurrent']; + }, + + colors() { + return this.$randomColor({ + count: this.items?.length, + hue: 'random', + luminosity: 'random', + }); + }, + }, + watch: { + items() { + this.items.length ? (this.isBusy = false) : (this.isBusy = true); + }, + }, +}; +</script> |