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

change file tags popover (#5696)

This commit is contained in:
Michael An
2023-10-19 17:29:01 +08:00
committed by GitHub
parent f2a4df29c5
commit 1625808229
2 changed files with 18 additions and 15 deletions

View File

@@ -1,11 +1,11 @@
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import moment from 'moment'; import moment from 'moment';
import { v4 as uuidv4 } from 'uuid';
import Icon from '../icon'; import Icon from '../icon';
import { gettext } from '../../utils/constants'; import { gettext } from '../../utils/constants';
import { Utils } from '../../utils/utils'; import { Utils } from '../../utils/utils';
import EditFileTagDialog from '../dialog/edit-filetag-dialog'; import EditFileTagPopover from '../popover/edit-filetag-popover';
import ModalPortal from '../modal-portal';
import ExtraAttributesDialog from '../dialog/extra-attributes-dialog'; import ExtraAttributesDialog from '../dialog/extra-attributes-dialog';
import FileTagList from '../file-tag-list'; import FileTagList from '../file-tag-list';
import ConfirmApplyFolderPropertiesDialog from '../dialog/confirm-apply-folder-properties-dialog'; import ConfirmApplyFolderPropertiesDialog from '../dialog/confirm-apply-folder-properties-dialog';
@@ -30,6 +30,7 @@ class DetailListView extends React.Component {
isShowExtraProperties: false, isShowExtraProperties: false,
isShowApplyProperties: false isShowApplyProperties: false
}; };
this.tagListTitleID = `detail-list-view-tags-${uuidv4()}`;
} }
getDirentPosition = () => { getDirentPosition = () => {
@@ -122,7 +123,7 @@ class DetailListView extends React.Component {
<th>{gettext('Tags')}</th> <th>{gettext('Tags')}</th>
<td> <td>
<FileTagList fileTagList={this.props.fileTagList} /> <FileTagList fileTagList={this.props.fileTagList} />
<span onClick={this.onEditFileTagToggle}><Icon symbol='tag' /></span> <span onClick={this.onEditFileTagToggle} id={this.tagListTitleID}><Icon symbol='tag' /></span>
</td> </td>
</tr> </tr>
{direntDetail.permission === 'rw' && ( {direntDetail.permission === 'rw' && (
@@ -147,15 +148,15 @@ class DetailListView extends React.Component {
<Fragment> <Fragment>
{this.renderTags()} {this.renderTags()}
{this.state.isEditFileTagShow && {this.state.isEditFileTagShow &&
<ModalPortal> <EditFileTagPopover
<EditFileTagDialog
repoID={this.props.repoID} repoID={this.props.repoID}
fileTagList={fileTagList}
filePath={direntPath} filePath={direntPath}
fileTagList={fileTagList}
toggleCancel={this.onEditFileTagToggle} toggleCancel={this.onEditFileTagToggle}
onFileTagChanged={this.onFileTagChanged} onFileTagChanged={this.onFileTagChanged}
target={this.tagListTitleID}
isEditFileTagShow={this.state.isEditFileTagShow}
/> />
</ModalPortal>
} }
{this.state.isShowExtraProperties && ( {this.state.isShowExtraProperties && (
<ExtraAttributesDialog <ExtraAttributesDialog

View File

@@ -4,7 +4,7 @@ import moment from 'moment';
import Icon from '../../../components/icon'; import Icon from '../../../components/icon';
import { gettext } from '../../../utils/constants'; import { gettext } from '../../../utils/constants';
import { Utils } from '../../../utils/utils'; import { Utils } from '../../../utils/utils';
import EditFileTagDialog from '../../../components/dialog/edit-filetag-dialog'; import EditFileTagPopover from '../../../components/popover/edit-filetag-popover';
import FileTagList from '../../../components/file-tag-list'; import FileTagList from '../../../components/file-tag-list';
import '../../../css/dirent-detail.css'; import '../../../css/dirent-detail.css';
@@ -48,19 +48,21 @@ class DetailListView extends React.Component {
<th>{gettext('Tags')}</th> <th>{gettext('Tags')}</th>
<td> <td>
<FileTagList fileTagList={this.props.fileTagList} /> <FileTagList fileTagList={this.props.fileTagList} />
<span onClick={this.onEditFileTagToggle}><Icon symbol='tag' /></span> <span onClick={this.onEditFileTagToggle} id='file-tag-container-icon'><Icon symbol='tag' /></span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
{this.state.isEditFileTagShow && {this.state.isEditFileTagShow &&
<EditFileTagDialog <EditFileTagPopover
repoID={repoID} repoID={repoID}
filePath={filePath} filePath={filePath}
fileTagList={this.props.fileTagList} fileTagList={this.props.fileTagList}
toggleCancel={this.onEditFileTagToggle} toggleCancel={this.onEditFileTagToggle}
onFileTagChanged={this.props.onFileTagChanged} onFileTagChanged={this.props.onFileTagChanged}
target={'file-tag-container-icon'}
isEditFileTagShow={this.state.isEditFileTagShow}
/> />
} }
</Fragment> </Fragment>