From 076ab27f57c5adb34564908411c914c0ac300272 Mon Sep 17 00:00:00 2001 From: Mateusz Gapski Date: Mon, 20 Jul 2020 10:55:15 +0200 Subject: Health icon shows ok while loading While web UI is loading it is showing controls as "OK" state instead of undetermined which might be confusing. More details: https://github.com/openbmc/webui-vue/issues/11 Signed-off-by: Mateusz Gapski Change-Id: I0dc4aa3f00cee5d67c764c1950b4961e59a0a3cd --- src/store/modules/Health/EventLogStore.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/store') diff --git a/src/store/modules/Health/EventLogStore.js b/src/store/modules/Health/EventLogStore.js index 2b93ffa7..79bee02a 100644 --- a/src/store/modules/Health/EventLogStore.js +++ b/src/store/modules/Health/EventLogStore.js @@ -1,8 +1,8 @@ import api, { getResponseCount } from '@/store/api'; import i18n from '@/i18n'; -const getHealthStatus = events => { - let status = 'OK'; +const getHealthStatus = (events, loadedEvents) => { + let status = loadedEvents ? 'OK' : ''; for (const event of events) { if (event.severity === 'Warning') { status = 'Warning'; @@ -23,15 +23,18 @@ const getHighPriorityEvents = events => const EventLogStore = { namespaced: true, state: { - allEvents: [] + allEvents: [], + loadedEvents: false }, getters: { allEvents: state => state.allEvents, highPriorityEvents: state => getHighPriorityEvents(state.allEvents), - healthStatus: state => getHealthStatus(state.allEvents) + healthStatus: state => getHealthStatus(state.allEvents, state.loadedEvents) }, mutations: { - setAllEvents: (state, allEvents) => (state.allEvents = allEvents) + setAllEvents: (state, allEvents) => ( + (state.allEvents = allEvents), (state.loadedEvents = true) + ) }, actions: { async getEventLogData({ commit }) { -- cgit v1.2.3