1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 10:50:24 +00:00

feat: refresh metadata view (#7110)

* feat: refresh metadata view

* feat: optimize code

* feat: optimize tip

---------

Co-authored-by: 杨国璇 <ygx@192.168.1.2>
Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-11-27 10:59:39 +08:00
committed by GitHub
parent 6f8389e70c
commit ed62007228
12 changed files with 56 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { UncontrolledTooltip } from 'reactstrap';
import { Link } from '@gatsbyjs/reach-router';
import DirOperationToolBar from '../../components/toolbar/dir-operation-toolbar';
import MetadataViewName from '../../metadata/components/metadata-view-name';
@@ -7,6 +8,8 @@ import TagViewName from '../../tag/components/tag-view-name';
import { siteRoot, gettext } from '../../utils/constants';
import { Utils } from '../../utils/utils';
import { PRIVATE_FILE_TYPE } from '../../constants';
import { debounce } from '../../metadata/utils/common';
import { EVENT_BUS_TYPE } from '../../metadata/constants';
const propTypes = {
currentRepoInfo: PropTypes.object.isRequired,
@@ -115,6 +118,10 @@ class DirPath extends React.Component {
});
};
handelRefresh = debounce(() => {
window.sfMetadataContext.eventBus.dispatch(EVENT_BUS_TYPE.RELOAD_DATA);
}, 200);
turnPathToLink = (path) => {
path = path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;
let pathList = path.split('/');
@@ -149,6 +156,12 @@ class DirPath extends React.Component {
<Fragment key={index}>
<span className="path-split">/</span>
<span className="path-item"><MetadataViewName id={item} /></span>
<div className="path-item-refresh" id="sf-metadata-view-refresh" onClick={this.handelRefresh}>
<i className="sf3-font sf3-font-refresh"></i>
<UncontrolledTooltip target="sf-metadata-view-refresh" placement="bottom">
{gettext('Refresh the page')}
</UncontrolledTooltip>
</div>
</Fragment>
);
}