From 8298d17d6f15c56c316fc38e2b9fff08da105974 Mon Sep 17 00:00:00 2001
From: vkovtun <viktor.kovtun@id.ethz.ch>
Date: Tue, 25 Jul 2023 18:36:08 +0200
Subject: [PATCH] SSDM-13579: Added other buttons to the left toolbar.

---
 ui-admin/src/js/common/messages.js            |  6 +++
 .../database/data-browser/LeftToolbar.jsx     | 43 ++++++++++++++++++-
 .../database/data-browser/RightToolbar.jsx    |  8 +++-
 3 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/ui-admin/src/js/common/messages.js b/ui-admin/src/js/common/messages.js
index bd8862b16d8..bf195f89fd1 100644
--- a/ui-admin/src/js/common/messages.js
+++ b/ui-admin/src/js/common/messages.js
@@ -51,6 +51,7 @@ const keys = {
   CONTAINER: 'CONTAINER',
   CONTENT: 'CONTENT',
   CONVERTED: 'CONVERTED',
+  COPY: 'COPY',
   CRASH: 'CRASH',
   CREATED: 'CREATED',
   CURRENT_PAGE: 'CURRENT_PAGE',
@@ -153,6 +154,7 @@ const keys = {
   MODIFICATION_DATE: 'MODIFICATION_DATE',
   MODIFIED: 'MODIFIED',
   MORE: 'MORE',
+  MOVE: 'MOVE',
   NAME: 'NAME',
   NEW_COLLECTION_TYPE: 'NEW_COLLECTION_TYPE',
   NEW_DATA_SET_TYPE: 'NEW_DATA_SET_TYPE',
@@ -222,6 +224,7 @@ const keys = {
   REMOVE: 'REMOVE',
   REMOVE_TERM: 'REMOVE_TERM',
   REMOVE_TOKEN: 'REMOVE_TOKEN',
+  RENAME: 'RENAME',
   REPORT: 'REPORT',
   RESULT: 'RESULT',
   RESULTS: 'RESULTS',
@@ -360,6 +363,7 @@ const messages_en = {
   [keys.CONTAINER]: 'Container',
   [keys.CONTENT]: 'Content',
   [keys.CONVERTED]: 'Converted',
+  [keys.COPY]: 'Copy',
   [keys.CRASH]: 'Something went wrong :(',
   [keys.CREATED]: 'Created',
   [keys.CURRENT_PAGE]: 'Current Page',
@@ -459,6 +463,7 @@ const messages_en = {
   [keys.MATERIAL_TYPE]: 'Material Type',
   [keys.META_DATA]: 'Meta Data',
   [keys.MORE]: 'More',
+  [keys.MOVE]: 'Move',
   [keys.MODIFICATION_DATE]: 'Modification Date',
   [keys.MODIFIED]: 'Modified',
   [keys.MINUTE_OR_MINUTES]: '${0} minute(s)',
@@ -531,6 +536,7 @@ const messages_en = {
   [keys.REMOVE]: 'Remove',
   [keys.REMOVE_TERM]: 'Remove Term',
   [keys.REMOVE_TOKEN]: 'Remove Token',
+  [keys.RENAME]: 'Rename',
   [keys.REPORT]: 'Report',
   [keys.RESULTS]: 'Results',
   [keys.RESULTS_RANGE]: '${0} of ${1}',
diff --git a/ui-admin/src/js/components/database/data-browser/LeftToolbar.jsx b/ui-admin/src/js/components/database/data-browser/LeftToolbar.jsx
index 68ce6c28535..8ddc33308e9 100644
--- a/ui-admin/src/js/components/database/data-browser/LeftToolbar.jsx
+++ b/ui-admin/src/js/components/database/data-browser/LeftToolbar.jsx
@@ -20,6 +20,9 @@ import Button from '@material-ui/core/Button'
 import CreateNewFolderIcon from '@material-ui/icons/CreateNewFolderOutlined'
 import DownloadIcon from '@material-ui/icons/GetApp'
 import DeleteIcon from '@material-ui/icons/Delete'
+import RenameIcon from '@material-ui/icons/Create'
+import CopyIcon from '@material-ui/icons/FileCopy'
+import MoveIcon from '@material-ui/icons/ArrowRightAlt'
 import messages from '@src/js/common/messages.js'
 import { withStyles } from '@material-ui/core/styles'
 import logger from "@src/js/common/logger.js";
@@ -32,7 +35,13 @@ const styles = theme => ({
     flex: '1 0 auto',
     display: 'flex',
     alignItems: 'center',
-    whiteSpace: 'nowrap'
+    whiteSpace: 'nowrap',
+    '&>button': {
+      marginRight: theme.spacing(1)
+    },
+    '&>button:nth-last-child(1)': {
+      marginRight: 0
+    }
   },
   toggleButton: {}
 })
@@ -82,12 +91,42 @@ class LeftToolbar extends React.Component {
           classes={{ root: classes.button }}
           color={color}
           size={buttonSize}
-          variant='outlined'
+          variant='text'
           startIcon={<DeleteIcon />}
           onClick={this.controller.handleNewFolderClick}
         >
           {messages.get(messages.DELETE)}
         </Button>
+        <Button
+          classes={{ root: classes.button }}
+          color={color}
+          size={buttonSize}
+          variant='text'
+          startIcon={<RenameIcon />}
+          onClick={this.controller.handleNewFolderClick}
+        >
+          {messages.get(messages.RENAME)}
+        </Button>
+        <Button
+          classes={{ root: classes.button }}
+          color={color}
+          size={buttonSize}
+          variant='text'
+          startIcon={<CopyIcon />}
+          onClick={this.controller.handleNewFolderClick}
+        >
+          {messages.get(messages.COPY)}
+        </Button>
+        <Button
+          classes={{ root: classes.button }}
+          color={color}
+          size={buttonSize}
+          variant='text'
+          startIcon={<MoveIcon />}
+          onClick={this.controller.handleNewFolderClick}
+        >
+          {messages.get(messages.MOVE)}
+        </Button>
       </div>
     )
   }
diff --git a/ui-admin/src/js/components/database/data-browser/RightToolbar.jsx b/ui-admin/src/js/components/database/data-browser/RightToolbar.jsx
index 6b23b5128ac..608e270d892 100644
--- a/ui-admin/src/js/components/database/data-browser/RightToolbar.jsx
+++ b/ui-admin/src/js/components/database/data-browser/RightToolbar.jsx
@@ -43,7 +43,13 @@ const styles = theme => ({
     flex: '0 0 auto',
     display: 'flex',
     alignItems: 'center',
-    whiteSpace: 'nowrap'
+    whiteSpace: 'nowrap',
+    '&>button': {
+      marginRight: theme.spacing(1)
+    },
+    '&>button:nth-last-child(1)': {
+      marginRight: 0
+    }
   },
   uploadButtonsContainer: {
     display: 'flex',
-- 
GitLab