ehr-alerts-ui 0.0.25 → 0.0.27
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/.husky/pre-commit +4 -0
- package/.prettierrc +13 -0
- package/lib/index.cjs.js +1 -1
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +22 -11
- package/src/App.tsx +19 -23
- package/src/index.tsx +1 -2
- package/src/library/actions/AlertActions.ts +91 -66
- package/src/library/actions/TableActions.ts +55 -54
- package/src/library/components/AlertModal/AlertModal.tsx +251 -152
- package/src/library/components/AlertModal/AlertModalContainer.tsx +16 -14
- package/src/library/components/AlertModal/index.ts +1 -1
- package/src/library/components/AlertsTable/AlertsTable.tsx +144 -66
- package/src/library/components/AlertsTable/AlertsTableContainer.tsx +37 -24
- package/src/library/components/AlertsTable/SortableRow/SortableRow.tsx +53 -33
- package/src/library/components/AlertsTable/SortableRow/index.ts +1 -1
- package/src/library/components/AlertsTable/index.ts +1 -1
- package/src/library/components/Header/Header.tsx +11 -12
- package/src/library/components/Header/HeaderContainer.tsx +13 -11
- package/src/library/components/Header/index.ts +1 -1
- package/src/library/components/MainPage/MainPage.tsx +17 -18
- package/src/library/components/MainPage/index.ts +2 -2
- package/src/library/configureStore.ts +10 -14
- package/src/library/helpers/appendZero.ts +1 -1
- package/src/library/helpers/printDate.ts +1 -1
- package/src/library/index.ts +1 -1
- package/src/library/reducers/alertReducer.ts +19 -20
- package/src/library/reducers/index.ts +6 -6
- package/src/library/reducers/tableReducer.ts +32 -33
- package/src/react-app-env.d.ts +1 -1
- package/src/setupProxy.js +9 -7
- package/src/translations/elements_et.json +231 -244
- package/tsconfig.json +1 -1
package/src/library/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './assets/styles/main.scss';
|
|
2
|
-
export {default} from './components/MainPage';
|
|
2
|
+
export { default } from './components/MainPage';
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import {AlertActions, AlertActionsType} from
|
|
2
|
-
import {Alert, Audience, MessageLevel} from
|
|
1
|
+
import { AlertActions, AlertActionsType } from '../actions/AlertActions';
|
|
2
|
+
import { Alert, Audience, MessageLevel } from './tableReducer';
|
|
3
3
|
|
|
4
4
|
export interface AlertModalError {
|
|
5
|
-
title: string
|
|
6
|
-
content: string
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface AlertState {
|
|
10
|
-
alert: Alert | undefined
|
|
11
|
-
errors: AlertModalError[]
|
|
10
|
+
alert: Alert | undefined;
|
|
11
|
+
errors: AlertModalError[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const initialState: AlertState = {
|
|
15
15
|
alert: undefined,
|
|
16
16
|
errors: [],
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function alertReducer(state = initialState, action: AlertActions): AlertState {
|
|
17
|
+
};
|
|
20
18
|
|
|
19
|
+
export function alertReducer(
|
|
20
|
+
state = initialState,
|
|
21
|
+
action: AlertActions,
|
|
22
|
+
): AlertState {
|
|
21
23
|
switch (action.type) {
|
|
22
24
|
case AlertActionsType.CREATE_ALERT: {
|
|
23
25
|
return {
|
|
@@ -34,37 +36,34 @@ export function alertReducer(state = initialState, action: AlertActions): AlertS
|
|
|
34
36
|
level: MessageLevel.TEADE,
|
|
35
37
|
title: '',
|
|
36
38
|
audience: Audience.AUTHENTICATED,
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
39
41
|
}
|
|
40
42
|
case AlertActionsType.EDIT_ALERT: {
|
|
41
43
|
return {
|
|
42
44
|
...state,
|
|
43
45
|
alert: action.payload.alert,
|
|
44
|
-
}
|
|
46
|
+
};
|
|
45
47
|
}
|
|
46
48
|
case AlertActionsType.CLEAR_ALERT: {
|
|
47
49
|
return {
|
|
48
50
|
...state,
|
|
49
51
|
alert: undefined,
|
|
50
|
-
}
|
|
52
|
+
};
|
|
51
53
|
}
|
|
52
54
|
case AlertActionsType.ADD_ALERT_MODAL_ERROR: {
|
|
53
55
|
return {
|
|
54
56
|
...state,
|
|
55
|
-
errors: [
|
|
56
|
-
|
|
57
|
-
action.payload.error,
|
|
58
|
-
]
|
|
59
|
-
}
|
|
57
|
+
errors: [...state.errors, action.payload.error],
|
|
58
|
+
};
|
|
60
59
|
}
|
|
61
60
|
case AlertActionsType.CLEAR_ALERT_MODAL_ERRORS: {
|
|
62
61
|
return {
|
|
63
62
|
...state,
|
|
64
63
|
errors: [],
|
|
65
|
-
}
|
|
64
|
+
};
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
return state;
|
|
70
|
-
}
|
|
69
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {combineReducers} from 'redux';
|
|
2
|
-
import {tableReducer, TableState} from
|
|
3
|
-
import {alertReducer, AlertState} from
|
|
1
|
+
import { combineReducers } from 'redux';
|
|
2
|
+
import { tableReducer, TableState } from './tableReducer';
|
|
3
|
+
import { alertReducer, AlertState } from './alertReducer';
|
|
4
4
|
|
|
5
5
|
export type AlertsUiState = {
|
|
6
|
-
table: TableState
|
|
7
|
-
alert: AlertState
|
|
6
|
+
table: TableState;
|
|
7
|
+
alert: AlertState;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export default combineReducers<AlertsUiState>({
|
|
11
11
|
table: tableReducer,
|
|
12
12
|
alert: alertReducer,
|
|
13
|
-
});
|
|
13
|
+
});
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import {TableActions, TableActionsType} from
|
|
1
|
+
import { TableActions, TableActionsType } from '../actions/TableActions';
|
|
2
2
|
|
|
3
3
|
export enum Audience {
|
|
4
|
-
AUTHENTICATED =
|
|
5
|
-
NOT_AUTHENTICATED =
|
|
4
|
+
AUTHENTICATED = 'Autenditud kasutaja',
|
|
5
|
+
NOT_AUTHENTICATED = 'Autentimata kasutaja',
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export enum MessageLevel {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
'TEADE' = 'TEADE',
|
|
10
|
+
'HOIATUS' = 'HOIATUS',
|
|
11
|
+
'VEATEADE' = 'VEATEADE',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface Alert {
|
|
15
|
-
id: number
|
|
16
|
-
title: string
|
|
17
|
-
audience: Audience
|
|
18
|
-
level: MessageLevel
|
|
19
|
-
begin: string | undefined
|
|
20
|
-
beginHour: number | undefined
|
|
21
|
-
beginMinute: number | undefined
|
|
22
|
-
end: string | undefined
|
|
23
|
-
endHour: number | undefined
|
|
24
|
-
endMinute: number | undefined
|
|
25
|
-
deleted?: Date
|
|
26
|
-
content: string
|
|
27
|
-
isDeleteOpen?: boolean
|
|
15
|
+
id: number;
|
|
16
|
+
title: string;
|
|
17
|
+
audience: Audience;
|
|
18
|
+
level: MessageLevel;
|
|
19
|
+
begin: string | undefined;
|
|
20
|
+
beginHour: number | undefined;
|
|
21
|
+
beginMinute: number | undefined;
|
|
22
|
+
end: string | undefined;
|
|
23
|
+
endHour: number | undefined;
|
|
24
|
+
endMinute: number | undefined;
|
|
25
|
+
deleted?: Date;
|
|
26
|
+
content: string;
|
|
27
|
+
isDeleteOpen?: boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface TableState {
|
|
31
|
-
alerts: Alert[]
|
|
31
|
+
alerts: Alert[];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const initialState: TableState = {
|
|
35
35
|
alerts: [],
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
|
|
38
38
|
export function tableReducer(state = initialState, action: TableActions) {
|
|
39
|
-
|
|
40
39
|
switch (action.type) {
|
|
41
40
|
case TableActionsType.ADD_ALERT: {
|
|
42
41
|
return {
|
|
@@ -44,16 +43,16 @@ export function tableReducer(state = initialState, action: TableActions) {
|
|
|
44
43
|
alerts: [
|
|
45
44
|
...state.alerts,
|
|
46
45
|
{
|
|
47
|
-
...action.payload.alert
|
|
46
|
+
...action.payload.alert,
|
|
48
47
|
},
|
|
49
|
-
]
|
|
50
|
-
}
|
|
48
|
+
],
|
|
49
|
+
};
|
|
51
50
|
}
|
|
52
51
|
case TableActionsType.CLEAR_TABLE: {
|
|
53
52
|
return {
|
|
54
53
|
...state,
|
|
55
54
|
alerts: [],
|
|
56
|
-
}
|
|
55
|
+
};
|
|
57
56
|
}
|
|
58
57
|
case TableActionsType.SET_DELETE_OPEN: {
|
|
59
58
|
return {
|
|
@@ -64,12 +63,12 @@ export function tableReducer(state = initialState, action: TableActions) {
|
|
|
64
63
|
return {
|
|
65
64
|
...alert,
|
|
66
65
|
isDeleteOpen: true,
|
|
67
|
-
}
|
|
66
|
+
};
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
return alert;
|
|
71
|
-
})
|
|
72
|
-
}
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
73
72
|
}
|
|
74
73
|
case TableActionsType.CLEAR_DELETES: {
|
|
75
74
|
return {
|
|
@@ -79,11 +78,11 @@ export function tableReducer(state = initialState, action: TableActions) {
|
|
|
79
78
|
return {
|
|
80
79
|
...alert,
|
|
81
80
|
isDeleteOpen: false,
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
}
|
|
81
|
+
};
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
return state;
|
|
89
|
-
}
|
|
88
|
+
}
|
package/src/react-app-env.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react-scripts" />
|
|
2
|
-
declare module 'ehr-components';
|
|
2
|
+
declare module 'ehr-components';
|
package/src/setupProxy.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
2
2
|
|
|
3
3
|
module.exports = function (app) {
|
|
4
|
-
app.use(
|
|
5
|
-
|
|
4
|
+
app.use(
|
|
5
|
+
'/api',
|
|
6
|
+
createProxyMiddleware({
|
|
6
7
|
target: 'https://devkluster.ehr.ee',
|
|
7
8
|
secure: false,
|
|
8
9
|
changeOrigin: true,
|
|
9
10
|
headers: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
|
|
11
|
+
Referer: 'https://devkluster.ehr.ee/ui/ehr/v1/',
|
|
12
|
+
Origin: 'https://devkluster.ehr.ee/',
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
};
|