ehr-alerts-ui 0.0.26 → 0.0.28

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.
Files changed (36) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/.prettierrc +13 -0
  3. package/lib/index.cjs.js +1 -1
  4. package/lib/index.cjs.js.map +1 -1
  5. package/lib/index.js +1 -1
  6. package/lib/index.js.map +1 -1
  7. package/package.json +20 -9
  8. package/src/App.tsx +21 -23
  9. package/src/Reducer.ts +1 -0
  10. package/src/index.tsx +1 -2
  11. package/src/library/actions/AlertActions.ts +91 -66
  12. package/src/library/actions/TableActions.ts +55 -54
  13. package/src/library/components/AlertModal/AlertModal.tsx +251 -152
  14. package/src/library/components/AlertModal/AlertModalContainer.tsx +16 -14
  15. package/src/library/components/AlertModal/index.ts +1 -1
  16. package/src/library/components/AlertsTable/AlertsTable.tsx +144 -66
  17. package/src/library/components/AlertsTable/AlertsTableContainer.tsx +37 -24
  18. package/src/library/components/AlertsTable/SortableRow/SortableRow.tsx +53 -33
  19. package/src/library/components/AlertsTable/SortableRow/index.ts +1 -1
  20. package/src/library/components/AlertsTable/index.ts +1 -1
  21. package/src/library/components/Header/Header.tsx +11 -12
  22. package/src/library/components/Header/HeaderContainer.tsx +13 -11
  23. package/src/library/components/Header/index.ts +1 -1
  24. package/src/library/components/MainPage/MainPage.tsx +59 -24
  25. package/src/library/components/MainPage/index.ts +2 -2
  26. package/src/library/configureStore.ts +12 -14
  27. package/src/library/helpers/appendZero.ts +1 -1
  28. package/src/library/helpers/printDate.ts +1 -1
  29. package/src/library/index.ts +1 -1
  30. package/src/library/reducers/alertReducer.ts +19 -20
  31. package/src/library/reducers/index.ts +16 -6
  32. package/src/library/reducers/tableReducer.ts +32 -33
  33. package/src/react-app-env.d.ts +1 -1
  34. package/src/setupProxy.js +9 -7
  35. package/src/translations/elements_et.json +231 -244
  36. package/tsconfig.json +1 -1
@@ -1,9 +1,11 @@
1
- import {applyMiddleware, createStore} from 'redux';
2
- import {createLogger} from 'redux-logger';
1
+ import { applyMiddleware, createStore } from 'redux';
2
+ import { createLogger } from 'redux-logger';
3
3
  import thunk from 'redux-thunk';
4
- import {RefreshMiddleware} from 'ehr-auth-react';
5
4
 
6
- import reducers, {AlertsUiState} from './reducers';
5
+ // @ts-ignore
6
+ import { RefreshMiddleware } from 'ehr-auth-react';
7
+
8
+ import reducers, { AlertsUiState } from './reducers';
7
9
 
8
10
  const middleware = [RefreshMiddleware, thunk];
9
11
 
@@ -12,18 +14,14 @@ if (process.env.NODE_ENV !== 'production') {
12
14
  middleware.push(
13
15
  createLogger({
14
16
  predicate: (getState, action) =>
15
- (action.type.toString() !== 'KEYCLOAK_REFRESH_SUCCEEDED' && action.type.toString() !== 'AXIOS_ACCESS_TOKEN')
16
- })
17
- )
17
+ action.type.toString() !== 'KEYCLOAK_REFRESH_SUCCEEDED' &&
18
+ action.type.toString() !== 'AXIOS_ACCESS_TOKEN',
19
+ }),
20
+ );
18
21
  }
19
22
 
20
-
21
23
  const store = (initialState?: AlertsUiState) => {
22
- return createStore(
23
- reducers,
24
- initialState,
25
- applyMiddleware(...middleware),
26
- );
27
- }
24
+ return createStore(reducers, initialState, applyMiddleware(...middleware));
25
+ };
28
26
 
29
27
  export default store;
@@ -4,4 +4,4 @@ export default function appendZero(value: string): string {
4
4
  }
5
5
 
6
6
  return value;
7
- }
7
+ }
@@ -20,4 +20,4 @@ export default function (date: Date | undefined, datepicker?: boolean): string {
20
20
  }
21
21
 
22
22
  return `${day}.${month}.${year}`;
23
- }
23
+ }
@@ -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 "../actions/AlertActions";
2
- import {Alert, Audience, MessageLevel} from "./tableReducer";
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
- ...state.errors,
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,23 @@
1
- import {combineReducers} from 'redux';
2
- import {tableReducer, TableState} from "./tableReducer";
3
- import {alertReducer, AlertState} from "./alertReducer";
1
+ import { combineReducers } from 'redux';
2
+
3
+ // @ts-ignore
4
+ import { KeycloakReducer, ProfileReducer, RulesReducer } from 'ehr-auth-react';
5
+
6
+ import { tableReducer, TableState } from './tableReducer';
7
+ import { alertReducer, AlertState } from './alertReducer';
4
8
 
5
9
  export type AlertsUiState = {
6
- table: TableState,
7
- alert: AlertState,
10
+ table: TableState;
11
+ alert: AlertState;
12
+ keycloak: any;
13
+ profile: any;
14
+ rules: any;
8
15
  };
9
16
 
10
17
  export default combineReducers<AlertsUiState>({
11
18
  table: tableReducer,
12
19
  alert: alertReducer,
13
- });
20
+ keycloak: KeycloakReducer,
21
+ profile: ProfileReducer,
22
+ rules: RulesReducer,
23
+ });
@@ -1,42 +1,41 @@
1
- import {TableActions, TableActionsType} from "../actions/TableActions";
1
+ import { TableActions, TableActionsType } from '../actions/TableActions';
2
2
 
3
3
  export enum Audience {
4
- AUTHENTICATED = "Autenditud kasutaja",
5
- NOT_AUTHENTICATED = "Autentimata kasutaja",
4
+ AUTHENTICATED = 'Autenditud kasutaja',
5
+ NOT_AUTHENTICATED = 'Autentimata kasutaja',
6
6
  }
7
7
 
8
8
  export enum MessageLevel {
9
- "TEADE" = "TEADE",
10
- "HOIATUS" = "HOIATUS",
11
- "VEATEADE" = "VEATEADE",
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
+ }
@@ -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('/api', createProxyMiddleware(
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
- "Referer": "https://devkluster.ehr.ee/ui/ehr/v1/",
11
- "Origin": "https://devkluster.ehr.ee/"
12
- }
13
- }));
14
- }
11
+ Referer: 'https://devkluster.ehr.ee/ui/ehr/v1/',
12
+ Origin: 'https://devkluster.ehr.ee/',
13
+ },
14
+ }),
15
+ );
16
+ };