Skip to content
Snippets Groups Projects
Commit 5d1c8cf1 authored by vkovtun's avatar vkovtun
Browse files

SSDM-13579: Made the LeftToolbar component change depending on whether at...

SSDM-13579: Made the LeftToolbar component change depending on whether at least one file is selected or not.
parent f62533e6
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -65,6 +65,7 @@ const keys = { ...@@ -65,6 +65,7 @@ const keys = {
DATE: 'DATE', DATE: 'DATE',
DAY_OR_DAYS: 'DAY_OR_DAYS', DAY_OR_DAYS: 'DAY_OR_DAYS',
DEACTIVATE_USER: 'DEACTIVATE_USER', DEACTIVATE_USER: 'DEACTIVATE_USER',
DELETE: 'DELETE',
DELETION: 'DELETION', DELETION: 'DELETION',
DELETIONS: 'DELETIONS', DELETIONS: 'DELETIONS',
DESCENDING: 'DESCENDING', DESCENDING: 'DESCENDING',
...@@ -373,6 +374,7 @@ const messages_en = { ...@@ -373,6 +374,7 @@ const messages_en = {
[keys.DATE]: 'Date', [keys.DATE]: 'Date',
[keys.DAY_OR_DAYS]: '${0} day(s)', [keys.DAY_OR_DAYS]: '${0} day(s)',
[keys.DEACTIVATE_USER]: 'Deactivate user', [keys.DEACTIVATE_USER]: 'Deactivate user',
[keys.DELETE]: 'Delete',
[keys.DELETION]: 'Deletion', [keys.DELETION]: 'Deletion',
[keys.DELETIONS]: 'Deletions', [keys.DELETIONS]: 'Deletions',
[keys.DESCENDING]: 'Descending', [keys.DESCENDING]: 'Descending',
......
...@@ -142,6 +142,7 @@ class DataBrowser extends React.Component { ...@@ -142,6 +142,7 @@ class DataBrowser extends React.Component {
onViewTypeChange={this.handleViewTypeChange} onViewTypeChange={this.handleViewTypeChange}
onShowInfoChange={this.handleShowInfoChange} onShowInfoChange={this.handleShowInfoChange}
showInfo={showInfo} showInfo={showInfo}
selectedFile={selectedFile}
/> />
<div className={[classes.flexContainer, classes.boundary, classes.content].join(' ')}> <div className={[classes.flexContainer, classes.boundary, classes.content].join(' ')}>
{viewType === 'list' && ( {viewType === 'list' && (
...@@ -209,7 +210,7 @@ class DataBrowser extends React.Component { ...@@ -209,7 +210,7 @@ class DataBrowser extends React.Component {
/> />
)} )}
{showInfo && selectedFile && ( {showInfo && selectedFile && (
<InfoPanel file={selectedFile} configuration={configuration} /> <InfoPanel selectedFile={selectedFile} configuration={configuration} />
)} )}
</div> </div>
</div> </div>
......
...@@ -58,33 +58,33 @@ class InfoPanel extends React.Component { ...@@ -58,33 +58,33 @@ class InfoPanel extends React.Component {
render() { render() {
const { const {
classes, classes,
file, selectedFile,
configuration configuration
} = this.props } = this.props
return (file && return (selectedFile &&
<Container className={classes.container}> <Container className={classes.container}>
<span className={classes.fileName}> <span className={classes.fileName}>
<Header size='big'>{file.name}</Header> <Header size='big'>{selectedFile.name}</Header>
</span> </span>
<ItemIcon file={file} classes={classes} configuration={configuration} /> <ItemIcon file={selectedFile} classes={classes} configuration={configuration} />
<Table> <Table>
<TableBody> <TableBody>
<TableRow> <TableRow>
<TableCell variant='head' component='th'>{messages.get(messages.SIZE)}</TableCell> <TableCell variant='head' component='th'>{messages.get(messages.SIZE)}</TableCell>
<TableCell>{file.size}</TableCell> <TableCell>{selectedFile.size}</TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell variant='head' component='th'>{messages.get(messages.CREATED)}</TableCell> <TableCell variant='head' component='th'>{messages.get(messages.CREATED)}</TableCell>
<TableCell>{file.creationTime.toLocaleString()}</TableCell> <TableCell>{selectedFile.creationTime.toLocaleString()}</TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell variant='head' component='th'>{messages.get(messages.MODIFIED)}</TableCell> <TableCell variant='head' component='th'>{messages.get(messages.MODIFIED)}</TableCell>
<TableCell>{file.lastModifiedTime.toLocaleString()}</TableCell> <TableCell>{selectedFile.lastModifiedTime.toLocaleString()}</TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell variant='head' component='th'>{messages.get(messages.ACCESSED)}</TableCell> <TableCell variant='head' component='th'>{messages.get(messages.ACCESSED)}</TableCell>
<TableCell>{file.lastAccessTime.toLocaleString()}</TableCell> <TableCell>{selectedFile.lastAccessTime.toLocaleString()}</TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>
</Table> </Table>
......
...@@ -18,9 +18,12 @@ ...@@ -18,9 +18,12 @@
import React from 'react' import React from 'react'
import Button from '@material-ui/core/Button' import Button from '@material-ui/core/Button'
import CreateNewFolderIcon from '@material-ui/icons/CreateNewFolderOutlined' import CreateNewFolderIcon from '@material-ui/icons/CreateNewFolderOutlined'
import DownloadIcon from '@material-ui/icons/GetApp'
import DeleteIcon from '@material-ui/icons/Delete'
import messages from '@src/js/common/messages.js' import messages from '@src/js/common/messages.js'
import { withStyles } from '@material-ui/core/styles' import { withStyles } from '@material-ui/core/styles'
import logger from "@src/js/common/logger.js"; import logger from "@src/js/common/logger.js";
import autoBind from "auto-bind";
const color = 'secondary' const color = 'secondary'
...@@ -35,10 +38,16 @@ const styles = theme => ({ ...@@ -35,10 +38,16 @@ const styles = theme => ({
}) })
class LeftToolbar extends React.Component { class LeftToolbar extends React.Component {
render() {
logger.log(logger.DEBUG, 'LeftToolbar.render')
const { buttonSize, controller, classes } = this.props constructor(props, context) {
super(props, context)
autoBind(this)
this.controller = this.props.controller
}
renderNoSelectionContextToolbar() {
const { classes, buttonSize } = this.props
return ( return (
<div className={classes.buttons}> <div className={classes.buttons}>
<Button <Button
...@@ -47,13 +56,50 @@ class LeftToolbar extends React.Component { ...@@ -47,13 +56,50 @@ class LeftToolbar extends React.Component {
size={buttonSize} size={buttonSize}
variant='outlined' variant='outlined'
startIcon={<CreateNewFolderIcon />} startIcon={<CreateNewFolderIcon />}
onClick={controller.handleNewFolderClick} onClick={this.controller.handleNewFolderClick}
> >
{messages.get(messages.NEW_FOLDER)} {messages.get(messages.NEW_FOLDER)}
</Button> </Button>
</div> </div>
) )
} }
renderSelectionContextToolbar() {
const { classes, buttonSize } = this.props
return (
<div className={classes.buttons}>
<Button
classes={{ root: classes.button }}
color={color}
size={buttonSize}
variant='outlined'
startIcon={<DownloadIcon />}
onClick={this.controller.handleNewFolderClick}
>
{messages.get(messages.DOWNLOAD)}
</Button>
<Button
classes={{ root: classes.button }}
color={color}
size={buttonSize}
variant='outlined'
startIcon={<DeleteIcon />}
onClick={this.controller.handleNewFolderClick}
>
{messages.get(messages.DELETE)}
</Button>
</div>
)
}
render() {
logger.log(logger.DEBUG, 'LeftToolbar.render')
const { selectedFile } = this.props
return selectedFile
? this.renderSelectionContextToolbar()
: this.renderNoSelectionContextToolbar()
}
} }
export default withStyles(styles)(LeftToolbar) export default withStyles(styles)(LeftToolbar)
...@@ -49,11 +49,14 @@ class Toolbar extends React.Component { ...@@ -49,11 +49,14 @@ class Toolbar extends React.Component {
render() { render() {
logger.log(logger.DEBUG, 'Toolbar.render') logger.log(logger.DEBUG, 'Toolbar.render')
const { viewType, onViewTypeChange, classes, showInfo, onShowInfoChange } = const { viewType, onViewTypeChange, classes, showInfo, onShowInfoChange,
this.props selectedFile } = this.props
return ( return (
<div className={classes.toolbar}> <div className={classes.toolbar}>
<LeftToolbar buttonSize={buttonSize} controller={this.controller} /> <LeftToolbar
buttonSize={buttonSize}
controller={this.controller}
selectedFile={selectedFile} />
<RightToolbar <RightToolbar
buttonSize={buttonSize} buttonSize={buttonSize}
selected={showInfo} selected={showInfo}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment