Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen to deregistration events to update home view state #1653

Merged
merged 2 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});
});
});