1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 06:11:16 +00:00

Prop type check repair (#2919)

* repair intent check wraning

* change doublequote to singlequote, add semicolon

* optimized code

* modify type-check wraning
This commit is contained in:
杨顺强
2019-01-31 17:37:02 +08:00
committed by Daniel Pan
parent 06f25f05f2
commit e57701fa38
74 changed files with 714 additions and 700 deletions

View File

@@ -146,41 +146,41 @@ class DirentListItem extends React.Component {
onMenuItemClick = (operation) => {
switch(operation) {
case 'Rename':
this.onItemRenameToggle();
break;
case 'Move':
this.onItemMoveToggle();
break;
case 'Copy':
this.onItemCopyToggle();
break;
case 'Permission':
this.onPermissionItem();
break;
case 'Details':
this.onDetailsItem();
break;
case 'Unlock':
this.onUnlockItem();
break;
case 'Lock':
this.onLockItem();
break;
case 'Comment':
this.onComnentItem();
break;
case 'History':
this.onHistory();
break;
case 'Access Log':
this.onAccessLog();
break;
case 'Open via Client':
this.onOpenViaClient();
break;
default:
break;
case 'Rename':
this.onItemRenameToggle();
break;
case 'Move':
this.onItemMoveToggle();
break;
case 'Copy':
this.onItemCopyToggle();
break;
case 'Permission':
this.onPermissionItem();
break;
case 'Details':
this.onDetailsItem();
break;
case 'Unlock':
this.onUnlockItem();
break;
case 'Lock':
this.onLockItem();
break;
case 'Comment':
this.onComnentItem();
break;
case 'History':
this.onHistory();
break;
case 'Access Log':
this.onAccessLog();
break;
case 'Open via Client':
this.onOpenViaClient();
break;
default:
break;
}
}
@@ -316,7 +316,7 @@ class DirentListItem extends React.Component {
onTagTooltipToggle = (e) => {
e.stopPropagation();
this.setState({isShowTagTooltip: !this.state.isShowTagTooltip})
this.setState({isShowTagTooltip: !this.state.isShowTagTooltip});
}
render() {

View File

@@ -143,7 +143,7 @@ class DirentListView extends React.Component {
'url': `${siteRoot}lib/${repoID}/file${path}`,
'src': src
};
}
};
return items.map((item) => { return prepareItem(item); });
}
@@ -227,85 +227,85 @@ class DirentListView extends React.Component {
const imageItemsLength = imageItems.length;
const imageCaption = imageItemsLength && (
<Fragment>
<span>{gettext("%curr% of %total%").replace('%curr%', imageIndex + 1).replace('%total%', imageItemsLength)}</span>
<span>{gettext('%curr% of %total%').replace('%curr%', imageIndex + 1).replace('%total%', imageItemsLength)}</span>
<br />
<a href={imageItems[imageIndex].url} target="_blank">{gettext("Open in New Tab")}</a>
<a href={imageItems[imageIndex].url} target="_blank">{gettext('Open in New Tab')}</a>
</Fragment>
);
return (
<Fragment>
<table>
<thead>
<tr>
<th width="3%" className="text-center">
<input type="checkbox" className="vam" onChange={this.props.onAllItemSelected} checked={this.props.isAllItemSelected}/>
</th>
<th width="3%">{/*icon */}</th>
<th width="5%">{/*star */}</th>
<th width="39%"><a className="d-block table-sort-op" href="#" onClick={this.sortByName}>{gettext('Name')} {sortByName && sortIcon}</a></th>
<th width="6%">{/*tag */}</th>
<th width="20%">{/*operation */}</th>
<th width="11%">{gettext('Size')}</th>
<th width="13%"><a className="d-block table-sort-op" href="#" onClick={this.sortByTime}>{gettext('Last Update')} {sortByTime && sortIcon}</a></th>
</tr>
</thead>
<tbody>
{
direntList.length !== 0 && direntList.map((dirent, index) => {
return (
<DirentListItem
key={index}
dirent={dirent}
path={this.props.path}
repoID={this.props.repoID}
currentRepoInfo={this.props.currentRepoInfo}
isRepoOwner={this.props.isRepoOwner}
direntList={this.props.direntList}
onItemClick={this.props.onItemClick}
onItemRenameToggle={this.onItemRenameToggle}
onItemSelected={this.props.onItemSelected}
onItemDelete={this.props.onItemDelete}
onItemRename={this.onItemRename}
onItemMove={this.props.onItemMove}
onItemCopy={this.props.onItemCopy}
updateDirent={this.props.updateDirent}
isItemFreezed={this.state.isItemFreezed}
onFreezedItem={this.onFreezedItem}
onUnfreezedItem={this.onUnfreezedItem}
onDirentClick={this.props.onDirentClick}
onItemDetails={this.onItemDetails}
showImagePopup={this.showImagePopup}
repoEncrypted={this.props.repoEncrypted}
enableDirPrivateShare={this.props.enableDirPrivateShare}
isAdmin={this.props.isAdmin}
isGroupOwnedRepo={this.props.isGroupOwnedRepo}
/>
);
})
}
</tbody>
</table>
<table>
<thead>
<tr>
<th width="3%" className="text-center">
<input type="checkbox" className="vam" onChange={this.props.onAllItemSelected} checked={this.props.isAllItemSelected}/>
</th>
<th width="3%">{/*icon */}</th>
<th width="5%">{/*star */}</th>
<th width="39%"><a className="d-block table-sort-op" href="#" onClick={this.sortByName}>{gettext('Name')} {sortByName && sortIcon}</a></th>
<th width="6%">{/*tag */}</th>
<th width="20%">{/*operation */}</th>
<th width="11%">{gettext('Size')}</th>
<th width="13%"><a className="d-block table-sort-op" href="#" onClick={this.sortByTime}>{gettext('Last Update')} {sortByTime && sortIcon}</a></th>
</tr>
</thead>
<tbody>
{
direntList.length !== 0 && direntList.map((dirent, index) => {
return (
<DirentListItem
key={index}
dirent={dirent}
path={this.props.path}
repoID={this.props.repoID}
currentRepoInfo={this.props.currentRepoInfo}
isRepoOwner={this.props.isRepoOwner}
direntList={this.props.direntList}
onItemClick={this.props.onItemClick}
onItemRenameToggle={this.onItemRenameToggle}
onItemSelected={this.props.onItemSelected}
onItemDelete={this.props.onItemDelete}
onItemRename={this.onItemRename}
onItemMove={this.props.onItemMove}
onItemCopy={this.props.onItemCopy}
updateDirent={this.props.updateDirent}
isItemFreezed={this.state.isItemFreezed}
onFreezedItem={this.onFreezedItem}
onUnfreezedItem={this.onUnfreezedItem}
onDirentClick={this.props.onDirentClick}
onItemDetails={this.onItemDetails}
showImagePopup={this.showImagePopup}
repoEncrypted={this.props.repoEncrypted}
enableDirPrivateShare={this.props.enableDirPrivateShare}
isAdmin={this.props.isAdmin}
isGroupOwnedRepo={this.props.isGroupOwnedRepo}
/>
);
})
}
</tbody>
</table>
{this.state.isImagePopupOpen && (
<Lightbox
mainSrc={imageItems[imageIndex].src}
imageTitle={imageItems[imageIndex].name}
imageCaption={imageCaption}
nextSrc={imageItems[(imageIndex + 1) % imageItemsLength].src}
prevSrc={imageItems[(imageIndex + imageItemsLength - 1) % imageItemsLength].src}
onCloseRequest={this.closeImagePopup}
onMovePrevRequest={this.moveToPrevImage}
onMoveNextRequest={this.moveToNextImage}
imagePadding={70}
imageLoadErrorMessage={gettext('The image could not be loaded.')}
prevLabel={gettext("Previous (Left arrow key)")}
nextLabel={gettext("Next (Right arrow key)")}
closeLabel={gettext("Close (Esc)")}
zoomInLabel={gettext('Zoom in')}
zoomOutLabel={gettext('Zoom out')}
/>
)}
{this.state.isImagePopupOpen && (
<Lightbox
mainSrc={imageItems[imageIndex].src}
imageTitle={imageItems[imageIndex].name}
imageCaption={imageCaption}
nextSrc={imageItems[(imageIndex + 1) % imageItemsLength].src}
prevSrc={imageItems[(imageIndex + imageItemsLength - 1) % imageItemsLength].src}
onCloseRequest={this.closeImagePopup}
onMovePrevRequest={this.moveToPrevImage}
onMoveNextRequest={this.moveToNextImage}
imagePadding={70}
imageLoadErrorMessage={gettext('The image could not be loaded.')}
prevLabel={gettext('Previous (Left arrow key)')}
nextLabel={gettext('Next (Right arrow key)')}
closeLabel={gettext('Close (Esc)')}
zoomInLabel={gettext('Zoom in')}
zoomOutLabel={gettext('Zoom out')}
/>
)}
</Fragment>
);
}

View File

@@ -4,6 +4,7 @@ import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap
import { gettext, isPro, enableFileComment, fileAuditEnabled, folderPermEnabled } from '../../utils/constants';
const propTypes = {
dirent: PropTypes.object.isRequired,
currentRepoInfo: PropTypes.object.isRequired,
isRepoOwner: PropTypes.bool.isRequired,
onMenuItemClick: PropTypes.func.isRequired,
@@ -55,7 +56,7 @@ class DirentMenu extends React.Component {
menuList.push('Copy');
if (isPro) {
if (dirent.is_locked) {
if (dirent.locked_by_me || (dirent.lock_owner === "OnlineOffice" && permission === 'rw')) {
if (dirent.locked_by_me || (dirent.lock_owner === 'OnlineOffice' && permission === 'rw')) {
menuList.push('Unlock');
}
} else {