Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and enhancements #18

Merged
merged 4 commits into from
May 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gok/gok.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ let prepareDetailedFileList = (parentDirPath, fileList) => {
// Other file details can be added as and when required
return {
name : stats.name,
isDirectory : stats.isDirectory
isDirectory : stats.isDirectory,
size : stats.size,
uploadedOn : stats.birthtime.toLocalDateString()
}
})
.catch((error) => {
Expand Down
9 changes: 0 additions & 9 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"react-scripts": "1.1.1",
"redux": "^3.7.2",
"semantic-ui-css": "^2.3.0",
"semantic-ui-react": "^0.78.3",
"video-react": "^0.10.4"
"semantic-ui-react": "^0.78.3"
},
"scripts": {
"start": "react-scripts start",
Expand Down
4 changes: 2 additions & 2 deletions ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class App extends Component {
/>
</Grid.Row>

<Grid.Row style={{ paddingTop : '10em', zIndex : 1 }} stretched>
<Grid.Row style={{ paddingTop : '10em', zIndex : 1, height: '100vh' }} stretched>
<Grid.Column only='computer' computer={3}>
<SideBar
fileList={this.state.topLevelDirectories}
Expand All @@ -87,7 +87,7 @@ class App extends Component {
/>
</Grid.Column>

<Grid.Column mobile={16} computer={13}>
<Grid.Column mobile={16} computer={13} style={{ overflowY : 'scroll'}}>
<ContentArea
fileList={this.state.fileList}
basePath={this.props.root}
Expand Down
36 changes: 32 additions & 4 deletions ui/src/components/ContentArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const VideoPlayer = (props) => {
controls
autoPlay
src={props.src}
height={window.innerHeight - 60}
width={window.innerWidth - 60}
/>
)
}
Expand Down Expand Up @@ -96,6 +98,20 @@ class ContentArea extends Component {
/>
);
break;
case '.html':
fileViewer = (
<div>
<iframe
src={url}
title="HTML Display Component"
height={window.innerHeight - 60}
width={window.innerWidth - 60}
frameborder="0"
style={{background: '#FFFFFF'}}
/>
</div>
);
break;
default:
fileViewer = (
<a href={url}>View in browser</a>
Expand All @@ -117,7 +133,7 @@ class ContentArea extends Component {
open={this.state.modalOpen}
onClose={this.handleModalClose}
closeOnEscape={true}
closeIcon
closeIcon={{ name: 'remove', size: 'big', link: true, className: 'icon-placement'}}
>
<Modal.Content style={{ textAlign : 'center' }}>
{ this.getFileViewer() }
Expand All @@ -136,6 +152,15 @@ class ContentArea extends Component {
}
}

formatBytes = (bytes,decimals) => {
if(bytes === 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}

renderFileList = () => {
let dirArr = [], fileArr = [];
for(let i=0;i<this.props.fileList.length;i++){
Expand Down Expand Up @@ -166,11 +191,14 @@ class ContentArea extends Component {

<span className="popup">
{ path.relative(this.props.basePath, path.resolve(this.props.currentPath, file.name)) }
{ file.isDirectory ? null : <span><br/>File Size: { this.formatBytes(file.size, 2) }</span>}
<br/>
Uploaded On : { file.uploadedOn }
</span>

<Divider fitted hidden style={{ paddingTop : '0.4em' }}/>

<div style={{ color : 'black', width : '100%', wordWrap : 'break-word' }}>
<div style={{ color : 'black', width : '100%', wordWrap : 'break-word', fontSize : '16px' }}>
{ path.basename(file.name) }
</div>
</a>
Expand All @@ -181,10 +209,10 @@ class ContentArea extends Component {

render() {
return (
<div style={{ minHeight : '56em', height : 'auto', padding : '0em', width : '100%' }}>
<div>
{ this.renderModal() }

<Card.Group style={{ fontSize : '18px', paddingLeft : '1em', textAlign : 'left', width : '100%' }}>
<Card.Group style={{ fontSize : '18px', paddingLeft : '1em', paddingBottom : '3em', textAlign : 'left', width : '100%' }}>
{this.props.fileList.length > 0 && this.renderFileList()}
{this.props.fileList.length === 0 && this.renderEmptyFolder()}
</Card.Group>
Expand Down
13 changes: 9 additions & 4 deletions ui/src/components/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@
background-color: black;
color: #fff;
opacity: 0.8;
text-align: center;
text-align: left;
padding: 5px;
border-radius: 6px;
position: absolute;
border-radius: 6px 0px 0px 0px;
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
font-size: 16px;
}

.fileItem:hover .popup {
visibility: visible;
}

.icon-placement {
float: right;
}

.watermark{
width: 100%;
text-align: center;
Expand Down
1 change: 0 additions & 1 deletion ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import App from './App';

import './index.css';
import 'semantic-ui-css/semantic.min.css';
import '../node_modules/video-react/dist/video-react.css';

import { FS_ROOT } from './config/config';

Expand Down