aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings/ServicesScreen.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/settings/ServicesScreen.tsx')
-rw-r--r--src/containers/settings/ServicesScreen.tsx53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/containers/settings/ServicesScreen.tsx b/src/containers/settings/ServicesScreen.tsx
new file mode 100644
index 000000000..615747382
--- /dev/null
+++ b/src/containers/settings/ServicesScreen.tsx
@@ -0,0 +1,53 @@
1import { Component, ReactElement } from 'react';
2import { inject, observer } from 'mobx-react';
3
4import { StoresProps } from 'src/@types/ferdium-components.types';
5import ServicesDashboard from '../../components/settings/services/ServicesDashboard';
6import ErrorBoundary from '../../components/util/ErrorBoundary';
7
8class ServicesScreen extends Component<StoresProps> {
9 componentWillUnmount(): void {
10 this.props.actions.service.resetFilter();
11 this.props.actions.service.resetStatus();
12 }
13
14 deleteService(): void {
15 this.props.actions.service.deleteService();
16 this.props.actions.service.resetFilter();
17 }
18
19 render(): ReactElement {
20 const { user, services, router } = this.props.stores;
21 const { toggleService, filter, resetFilter } = this.props.actions.service;
22 const isLoading = services.allServicesRequest.isExecuting;
23
24 let allServices = services.all;
25 if (services.filterNeedle !== null) {
26 allServices = services.filtered;
27 }
28
29 return (
30 <ErrorBoundary>
31 <ServicesDashboard
32 user={user.data}
33 services={allServices}
34 status={services.actionStatus}
35 deleteService={() => this.deleteService()}
36 toggleService={toggleService}
37 isLoading={isLoading}
38 filterServices={filter}
39 resetFilter={resetFilter}
40 goTo={router.push}
41 servicesRequestFailed={
42 services.allServicesRequest.wasExecuted &&
43 services.allServicesRequest.isError
44 }
45 retryServicesRequest={() => services.allServicesRequest.reload()}
46 searchNeedle={services.filterNeedle}
47 />
48 </ErrorBoundary>
49 );
50 }
51}
52
53export default inject('stores', 'actions')(observer(ServicesScreen));