UI Improvements
[arvados-workbench2.git] / src / store / link-panel / link-panel-actions.ts
index 944c1bd17703004742f7b5bc16212bf7982ba84a..bb9077b9233402ebf084c5b60aa42b6b816bfc19 100644 (file)
@@ -10,7 +10,7 @@ import { setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
 import { dialogActions } from '~/store/dialog/dialog-actions';
 import { LinkResource } from '~/models/link';
 import { getResource } from '~/store/resources/resources';
-import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import {snackbarActions, SnackbarKind} from '~/store/snackbar/snackbar-actions';
 
 export const LINK_PANEL_ID = "linkPanelId";
 export const linkPanelActions = bindDataExplorerActions(LINK_PANEL_ID);
@@ -18,6 +18,12 @@ export const linkPanelActions = bindDataExplorerActions(LINK_PANEL_ID);
 export const LINK_REMOVE_DIALOG = 'linkRemoveDialog';
 export const LINK_ATTRIBUTES_DIALOG = 'linkAttributesDialog';
 
+export const loadLinkPanel = () =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(setBreadcrumbs([{ label: 'Links' }]));
+        dispatch(linkPanelActions.REQUEST_ITEMS());
+    };
+
 export const openLinkAttributesDialog = (uuid: string) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const { resources } = getState();
@@ -38,19 +44,13 @@ export const openLinkRemoveDialog = (uuid: string) =>
         }));
     };
 
-export const loadLinkPanel = () =>
-    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        dispatch(setBreadcrumbs([{ label: 'Links' }]));
-        dispatch(linkPanelActions.REQUEST_ITEMS());
-    };
-
 export const removeLink = (uuid: string) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+        dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...', kind: SnackbarKind.INFO }));
         try {
             await services.linkService.delete(uuid);
             dispatch(linkPanelActions.REQUEST_ITEMS());
-            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Link has been successfully removed.', hideDuration: 2000 }));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Link has been successfully removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
         } catch (e) {
             return;
         }