From f6108ddb2acdefdc19c47bf4b8cd4c5e8a1c75d2 Mon Sep 17 00:00:00 2001
From: vkovtun <vkovtun@ethz.ch>
Date: Thu, 25 May 2023 16:39:54 +0200
Subject: [PATCH] SSDM-13579: Added default icons for files and folders.

---
 .../database/data-browser/DataBrowser.jsx     |  6 ----
 .../database/data-browser/ListView.jsx        | 28 +++++++++++++------
 .../database/data-browser/Toolbar.jsx         |  6 ----
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/ui-admin/src/js/components/database/data-browser/DataBrowser.jsx b/ui-admin/src/js/components/database/data-browser/DataBrowser.jsx
index 376d14cb172..53a7a4e7f40 100644
--- a/ui-admin/src/js/components/database/data-browser/DataBrowser.jsx
+++ b/ui-admin/src/js/components/database/data-browser/DataBrowser.jsx
@@ -6,12 +6,6 @@ import ListView from '@src/js/components/database/data-browser/ListView.jsx'
 import GridView from '@src/js/components/database/data-browser/GridView.jsx'
 
 const styles = theme => ({
-  containerDefault: {
-    padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`
-  },
-  containerSquare: {
-    padding: `${theme.spacing(2)}px ${theme.spacing(2)}px`
-  },
   boundary: {
     padding: theme.spacing(1),
     borderWidth: '2px',
diff --git a/ui-admin/src/js/components/database/data-browser/ListView.jsx b/ui-admin/src/js/components/database/data-browser/ListView.jsx
index 9f8589141e8..7dab5047e57 100644
--- a/ui-admin/src/js/components/database/data-browser/ListView.jsx
+++ b/ui-admin/src/js/components/database/data-browser/ListView.jsx
@@ -1,16 +1,14 @@
 import React from 'react'
 import { withStyles } from '@material-ui/core/styles'
 import Container from '@src/js/components/common/form/Container.jsx'
+import FolderIcon from '@material-ui/icons/FolderOpen'
+import FileIcon from '@material-ui/icons/DescriptionOutlined'
+import autoBind from 'auto-bind'
 
 const styles = theme => ({
-  containerDefault: {
-    padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`
-  },
-  containerSquare: {
-    padding: `${theme.spacing(2)}px ${theme.spacing(2)}px`
-  },
   content: {
-    width: '100%'
+    width: '100%',
+    fontFamily: theme.typography.fontFamily,
   },
   tableHeader: {
     textAlign: 'left'
@@ -29,6 +27,20 @@ const styles = theme => ({
 })
 
 class ListView extends React.Component {
+
+  constructor(props, context) {
+    super(props, context)
+    autoBind(this)
+  }
+
+  getIcon(file) {
+    if (file.folder) {
+      return <FolderIcon />
+    } else {
+      return <FileIcon />
+    }
+  }
+
   render() {
     const { classes, files } = this.props
     /* Create strings in messages. */
@@ -45,7 +57,7 @@ class ListView extends React.Component {
           <tbody>
             {files.map((file, index) =>
               <tr key={index}>
-                <td className={classes.nameColumn}>{file.name}</td>
+                <td className={classes.nameColumn}>{<>{this.getIcon(file)} {file.name}</>}</td>
                 <td className={classes.sizeColumn}>{file.folder ? '-' : file.size}</td>
                 <td className={classes.modifiedColumn}>{file.lastModifiedTime.toLocaleString()}</td>
               </tr>
diff --git a/ui-admin/src/js/components/database/data-browser/Toolbar.jsx b/ui-admin/src/js/components/database/data-browser/Toolbar.jsx
index 1d54c5d68a7..e6e8b484564 100644
--- a/ui-admin/src/js/components/database/data-browser/Toolbar.jsx
+++ b/ui-admin/src/js/components/database/data-browser/Toolbar.jsx
@@ -12,12 +12,6 @@ import InfoIcon from '@material-ui/icons/InfoOutlined'
 import CreateNewFolderIcon from '@material-ui/icons/CreateNewFolderOutlined'
 
 const styles = theme => ({
-  containerDefault: {
-    padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`
-  },
-  containerSquare: {
-    padding: `${theme.spacing(2)}px ${theme.spacing(2)}px`
-  }
 })
 
 class Toolbar extends React.Component {
-- 
GitLab