mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
Draft optimized (#2409)
* repair drafts * repair naming error * optimized code * sentence error
This commit is contained in:
committed by
Daniel Pan
parent
3273900056
commit
5cffd4cb69
@@ -9,7 +9,7 @@ const propTypes = {
|
||||
isItemFreezed: PropTypes.bool.isRequired,
|
||||
onMenuToggleClick: PropTypes.func.isRequired,
|
||||
}
|
||||
class ListItem extends React.Component {
|
||||
class DraftListItem extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@@ -77,6 +77,6 @@ class ListItem extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.propTypes = propTypes;
|
||||
DraftListItem.propTypes = propTypes;
|
||||
|
||||
export default ListItem;
|
||||
export default DraftListItem;
|
@@ -9,7 +9,7 @@ const propTypes = {
|
||||
onPublishHandler: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class ListMenu extends React.Component {
|
||||
class DraftListMenu extends React.Component {
|
||||
|
||||
render() {
|
||||
let style = '';
|
||||
@@ -28,6 +28,6 @@ class ListMenu extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
ListMenu.propTypes = propTypes;
|
||||
DraftListMenu.propTypes = propTypes;
|
||||
|
||||
export default ListMenu;
|
||||
export default DraftListMenu;
|
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { gettext } from '../constants';
|
||||
import ListItem from './list-item';
|
||||
import DraftListItem from './draft-list-item';
|
||||
|
||||
const propTypes = {
|
||||
isItemFreezed: PropTypes.bool.isRequired,
|
||||
@@ -9,7 +9,7 @@ const propTypes = {
|
||||
onMenuToggleClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
class ListView extends React.Component {
|
||||
class DraftListView extends React.Component {
|
||||
|
||||
render() {
|
||||
let drafts = this.props.draftList;
|
||||
@@ -21,14 +21,14 @@ class ListView extends React.Component {
|
||||
<th style={{width: '4%'}}>{/*img*/}</th>
|
||||
<th style={{width: '46%'}}>{gettext('Name')}</th>
|
||||
<th style={{width: '20%'}}>{gettext('Owner')}</th>
|
||||
<th style={{width: '20%'}}>{gettext('Update time')}</th>
|
||||
<th style={{width: '20%'}}>{gettext('Last Update')}</th>
|
||||
<th style={{width: '10%'}}></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{ drafts && drafts.map((draft) => {
|
||||
return (
|
||||
<ListItem
|
||||
<DraftListItem
|
||||
key={draft.id}
|
||||
draft={draft}
|
||||
onMenuToggleClick={this.props.onMenuToggleClick}
|
||||
@@ -43,6 +43,6 @@ class ListView extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
ListView.propTypes = propTypes;
|
||||
DraftListView.propTypes = propTypes;
|
||||
|
||||
export default ListView;
|
||||
export default DraftListView;
|
@@ -4,17 +4,17 @@ export const keyCodes = {
|
||||
tab: 9,
|
||||
up: 38,
|
||||
down: 40
|
||||
}
|
||||
};
|
||||
|
||||
export function bytesToSize(bytes) {
|
||||
if (typeof(bytes) == 'undefined') return ' '
|
||||
if (typeof(bytes) == 'undefined') return ' ';
|
||||
|
||||
if(bytes < 0) return '--'
|
||||
const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB']
|
||||
if(bytes < 0) return '--';
|
||||
const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
||||
|
||||
if (bytes === 0) return bytes + ' ' + sizes[0]
|
||||
if (bytes === 0) return bytes + ' ' + sizes[0];
|
||||
|
||||
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)), 10)
|
||||
if (i === 0) return bytes + ' ' + sizes[i]
|
||||
return (bytes / (1000 ** i)).toFixed(1) + ' ' + sizes[i]
|
||||
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1000)), 10);
|
||||
if (i === 0) return bytes + ' ' + sizes[i];
|
||||
return (bytes / (1000 ** i)).toFixed(1) + ' ' + sizes[i];
|
||||
}
|
||||
|
Reference in New Issue
Block a user