mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-02 05:36:38 +00:00
Extracted short-url related services to its own service provider
This commit is contained in:
@@ -1,31 +1,18 @@
|
||||
import Bottle from 'bottlejs';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { connect as reduxConnect } from 'react-redux';
|
||||
import { assoc, pick } from 'ramda';
|
||||
import { pick } from 'ramda';
|
||||
import axios from 'axios';
|
||||
import App from '../App';
|
||||
import ScrollToTop from '../common/ScrollToTop';
|
||||
import MainHeader from '../common/MainHeader';
|
||||
import { resetSelectedServer } from '../servers/reducers/selectedServer';
|
||||
import Home from '../common/Home';
|
||||
import MenuLayout from '../common/MenuLayout';
|
||||
import ShortUrls from '../short-urls/ShortUrls';
|
||||
import SearchBar from '../short-urls/SearchBar';
|
||||
import { listShortUrls } from '../short-urls/reducers/shortUrlsList';
|
||||
import ShortUrlsList from '../short-urls/ShortUrlsList';
|
||||
import { resetShortUrlParams } from '../short-urls/reducers/shortUrlsListParams';
|
||||
import { ColorGenerator } from '../utils/ColorGenerator';
|
||||
import { Storage } from '../utils/Storage';
|
||||
import ShortUrlsRow from '../short-urls/helpers/ShortUrlsRow';
|
||||
import ShortUrlsRowMenu from '../short-urls/helpers/ShortUrlsRowMenu';
|
||||
import AsideMenu from '../common/AsideMenu';
|
||||
import CreateShortUrl from '../short-urls/CreateShortUrl';
|
||||
import { createShortUrl, resetCreateShortUrl } from '../short-urls/reducers/shortUrlCreation';
|
||||
import DeleteShortUrlModal from '../short-urls/helpers/DeleteShortUrlModal';
|
||||
import { deleteShortUrl, resetDeleteShortUrl, shortUrlDeleted } from '../short-urls/reducers/shortUrlDeletion';
|
||||
import EditTagsModal from '../short-urls/helpers/EditTagsModal';
|
||||
import { editShortUrlTags, resetShortUrlsTags, shortUrlTagsEdited } from '../short-urls/reducers/shortUrlTags';
|
||||
import ColorGenerator from '../utils/ColorGenerator';
|
||||
import Storage from '../utils/Storage';
|
||||
import buildShlinkApiClient from '../api/ShlinkApiClientBuilder';
|
||||
import provideShortUrlsServices from '../short-urls/services/provideServices';
|
||||
import provideServersServices from '../servers/services/provideServices';
|
||||
import provideVisitsServices from '../visits/services/provideServices';
|
||||
import provideTagsServices from '../tags/services/provideServices';
|
||||
@@ -54,7 +41,7 @@ bottle.serviceFactory('MainHeader', MainHeader, 'ServersDropdown');
|
||||
bottle.decorator('MainHeader', withRouter);
|
||||
|
||||
bottle.serviceFactory('Home', () => Home);
|
||||
bottle.decorator('Home', connect([ 'servers' ], { resetSelectedServer }));
|
||||
bottle.decorator('Home', connect([ 'servers' ], [ 'resetSelectedServer' ]));
|
||||
|
||||
bottle.serviceFactory(
|
||||
'MenuLayout',
|
||||
@@ -77,49 +64,7 @@ bottle.service('ColorGenerator', ColorGenerator, 'Storage');
|
||||
bottle.constant('axios', axios);
|
||||
bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'axios');
|
||||
|
||||
bottle.serviceFactory('ShortUrls', ShortUrls, 'SearchBar', 'ShortUrlsList');
|
||||
bottle.decorator('ShortUrls', reduxConnect(
|
||||
(state) => assoc('shortUrlsList', state.shortUrlsList.shortUrls, state.shortUrlsList)
|
||||
));
|
||||
|
||||
bottle.serviceFactory('SearchBar', SearchBar, 'ColorGenerator');
|
||||
bottle.decorator('SearchBar', connect([ 'shortUrlsListParams' ], { listShortUrls }));
|
||||
|
||||
bottle.serviceFactory('ShortUrlsList', ShortUrlsList, 'ShortUrlsRow');
|
||||
bottle.decorator('ShortUrlsList', connect(
|
||||
[ 'selectedServer', 'shortUrlsListParams' ],
|
||||
[ 'listShortUrls', 'resetShortUrlParams' ]
|
||||
));
|
||||
|
||||
bottle.serviceFactory('ShortUrlsRow', ShortUrlsRow, 'ShortUrlsRowMenu', 'ColorGenerator');
|
||||
|
||||
bottle.serviceFactory('ShortUrlsRowMenu', ShortUrlsRowMenu, 'DeleteShortUrlModal', 'EditTagsModal');
|
||||
|
||||
bottle.serviceFactory('CreateShortUrl', CreateShortUrl, 'TagsSelector');
|
||||
bottle.decorator('CreateShortUrl', connect([ 'shortUrlCreationResult' ], {
|
||||
createShortUrl,
|
||||
resetCreateShortUrl,
|
||||
}));
|
||||
|
||||
bottle.serviceFactory('DeleteShortUrlModal', () => DeleteShortUrlModal);
|
||||
bottle.decorator('DeleteShortUrlModal', connect(
|
||||
[ 'shortUrlDeletion' ],
|
||||
{ deleteShortUrl, resetDeleteShortUrl, shortUrlDeleted }
|
||||
));
|
||||
|
||||
bottle.serviceFactory('EditTagsModal', EditTagsModal, 'TagsSelector');
|
||||
bottle.decorator('EditTagsModal', connect(
|
||||
[ 'shortUrlTags' ],
|
||||
[ 'editShortUrlTags', 'resetShortUrlsTags', 'shortUrlTagsEdited' ]
|
||||
));
|
||||
|
||||
bottle.serviceFactory('editShortUrlTags', editShortUrlTags, 'buildShlinkApiClient');
|
||||
bottle.serviceFactory('resetShortUrlsTags', () => resetShortUrlsTags);
|
||||
bottle.serviceFactory('shortUrlTagsEdited', () => shortUrlTagsEdited);
|
||||
|
||||
bottle.serviceFactory('listShortUrls', listShortUrls, 'buildShlinkApiClient');
|
||||
bottle.serviceFactory('resetShortUrlParams', () => resetShortUrlParams);
|
||||
|
||||
provideShortUrlsServices(bottle, connect);
|
||||
provideServersServices(bottle, connect, withRouter);
|
||||
provideTagsServices(bottle, connect);
|
||||
provideVisitsServices(bottle, connect);
|
||||
|
||||
Reference in New Issue
Block a user