18874: Add 'services/workbench2/' from commit 'f6f88d9ca9cdeeeebfadcfe999789bfb9f69e5c6'
[arvados.git] / services / workbench2 / src / store / snackbar / snackbar-actions.ts
diff --git a/services/workbench2/src/store/snackbar/snackbar-actions.ts b/services/workbench2/src/store/snackbar/snackbar-actions.ts
new file mode 100644 (file)
index 0000000..7b6f2ef
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { unionize, ofType, UnionOf } from "common/unionize";
+
+export interface SnackbarMessage {
+    message: string;
+    hideDuration: number;
+    kind: SnackbarKind;
+    link?: string;
+}
+
+export enum SnackbarKind {
+    SUCCESS = 1,
+    ERROR = 2,
+    INFO = 3,
+    WARNING = 4
+}
+
+export const snackbarActions = unionize({
+    OPEN_SNACKBAR: ofType<{message: string; hideDuration?: number, kind?: SnackbarKind, link?: string}>(),
+    CLOSE_SNACKBAR: ofType<{}|null>(),
+    SHIFT_MESSAGES: ofType<{}>()
+});
+
+export type SnackbarAction = UnionOf<typeof snackbarActions>;