diff --git a/src/short-urls/CreateShortUrl.js b/src/short-urls/CreateShortUrl.js index 38d1d4be..84ab63b9 100644 --- a/src/short-urls/CreateShortUrl.js +++ b/src/short-urls/CreateShortUrl.js @@ -1,6 +1,6 @@ import { faAngleDoubleDown as downIcon, faAngleDoubleUp as upIcon } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { assoc, dissoc, isNil, pipe, replace, trim } from 'ramda'; +import { assoc, dissoc, isEmpty, isNil, pipe, replace, trim } from 'ramda'; import React from 'react'; import { Collapse } from 'reactstrap'; import * as PropTypes from 'prop-types'; @@ -23,6 +23,7 @@ const CreateShortUrl = (TagsSelector, CreateShortUrlResult) => class CreateShort longUrl: '', tags: [], customSlug: undefined, + domain: undefined, validSince: undefined, validUntil: undefined, maxVisits: undefined, @@ -89,15 +90,25 @@ const CreateShortUrl = (TagsSelector, CreateShortUrlResult) => class CreateShort
{renderOptionalInput('customSlug', 'Custom slug')} - {renderOptionalInput('maxVisits', 'Maximum number of visits allowed', 'number', { min: 1 })}
+ {renderOptionalInput('domain', 'Domain', 'text')} +
+
+ +
+
+ {renderOptionalInput('maxVisits', 'Maximum number of visits allowed', 'number', { min: 1 })} +
+
{renderDateInput('validSince', 'Enabled since...', { maxDate: this.state.validUntil })} +
+
{renderDateInput('validUntil', 'Enabled until...', { minDate: this.state.validSince })}
-
+
class CreateShort   {this.state.moreOptionsVisible ? 'Less' : 'More'} options -
diff --git a/src/short-urls/UseExistingIfFoundInfoIcon.js b/src/short-urls/UseExistingIfFoundInfoIcon.js index 7e155ac4..d91b0e24 100644 --- a/src/short-urls/UseExistingIfFoundInfoIcon.js +++ b/src/short-urls/UseExistingIfFoundInfoIcon.js @@ -20,7 +20,7 @@ const renderInfoModal = (isOpen, toggle) => ( -
- Important: This feature will be ignored while using a Shlink version older than v1.16.0. -
); diff --git a/test/short-urls/CreateShortUrl.test.js b/test/short-urls/CreateShortUrl.test.js index f7b08096..6d281b7c 100644 --- a/test/short-urls/CreateShortUrl.test.js +++ b/test/short-urls/CreateShortUrl.test.js @@ -32,6 +32,7 @@ describe('', () => { const urlInput = wrapper.find('.form-control-lg'); const tagsInput = wrapper.find(TagsSelector); const customSlugInput = wrapper.find('#customSlug'); + const domain = wrapper.find('#domain'); const maxVisitsInput = wrapper.find('#maxVisits'); const dateInputs = wrapper.find(DateInput); const validSinceInput = dateInputs.at(0); @@ -40,6 +41,7 @@ describe('', () => { urlInput.simulate('change', { target: { value: 'https://long-domain.com/foo/bar' } }); tagsInput.simulate('change', [ 'tag_foo', 'tag_bar' ]); customSlugInput.simulate('change', { target: { value: 'my-slug' } }); + domain.simulate('change', { target: { value: 'example.com' } }); maxVisitsInput.simulate('change', { target: { value: '20' } }); validSinceInput.simulate('change', validSince); validUntilInput.simulate('change', validUntil); @@ -53,6 +55,7 @@ describe('', () => { longUrl: 'https://long-domain.com/foo/bar', tags: [ 'tag_foo', 'tag_bar' ], customSlug: 'my-slug', + domain: 'example.com', validSince: validSince.format(), validUntil: validUntil.format(), maxVisits: '20',