@truedat/cx 4.36.6 → 4.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +7 -6
- package/src/configurations/components/ConfigurationActions.js +1 -1
- package/src/configurations/components/ConfigurationCards.js +1 -1
- package/src/configurations/components/__tests__/__snapshots__/ConfigurationCards.spec.js.snap +5 -5
- package/src/messages/en.js +32 -25
- package/src/messages/es.js +32 -25
- package/src/sources/components/EditSource.js +3 -3
- package/src/sources/components/NewSource.js +1 -1
- package/src/sources/components/Source.js +3 -3
- package/src/sources/components/SourceActions.js +107 -79
- package/src/sources/components/SourceForm.js +15 -24
- package/src/sources/components/SourceRoutes.js +8 -18
- package/src/sources/components/{SourcesSelector.js → SourceSelector.js} +0 -0
- package/src/sources/components/Sources.js +53 -47
- package/src/sources/components/SourcesTable.js +88 -0
- package/src/sources/components/__tests__/SourceActions.spec.js +27 -6
- package/src/sources/components/__tests__/Sources.spec.js +68 -18
- package/src/sources/components/__tests__/SourcesTable.spec.js +59 -0
- package/src/sources/components/__tests__/__snapshots__/EditSource.spec.js.snap +3 -3
- package/src/sources/components/__tests__/__snapshots__/NewSource.spec.js.snap +1 -1
- package/src/sources/components/__tests__/__snapshots__/Source.spec.js.snap +1 -1
- package/src/sources/components/__tests__/__snapshots__/SourceActions.spec.js.snap +53 -65
- package/src/sources/components/__tests__/__snapshots__/SourceForm.spec.js.snap +10 -8
- package/src/sources/components/__tests__/__snapshots__/Sources.spec.js.snap +170 -62
- package/src/sources/components/__tests__/__snapshots__/SourcesTable.spec.js.snap +217 -0
- package/src/sources/components/index.js +3 -3
- package/src/sources/reducers/__tests__/sourceRedirect.spec.js +28 -5
- package/src/sources/reducers/source.js +4 -3
- package/src/sources/reducers/sourceRedirect.js +7 -1
- package/src/sources/routines.js +6 -4
- package/src/sources/sagas/__tests__/disableSource.spec.js +82 -0
- package/src/sources/sagas/__tests__/enableSource.spec.js +82 -0
- package/src/sources/sagas/disableSource.js +39 -0
- package/src/sources/sagas/enableSource.js +39 -0
- package/src/sources/sagas/index.js +13 -7
- package/src/sources/components/SourceCards.js +0 -115
- package/src/sources/components/__tests__/SourceCards.spec.js +0 -45
- package/src/sources/components/__tests__/__snapshots__/SourceCards.spec.js.snap +0 -421
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/cx",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.37.0",
|
|
4
4
|
"description": "Truedat Web Connectors",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"clean": "rimraf yarn-error.log",
|
|
18
18
|
"debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
19
|
-
"test": "jest --coverage",
|
|
20
|
-
"test:watch": "jest --watch",
|
|
19
|
+
"test": "TZ=UTC jest --coverage",
|
|
20
|
+
"test:watch": "TZ=UTC jest --watch",
|
|
21
21
|
"eslint": "eslint src/**",
|
|
22
22
|
"eslint:fix": "eslint --fix src/**"
|
|
23
23
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"jest-localstorage-mock": "^2.4.14",
|
|
45
45
|
"react": "^16.14.0",
|
|
46
46
|
"react-dom": "^16.14.0",
|
|
47
|
-
"redux-saga-test-plan": "^4.0.
|
|
47
|
+
"redux-saga-test-plan": "^4.0.4",
|
|
48
48
|
"rimraf": "^3.0.2",
|
|
49
49
|
"semantic-ui-react": "^2.0.3"
|
|
50
50
|
},
|
|
@@ -83,8 +83,9 @@
|
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@truedat/core": "4.
|
|
86
|
+
"@truedat/core": "4.37.0",
|
|
87
87
|
"lodash": "^4.17.21",
|
|
88
|
+
"match-sorter": "^6.3.1",
|
|
88
89
|
"path-to-regexp": "^1.7.0",
|
|
89
90
|
"prop-types": "^15.7.2",
|
|
90
91
|
"react-intl": "^5.20.10",
|
|
@@ -100,5 +101,5 @@
|
|
|
100
101
|
"react-dom": ">= 16.8.6 < 17",
|
|
101
102
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
102
103
|
},
|
|
103
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "a2584d116d738be9a237f26c617e1400d4a24803"
|
|
104
105
|
}
|
package/src/configurations/components/__tests__/__snapshots__/ConfigurationCards.spec.js.snap
CHANGED
|
@@ -54,13 +54,13 @@ exports[`<ConfigurationCards /> matches the latest snapshot 1`] = `
|
|
|
54
54
|
}
|
|
55
55
|
/>
|
|
56
56
|
}
|
|
57
|
-
handleSubmit={[Function]}
|
|
58
57
|
header={
|
|
59
58
|
<Memo(MemoizedFormattedMessage)
|
|
60
59
|
id="configurations.actions.delete.confirmation.header"
|
|
61
60
|
/>
|
|
62
61
|
}
|
|
63
62
|
icon="trash"
|
|
63
|
+
onConfirm={[Function]}
|
|
64
64
|
trigger={
|
|
65
65
|
<Button
|
|
66
66
|
as="button"
|
|
@@ -125,13 +125,13 @@ exports[`<ConfigurationCards /> matches the latest snapshot 1`] = `
|
|
|
125
125
|
}
|
|
126
126
|
/>
|
|
127
127
|
}
|
|
128
|
-
handleSubmit={[Function]}
|
|
129
128
|
header={
|
|
130
129
|
<Memo(MemoizedFormattedMessage)
|
|
131
130
|
id="configurations.actions.delete.confirmation.header"
|
|
132
131
|
/>
|
|
133
132
|
}
|
|
134
133
|
icon="trash"
|
|
134
|
+
onConfirm={[Function]}
|
|
135
135
|
trigger={
|
|
136
136
|
<Button
|
|
137
137
|
as="button"
|
|
@@ -196,13 +196,13 @@ exports[`<ConfigurationCards /> matches the latest snapshot 1`] = `
|
|
|
196
196
|
}
|
|
197
197
|
/>
|
|
198
198
|
}
|
|
199
|
-
handleSubmit={[Function]}
|
|
200
199
|
header={
|
|
201
200
|
<Memo(MemoizedFormattedMessage)
|
|
202
201
|
id="configurations.actions.delete.confirmation.header"
|
|
203
202
|
/>
|
|
204
203
|
}
|
|
205
204
|
icon="trash"
|
|
205
|
+
onConfirm={[Function]}
|
|
206
206
|
trigger={
|
|
207
207
|
<Button
|
|
208
208
|
as="button"
|
|
@@ -267,13 +267,13 @@ exports[`<ConfigurationCards /> matches the latest snapshot 1`] = `
|
|
|
267
267
|
}
|
|
268
268
|
/>
|
|
269
269
|
}
|
|
270
|
-
handleSubmit={[Function]}
|
|
271
270
|
header={
|
|
272
271
|
<Memo(MemoizedFormattedMessage)
|
|
273
272
|
id="configurations.actions.delete.confirmation.header"
|
|
274
273
|
/>
|
|
275
274
|
}
|
|
276
275
|
icon="trash"
|
|
276
|
+
onConfirm={[Function]}
|
|
277
277
|
trigger={
|
|
278
278
|
<Button
|
|
279
279
|
as="button"
|
|
@@ -338,13 +338,13 @@ exports[`<ConfigurationCards /> matches the latest snapshot 1`] = `
|
|
|
338
338
|
}
|
|
339
339
|
/>
|
|
340
340
|
}
|
|
341
|
-
handleSubmit={[Function]}
|
|
342
341
|
header={
|
|
343
342
|
<Memo(MemoizedFormattedMessage)
|
|
344
343
|
id="configurations.actions.delete.confirmation.header"
|
|
345
344
|
/>
|
|
346
345
|
}
|
|
347
346
|
icon="trash"
|
|
347
|
+
onConfirm={[Function]}
|
|
348
348
|
trigger={
|
|
349
349
|
<Button
|
|
350
350
|
as="button"
|
package/src/messages/en.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable prettier/prettier */
|
|
1
2
|
export default {
|
|
2
3
|
"alert.fetchSource.failed.header": "Error retrieving source",
|
|
3
4
|
"alert.signConfiguration.failed.header": "Error signing configuration",
|
|
@@ -5,21 +6,26 @@ export default {
|
|
|
5
6
|
"configuration.props.external_id": "Id Externo",
|
|
6
7
|
"configuration.search.no_results": "No configurations found",
|
|
7
8
|
"configurations.actions.create": "Create",
|
|
8
|
-
"configurations.actions.delete.confirmation.content":
|
|
9
|
-
"Configuration {external_id} will be deleted. Are you sure?",
|
|
9
|
+
"configurations.actions.delete.confirmation.content": "Configuration {external_id} will be deleted. Are you sure?",
|
|
10
10
|
"configurations.actions.delete.confirmation.header": "Delete Configuration",
|
|
11
11
|
"configurations.actions.edit": "Edit Configuration",
|
|
12
|
-
"configurations.actions.update": "Update Configuration",
|
|
13
12
|
"configurations.actions.remove": "Delete Configuration",
|
|
13
|
+
"configurations.actions.update": "Update Configuration",
|
|
14
14
|
"configurations.header": "Configurations",
|
|
15
15
|
"configurations.search.placeholder": "Search configurations",
|
|
16
16
|
"configurations.subheader": "List of system configurations",
|
|
17
17
|
"filters.source_external_id": "Source",
|
|
18
18
|
"filters.source_type": "Source Type",
|
|
19
19
|
"filters.type": "Type",
|
|
20
|
+
"job.pending.content": "This job has not started yet, please check again later.",
|
|
20
21
|
"job.pending.header": "Job Pending",
|
|
21
|
-
"
|
|
22
|
-
|
|
22
|
+
"jobType.DQ.label": "Data Quality",
|
|
23
|
+
"jobType.Metadata.label": "Catalog",
|
|
24
|
+
"jobType.Profile.label": "Profiling",
|
|
25
|
+
"jobType.catalog.label": "Catalog",
|
|
26
|
+
"jobType.label": "Type",
|
|
27
|
+
"jobType.profile.label": "Profile",
|
|
28
|
+
"jobType.quality.label": "Quality",
|
|
23
29
|
"jobs.actions.create": "New Job",
|
|
24
30
|
"jobs.header": "Jobs",
|
|
25
31
|
"jobs.props.end_date": "Updated At",
|
|
@@ -33,33 +39,34 @@ export default {
|
|
|
33
39
|
"jobs.search.results.empty": "No jobs found",
|
|
34
40
|
"jobs.searching": "Searching...",
|
|
35
41
|
"jobs.subheader": "Connectors execution by defined sources",
|
|
36
|
-
"jobType.label": "Type",
|
|
37
|
-
"jobType.catalog.label": "Catalog",
|
|
38
|
-
"jobType.quality.label": "Quality",
|
|
39
|
-
"jobType.profile.label": "Profile",
|
|
40
|
-
"jobType.Metadata.label": "Catalog",
|
|
41
|
-
"jobType.DQ.label": "Data Quality",
|
|
42
|
-
"jobType.Profile.label": "Profiling",
|
|
43
42
|
"navigation.admin.configurations": "Configurations",
|
|
44
43
|
"navigation.admin.jobs": "Jobs",
|
|
45
44
|
"navigation.admin.sources": "Sources",
|
|
45
|
+
"source.actions.delete": "Delete source",
|
|
46
|
+
"source.actions.delete.confirmation.content": "Source {external_id} will be deleted. Are you sure?",
|
|
47
|
+
"source.actions.delete.confirmation.header": "Delete source",
|
|
48
|
+
"source.actions.disable": "Disable",
|
|
49
|
+
"source.actions.disable.confirmation.content": "Source {external_id} will be disabled. Are you sure?",
|
|
50
|
+
"source.actions.disable.confirmation.header": "Disable source",
|
|
51
|
+
"source.actions.edit": "Edit source",
|
|
52
|
+
"source.actions.enable": "Enable",
|
|
53
|
+
"source.actions.enable.confirmation.content": "Source {external_id} will be enabled. Are you sure?",
|
|
54
|
+
"source.actions.enable.confirmation.header": "Enable source",
|
|
46
55
|
"source.config.label": "Configuration",
|
|
47
|
-
"source.
|
|
48
|
-
"source.
|
|
49
|
-
"source.
|
|
50
|
-
"
|
|
51
|
-
"
|
|
56
|
+
"source.disabled": "Disabled",
|
|
57
|
+
"source.external_id": "External Id",
|
|
58
|
+
"source.latestEvent.insertedAt": "Latest event",
|
|
59
|
+
"source.latestEvent.message": "Message",
|
|
60
|
+
"source.latestEvent.type": "Event type",
|
|
61
|
+
"source.search.placeholder": "Select source",
|
|
62
|
+
"source.status": "Status",
|
|
63
|
+
"source.type": "Type",
|
|
52
64
|
"sources.actions.create": "New Source",
|
|
53
|
-
"sources.
|
|
54
|
-
"Source {external_id} will be deleted. Are you sure?",
|
|
55
|
-
"sources.actions.delete.confirmation.header": "Delete source",
|
|
56
|
-
"sources.actions.edit": "Edit source",
|
|
57
|
-
"sources.actions.remove": "Delete source",
|
|
65
|
+
"sources.count": "{count, plural, =0 {No sources found} =1 {One source found} other {# sources found}}",
|
|
58
66
|
"sources.header": "Metadata Sources",
|
|
59
|
-
"sources.search.placeholder": "Search
|
|
67
|
+
"sources.search.placeholder": "Search sources",
|
|
60
68
|
"sources.subheader": "Management of Metadata Sources",
|
|
61
69
|
"type.selector.label": "Type",
|
|
62
70
|
"type.selector.placeholder": "Source type (template)",
|
|
63
|
-
|
|
64
|
-
"source.deactivated": "Deactivated",
|
|
71
|
+
source: "Source",
|
|
65
72
|
};
|
package/src/messages/es.js
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
+
/* eslint-disable prettier/prettier */
|
|
1
2
|
export default {
|
|
2
3
|
"alert.fetchSource.failed.header": "Error al recuperar origen",
|
|
3
4
|
"alert.signConfiguration.failed.header": "Error firmando configuración",
|
|
4
5
|
"configuration.content.label": "Contenido",
|
|
5
6
|
"configuration.props.external_id": "External Id",
|
|
6
7
|
"configuration.search.no_results": "Ninguna configuración encontrada",
|
|
7
|
-
"configurations.actions.delete.confirmation.content":
|
|
8
|
-
"La configuración {external_id} va a ser eliminada. ¿Desea proceder?",
|
|
9
|
-
"configurations.actions.delete.confirmation.header": "Borrar Configuración",
|
|
10
8
|
"configurations.actions.create": "Nueva Configuración",
|
|
9
|
+
"configurations.actions.delete.confirmation.content": "La configuración {external_id} va a ser eliminada. ¿Desea proceder?",
|
|
10
|
+
"configurations.actions.delete.confirmation.header": "Borrar Configuración",
|
|
11
11
|
"configurations.actions.edit": "Editar Configuración",
|
|
12
|
-
"configurations.actions.update": "Actualizar Configuración",
|
|
13
12
|
"configurations.actions.remove": "Eliminar Configuración",
|
|
13
|
+
"configurations.actions.update": "Actualizar Configuración",
|
|
14
14
|
"configurations.header": "Configuraciones",
|
|
15
15
|
"configurations.search.placeholder": "Buscar configuraciones",
|
|
16
16
|
"configurations.subheader": "Listado de configuraciones del sistema",
|
|
17
17
|
"filters.source_external_id": "Origen",
|
|
18
18
|
"filters.source_type": "Tipo de Origen",
|
|
19
19
|
"filters.type": "Tipo",
|
|
20
|
+
"job.pending.content": "Este job no se ha iniciado aún, por favor comprueba de nuevo más tarde",
|
|
20
21
|
"job.pending.header": "Job Pendiente",
|
|
21
|
-
"
|
|
22
|
-
|
|
22
|
+
"jobType.DQ.label": "Calidad",
|
|
23
|
+
"jobType.Metadata.label": "Catálogo",
|
|
24
|
+
"jobType.Profile.label": "Perfilado",
|
|
25
|
+
"jobType.catalog.label": "Catálogo",
|
|
26
|
+
"jobType.label": "Tipo",
|
|
27
|
+
"jobType.profile.label": "Perfilado",
|
|
28
|
+
"jobType.quality.label": "Calidad",
|
|
23
29
|
"jobs.actions.create": "Nuevo Job",
|
|
24
30
|
"jobs.header": "Jobs",
|
|
25
31
|
"jobs.props.end_date": "Última actualización",
|
|
@@ -33,33 +39,34 @@ export default {
|
|
|
33
39
|
"jobs.search.results.empty": "Ningún job encontrado",
|
|
34
40
|
"jobs.searching": "Buscando...",
|
|
35
41
|
"jobs.subheader": "Ejecución de conectores según orígenes conocidos",
|
|
36
|
-
"jobType.label": "Tipo",
|
|
37
|
-
"jobType.catalog.label": "Catálogo",
|
|
38
|
-
"jobType.quality.label": "Calidad",
|
|
39
|
-
"jobType.profile.label": "Perfilado",
|
|
40
|
-
"jobType.Metadata.label": "Catálogo",
|
|
41
|
-
"jobType.DQ.label": "Calidad",
|
|
42
|
-
"jobType.Profile.label": "Perfilado",
|
|
43
42
|
"navigation.admin.configurations": "Configuraciones",
|
|
44
43
|
"navigation.admin.jobs": "Jobs",
|
|
45
44
|
"navigation.admin.sources": "Orígenes",
|
|
45
|
+
"source.actions.delete": "Eliminar origen",
|
|
46
|
+
"source.actions.delete.confirmation.content": "El origen {external_id} va a ser eliminado. ¿Desea proceder?",
|
|
47
|
+
"source.actions.delete.confirmation.header": "Eliminar origen",
|
|
48
|
+
"source.actions.disable": "Desactivar",
|
|
49
|
+
"source.actions.disable.confirmation.content": "El origen {external_id} va a ser desactivado. ¿Desea proceder?",
|
|
50
|
+
"source.actions.disable.confirmation.header": "Desactivar origen",
|
|
51
|
+
"source.actions.edit": "Editar origen",
|
|
52
|
+
"source.actions.enable": "Activar",
|
|
53
|
+
"source.actions.enable.confirmation.content": "El origen {external_id} va a ser activado. ¿Desea proceder?",
|
|
54
|
+
"source.actions.enable.confirmation.header": "Activar origen",
|
|
46
55
|
"source.config.label": "Configuración",
|
|
47
|
-
"source.
|
|
48
|
-
"source.
|
|
56
|
+
"source.disabled": "Deshabilitado",
|
|
57
|
+
"source.external_id": "External Id",
|
|
58
|
+
"source.latestEvent.insertedAt": "Evento más reciente",
|
|
59
|
+
"source.latestEvent.message": "Detalle",
|
|
60
|
+
"source.latestEvent.type": "Tipo de evento",
|
|
49
61
|
"source.search.placeholder": "Seleccionar origen",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
62
|
+
"source.status": "Estado",
|
|
63
|
+
"source.type": "Tipo",
|
|
52
64
|
"sources.actions.create": "Nuevo origen",
|
|
53
|
-
"sources.
|
|
54
|
-
"El origen {external_id} va a ser eliminado. ¿Desea proceder?",
|
|
55
|
-
"sources.actions.delete.confirmation.header": "Eliminar origen",
|
|
56
|
-
"sources.actions.edit": "Editar origen",
|
|
57
|
-
"sources.actions.remove": "Eliminar origen",
|
|
65
|
+
"sources.count": "{count, plural, =0 {Ningún origen encontrado} =1 {un origen encontrado} other {# origenes encontrados}}",
|
|
58
66
|
"sources.header": "Orígenes de metadatos",
|
|
59
|
-
"sources.search.placeholder": "Buscar
|
|
67
|
+
"sources.search.placeholder": "Buscar origenes",
|
|
60
68
|
"sources.subheader": "Gestión de los distintos orígenes de metadatos",
|
|
61
69
|
"type.selector.label": "Tipo",
|
|
62
70
|
"type.selector.placeholder": "Tipo de origen (plantilla)",
|
|
63
|
-
|
|
64
|
-
"source.deactivated": "Desactivado",
|
|
71
|
+
source: "Origen",
|
|
65
72
|
};
|
|
@@ -14,15 +14,15 @@ export const EditSource = ({ updateSource, source, sourceLoading }) => {
|
|
|
14
14
|
<Loading />
|
|
15
15
|
) : (
|
|
16
16
|
<>
|
|
17
|
-
<SourceBreadcrumbs text={formatMessage({ id: "
|
|
17
|
+
<SourceBreadcrumbs text={formatMessage({ id: "source.actions.edit" })} />
|
|
18
18
|
<Container as={Segment} text>
|
|
19
19
|
<Header as="h2">
|
|
20
20
|
<Icon name="plug" />
|
|
21
21
|
<Header.Content>
|
|
22
|
-
<FormattedMessage id="
|
|
22
|
+
<FormattedMessage id="source.actions.edit" />
|
|
23
23
|
</Header.Content>
|
|
24
24
|
</Header>
|
|
25
|
-
<SourceForm source={source}
|
|
25
|
+
<SourceForm source={source} onSubmit={updateSource} />
|
|
26
26
|
</Container>
|
|
27
27
|
</>
|
|
28
28
|
);
|
|
@@ -18,7 +18,7 @@ export const Source = ({ source, template }) => {
|
|
|
18
18
|
<Grid>
|
|
19
19
|
<Grid.Column width={8}>
|
|
20
20
|
<Header as="h2">
|
|
21
|
-
<Icon circular name="
|
|
21
|
+
<Icon circular name="plug" />
|
|
22
22
|
<Header.Content>
|
|
23
23
|
{source.external_id}
|
|
24
24
|
<Header.Subheader>{source.type}</Header.Subheader>
|
|
@@ -39,12 +39,12 @@ export const Source = ({ source, template }) => {
|
|
|
39
39
|
|
|
40
40
|
Source.propTypes = {
|
|
41
41
|
source: PropTypes.object.isRequired,
|
|
42
|
-
template: PropTypes.object
|
|
42
|
+
template: PropTypes.object,
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const mapStateToProps = ({ source, templates }) => ({
|
|
46
46
|
source,
|
|
47
|
-
template: _.find(_.propEq("name", source.type))(templates)
|
|
47
|
+
template: _.find(_.propEq("name", source.type))(templates),
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
export default connect(mapStateToProps)(Source);
|
|
@@ -1,101 +1,129 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { Link } from "react-router-dom";
|
|
4
3
|
import { connect } from "react-redux";
|
|
5
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
6
|
import { Button } from "semantic-ui-react";
|
|
7
|
-
import { FormattedMessage } from "react-intl";
|
|
8
7
|
import { ConfirmModal, GroupActions } from "@truedat/core/components";
|
|
9
8
|
import { linkTo } from "@truedat/core/routes";
|
|
10
|
-
import { deleteSource } from "../routines";
|
|
9
|
+
import { deleteSource, disableSource, enableSource } from "../routines";
|
|
11
10
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
id
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
11
|
+
export const ConfirmToggleModal = ({ onConfirm, source }) => {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
const { active, id, external_id } = source || {};
|
|
14
|
+
const action = active ? "disable" : "enable";
|
|
15
|
+
const icon = active ? "pause" : "play";
|
|
16
|
+
return (
|
|
17
|
+
<ConfirmModal
|
|
18
|
+
icon={icon}
|
|
19
|
+
trigger={
|
|
20
|
+
<Button
|
|
21
|
+
icon={icon}
|
|
22
|
+
content={formatMessage({ id: `source.actions.${action}` })}
|
|
23
|
+
/>
|
|
24
|
+
}
|
|
25
|
+
header={formatMessage({
|
|
26
|
+
id: `source.actions.${action}.confirmation.header`,
|
|
27
|
+
})}
|
|
28
|
+
size="small"
|
|
29
|
+
content={formatMessage(
|
|
30
|
+
{ id: `source.actions.${action}.confirmation.content` },
|
|
31
|
+
{ external_id: <i>{external_id}</i> }
|
|
32
|
+
)}
|
|
33
|
+
onConfirm={() => onConfirm({ id })}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
delete: true,
|
|
40
|
-
run: true,
|
|
41
|
-
};
|
|
42
|
-
const contentActions = {
|
|
43
|
-
run: {
|
|
44
|
-
key: "run",
|
|
45
|
-
icon: "play",
|
|
46
|
-
text: "Run",
|
|
47
|
-
value: "run",
|
|
48
|
-
as: Link,
|
|
49
|
-
to: linkTo.SOURCE_JOBS_NEW({ external_id }),
|
|
50
|
-
selected: false,
|
|
51
|
-
active: false,
|
|
52
|
-
},
|
|
53
|
-
edit: {
|
|
54
|
-
key: "edit",
|
|
55
|
-
icon: "edit",
|
|
56
|
-
text: (
|
|
57
|
-
<FormattedMessage id="sources.actions.edit" defaultMessage="edit" />
|
|
58
|
-
),
|
|
59
|
-
value: "edit",
|
|
60
|
-
as: Link,
|
|
61
|
-
to: linkTo.SOURCE_EDIT({ external_id }),
|
|
62
|
-
selected: false,
|
|
63
|
-
active: false,
|
|
64
|
-
},
|
|
65
|
-
delete: {
|
|
66
|
-
key: "delete",
|
|
67
|
-
icon: "trash",
|
|
68
|
-
value: "delete",
|
|
69
|
-
as: ModalDelete,
|
|
70
|
-
deleteSource,
|
|
71
|
-
external_id,
|
|
72
|
-
name,
|
|
73
|
-
selected: false,
|
|
74
|
-
active: false,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
const availableActions = _.flow(
|
|
78
|
-
_.omitBy(_.isUndefined),
|
|
79
|
-
_.keys,
|
|
80
|
-
_.map((action) => contentActions[action])
|
|
81
|
-
)(actions);
|
|
82
|
-
return availableActions;
|
|
83
|
-
};
|
|
38
|
+
ConfirmToggleModal.propTypes = {
|
|
39
|
+
source: PropTypes.object,
|
|
40
|
+
onConfirm: PropTypes.func,
|
|
41
|
+
};
|
|
84
42
|
|
|
43
|
+
export const ConfirmDeleteModal = ({ deleteSource, external_id }) => {
|
|
44
|
+
const { formatMessage } = useIntl();
|
|
85
45
|
return (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
46
|
+
<ConfirmModal
|
|
47
|
+
icon="trash"
|
|
48
|
+
trigger={
|
|
49
|
+
<Button
|
|
50
|
+
icon="trash"
|
|
51
|
+
content={formatMessage({ id: "source.actions.delete" })}
|
|
52
|
+
/>
|
|
53
|
+
}
|
|
54
|
+
header={formatMessage({
|
|
55
|
+
id: "source.actions.delete.confirmation.header",
|
|
56
|
+
})}
|
|
57
|
+
size="small"
|
|
58
|
+
content={formatMessage(
|
|
59
|
+
{ id: "source.actions.delete.confirmation.content" },
|
|
60
|
+
{ external_id: <i>{external_id}</i> }
|
|
89
61
|
)}
|
|
90
|
-
|
|
62
|
+
onConfirm={() => deleteSource({ external_id })}
|
|
63
|
+
/>
|
|
91
64
|
);
|
|
92
65
|
};
|
|
93
66
|
|
|
67
|
+
ConfirmDeleteModal.propTypes = {
|
|
68
|
+
deleteSource: PropTypes.func,
|
|
69
|
+
external_id: PropTypes.string,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const SourceActions = ({
|
|
73
|
+
deleteSource,
|
|
74
|
+
disableSource,
|
|
75
|
+
enableSource,
|
|
76
|
+
source,
|
|
77
|
+
}) => {
|
|
78
|
+
const { formatMessage } = useIntl();
|
|
79
|
+
const { external_id, active } = source || {};
|
|
80
|
+
const edit = {
|
|
81
|
+
key: "edit",
|
|
82
|
+
icon: "edit",
|
|
83
|
+
text: formatMessage({ id: "source.actions.edit" }),
|
|
84
|
+
value: "edit",
|
|
85
|
+
as: Link,
|
|
86
|
+
to: linkTo.SOURCE_EDIT({ external_id }),
|
|
87
|
+
};
|
|
88
|
+
const run = {
|
|
89
|
+
key: "run",
|
|
90
|
+
icon: "sync",
|
|
91
|
+
text: "Run",
|
|
92
|
+
value: "run",
|
|
93
|
+
as: Link,
|
|
94
|
+
to: linkTo.SOURCE_JOBS_NEW({ external_id }),
|
|
95
|
+
};
|
|
96
|
+
const toggle = {
|
|
97
|
+
key: "toggle",
|
|
98
|
+
value: "toggle",
|
|
99
|
+
as: ConfirmToggleModal,
|
|
100
|
+
onConfirm: active ? disableSource : enableSource,
|
|
101
|
+
source,
|
|
102
|
+
};
|
|
103
|
+
const remove = {
|
|
104
|
+
key: "delete",
|
|
105
|
+
icon: "trash",
|
|
106
|
+
value: "delete",
|
|
107
|
+
as: ConfirmDeleteModal,
|
|
108
|
+
deleteSource,
|
|
109
|
+
external_id,
|
|
110
|
+
};
|
|
111
|
+
const actions = active ? [edit, run, toggle, remove] : [edit, toggle, remove];
|
|
112
|
+
|
|
113
|
+
return <GroupActions availableActions={actions} />;
|
|
114
|
+
};
|
|
115
|
+
|
|
94
116
|
SourceActions.propTypes = {
|
|
95
117
|
deleteSource: PropTypes.func,
|
|
118
|
+
disableSource: PropTypes.func,
|
|
119
|
+
enableSource: PropTypes.func,
|
|
96
120
|
source: PropTypes.object.isRequired,
|
|
97
121
|
};
|
|
98
122
|
|
|
99
123
|
const mapStateToProps = ({ source }) => ({ source });
|
|
100
124
|
|
|
101
|
-
export default connect(mapStateToProps, {
|
|
125
|
+
export default connect(mapStateToProps, {
|
|
126
|
+
deleteSource,
|
|
127
|
+
disableSource,
|
|
128
|
+
enableSource,
|
|
129
|
+
})(SourceActions);
|