mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 02:48:51 +00:00
repo-metadata-views (#6344)
* repo-metadata-views * Update metadata_manage.py * feat: add view * feat: refresh view tool bar * update --------- Co-authored-by: 杨国璇 <ygx@192.168.124.14>
This commit is contained in:
@@ -62,16 +62,25 @@ class DirPath extends React.Component {
|
||||
if (item === '') {
|
||||
return null;
|
||||
}
|
||||
if (index === (pathList.length - 1)) {
|
||||
if (item === PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<span className="path-split">/</span>
|
||||
<span className="path-item">{gettext('File extended properties')}</span>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
if (index === pathList.length - 2 && item === PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<span className="path-split">/</span>
|
||||
<span className="path-item">{gettext('File extended properties')}</span>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
if (index === pathList.length - 1 && pathList[pathList.length - 2] === PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<span className="path-split">/</span>
|
||||
<span className="path-item">{item}</span>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
if (index === (pathList.length - 1)) {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<span className="path-split">/</span>
|
||||
@@ -129,7 +138,7 @@ class DirPath extends React.Component {
|
||||
const { currentPath } = this.props;
|
||||
const path = currentPath[currentPath.length - 1] === '/' ? currentPath.slice(0, currentPath.length - 1) : currentPath;
|
||||
const pathList = path.split('/');
|
||||
return pathList[pathList.length - 1] === PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES;
|
||||
return pathList[pathList.length - 2] === PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES;
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@@ -23,6 +23,7 @@ const propTypes = {
|
||||
sortBy: PropTypes.string,
|
||||
sortOrder: PropTypes.string,
|
||||
sortItems: PropTypes.func,
|
||||
metadataViewId: PropTypes.string,
|
||||
};
|
||||
|
||||
class DirTool extends React.Component {
|
||||
@@ -97,9 +98,9 @@ class DirTool extends React.Component {
|
||||
render() {
|
||||
const menuItems = this.getMenu();
|
||||
const { isDropdownMenuOpen } = this.state;
|
||||
const { repoID, currentMode, currentPath, sortBy, sortOrder } = this.props;
|
||||
const { repoID, currentMode, currentPath, sortBy, sortOrder, metadataViewId } = this.props;
|
||||
const propertiesText = TextTranslation.PROPERTIES.value;
|
||||
const isFileExtended = currentPath === '/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES;
|
||||
const isFileExtended = currentPath.startsWith('/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES + '/');
|
||||
|
||||
const sortOptions = this.sortOptions.map(item => {
|
||||
return {
|
||||
@@ -111,7 +112,7 @@ class DirTool extends React.Component {
|
||||
if (isFileExtended) {
|
||||
return (
|
||||
<div className="d-flex">
|
||||
<MetadataViewToolBar />
|
||||
<MetadataViewToolBar metadataViewId={metadataViewId} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ const propTypes = {
|
||||
filePermission: PropTypes.string,
|
||||
repoTags: PropTypes.array.isRequired,
|
||||
onFileTagChanged: PropTypes.func.isRequired,
|
||||
metadataViewId: PropTypes.string,
|
||||
};
|
||||
|
||||
class CurDirPath extends React.Component {
|
||||
@@ -96,6 +97,7 @@ class CurDirPath extends React.Component {
|
||||
sortBy={this.props.sortBy}
|
||||
sortOrder={this.props.sortOrder}
|
||||
sortItems={this.props.sortItems}
|
||||
metadataViewId={this.props.metadataViewId}
|
||||
/>}
|
||||
{!isDesktop && this.props.direntList.length > 0 &&
|
||||
<span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
||||
|
@@ -13,6 +13,7 @@ const propTypes = {
|
||||
isFileLoadedErr: PropTypes.bool.isRequired,
|
||||
filePermission: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
metadataViewId: PropTypes.string,
|
||||
lastModified: PropTypes.string,
|
||||
latestContributor: PropTypes.string,
|
||||
onLinkClick: PropTypes.func.isRequired,
|
||||
@@ -52,13 +53,14 @@ class DirColumnFile extends React.Component {
|
||||
}
|
||||
|
||||
if (this.props.content === '__sf-metadata') {
|
||||
const { repoID, currentRepoInfo, metadataViewId } = this.props;
|
||||
window.sfMetadata = {
|
||||
siteRoot,
|
||||
lang,
|
||||
mediaUrl,
|
||||
};
|
||||
|
||||
return (<SeafileMetadata repoID={this.props.repoID} currentRepoInfo={this.props.currentRepoInfo} />);
|
||||
return (<SeafileMetadata repoID={repoID} currentRepoInfo={currentRepoInfo} viewID={metadataViewId} />);
|
||||
}
|
||||
|
||||
return (
|
||||
|
@@ -37,6 +37,7 @@ const propTypes = {
|
||||
hash: PropTypes.string,
|
||||
filePermission: PropTypes.string,
|
||||
content: PropTypes.string,
|
||||
metadataViewId: PropTypes.string,
|
||||
lastModified: PropTypes.string,
|
||||
latestContributor: PropTypes.string,
|
||||
onLinkClick: PropTypes.func.isRequired,
|
||||
@@ -192,6 +193,7 @@ class DirColumnView extends React.Component {
|
||||
isFileLoadedErr={this.props.isFileLoadedErr}
|
||||
filePermission={this.props.filePermission}
|
||||
content={this.props.content}
|
||||
metadataViewId={this.props.metadataViewId}
|
||||
currentRepoInfo={this.props.currentRepoInfo}
|
||||
lastModified={this.props.lastModified}
|
||||
latestContributor={this.props.latestContributor}
|
||||
|
@@ -67,7 +67,7 @@ const DirViews = ({ userPerm, repoID, currentPath, onNodeClick }) => {
|
||||
moreOperations={moreOperations}
|
||||
moreOperationClick={moreOperationClick}
|
||||
>
|
||||
{!loading && metadataStatus && (<MetadataTreeView repoID={repoID} currentPath={currentPath} onNodeClick={onNodeClick} />)}
|
||||
{!loading && metadataStatus && (<MetadataTreeView userPerm={userPerm} repoID={repoID} currentPath={currentPath} onNodeClick={onNodeClick} />)}
|
||||
</TreeSection>
|
||||
{showMetadataStatusManagementDialog && (
|
||||
<MetadataStatusManagementDialog
|
||||
|
@@ -107,6 +107,7 @@ class TreeView extends React.Component {
|
||||
return;
|
||||
}
|
||||
let dragStartNodeData = e.dataTransfer.getData('applicaiton/drag-item-info');
|
||||
if (!dragStartNodeData) return;
|
||||
dragStartNodeData = JSON.parse(dragStartNodeData);
|
||||
|
||||
let { nodeDirent, nodeParentPath, nodeRootPath } = dragStartNodeData;
|
||||
|
Reference in New Issue
Block a user