2020-08-23 10:03:44 +03:00
|
|
|
import Bottle from 'bottlejs';
|
2018-12-18 21:59:50 +03:00
|
|
|
import ShortUrls from '../ShortUrls';
|
|
|
|
import SearchBar from '../SearchBar';
|
|
|
|
import ShortUrlsList from '../ShortUrlsList';
|
|
|
|
import ShortUrlsRow from '../helpers/ShortUrlsRow';
|
|
|
|
import ShortUrlsRowMenu from '../helpers/ShortUrlsRowMenu';
|
|
|
|
import CreateShortUrl from '../CreateShortUrl';
|
|
|
|
import DeleteShortUrlModal from '../helpers/DeleteShortUrlModal';
|
|
|
|
import EditTagsModal from '../helpers/EditTagsModal';
|
2020-01-19 15:07:33 +03:00
|
|
|
import EditMetaModal from '../helpers/EditMetaModal';
|
2020-03-30 21:42:58 +03:00
|
|
|
import EditShortUrlModal from '../helpers/EditShortUrlModal';
|
2019-01-08 22:49:47 +03:00
|
|
|
import CreateShortUrlResult from '../helpers/CreateShortUrlResult';
|
2018-12-18 21:59:50 +03:00
|
|
|
import { listShortUrls } from '../reducers/shortUrlsList';
|
|
|
|
import { createShortUrl, resetCreateShortUrl } from '../reducers/shortUrlCreation';
|
2020-01-31 22:12:22 +03:00
|
|
|
import { deleteShortUrl, resetDeleteShortUrl } from '../reducers/shortUrlDeletion';
|
2020-01-31 22:06:28 +03:00
|
|
|
import { editShortUrlTags, resetShortUrlsTags } from '../reducers/shortUrlTags';
|
2020-01-19 22:37:12 +03:00
|
|
|
import { editShortUrlMeta, resetShortUrlMeta } from '../reducers/shortUrlMeta';
|
2018-12-18 21:59:50 +03:00
|
|
|
import { resetShortUrlParams } from '../reducers/shortUrlsListParams';
|
2020-03-30 21:47:33 +03:00
|
|
|
import { editShortUrl } from '../reducers/shortUrlEdition';
|
2020-12-07 13:17:19 +03:00
|
|
|
import { ConnectDecorator } from '../../container/types';
|
|
|
|
import { ShortUrlsTable } from '../ShortUrlsTable';
|
2018-12-18 21:59:50 +03:00
|
|
|
|
2020-08-23 10:03:44 +03:00
|
|
|
const provideServices = (bottle: Bottle, connect: ConnectDecorator) => {
|
2018-12-18 21:59:50 +03:00
|
|
|
// Components
|
|
|
|
bottle.serviceFactory('ShortUrls', ShortUrls, 'SearchBar', 'ShortUrlsList');
|
2020-12-07 13:17:19 +03:00
|
|
|
bottle.decorator('ShortUrls', connect([ 'shortUrlsList' ]));
|
2018-12-18 21:59:50 +03:00
|
|
|
|
2020-12-07 13:17:19 +03:00
|
|
|
bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsTable');
|
2018-12-18 21:59:50 +03:00
|
|
|
bottle.decorator('ShortUrlsList', connect(
|
2020-06-06 10:24:05 +03:00
|
|
|
[ 'selectedServer', 'shortUrlsListParams', 'mercureInfo' ],
|
2020-09-12 12:31:44 +03:00
|
|
|
[ 'listShortUrls', 'resetShortUrlParams', 'createNewVisits', 'loadMercureInfo' ],
|
2018-12-18 21:59:50 +03:00
|
|
|
));
|
|
|
|
|
2020-12-07 13:17:19 +03:00
|
|
|
bottle.serviceFactory('ShortUrlsTable', ShortUrlsTable, 'ShortUrlsRow');
|
2020-03-06 23:44:03 +03:00
|
|
|
bottle.serviceFactory('ShortUrlsRow', ShortUrlsRow, 'ShortUrlsRowMenu', 'ColorGenerator', 'useStateFlagTimeout');
|
2020-01-28 21:46:36 +03:00
|
|
|
bottle.serviceFactory(
|
|
|
|
'ShortUrlsRowMenu',
|
|
|
|
ShortUrlsRowMenu,
|
|
|
|
'DeleteShortUrlModal',
|
|
|
|
'EditTagsModal',
|
|
|
|
'EditMetaModal',
|
2020-03-30 21:42:58 +03:00
|
|
|
'EditShortUrlModal',
|
2020-08-22 09:10:31 +03:00
|
|
|
'ForServerVersion',
|
2020-01-28 21:46:36 +03:00
|
|
|
);
|
2020-05-31 11:16:09 +03:00
|
|
|
bottle.serviceFactory('CreateShortUrlResult', CreateShortUrlResult, 'useStateFlagTimeout');
|
2018-12-18 21:59:50 +03:00
|
|
|
|
2020-11-25 23:05:27 +03:00
|
|
|
bottle.serviceFactory(
|
|
|
|
'CreateShortUrl',
|
|
|
|
CreateShortUrl,
|
|
|
|
'TagsSelector',
|
|
|
|
'CreateShortUrlResult',
|
|
|
|
'ForServerVersion',
|
2020-11-28 11:58:05 +03:00
|
|
|
'DomainSelector',
|
2020-11-25 23:05:27 +03:00
|
|
|
);
|
2018-12-18 21:59:50 +03:00
|
|
|
bottle.decorator(
|
|
|
|
'CreateShortUrl',
|
2020-08-22 09:10:31 +03:00
|
|
|
connect([ 'shortUrlCreationResult', 'selectedServer' ], [ 'createShortUrl', 'resetCreateShortUrl' ]),
|
2018-12-18 21:59:50 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
bottle.serviceFactory('DeleteShortUrlModal', () => DeleteShortUrlModal);
|
2020-01-31 22:12:22 +03:00
|
|
|
bottle.decorator('DeleteShortUrlModal', connect([ 'shortUrlDeletion' ], [ 'deleteShortUrl', 'resetDeleteShortUrl' ]));
|
2018-12-18 21:59:50 +03:00
|
|
|
|
|
|
|
bottle.serviceFactory('EditTagsModal', EditTagsModal, 'TagsSelector');
|
2020-01-31 22:06:28 +03:00
|
|
|
bottle.decorator('EditTagsModal', connect([ 'shortUrlTags' ], [ 'editShortUrlTags', 'resetShortUrlsTags' ]));
|
2018-12-18 21:59:50 +03:00
|
|
|
|
2020-01-17 23:07:59 +03:00
|
|
|
bottle.serviceFactory('EditMetaModal', () => EditMetaModal);
|
2020-01-19 22:37:12 +03:00
|
|
|
bottle.decorator('EditMetaModal', connect([ 'shortUrlMeta' ], [ 'editShortUrlMeta', 'resetShortUrlMeta' ]));
|
2020-01-17 23:07:59 +03:00
|
|
|
|
2020-03-30 21:42:58 +03:00
|
|
|
bottle.serviceFactory('EditShortUrlModal', () => EditShortUrlModal);
|
2020-03-30 21:47:33 +03:00
|
|
|
bottle.decorator('EditShortUrlModal', connect([ 'shortUrlEdition' ], [ 'editShortUrl' ]));
|
2020-03-30 21:42:58 +03:00
|
|
|
|
2020-12-07 22:37:03 +03:00
|
|
|
// Services
|
2020-12-12 15:33:21 +03:00
|
|
|
bottle.serviceFactory('SearchBar', SearchBar, 'ColorGenerator');
|
2020-12-07 22:37:03 +03:00
|
|
|
bottle.decorator('SearchBar', connect([ 'shortUrlsListParams' ], [ 'listShortUrls' ]));
|
|
|
|
|
2018-12-18 21:59:50 +03:00
|
|
|
// Actions
|
|
|
|
bottle.serviceFactory('editShortUrlTags', editShortUrlTags, 'buildShlinkApiClient');
|
|
|
|
bottle.serviceFactory('resetShortUrlsTags', () => resetShortUrlsTags);
|
|
|
|
|
|
|
|
bottle.serviceFactory('listShortUrls', listShortUrls, 'buildShlinkApiClient');
|
|
|
|
bottle.serviceFactory('resetShortUrlParams', () => resetShortUrlParams);
|
|
|
|
|
|
|
|
bottle.serviceFactory('createShortUrl', createShortUrl, 'buildShlinkApiClient');
|
|
|
|
bottle.serviceFactory('resetCreateShortUrl', () => resetCreateShortUrl);
|
|
|
|
|
|
|
|
bottle.serviceFactory('deleteShortUrl', deleteShortUrl, 'buildShlinkApiClient');
|
|
|
|
bottle.serviceFactory('resetDeleteShortUrl', () => resetDeleteShortUrl);
|
2020-01-19 15:07:33 +03:00
|
|
|
|
|
|
|
bottle.serviceFactory('editShortUrlMeta', editShortUrlMeta, 'buildShlinkApiClient');
|
2020-01-19 22:37:12 +03:00
|
|
|
bottle.serviceFactory('resetShortUrlMeta', () => resetShortUrlMeta);
|
2020-03-30 21:42:58 +03:00
|
|
|
|
|
|
|
bottle.serviceFactory('editShortUrl', editShortUrl, 'buildShlinkApiClient');
|
2018-12-18 21:59:50 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default provideServices;
|