Completed
Pull Request — master (#81)
by Alejandro
03:28
created

src/servers/services/provideServices.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 47
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 2.94%

Importance

Changes 0
Metric Value
cc 0
eloc 34
nc 1
dl 0
loc 47
ccs 1
cts 34
cp 0.0294
crap 0
rs 10
c 0
b 0
f 0
wmc 3
mnd 0
bc 1
fnc 3
bpm 0.3333
cpm 1
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A provideServices.js ➔ ??? 0 33 1
1
import csvjson from 'csvjson';
2
import CreateServer from '../CreateServer';
3
import ServersDropdown from '../ServersDropdown';
4
import DeleteServerModal from '../DeleteServerModal';
5
import DeleteServerButton from '../DeleteServerButton';
6
import ImportServersBtn from '../helpers/ImportServersBtn';
7
import { resetSelectedServer, selectServer } from '../reducers/selectedServer';
8
import { createServer, createServers, deleteServer, listServers } from '../reducers/server';
9
import ServersImporter from './ServersImporter';
10
import ServersService from './ServersService';
11 4
import ServersExporter from './ServersExporter';
12
13
const provideServices = (bottle, connect, withRouter) => {
14
  // Components
15
  bottle.serviceFactory('CreateServer', CreateServer, 'ImportServersBtn');
16
  bottle.decorator('CreateServer', connect([ 'selectedServer' ], [ 'createServer', 'resetSelectedServer' ]));
17
18
  bottle.serviceFactory('ServersDropdown', ServersDropdown, 'ServersExporter');
19
  bottle.decorator('ServersDropdown', connect([ 'servers', 'selectedServer' ], [ 'listServers', 'selectServer' ]));
20
21
  bottle.serviceFactory('DeleteServerModal', () => DeleteServerModal);
22
  bottle.decorator('DeleteServerModal', withRouter);
23
  bottle.decorator('DeleteServerModal', connect(null, [ 'deleteServer' ]));
24
25
  bottle.serviceFactory('DeleteServerButton', DeleteServerButton, 'DeleteServerModal');
26
27
  bottle.serviceFactory('ImportServersBtn', ImportServersBtn, 'ServersImporter');
28
  bottle.decorator('ImportServersBtn', connect(null, [ 'createServers' ]));
29
30
  // Services
31
  bottle.constant('csvjson', csvjson);
32
  bottle.constant('window', global.window);
33
  bottle.service('ServersImporter', ServersImporter, 'csvjson');
34
  bottle.service('ServersService', ServersService, 'Storage');
35
  bottle.service('ServersExporter', ServersExporter, 'ServersService', 'window', 'csvjson');
36
37
  // Actions
38
  bottle.serviceFactory('selectServer', selectServer, 'ServersService');
39
  bottle.serviceFactory('createServer', createServer, 'ServersService');
40
  bottle.serviceFactory('createServers', createServers, 'ServersService');
41
  bottle.serviceFactory('deleteServer', deleteServer, 'ServersService');
42
  bottle.serviceFactory('listServers', listServers, 'ServersService');
43
44
  bottle.serviceFactory('resetSelectedServer', () => resetSelectedServer);
45
};
46
47
export default provideServices;
48