mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-13 11:03:50 +00:00
Disabled domain component for Shlink versions not supporting it
This commit is contained in:
@@ -4,6 +4,7 @@ import { assoc, dissoc, isEmpty, isNil, pipe, replace, trim } from 'ramda';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Collapse } from 'reactstrap';
|
import { Collapse } from 'reactstrap';
|
||||||
import * as PropTypes from 'prop-types';
|
import * as PropTypes from 'prop-types';
|
||||||
|
import { compare } from 'compare-versions';
|
||||||
import DateInput from '../utils/DateInput';
|
import DateInput from '../utils/DateInput';
|
||||||
import Checkbox from '../utils/Checkbox';
|
import Checkbox from '../utils/Checkbox';
|
||||||
import ForVersion from '../utils/ForVersion';
|
import ForVersion from '../utils/ForVersion';
|
||||||
@@ -70,6 +71,8 @@ const CreateShortUrl = (TagsSelector, CreateShortUrlResult) => class CreateShort
|
|||||||
assoc('validUntil', formatDate(this.state.validUntil))
|
assoc('validUntil', formatDate(this.state.validUntil))
|
||||||
)(this.state));
|
)(this.state));
|
||||||
};
|
};
|
||||||
|
const currentServerVersion = this.props.selectedServer ? this.props.selectedServer.version : '9999';
|
||||||
|
const disableDomain = compare('1.19.0-beta.1', currentServerVersion, '>');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="shlink-container">
|
<div className="shlink-container">
|
||||||
@@ -95,26 +98,26 @@ const CreateShortUrl = (TagsSelector, CreateShortUrlResult) => class CreateShort
|
|||||||
{renderOptionalInput('customSlug', 'Custom slug')}
|
{renderOptionalInput('customSlug', 'Custom slug')}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-sm-6">
|
<div className="col-sm-6">
|
||||||
{renderOptionalInput('domain', 'Domain', 'text')}
|
{renderOptionalInput('domain', 'Domain', 'text', {
|
||||||
|
disabled: disableDomain,
|
||||||
|
...disableDomain && { title: 'Shlink 1.19.0 or higher is required to be able to provide the domain' },
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-sm-4">
|
<div className="col-sm-6">
|
||||||
{renderOptionalInput('maxVisits', 'Maximum number of visits allowed', 'number', { min: 1 })}
|
{renderOptionalInput('maxVisits', 'Maximum number of visits allowed', 'number', { min: 1 })}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-sm-4">
|
<div className="col-sm-3">
|
||||||
{renderDateInput('validSince', 'Enabled since...', { maxDate: this.state.validUntil })}
|
{renderDateInput('validSince', 'Enabled since...', { maxDate: this.state.validUntil })}
|
||||||
</div>
|
</div>
|
||||||
<div className="col-sm-4">
|
<div className="col-sm-3">
|
||||||
{renderDateInput('validUntil', 'Enabled until...', { minDate: this.state.validSince })}
|
{renderDateInput('validUntil', 'Enabled until...', { minDate: this.state.validSince })}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ForVersion
|
<ForVersion minVersion="1.16.0" currentServerVersion={currentServerVersion}>
|
||||||
minVersion="1.16.0"
|
|
||||||
currentServerVersion={this.props.selectedServer ? this.props.selectedServer.version : ''}
|
|
||||||
>
|
|
||||||
<div className="mb-4 text-right">
|
<div className="mb-4 text-right">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
className="mr-2"
|
className="mr-2"
|
||||||
|
|||||||
Reference in New Issue
Block a user