mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 10:26:17 +00:00
fix code format (#6365)
This commit is contained in:
@@ -79,17 +79,17 @@ class Content extends Component {
|
||||
// only for some columns
|
||||
const columnWidths = isPro ? ['14%', '7%', '14%'] : ['21%', '14%', '20%'];
|
||||
const table = (
|
||||
<table className={`${isDesktop ? '': 'table-thead-hidden'}`}>
|
||||
<table className={`${isDesktop ? '' : 'table-thead-hidden'}`}>
|
||||
<thead>
|
||||
{isDesktop ? (
|
||||
<tr>
|
||||
<th width="4%">{/*icon*/}</th>
|
||||
<th width="4%">{/* icon*/}</th>
|
||||
<th width="31%"><a className="d-block table-sort-op" href="#" onClick={this.sortByName}>{gettext('Name')} {sortByName && sortIcon}</a></th>
|
||||
<th width={columnWidths[0]}>{gettext('Library')}</th>
|
||||
{isPro && <th width="20%">{gettext('Permission')}</th>}
|
||||
<th width={columnWidths[1]}>{gettext('Visits')}</th>
|
||||
<th width={columnWidths[2]}><a className="d-block table-sort-op" href="#" onClick={this.sortByTime}>{gettext('Expiration')} {sortByTime && sortIcon}</a></th>
|
||||
<th width="10%">{/*Operations*/}</th>
|
||||
<th width="10%">{/* Operations*/}</th>
|
||||
</tr>
|
||||
) : (
|
||||
<tr>
|
||||
@@ -247,7 +247,7 @@ class Item extends Component {
|
||||
|
||||
render() {
|
||||
const item = this.props.item;
|
||||
const { currentPermission, permissionOptions , isOpIconShown, isPermSelectDialogOpen, isLinkDialogOpen } = this.state;
|
||||
const { currentPermission, permissionOptions, isOpIconShown, isPermSelectDialogOpen, isLinkDialogOpen } = this.state;
|
||||
this.permOptions = permissionOptions.map(item => {
|
||||
return {
|
||||
value: item,
|
||||
@@ -257,7 +257,7 @@ class Item extends Component {
|
||||
});
|
||||
const currentSelectedPermOption = this.permOptions.filter(item => item.isSelected)[0] || {};
|
||||
|
||||
let iconUrl, objUrl;
|
||||
let iconUrl; let objUrl;
|
||||
if (item.is_dir) {
|
||||
let path = item.path === '/' ? '/' : item.path.slice(0, item.path.length - 1);
|
||||
iconUrl = Utils.getFolderIconUrl(false);
|
||||
@@ -267,7 +267,7 @@ class Item extends Component {
|
||||
objUrl = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`;
|
||||
}
|
||||
|
||||
const deletedTip = item.obj_id === '' ? <span style={{color:'red'}}>{gettext('(deleted)')}</span> : null;
|
||||
const deletedTip = item.obj_id === '' ? <span style={{ color: 'red' }}>{gettext('(deleted)')}</span> : null;
|
||||
const desktopItem = (
|
||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} onFocus={this.handleMouseEnter}>
|
||||
<td><img src={iconUrl} width="24" alt="" /></td>
|
||||
@@ -293,8 +293,8 @@ class Item extends Component {
|
||||
<td>{item.view_cnt}</td>
|
||||
<td>{this.renderExpiration()}</td>
|
||||
<td>
|
||||
{!item.is_expired && <a href="#" className={`sf2-icon-link action-icon op-icon ${isOpIconShown ? '': 'invisible'}`} title={gettext('View')} aria-label={gettext('View')} role="button" onClick={this.viewLink}></a>}
|
||||
<a href="#" className={`sf3-font-delete1 sf3-font action-icon op-icon ${isOpIconShown ? '': 'invisible'}`} title={gettext('Remove')} aria-label={gettext('Remove')} role="button" onClick={this.removeLink}></a>
|
||||
{!item.is_expired && <a href="#" className={`sf2-icon-link action-icon op-icon ${isOpIconShown ? '' : 'invisible'}`} title={gettext('View')} aria-label={gettext('View')} role="button" onClick={this.viewLink}></a>}
|
||||
<a href="#" className={`sf3-font-delete1 sf3-font action-icon op-icon ${isOpIconShown ? '' : 'invisible'}`} title={gettext('Remove')} aria-label={gettext('Remove')} role="button" onClick={this.removeLink}></a>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
@@ -382,10 +382,10 @@ class ShareAdminShareLinks extends Component {
|
||||
|
||||
// for mobile
|
||||
this.sortOptions = [
|
||||
{value: 'name-asc', text: gettext('By name ascending')},
|
||||
{value: 'name-desc', text: gettext('By name descending')},
|
||||
{value: 'time-asc', text: gettext('By expiration ascending')},
|
||||
{value: 'time-desc', text: gettext('By expiration descending')}
|
||||
{ value: 'name-asc', text: gettext('By name ascending') },
|
||||
{ value: 'name-desc', text: gettext('By name descending') },
|
||||
{ value: 'time-asc', text: gettext('By expiration ascending') },
|
||||
{ value: 'time-desc', text: gettext('By expiration descending') }
|
||||
];
|
||||
}
|
||||
|
||||
@@ -394,24 +394,24 @@ class ShareAdminShareLinks extends Component {
|
||||
|
||||
switch (`${sortBy}-${sortOrder}`) {
|
||||
case 'name-asc':
|
||||
comparator = function(a, b) {
|
||||
comparator = function (a, b) {
|
||||
var result = Utils.compareTwoWord(a.obj_name, b.obj_name);
|
||||
return result;
|
||||
};
|
||||
break;
|
||||
case 'name-desc':
|
||||
comparator = function(a, b) {
|
||||
comparator = function (a, b) {
|
||||
var result = Utils.compareTwoWord(a.obj_name, b.obj_name);
|
||||
return -result;
|
||||
};
|
||||
break;
|
||||
case 'time-asc':
|
||||
comparator = function(a, b) {
|
||||
comparator = function (a, b) {
|
||||
return a.expire_date < b.expire_date ? -1 : 1;
|
||||
};
|
||||
break;
|
||||
case 'time-desc':
|
||||
comparator = function(a, b) {
|
||||
comparator = function (a, b) {
|
||||
return a.expire_date < b.expire_date ? 1 : -1;
|
||||
};
|
||||
break;
|
||||
@@ -466,10 +466,10 @@ class ShareAdminShareLinks extends Component {
|
||||
if (!this.state.isLoadingMore && this.state.hasMore) {
|
||||
const clientHeight = event.target.clientHeight;
|
||||
const scrollHeight = event.target.scrollHeight;
|
||||
const scrollTop = event.target.scrollTop;
|
||||
const scrollTop = event.target.scrollTop;
|
||||
const isBottom = (clientHeight + scrollTop + 1 >= scrollHeight);
|
||||
if (isBottom) { // scroll to the bottom
|
||||
this.setState({isLoadingMore: true}, () => {
|
||||
this.setState({ isLoadingMore: true }, () => {
|
||||
this.getMore();
|
||||
});
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class ShareAdminShareLinks extends Component {
|
||||
let items = this.state.items.filter(uploadItem => {
|
||||
return uploadItem.token !== item.token;
|
||||
});
|
||||
this.setState({items: items});
|
||||
this.setState({ items: items });
|
||||
let message = gettext('Successfully deleted 1 item.');
|
||||
toaster.success(message);
|
||||
}).catch((error) => {
|
||||
@@ -517,13 +517,13 @@ class ShareAdminShareLinks extends Component {
|
||||
};
|
||||
|
||||
toggleCleanInvalidShareLinksDialog = () => {
|
||||
this.setState({isCleanInvalidShareLinksDialogOpen: !this.state.isCleanInvalidShareLinksDialogOpen});
|
||||
this.setState({ isCleanInvalidShareLinksDialogOpen: !this.state.isCleanInvalidShareLinksDialogOpen });
|
||||
};
|
||||
|
||||
cleanInvalidShareLinks = () => {
|
||||
seafileAPI.cleanInvalidShareLinks().then(res => {
|
||||
const newItems = this.state.items.filter(item => item.obj_id !== '').filter(item => !item.is_expired);
|
||||
this.setState({items: newItems});
|
||||
this.setState({ items: newItems });
|
||||
toaster.success(gettext('Successfully cleaned invalid share links.'));
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
@@ -542,7 +542,7 @@ class ShareAdminShareLinks extends Component {
|
||||
<Link to={`${siteRoot}share-admin-share-links/`} className="nav-link active">
|
||||
{gettext('Share Links')}
|
||||
<SingleDropdownToolbar
|
||||
opList={[{'text': gettext('Clean invalid share links'), 'onClick': this.toggleCleanInvalidShareLinksDialog}]}
|
||||
opList={[{ 'text': gettext('Clean invalid share links'), 'onClick': this.toggleCleanInvalidShareLinksDialog }]}
|
||||
/>
|
||||
</Link>
|
||||
</li>
|
||||
|
Reference in New Issue
Block a user