mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
[dirent details panel] fixup & improvement (#2844)
* [dirent details panel] fixup & improvement * [my libs] details: click item to show details when details panel is open
This commit is contained in:
@@ -84,6 +84,13 @@ class DirPanel extends React.Component {
|
|||||||
this.props.onItemClick(dirent);
|
this.props.onItemClick(dirent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// on '<tr>'
|
||||||
|
onDirentClick = (dirent) => {
|
||||||
|
if (this.state.isDirentDetailShow) {
|
||||||
|
this.onItemDetails(dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onItemDetails = (dirent) => {
|
onItemDetails = (dirent) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
currentDirent: dirent,
|
currentDirent: dirent,
|
||||||
@@ -205,6 +212,7 @@ class DirPanel extends React.Component {
|
|||||||
isAllItemSelected={this.props.isAllDirentSelected}
|
isAllItemSelected={this.props.isAllDirentSelected}
|
||||||
isRepoOwner={this.state.isRepoOwner}
|
isRepoOwner={this.state.isRepoOwner}
|
||||||
onAddFile={this.props.onAddFile}
|
onAddFile={this.props.onAddFile}
|
||||||
|
onDirentClick={this.onDirentClick}
|
||||||
onItemDetails={this.onItemDetails}
|
onItemDetails={this.onItemDetails}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
onItemCopy={this.props.onItemCopy}
|
onItemCopy={this.props.onItemCopy}
|
||||||
|
@@ -86,7 +86,7 @@ class DetailListView extends React.Component {
|
|||||||
<tr><th>{gettext('Folder')}</th><td>{direntDetail.dir_count}</td></tr>
|
<tr><th>{gettext('Folder')}</th><td>{direntDetail.dir_count}</td></tr>
|
||||||
<tr><th>{gettext('File')}</th><td>{direntDetail.file_count}</td></tr>
|
<tr><th>{gettext('File')}</th><td>{direntDetail.file_count}</td></tr>
|
||||||
<tr><th>{gettext('Size')}</th><td>{Utils.bytesToSize(direntDetail.size)}</td></tr>
|
<tr><th>{gettext('Size')}</th><td>{Utils.bytesToSize(direntDetail.size)}</td></tr>
|
||||||
<tr><th>{gettext('Position')}</th><td>{position}</td></tr>
|
<tr><th>{gettext('Location')}</th><td>{position}</td></tr>
|
||||||
<tr><th>{gettext('Last Update')}</th><td>{moment(direntDetail.mtime).format('YYYY-MM-DD')}</td></tr>
|
<tr><th>{gettext('Last Update')}</th><td>{moment(direntDetail.mtime).format('YYYY-MM-DD')}</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -99,8 +99,8 @@ class DetailListView extends React.Component {
|
|||||||
<tr><th width="35%"></th><th width="65%"></th></tr>
|
<tr><th width="35%"></th><th width="65%"></th></tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr><th>{gettext('Size')}</th><td>{direntDetail.size}</td></tr>
|
<tr><th>{gettext('Size')}</th><td>{Utils.bytesToSize(direntDetail.size)}</td></tr>
|
||||||
<tr><th>{gettext('Position')}</th><td>{position}</td></tr>
|
<tr><th>{gettext('Location')}</th><td>{position}</td></tr>
|
||||||
<tr><th>{gettext('Last Update')}</th><td>{moment(direntDetail.last_modified).fromNow()}</td></tr>
|
<tr><th>{gettext('Last Update')}</th><td>{moment(direntDetail.last_modified).fromNow()}</td></tr>
|
||||||
<tr className="file-tag-container">
|
<tr className="file-tag-container">
|
||||||
<th>{gettext('Tags')}</th>
|
<th>{gettext('Tags')}</th>
|
||||||
|
@@ -32,6 +32,7 @@ const propTypes = {
|
|||||||
onItemMove: PropTypes.func.isRequired,
|
onItemMove: PropTypes.func.isRequired,
|
||||||
onItemCopy: PropTypes.func.isRequired,
|
onItemCopy: PropTypes.func.isRequired,
|
||||||
onItemDetails: PropTypes.func.isRequired,
|
onItemDetails: PropTypes.func.isRequired,
|
||||||
|
onDirentClick: PropTypes.func.isRequired,
|
||||||
updateDirent: PropTypes.func.isRequired,
|
updateDirent: PropTypes.func.isRequired,
|
||||||
currentRepoInfo: PropTypes.object,
|
currentRepoInfo: PropTypes.object,
|
||||||
isRepoOwner: PropTypes.bool,
|
isRepoOwner: PropTypes.bool,
|
||||||
@@ -111,6 +112,14 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// on '<tr>'
|
||||||
|
onDirentClick = (e) => {
|
||||||
|
// '<td>' is clicked
|
||||||
|
if (e.target.tagName == 'TD') {
|
||||||
|
this.props.onDirentClick(this.props.dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onItemClick = (e) => {
|
onItemClick = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -383,7 +392,7 @@ class DirentListItem extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave} onClick={this.onDirentClick}>
|
||||||
<td className="text-center">
|
<td className="text-center">
|
||||||
<input type="checkbox" className="vam" onChange={this.onItemSelected} checked={dirent.isSelected}/>
|
<input type="checkbox" className="vam" onChange={this.onItemSelected} checked={dirent.isSelected}/>
|
||||||
</td>
|
</td>
|
||||||
|
@@ -32,6 +32,7 @@ const propTypes = {
|
|||||||
onItemClick: PropTypes.func.isRequired,
|
onItemClick: PropTypes.func.isRequired,
|
||||||
onItemMove: PropTypes.func.isRequired,
|
onItemMove: PropTypes.func.isRequired,
|
||||||
onItemCopy: PropTypes.func.isRequired,
|
onItemCopy: PropTypes.func.isRequired,
|
||||||
|
onDirentClick: PropTypes.func.isRequired,
|
||||||
onItemDetails: PropTypes.func.isRequired,
|
onItemDetails: PropTypes.func.isRequired,
|
||||||
updateDirent: PropTypes.func.isRequired,
|
updateDirent: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
@@ -248,6 +249,7 @@ class DirentListView extends React.Component {
|
|||||||
isItemFreezed={this.state.isItemFreezed}
|
isItemFreezed={this.state.isItemFreezed}
|
||||||
onFreezedItem={this.onFreezedItem}
|
onFreezedItem={this.onFreezedItem}
|
||||||
onUnfreezedItem={this.onUnfreezedItem}
|
onUnfreezedItem={this.onUnfreezedItem}
|
||||||
|
onDirentClick={this.props.onDirentClick}
|
||||||
onItemDetails={this.onItemDetails}
|
onItemDetails={this.onItemDetails}
|
||||||
showImagePopup={this.showImagePopup}
|
showImagePopup={this.showImagePopup}
|
||||||
/>
|
/>
|
||||||
|
@@ -19,6 +19,7 @@ const propTypes = {
|
|||||||
onDeleteRepo: PropTypes.func.isRequired,
|
onDeleteRepo: PropTypes.func.isRequired,
|
||||||
onTransferRepo: PropTypes.func.isRequired,
|
onTransferRepo: PropTypes.func.isRequired,
|
||||||
onRepoDetails: PropTypes.func.isRequired,
|
onRepoDetails: PropTypes.func.isRequired,
|
||||||
|
onItemClick: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
class Content extends Component {
|
class Content extends Component {
|
||||||
@@ -138,6 +139,7 @@ class Content extends Component {
|
|||||||
onRenameRepo={this.props.onRenameRepo}
|
onRenameRepo={this.props.onRenameRepo}
|
||||||
onDeleteRepo={this.props.onDeleteRepo}
|
onDeleteRepo={this.props.onDeleteRepo}
|
||||||
onRepoDetails={this.props.onRepoDetails}
|
onRepoDetails={this.props.onRepoDetails}
|
||||||
|
onItemClick={this.props.onItemClick}
|
||||||
onTransfer={this.onTransfer}
|
onTransfer={this.onTransfer}
|
||||||
showDeleteItemPopup={this.showDeleteItemPopup}
|
showDeleteItemPopup={this.showDeleteItemPopup}
|
||||||
onHistorySetting={this.onHistorySetting}
|
onHistorySetting={this.onHistorySetting}
|
||||||
|
@@ -21,6 +21,7 @@ const propTypes = {
|
|||||||
showDeleteItemPopup: PropTypes.func.isRequired,
|
showDeleteItemPopup: PropTypes.func.isRequired,
|
||||||
onHistorySetting: PropTypes.func.isRequired,
|
onHistorySetting: PropTypes.func.isRequired,
|
||||||
onRepoDetails: PropTypes.func.isRequired,
|
onRepoDetails: PropTypes.func.isRequired,
|
||||||
|
onItemClick: PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
class Item extends Component {
|
class Item extends Component {
|
||||||
@@ -149,6 +150,14 @@ class Item extends Component {
|
|||||||
folderPerm = () => {
|
folderPerm = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// on '<tr>'
|
||||||
|
onItemClick = (e) => {
|
||||||
|
// '<td>' is clicked
|
||||||
|
if (e.target.tagName == 'TD') {
|
||||||
|
this.props.onItemClick(this.props.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showDetails = () => {
|
showDetails = () => {
|
||||||
let data = this.props.data;
|
let data = this.props.data;
|
||||||
this.props.onRepoDetails(data);
|
this.props.onRepoDetails(data);
|
||||||
@@ -239,7 +248,7 @@ class Item extends Component {
|
|||||||
|
|
||||||
const desktopItem = (
|
const desktopItem = (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut} onClick={this.onItemClick}>
|
||||||
<td><img src={data.icon_url} title={data.icon_title} alt={data.icon_title} width="24" /></td>
|
<td><img src={data.icon_url} title={data.icon_title} alt={data.icon_title} width="24" /></td>
|
||||||
<td>
|
<td>
|
||||||
{this.state.showChangeLibName && (
|
{this.state.showChangeLibName && (
|
||||||
@@ -277,7 +286,7 @@ class Item extends Component {
|
|||||||
|
|
||||||
const mobileItem = (
|
const mobileItem = (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut} onClick={this.onItemClick}>
|
||||||
<td><img src={data.icon_url} title={data.icon_title} alt={data.icon_title} width="24" /></td>
|
<td><img src={data.icon_url} title={data.icon_title} alt={data.icon_title} width="24" /></td>
|
||||||
<td>
|
<td>
|
||||||
{data.repo_name ?
|
{data.repo_name ?
|
||||||
|
@@ -103,6 +103,12 @@ class MyLibraries extends Component {
|
|||||||
this.setState({items: items});
|
this.setState({items: items});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onItemClick = (repo) => {
|
||||||
|
if (this.state.isShowDetails) {
|
||||||
|
this.onRepoDetails(repo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onRepoDetails = (repo) => {
|
onRepoDetails = (repo) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
isShowDetails: true,
|
isShowDetails: true,
|
||||||
@@ -140,6 +146,7 @@ class MyLibraries extends Component {
|
|||||||
onRenameRepo={this.onRenameRepo}
|
onRenameRepo={this.onRenameRepo}
|
||||||
onTransferRepo={this.onTransferRepo}
|
onTransferRepo={this.onTransferRepo}
|
||||||
onRepoDetails={this.onRepoDetails}
|
onRepoDetails={this.onRepoDetails}
|
||||||
|
onItemClick={this.onItemClick}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -10,6 +10,7 @@ const propTypes = {
|
|||||||
showDeleteItemPopup: PropTypes.func.isRequired,
|
showDeleteItemPopup: PropTypes.func.isRequired,
|
||||||
onHistorySetting: PropTypes.func.isRequired,
|
onHistorySetting: PropTypes.func.isRequired,
|
||||||
onRepoDetails: PropTypes.func.isRequired,
|
onRepoDetails: PropTypes.func.isRequired,
|
||||||
|
onItemClick: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
class TableBody extends Component {
|
class TableBody extends Component {
|
||||||
@@ -39,6 +40,7 @@ class TableBody extends Component {
|
|||||||
showDeleteItemPopup={this.props.showDeleteItemPopup}
|
showDeleteItemPopup={this.props.showDeleteItemPopup}
|
||||||
onHistorySetting={this.props.onHistorySetting}
|
onHistorySetting={this.props.onHistorySetting}
|
||||||
onRepoDetails={this.props.onRepoDetails}
|
onRepoDetails={this.props.onRepoDetails}
|
||||||
|
onItemClick={this.props.onItemClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -51,4 +53,4 @@ class TableBody extends Component {
|
|||||||
|
|
||||||
TableBody.propTypes = propTypes;
|
TableBody.propTypes = propTypes;
|
||||||
|
|
||||||
export default TableBody;
|
export default TableBody;
|
||||||
|
@@ -121,6 +121,13 @@ class MainPanel extends Component {
|
|||||||
this.props.onMainNavBarClick(path);
|
this.props.onMainNavBarClick(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// on '<tr>'
|
||||||
|
onDirentClick = (dirent) => {
|
||||||
|
if (this.state.isDirentDetailShow) {
|
||||||
|
this.onItemDetails(dirent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onItemDetails = (dirent) => {
|
onItemDetails = (dirent) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
currentDirent: dirent,
|
currentDirent: dirent,
|
||||||
@@ -255,6 +262,7 @@ class MainPanel extends Component {
|
|||||||
onItemRename={this.props.onItemRename}
|
onItemRename={this.props.onItemRename}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
onItemCopy={this.props.onItemCopy}
|
onItemCopy={this.props.onItemCopy}
|
||||||
|
onDirentClick={this.onDirentClick}
|
||||||
onItemDetails={this.onItemDetails}
|
onItemDetails={this.onItemDetails}
|
||||||
isDirentListLoading={this.props.isDirentListLoading}
|
isDirentListLoading={this.props.isDirentListLoading}
|
||||||
updateDirent={this.props.updateDirent}
|
updateDirent={this.props.updateDirent}
|
||||||
|
Reference in New Issue
Block a user