Add success notification for creating and updating labels (#1205)

- Add "Label created. Try refreshing this page in just a moment to see the updated host count for your label." message after the user successfully creates a label.
This commit is contained in:
noahtalerman
2021-06-25 11:58:02 -04:00
committed by GitHub
parent 6290bb24e6
commit a21d027518
2 changed files with 15 additions and 2 deletions
@@ -46,6 +46,9 @@ describe("Label flow", () => {
cy.findByRole("button", { name: /update label/i }).click();
// Close success notification
cy.get(".flash-message__remove").click();
cy.findByRole("button", { name: /delete/i }).click();
// Can't figure out how attach findByRole onto modal button
@@ -203,7 +203,12 @@ export class ManageHostsPage extends PureComponent {
return dispatch(labelActions.update(selectedLabel, updateAttrs))
.then(() => {
dispatch(push(`${PATHS.MANAGE_HOSTS}/${selectedFilter}`));
dispatch(
renderFlash(
"success",
"Label updated. Try refreshing this page in just a moment to see the updated host count for your label."
)
);
return false;
})
.catch(() => false);
@@ -234,7 +239,12 @@ export class ManageHostsPage extends PureComponent {
return dispatch(labelActions.create(formData)).then(() => {
dispatch(push(PATHS.MANAGE_HOSTS));
dispatch(
renderFlash(
"success",
"Label created. Try refreshing this page in just a moment to see the updated host count for your label."
)
);
return false;
});
};