mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Merge pull request #263 from acelaya-forks/feature/minor-improvements
Minor improvements
This commit is contained in:
commit
61c027f9a1
6 changed files with 21 additions and 26 deletions
16
package-lock.json
generated
16
package-lock.json
generated
|
@ -1463,14 +1463,6 @@
|
|||
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
|
||||
"dev": true
|
||||
},
|
||||
"@shlinkio/redux-localstorage-simple": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@shlinkio/redux-localstorage-simple/-/redux-localstorage-simple-2.2.0.tgz",
|
||||
"integrity": "sha512-2/VggbehDAM1dOH7rT3Qjr/MTp7qQ6VeTM+Ez4JnMUPtU9OxgV9FQbKqduasLT4EZhlRUhxwBp7K6WO3gROQDA==",
|
||||
"requires": {
|
||||
"object-merge": "2.5.1"
|
||||
}
|
||||
},
|
||||
"@stryker-mutator/api": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@stryker-mutator/api/-/api-2.1.0.tgz",
|
||||
|
@ -14548,6 +14540,14 @@
|
|||
"to-camel-case": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"redux-localstorage-simple": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-localstorage-simple/-/redux-localstorage-simple-2.2.0.tgz",
|
||||
"integrity": "sha512-BmgnJ3NkxTDvNsnHAZrRVDgODafg2Vtb17q2F2LEhuJ+EderZBJA6aqRsyqZC32BJWpu8PPtferv4Io9dpUf3w==",
|
||||
"requires": {
|
||||
"object-merge": "2.5.1"
|
||||
}
|
||||
},
|
||||
"redux-thunk": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.3.0.tgz",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"name": "shlink-web-client",
|
||||
"description": "A React-based progressive web application for shlink",
|
||||
"version": "2.3.0",
|
||||
"private": false,
|
||||
"homepage": "",
|
||||
"repository": "https://github.com/shlinkio/shlink-web-client",
|
||||
|
@ -27,7 +26,6 @@
|
|||
"@fortawesome/free-regular-svg-icons": "^5.11.2",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.11.2",
|
||||
"@fortawesome/react-fontawesome": "^0.1.5",
|
||||
"@shlinkio/redux-localstorage-simple": "^2.2.0",
|
||||
"array-filter": "^1.0.0",
|
||||
"array-map": "^0.0.0",
|
||||
"array-reduce": "^0.0.0",
|
||||
|
@ -63,6 +61,7 @@
|
|||
"reactstrap": "^8.0.1",
|
||||
"redux": "^4.0.4",
|
||||
"redux-actions": "^2.6.5",
|
||||
"redux-localstorage-simple": "^2.2.0",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"uuid": "^3.3.3"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import ReduxThunk from 'redux-thunk';
|
||||
import { applyMiddleware, compose, createStore } from 'redux';
|
||||
import { save, load } from '@shlinkio/redux-localstorage-simple';
|
||||
import { save, load } from 'redux-localstorage-simple';
|
||||
import reducers from '../reducers';
|
||||
|
||||
const composeEnhancers = process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
|
@ -11,6 +11,7 @@ const localStorageConfig = {
|
|||
states: [ 'settings', 'servers' ],
|
||||
namespace: 'shlink',
|
||||
namespaceSeparator: '.',
|
||||
debounce: 300,
|
||||
};
|
||||
|
||||
const store = createStore(reducers, load(localStorageConfig), composeEnhancers(
|
||||
|
|
|
@ -2,20 +2,17 @@ import { isEmpty, values } from 'ramda';
|
|||
import React from 'react';
|
||||
import { DropdownItem, DropdownMenu, DropdownToggle, UncontrolledDropdown } from 'reactstrap';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { serverType } from './prop-types';
|
||||
|
||||
const propTypes = {
|
||||
servers: PropTypes.object,
|
||||
selectedServer: serverType,
|
||||
history: PropTypes.shape({
|
||||
push: PropTypes.func,
|
||||
}),
|
||||
};
|
||||
|
||||
const ServersDropdown = (serversExporter) => {
|
||||
const ServersDropdownComp = ({ servers, selectedServer, history }) => {
|
||||
const ServersDropdownComp = ({ servers, selectedServer }) => {
|
||||
const serversList = values(servers);
|
||||
const loadServer = (id) => history.push(`/server/${id}/list-short-urls/1`);
|
||||
|
||||
const renderServers = () => {
|
||||
if (isEmpty(serversList)) {
|
||||
|
@ -25,7 +22,12 @@ const ServersDropdown = (serversExporter) => {
|
|||
return (
|
||||
<React.Fragment>
|
||||
{serversList.map(({ name, id }) => (
|
||||
<DropdownItem key={id} active={selectedServer && selectedServer.id === id} onClick={() => loadServer(id)}>
|
||||
<DropdownItem
|
||||
key={id}
|
||||
tag={Link}
|
||||
to={`/server/${id}/list-short-urls/1`}
|
||||
active={selectedServer && selectedServer.id === id}
|
||||
>
|
||||
{name}
|
||||
</DropdownItem>
|
||||
))}
|
||||
|
|
|
@ -22,7 +22,6 @@ const provideServices = (bottle, connect, withRouter) => {
|
|||
bottle.decorator('EditServer', connect([ 'selectedServer' ], [ 'editServer', 'selectServer' ]));
|
||||
|
||||
bottle.serviceFactory('ServersDropdown', ServersDropdown, 'ServersExporter');
|
||||
bottle.decorator('ServersDropdown', withRouter);
|
||||
bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ]));
|
||||
|
||||
bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Card, CardBody, CardHeader, UncontrolledTooltip } from 'reactstrap';
|
||||
import { Card, CardBody, CardHeader } from 'reactstrap';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
|
||||
import Checkbox from '../utils/Checkbox';
|
||||
import { SettingsType } from './reducers/settings';
|
||||
|
||||
|
@ -16,12 +14,8 @@ const RealTimeUpdates = ({ settings: { realTimeUpdates }, setRealTimeUpdates })
|
|||
<CardHeader>Real-time updates</CardHeader>
|
||||
<CardBody>
|
||||
<Checkbox checked={realTimeUpdates.enabled} onChange={setRealTimeUpdates}>
|
||||
Enable real-time updates
|
||||
<FontAwesomeIcon icon={faInfoCircle} className="ml-2" id="realTimeUpdatesInfo" />
|
||||
</Checkbox>
|
||||
<UncontrolledTooltip target="realTimeUpdatesInfo">
|
||||
Enable or disable real-time updates, when using Shlink v2.2.0 or newer.
|
||||
</UncontrolledTooltip>
|
||||
</Checkbox>
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue