[arvados-workbench2] updated: 2.6.0-78-g5bfb2e1c

git repository hosting git at public.arvados.org
Fri Sep 1 13:33:03 UTC 2023


Summary of changes:
 .../open-in-new-tab/open-in-new-tab.actions.ts     | 31 ++++++++++++++--------
 1 file changed, 20 insertions(+), 11 deletions(-)

       via  5bfb2e1cb9f87c2e62aaae870a8789ed132eba50 (commit)
      from  4ef379e48ed887a2c6f5eeeb84753bd0ec68c124 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 5bfb2e1cb9f87c2e62aaae870a8789ed132eba50
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Sep 1 09:32:57 2023 -0400

    15768: added copytoclipboard snackbar Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/store/open-in-new-tab/open-in-new-tab.actions.ts b/src/store/open-in-new-tab/open-in-new-tab.actions.ts
index f9b1ef55..6a1ec643 100644
--- a/src/store/open-in-new-tab/open-in-new-tab.actions.ts
+++ b/src/store/open-in-new-tab/open-in-new-tab.actions.ts
@@ -2,33 +2,42 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import copy from 'copy-to-clipboard';
-import { Dispatch } from 'redux';
-import { getNavUrl } from 'routes/routes';
-import { RootState } from 'store/store';
+import copy from "copy-to-clipboard";
+import { Dispatch } from "redux";
+import { getNavUrl } from "routes/routes";
+import { RootState } from "store/store";
+import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
 
 export const openInNewTabAction = (resource: any) => (dispatch: Dispatch, getState: () => RootState) => {
     const url = getNavUrl(resource.uuid, getState().auth);
 
-    if (url[0] === '/') {
-        window.open(`${window.location.origin}${url}`, '_blank');
+    if (url[0] === "/") {
+        window.open(`${window.location.origin}${url}`, "_blank");
     } else if (url.length) {
-        window.open(url, '_blank');
+        window.open(url, "_blank");
     }
 };
 
 export const copyToClipboardAction = (resources: Array<any>) => (dispatch: Dispatch, getState: () => RootState) => {
     // Copy to clipboard omits token to avoid accidental sharing
 
-    let output = '';
+    let output = "";
 
-    resources.forEach((resource) => {
+    resources.forEach(resource => {
         let url = getNavUrl(resource.uuid, getState().auth, false);
-        if (url[0] === '/') url = `${window.location.origin}${url}`;
+        if (url[0] === "/") url = `${window.location.origin}${url}`;
         output += output.length ? `, ${url}` : url;
     });
 
     if (output.length) {
-        copy(output);
+        const wasCopied = copy(output);
+        if (wasCopied)
+            dispatch(
+                snackbarActions.OPEN_SNACKBAR({
+                    message: "Copied",
+                    hideDuration: 2000,
+                    kind: SnackbarKind.SUCCESS,
+                })
+            );
     }
 };

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list