From ce9a3ef3036923cb4c0f28240c8bb37a6b4540fc Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Wed, 6 May 2020 14:33:22 -0700 Subject: Update EventLogStore request to use Redfish Changes to WebSocketPlugin to dispatch event log GET request when new event interfaces are received. By re-fetching the Redfish logs the health status icon in the application header will always reflect the visible event logs. The plugin was previously only updating the header status, so it was possible for the header status and event logs to be out of sync. - Changed to use Redfish endpoint for event log GET request /redfish/v1/Systems/system/LogServices/EventLog/Entries - Update AppHeader Health status icon to reflect changes made with Redfish log Severity property Signed-off-by: Yoshie Muranaka Change-Id: I73a3a441dcbbb3a29ef9a51f961c062689cb5add --- src/store/plugins/WebSocketPlugin.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/store/plugins') diff --git a/src/store/plugins/WebSocketPlugin.js b/src/store/plugins/WebSocketPlugin.js index 965c32c9..400fdefa 100644 --- a/src/store/plugins/WebSocketPlugin.js +++ b/src/store/plugins/WebSocketPlugin.js @@ -1,3 +1,5 @@ +import { debounce } from 'lodash'; + /** * WebSocketPlugin will allow us to get new data from the server * without having to poll for changes on the frontend. @@ -26,23 +28,21 @@ const WebSocketPlugin = store => { ws.onerror = event => { console.error(event); }; - ws.onmessage = event => { + ws.onmessage = debounce(event => { const data = JSON.parse(event.data); const eventInterface = data.interface; + const path = data.path; if (eventInterface === 'xyz.openbmc_project.State.Host') { const { properties: { CurrentHostState } = {} } = data; store.commit('global/setHostStatus', CurrentHostState); - } else { - const { interfaces, event } = data; - if (event === 'InterfacesAdded' && interfaces) { - // Checking for 'InterfacesAdded' events - // since they have all properties needed to - // change health status - store.dispatch('eventLog/checkHealth', interfaces); - } + } else if (path === '/xyz/openbmc_project/logging') { + store.dispatch('eventLog/getEventLogData'); } - }; + // 2.5 sec debounce to avoid making multiple consecutive + // GET requests since log related server messages seem to + // come in clusters + }, 2500); }; store.subscribe(({ type }) => { -- cgit v1.2.3