diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-07-02 20:58:21 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-07-09 21:28:48 +0300 |
commit | 2f8bbbfe198087497c475029c573727e0711eb04 (patch) | |
tree | 10b3b606e84756068bc4ac2368cc19a93a966eab /src | |
parent | 96f69ca98f92ff64cc50104a70b3978595683c72 (diff) | |
download | webui-vue-2f8bbbfe198087497c475029c573727e0711eb04.tar.xz |
Add server LED switch calls to Overview page
The Overview page currently shows a static Server LED switch. It does
not accurately display the IndicatorLED state.
This commit will add ability to toggle the IndicatorLED value and
accurately displays the current value.
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I4fc9b18a0c87db421dfa73e51ecc472d0907d323
Diffstat (limited to 'src')
-rw-r--r-- | src/views/Overview/OverviewQuickLinks.vue | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/views/Overview/OverviewQuickLinks.vue b/src/views/Overview/OverviewQuickLinks.vue index b964795b..5dd71ee2 100644 --- a/src/views/Overview/OverviewQuickLinks.vue +++ b/src/views/Overview/OverviewQuickLinks.vue @@ -10,7 +10,6 @@ </dl> </div> <div> - <!-- TODO: add toggle LED on/off funtionality --> <dl> <dt>{{ $t('pageOverview.quicklinks.serverLed') }}</dt> <dd> @@ -19,8 +18,13 @@ data-test-id="overviewQuickLinks-checkbox-serverLed" name="check-button" switch + value="Lit" + unchecked-value="Off" + @change="onChangeServerLed" > - <span v-if="serverLedChecked">{{ $t('global.status.on') }}</span> + <span v-if="serverLedChecked !== 'Off'"> + {{ $t('global.status.on') }} + </span> <span v-else>{{ $t('global.status.off') }}</span> </b-form-checkbox> </dd> @@ -53,26 +57,42 @@ <script> import ArrowRight16 from '@carbon/icons-vue/es/arrow--right/16'; +import BVToastMixin from '@/components/Mixins/BVToastMixin'; export default { name: 'QuickLinks', components: { IconArrowRight: ArrowRight16 }, - data() { - return { - serverLedChecked: false - }; - }, + mixins: [BVToastMixin], computed: { bmcTime() { return this.$store.getters['global/bmcTime']; + }, + serverLedChecked: { + get() { + return this.$store.getters['serverLed/getIndicatorValue']; + }, + set(value) { + return value; + } } }, created() { - this.$store.dispatch('global/getBmcTime').finally(() => { + Promise.all([ + this.$store.dispatch('global/getBmcTime'), + this.$store.dispatch('serverLed/getIndicatorValue') + ]).finally(() => { this.$root.$emit('overview::quicklinks::complete'); }); + }, + methods: { + onChangeServerLed(value) { + this.$store + .dispatch('serverLed/saveIndicatorLedValue', value) + .then(message => this.successToast(message)) + .catch(({ message }) => this.errorToast(message)); + } } }; </script> |