mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 10:17:28 +03:00
Ensured edit meta menu item is only displayed when shlink v1.18 or greater is run
This commit is contained in:
parent
2236ed467e
commit
5762342d6c
2 changed files with 14 additions and 4 deletions
|
@ -46,6 +46,7 @@ const ShortUrlsRowMenu = (
|
||||||
const { onCopyToClipboard, shortUrl, selectedServer } = this.props;
|
const { onCopyToClipboard, shortUrl, selectedServer } = this.props;
|
||||||
const completeShortUrl = shortUrl && shortUrl.shortUrl ? shortUrl.shortUrl : '';
|
const completeShortUrl = shortUrl && shortUrl.shortUrl ? shortUrl.shortUrl : '';
|
||||||
const currentServerVersion = selectedServer ? selectedServer.version : '';
|
const currentServerVersion = selectedServer ? selectedServer.version : '';
|
||||||
|
const showEditMetaBtn = !isEmpty(currentServerVersion) && compareVersions(currentServerVersion, '>=', '1.18.0');
|
||||||
const showPreviewBtn = !isEmpty(currentServerVersion) && compareVersions(currentServerVersion, '<', '2.0.0');
|
const showPreviewBtn = !isEmpty(currentServerVersion) && compareVersions(currentServerVersion, '<', '2.0.0');
|
||||||
const toggleModal = (prop) => () => this.setState((prevState) => ({ [prop]: !prevState[prop] }));
|
const toggleModal = (prop) => () => this.setState((prevState) => ({ [prop]: !prevState[prop] }));
|
||||||
const toggleQrCode = toggleModal('isQrModalOpen');
|
const toggleQrCode = toggleModal('isQrModalOpen');
|
||||||
|
@ -69,10 +70,14 @@ const ShortUrlsRowMenu = (
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
<EditTagsModal shortUrl={shortUrl} isOpen={this.state.isTagsModalOpen} toggle={toggleTags} />
|
<EditTagsModal shortUrl={shortUrl} isOpen={this.state.isTagsModalOpen} toggle={toggleTags} />
|
||||||
|
|
||||||
|
{showEditMetaBtn && (
|
||||||
|
<React.Fragment>
|
||||||
<DropdownItem onClick={toggleMeta}>
|
<DropdownItem onClick={toggleMeta}>
|
||||||
<FontAwesomeIcon icon={editIcon} fixedWidth /> Edit metadata
|
<FontAwesomeIcon icon={editIcon} fixedWidth /> Edit metadata
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
<EditMetaModal shortUrl={shortUrl} isOpen={this.state.isMetaModalOpen} toggle={toggleMeta} />
|
<EditMetaModal shortUrl={shortUrl} isOpen={this.state.isMetaModalOpen} toggle={toggleMeta} />
|
||||||
|
</React.Fragment>
|
||||||
|
)}
|
||||||
|
|
||||||
<DropdownItem className="short-urls-row-menu__dropdown-item--danger" onClick={toggleDelete}>
|
<DropdownItem className="short-urls-row-menu__dropdown-item--danger" onClick={toggleDelete}>
|
||||||
<FontAwesomeIcon icon={deleteIcon} fixedWidth /> Delete short URL
|
<FontAwesomeIcon icon={deleteIcon} fixedWidth /> Delete short URL
|
||||||
|
|
|
@ -47,6 +47,11 @@ describe('<ShortUrlsRowMenu />', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
each([
|
each([
|
||||||
|
[ '1.17.0', 6, 2 ],
|
||||||
|
[ '1.17.2', 6, 2 ],
|
||||||
|
[ '1.18.0', 7, 2 ],
|
||||||
|
[ '1.18.1', 7, 2 ],
|
||||||
|
[ '1.19.0', 7, 2 ],
|
||||||
[ '1.20.3', 7, 2 ],
|
[ '1.20.3', 7, 2 ],
|
||||||
[ '1.21.0', 7, 2 ],
|
[ '1.21.0', 7, 2 ],
|
||||||
[ '1.21.1', 7, 2 ],
|
[ '1.21.1', 7, 2 ],
|
||||||
|
|
Loading…
Reference in a new issue