Skip to content

Commit

Permalink
Listen to deregistration events to update home view state (#1653)
Browse files Browse the repository at this point in the history
* Listen to deregistration events to update home view state

* Add e2e test
  • Loading branch information
arbulu89 authored Jul 20, 2023
1 parent 678132c commit 7b7a2ba
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions assets/js/state/sagas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { keysToCamel } from '@lib/serialization';

import {
HOST_DEREGISTERED,
setHosts,
appendHost,
updateHost,
Expand All @@ -25,6 +26,7 @@ import {
} from '@state/hosts';

import {
CLUSTER_DEREGISTERED,
setClusters,
appendCluster,
updateCluster,
Expand All @@ -38,6 +40,7 @@ import {
import {
SAP_SYSTEM_REGISTERED,
SAP_SYSTEM_HEALTH_CHANGED,
SAP_SYSTEM_DEREGISTERED,
startSapSystemsLoading,
stopSapSystemsLoading,
setSapSystems,
Expand Down Expand Up @@ -328,6 +331,21 @@ function* refreshHealthSummaryOnComnponentsHealthChange() {
'CLUSTER_HEALTH_CHANGED',
loadSapSystemsHealthSummary
);
yield debounce(
debounceDuration,
SAP_SYSTEM_DEREGISTERED,
loadSapSystemsHealthSummary
);
yield debounce(
debounceDuration,
CLUSTER_DEREGISTERED,
loadSapSystemsHealthSummary
);
yield debounce(
debounceDuration,
HOST_DEREGISTERED,
loadSapSystemsHealthSummary
);
}

export default function* rootSaga() {
Expand Down
19 changes: 19 additions & 0 deletions test/e2e/cypress/e2e/home.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
context('Homepage', () => {
before(() => {
cy.visit('/');
cy.url().should('include', '/');
});

describe('Deregistration', () => {
const sapSystemNwp = {
sid: 'NWP',
hostId: '9cd46919-5f19-59aa-993e-cf3736c71053',
};

it(`should not display SAP System ${sapSystemNwp.sid} after it is deregistered`, () => {
cy.contains(sapSystemNwp.sid).should('exist');
cy.deregisterHost(sapSystemNwp.hostId);
cy.contains(sapSystemNwp.sid).should('not.exist');
});
});
});

0 comments on commit 7b7a2ba

Please sign in to comment.