@uxland/primary-shell 5.1.2 → 5.2.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/dist/index.js +27047 -26702
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1637 -1519
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/bootstrapper.d.ts +1 -0
- package/dist/primary/shell/src/UI/components/bootstrapper.d.ts +1 -0
- package/dist/primary/shell/src/UI/components/{shell-header → primaria-shell/shell-header}/shell-header.d.ts +3 -3
- package/dist/primary/shell/src/UI/components/primaria-shell/shell-header/template.d.ts +3 -0
- package/dist/primary/shell/src/UI/index.d.ts +0 -1
- package/dist/primary/shell/src/UI/shared-components/bootstrapper.d.ts +1 -0
- package/dist/primary/shell/src/UI/shared-components/index.d.ts +0 -1
- package/dist/primary/shell/src/api/api.d.ts +4 -4
- package/dist/primary/shell/src/api/ecap-event-manager/ecap-event-manager.test.d.ts +1 -0
- package/dist/primary/shell/src/api/notification-service/notification-service-impl.test.d.ts +1 -0
- package/dist/primary/shell/src/api/pdf-viewer-manager/constants.d.ts +1 -0
- package/dist/primary/shell/src/api/pdf-viewer-manager/handle-views.d.ts +2 -0
- package/dist/primary/shell/src/api/pdf-viewer-manager/pdf-viewer-manager.d.ts +2 -4
- package/dist/primary/shell/src/api/pdf-viewer-manager/pdf-viewer-manager.test.d.ts +1 -0
- package/dist/primary/shell/src/api/region-manager/region-manager.test.d.ts +1 -0
- package/dist/primary/shell/src/bootstrapper.d.ts +0 -1
- package/dist/primary/shell/src/constants.d.ts +0 -2
- package/dist/primary/shell/src/features/bootstrapper.d.ts +2 -2
- package/dist/primary/shell/src/features/clinical-monitoring/bootstrapper.d.ts +4 -0
- package/dist/primary/shell/src/features/clinical-monitoring/constants.d.ts +1 -0
- package/dist/primary/shell/src/features/clinical-monitoring/handle-views.d.ts +1 -0
- package/dist/primary/shell/src/features/exit/bootstrapper.d.ts +4 -2
- package/dist/primary/shell/src/features/exit/handler.test.d.ts +1 -0
- package/dist/primary/shell/src/features/get-patient-cip/action.d.ts +3 -0
- package/dist/primary/shell/src/features/get-user-info/bootstrapper.d.ts +4 -2
- package/dist/primary/shell/src/features/get-user-info/handler.d.ts +1 -1
- package/dist/primary/shell/src/features/get-user-info/handler.test.d.ts +1 -0
- package/dist/primary/shell/src/features/navigate-to-ecap/navigate-without-closing-and-with-cip.d.ts +1 -0
- package/dist/primary/shell/src/handle-views.d.ts +1 -2
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.test.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/normalize-string.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/normalize-string.test.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/prop-contains-string.test.d.ts +1 -0
- package/dist/primary/shell/src/locales.d.ts +1 -1
- package/package.json +2 -2
- package/src/UI/bootstrapper.ts +12 -0
- package/src/UI/components/bootstrapper.ts +17 -0
- package/src/UI/components/{primaria-error-view → error-view}/component.ts +2 -3
- package/src/UI/components/poc-events-ecap/poc-events-ecap.ts +3 -7
- package/src/UI/components/primaria-shell/primaria-shell.ts +8 -10
- package/src/UI/components/{shell-header → primaria-shell/shell-header}/shell-header.ts +8 -9
- package/src/UI/components/{shell-header → primaria-shell/shell-header}/template.ts +4 -4
- package/src/UI/components/primaria-shell/template.ts +14 -8
- package/src/UI/components/quick-actions-menu/quick-actions-menu.ts +0 -2
- package/src/UI/index.ts +0 -1
- package/src/UI/shared-components/bootstrapper.ts +12 -0
- package/src/UI/shared-components/index.ts +0 -3
- package/src/UI/shared-components/primaria-content-switcher/primaria-content-switcher.ts +1 -2
- package/src/UI/shared-components/primaria-nav-item/primaria-nav-item.ts +6 -7
- package/src/UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu.ts +3 -4
- package/src/UI/shared-components/primaria-text-editor/primaria-rich-text-editor.ts +1 -2
- package/src/api/api.ts +17 -14
- package/src/api/ecap-event-manager/ecap-event-manager.test.ts +48 -0
- package/src/api/notification-service/notification-service-impl.test.ts +56 -0
- package/src/api/pdf-viewer-manager/constants.ts +1 -0
- package/src/api/pdf-viewer-manager/handle-views.ts +32 -0
- package/src/api/pdf-viewer-manager/pdf-viewer-manager.test.ts +99 -0
- package/src/api/pdf-viewer-manager/pdf-viewer-manager.ts +15 -25
- package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/pdf-selector.ts +3 -4
- package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-visor.ts +8 -9
- package/src/api/plugin-busy-manager/plugin-busy-list/component.ts +0 -2
- package/src/api/plugin-busy-manager/plugin-busy-manager.ts +7 -1
- package/src/api/region-manager/region-manager.test.ts +123 -0
- package/src/bootstrapper.ts +8 -9
- package/src/constants.ts +0 -2
- package/src/disposer.ts +2 -2
- package/src/features/bootstrapper.ts +14 -8
- package/src/features/clinical-monitoring/bootstrapper.ts +39 -0
- package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/clinical-monitoring.ts +3 -6
- package/src/features/clinical-monitoring/constants.ts +1 -0
- package/src/features/clinical-monitoring/handle-views.ts +6 -0
- package/src/features/exit/bootstrapper.ts +5 -5
- package/src/features/exit/handler.test.ts +103 -0
- package/src/features/get-patient-cip/action.ts +5 -0
- package/src/features/get-user-info/bootstrapper.ts +5 -5
- package/src/features/get-user-info/handler.test.ts +60 -0
- package/src/features/get-user-info/handler.ts +2 -4
- package/src/features/navigate-to-ecap/navigate-without-closing-and-with-cip.ts +7 -0
- package/src/handle-views.ts +91 -133
- package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.test.ts +61 -0
- package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.ts +2 -2
- package/src/internal-plugins/activity-history/utils/normalize-string.test.ts +29 -0
- package/src/internal-plugins/activity-history/utils/normalize-string.ts +5 -3
- package/src/internal-plugins/activity-history/utils/prop-contains-string.test.ts +47 -0
- package/src/locales.ts +1 -1
- package/dist/primary/shell/src/UI/components/index.d.ts +0 -1
- package/dist/primary/shell/src/UI/components/shell-header/template.d.ts +0 -3
- package/src/UI/components/index.ts +0 -7
- /package/dist/primary/shell/src/UI/components/{primaria-error-view → error-view}/component.d.ts +0 -0
- /package/dist/primary/shell/src/UI/components/{primaria-error-view → error-view}/template.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/pdf-selector.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/template.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-visor.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/utils.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/clinical-monitoring.d.ts +0 -0
- /package/dist/primary/shell/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/template.d.ts +0 -0
- /package/src/UI/components/{primaria-error-view → error-view}/styles.css +0 -0
- /package/src/UI/components/{primaria-error-view → error-view}/template.ts +0 -0
- /package/src/UI/components/{shell-header → primaria-shell/shell-header}/styles.css +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/styles.css +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/pdf-selector/template.ts +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/styles.css +0 -0
- /package/src/{UI/components → api/pdf-viewer-manager}/pdf-visor/utils.ts +0 -0
- /package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/styles.css +0 -0
- /package/src/{UI/components/clinical-monitoring → features/clinical-monitoring/component}/template.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PrimariaApi } from "../../api/api";
|
|
2
2
|
import { BrokerDisposableHandler } from "../../api/broker/primaria-broker";
|
|
3
3
|
import { container } from "../../infrastructure/ioc/container";
|
|
4
4
|
import { registerRequest } from "../utils";
|
|
@@ -7,11 +7,11 @@ import { ExitShell } from "./request";
|
|
|
7
7
|
|
|
8
8
|
let request: BrokerDisposableHandler;
|
|
9
9
|
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
request = registerRequest(
|
|
10
|
+
export const useExitShell = (api: PrimariaApi) => {
|
|
11
|
+
disposeExitShell();
|
|
12
|
+
request = registerRequest(api, container)(ExitShell, ExitShellHandler);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export const
|
|
15
|
+
export const disposeExitShell = () => {
|
|
16
16
|
request?.dispose();
|
|
17
17
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import { ExitShellHandler } from "./handler";
|
|
3
|
+
import { ExitShell } from "./request";
|
|
4
|
+
import { disposePlugins } from "../../handle-plugins";
|
|
5
|
+
import { disposeShell, raiseCloseEvent } from "../../disposer";
|
|
6
|
+
import { PluginBusyTask } from "../../api/plugin-busy-manager/plugin-busy-manager";
|
|
7
|
+
import { PrimariaApi } from "@uxland/primary-shell";
|
|
8
|
+
|
|
9
|
+
vi.mock("../../handle-plugins", () => ({
|
|
10
|
+
disposePlugins: vi.fn(),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
vi.mock("../../disposer", () => ({
|
|
14
|
+
disposeShell: vi.fn(),
|
|
15
|
+
raiseCloseEvent: vi.fn(),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const createMockApi = (): PrimariaApi =>
|
|
19
|
+
({
|
|
20
|
+
pluginBusyManager: {
|
|
21
|
+
getBusyPluginTasks: vi.fn(),
|
|
22
|
+
},
|
|
23
|
+
interactionService: {
|
|
24
|
+
confirm: vi.fn(),
|
|
25
|
+
},
|
|
26
|
+
notificationService: {
|
|
27
|
+
error: vi.fn(),
|
|
28
|
+
},
|
|
29
|
+
}) as any;
|
|
30
|
+
|
|
31
|
+
describe("ExitShellHandler", () => {
|
|
32
|
+
let handler: ExitShellHandler;
|
|
33
|
+
let mockApi: PrimariaApi;
|
|
34
|
+
const message = {} as ExitShell;
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
mockApi = createMockApi();
|
|
38
|
+
handler = new ExitShellHandler(mockApi);
|
|
39
|
+
vi.clearAllMocks();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should dispose and raise close event if no busy tasks", async () => {
|
|
43
|
+
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
44
|
+
(disposePlugins as any).mockResolvedValue(undefined);
|
|
45
|
+
|
|
46
|
+
await handler.handle(message);
|
|
47
|
+
|
|
48
|
+
expect(disposePlugins).toHaveBeenCalled();
|
|
49
|
+
expect(disposeShell).toHaveBeenCalled();
|
|
50
|
+
expect(raiseCloseEvent).toHaveBeenCalled();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("should ask for confirmation if there are busy tasks", async () => {
|
|
54
|
+
const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
|
|
55
|
+
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue(busyTasks);
|
|
56
|
+
mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: true });
|
|
57
|
+
(disposePlugins as any).mockResolvedValue(undefined);
|
|
58
|
+
|
|
59
|
+
await handler.handle(message);
|
|
60
|
+
|
|
61
|
+
expect(mockApi.interactionService.confirm).toHaveBeenCalled();
|
|
62
|
+
expect(disposePlugins).toHaveBeenCalled();
|
|
63
|
+
expect(disposeShell).toHaveBeenCalled();
|
|
64
|
+
expect(raiseCloseEvent).toHaveBeenCalled();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should not continue if confirmation is declined", async () => {
|
|
68
|
+
const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
|
|
69
|
+
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue(busyTasks);
|
|
70
|
+
mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: false });
|
|
71
|
+
|
|
72
|
+
await handler.handle(message);
|
|
73
|
+
|
|
74
|
+
expect(mockApi.interactionService.confirm).toHaveBeenCalled();
|
|
75
|
+
expect(disposePlugins).not.toHaveBeenCalled();
|
|
76
|
+
expect(disposeShell).not.toHaveBeenCalled();
|
|
77
|
+
expect(raiseCloseEvent).not.toHaveBeenCalled();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("should handle errors and raise close event", async () => {
|
|
81
|
+
const error = new Error("Something went wrong");
|
|
82
|
+
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
83
|
+
(disposePlugins as any).mockRejectedValue(error);
|
|
84
|
+
|
|
85
|
+
await handler.handle(message);
|
|
86
|
+
|
|
87
|
+
expect(mockApi.notificationService.error).toHaveBeenCalledWith("Something went wrong");
|
|
88
|
+
expect(raiseCloseEvent).toHaveBeenCalled();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("should proceed if disposePlugins takes longer than 5 seconds", async () => {
|
|
92
|
+
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
93
|
+
(disposePlugins as any).mockImplementation(
|
|
94
|
+
() => new Promise((resolve) => setTimeout(resolve, 6000)),
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
await handler.handle(message);
|
|
98
|
+
|
|
99
|
+
expect(disposePlugins).toHaveBeenCalled();
|
|
100
|
+
expect(disposeShell).toHaveBeenCalled();
|
|
101
|
+
expect(raiseCloseEvent).toHaveBeenCalled();
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shellApi } from "../../api/api";
|
|
1
|
+
import { PrimariaApi, shellApi } from "../../api/api";
|
|
2
2
|
import { BrokerDisposableHandler } from "../../api/broker/primaria-broker";
|
|
3
3
|
import { container, registerDep, unregisterDep } from "../../infrastructure/ioc/container";
|
|
4
4
|
import { registerRequest } from "../utils";
|
|
@@ -8,13 +8,13 @@ import { GetUserInfo } from "./request";
|
|
|
8
8
|
|
|
9
9
|
let request: BrokerDisposableHandler;
|
|
10
10
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
request = registerRequest(
|
|
11
|
+
export const useGetUserInfo = (api: PrimariaApi) => {
|
|
12
|
+
disposeGetUserInfo();
|
|
13
|
+
request = registerRequest(api, container)(GetUserInfo, GetUserInfoHandler);
|
|
14
14
|
registerDep(GetUserInfoBackendAdapter);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const
|
|
17
|
+
export const disposeGetUserInfo = () => {
|
|
18
18
|
request?.dispose();
|
|
19
19
|
unregisterDep(GetUserInfoBackendAdapter);
|
|
20
20
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import { GetUserInfoHandler } from "./handler";
|
|
3
|
+
import { GetUserInfo } from "./request";
|
|
4
|
+
import { IUserInfo } from "./model";
|
|
5
|
+
import { UserInfoBackendAdapter } from "./backend-adapter";
|
|
6
|
+
import { PrimariaApi } from "../../api/api";
|
|
7
|
+
|
|
8
|
+
const createMockApi = (): PrimariaApi =>
|
|
9
|
+
({
|
|
10
|
+
globalStateManager: {
|
|
11
|
+
setData: vi.fn(),
|
|
12
|
+
},
|
|
13
|
+
notificationService: {
|
|
14
|
+
error: vi.fn(),
|
|
15
|
+
},
|
|
16
|
+
}) as any;
|
|
17
|
+
|
|
18
|
+
const createMockBackendAdapter = (): UserInfoBackendAdapter =>
|
|
19
|
+
({
|
|
20
|
+
getUserInfo: vi.fn(),
|
|
21
|
+
}) as any;
|
|
22
|
+
|
|
23
|
+
describe("GetUserInfoHandler", () => {
|
|
24
|
+
let handler: GetUserInfoHandler;
|
|
25
|
+
let api: PrimariaApi;
|
|
26
|
+
let backendAdapter: UserInfoBackendAdapter;
|
|
27
|
+
|
|
28
|
+
const message = {} as GetUserInfo;
|
|
29
|
+
const mockUserInfo: IUserInfo = {
|
|
30
|
+
name: "John Doe",
|
|
31
|
+
email: "john@example.com",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
api = createMockApi();
|
|
36
|
+
backendAdapter = createMockBackendAdapter();
|
|
37
|
+
handler = new GetUserInfoHandler(api, backendAdapter);
|
|
38
|
+
vi.clearAllMocks();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("should fetch user info and store it in global state", async () => {
|
|
42
|
+
(backendAdapter.getUserInfo as any).mockResolvedValue(mockUserInfo);
|
|
43
|
+
|
|
44
|
+
const result = await handler.handle(message);
|
|
45
|
+
|
|
46
|
+
expect(backendAdapter.getUserInfo).toHaveBeenCalled();
|
|
47
|
+
expect(api.globalStateManager.setData).toHaveBeenCalledWith("userInfo", mockUserInfo);
|
|
48
|
+
expect(result).toEqual(mockUserInfo);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should handle error and call notificationService", async () => {
|
|
52
|
+
const error = new Error("Failed to fetch user info");
|
|
53
|
+
(backendAdapter.getUserInfo as any).mockRejectedValue(error);
|
|
54
|
+
|
|
55
|
+
const result = await handler.handle(message);
|
|
56
|
+
|
|
57
|
+
expect(api.notificationService.error).toHaveBeenCalledWith("Failed to fetch user info");
|
|
58
|
+
expect(result).toBeUndefined();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PrimariaApi } from "@uxland/primary-shell";
|
|
2
1
|
import { TYPES } from "../../infrastructure/ioc/types";
|
|
3
2
|
import { inject } from "inversify";
|
|
4
3
|
import { GetUserInfo } from "./request";
|
|
5
4
|
import { IUserInfo } from "./model";
|
|
6
5
|
import { UserInfoBackendAdapter } from "./backend-adapter";
|
|
7
6
|
import { GetUserInfoBackendAdapter } from "./backend-adapter";
|
|
7
|
+
import { PrimariaApi } from "../../api/api";
|
|
8
8
|
|
|
9
9
|
export class GetUserInfoHandler {
|
|
10
10
|
constructor(
|
|
@@ -17,9 +17,7 @@ export class GetUserInfoHandler {
|
|
|
17
17
|
this.api.globalStateManager.setData("userInfo", userInfo);
|
|
18
18
|
return userInfo;
|
|
19
19
|
} catch (error) {
|
|
20
|
-
this.api.notificationService.error(
|
|
21
|
-
error.message,
|
|
22
|
-
);
|
|
20
|
+
this.api.notificationService.error(error.message);
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { shellApi } from "../../api/api";
|
|
2
|
+
import { getPatientCip } from "../get-patient-cip/action";
|
|
3
|
+
|
|
4
|
+
export const navigateToEcapWithoutClosingWithCip = async (eventName: string) => {
|
|
5
|
+
const CIP = await getPatientCip(shellApi);
|
|
6
|
+
shellApi.ecapEventManager.publish(eventName, "NO_TANCAR", { CIP });
|
|
7
|
+
};
|
package/src/handle-views.ts
CHANGED
|
@@ -1,158 +1,123 @@
|
|
|
1
1
|
import { shellApi } from "./api/api";
|
|
2
|
+
import { registerPDFVisorMainView } from "./api/pdf-viewer-manager/handle-views";
|
|
2
3
|
import { shellRegions } from "./api/region-manager/regions";
|
|
3
|
-
import {
|
|
4
|
-
import { shellEvents } from "./events";
|
|
4
|
+
import { pocTestEventsId } from "./constants";
|
|
5
5
|
import { ExitShell } from "./features/exit/request";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { getPatientCip } from "./features/get-patient-cip/action";
|
|
7
|
+
import { navigateToEcapWithoutClosingWithCip } from "./features/navigate-to-ecap/navigate-without-closing-and-with-cip";
|
|
8
8
|
import { PocEventsEcap } from "./UI/components/poc-events-ecap/poc-events-ecap";
|
|
9
9
|
import { PrimariaNavItem } from "./UI/shared-components/primaria-nav-item/primaria-nav-item";
|
|
10
10
|
import { PrimariaNavTreeMenu } from "./UI/shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu";
|
|
11
11
|
|
|
12
|
-
const getPatientCip = async (): Promise<string> => {
|
|
13
|
-
return (await shellApi.broker.send("get_patient_cip")) as string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const publishEcapNoCloseWithCip = async (eventName: string) => {
|
|
17
|
-
const CIP = await getPatientCip();
|
|
18
|
-
shellApi.ecapEventManager.publish(eventName, "NO_TANCAR", { CIP });
|
|
19
|
-
};
|
|
20
|
-
|
|
21
12
|
const registerUpperNavMenuViews = () => {
|
|
22
13
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
23
|
-
id:
|
|
14
|
+
id: "landing",
|
|
24
15
|
factory: () => {
|
|
25
16
|
const menuItem = new PrimariaNavItem({
|
|
26
|
-
icon: "
|
|
27
|
-
label: "
|
|
17
|
+
icon: "home",
|
|
18
|
+
label: "Pàgina inici",
|
|
28
19
|
callbackFn: () => {
|
|
29
|
-
shellApi.
|
|
20
|
+
shellApi.broker.send(new ExitShell());
|
|
30
21
|
},
|
|
31
22
|
});
|
|
32
23
|
return Promise.resolve(menuItem);
|
|
33
24
|
},
|
|
34
25
|
sortHint: "000100",
|
|
35
26
|
});
|
|
27
|
+
|
|
36
28
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
37
|
-
id: "
|
|
29
|
+
id: "processes",
|
|
38
30
|
factory: () => {
|
|
39
31
|
const menuItem = new PrimariaNavTreeMenu({
|
|
40
|
-
icon: "
|
|
41
|
-
label: "
|
|
32
|
+
icon: "account_tree",
|
|
33
|
+
label: "Vies clíniques",
|
|
42
34
|
actionMenuItems: [
|
|
43
35
|
{
|
|
44
36
|
icon: "open_in_new",
|
|
45
|
-
label: "
|
|
46
|
-
callbackFn: async ()
|
|
47
|
-
|
|
48
|
-
shellApi.ecapEventManager.publish("MISSATGES_DEV", "NO_TANCAR", {
|
|
49
|
-
CIP: CIP || "",
|
|
50
|
-
TipusMissatge: "SMS",
|
|
51
|
-
});
|
|
37
|
+
label: "ARES",
|
|
38
|
+
callbackFn: async () => {
|
|
39
|
+
navigateToEcapWithoutClosingWithCip("PROCES_ATENCIO");
|
|
52
40
|
},
|
|
53
41
|
},
|
|
54
42
|
{
|
|
55
43
|
icon: "open_in_new",
|
|
56
|
-
label: "
|
|
44
|
+
label: "Procés Obstètric",
|
|
57
45
|
callbackFn: (): void => {},
|
|
58
46
|
},
|
|
59
47
|
{
|
|
60
48
|
icon: "open_in_new",
|
|
61
|
-
label: "
|
|
62
|
-
callbackFn: ()
|
|
49
|
+
label: "Nen sa",
|
|
50
|
+
callbackFn: async () => {
|
|
51
|
+
navigateToEcapWithoutClosingWithCip("NEN_SA");
|
|
52
|
+
},
|
|
63
53
|
},
|
|
64
54
|
{
|
|
65
55
|
icon: "open_in_new",
|
|
66
|
-
label: "
|
|
67
|
-
callbackFn: async ()
|
|
68
|
-
|
|
56
|
+
label: "Odontologia",
|
|
57
|
+
callbackFn: async () => {
|
|
58
|
+
navigateToEcapWithoutClosingWithCip("ODONTOLOGO");
|
|
69
59
|
},
|
|
70
60
|
},
|
|
71
61
|
{
|
|
72
62
|
icon: "open_in_new",
|
|
73
|
-
label: "
|
|
74
|
-
callbackFn: ()
|
|
63
|
+
label: "Situació d'especial cura",
|
|
64
|
+
callbackFn: async () => {
|
|
65
|
+
navigateToEcapWithoutClosingWithCip("SIT_ESPEC_CURA_DEV");
|
|
66
|
+
},
|
|
75
67
|
},
|
|
76
68
|
],
|
|
77
69
|
});
|
|
78
70
|
return Promise.resolve(menuItem);
|
|
79
71
|
},
|
|
80
|
-
|
|
81
|
-
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
82
|
-
id: "visits",
|
|
83
|
-
factory: () => {
|
|
84
|
-
const menuItem = new PrimariaNavItem({
|
|
85
|
-
icon: "add_box",
|
|
86
|
-
label: "Visites",
|
|
87
|
-
callbackFn: async (): Promise<void> => {
|
|
88
|
-
publishEcapNoCloseWithCip("CONSULTA_VISITES");
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
return Promise.resolve(menuItem);
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
95
|
-
id: "it",
|
|
96
|
-
factory: () => {
|
|
97
|
-
const menuItem = new PrimariaNavItem({
|
|
98
|
-
icon: "add_box",
|
|
99
|
-
label: "IT",
|
|
100
|
-
callbackFn: async (): Promise<void> => {
|
|
101
|
-
publishEcapNoCloseWithCip("REV_IT");
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
return Promise.resolve(menuItem);
|
|
105
|
-
},
|
|
72
|
+
sortHint: "000400",
|
|
106
73
|
});
|
|
107
74
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
108
75
|
id: "unique-petition",
|
|
109
76
|
factory: () => {
|
|
110
77
|
const menuItem = new PrimariaNavTreeMenu({
|
|
111
|
-
icon: "
|
|
112
|
-
label: "Petitori
|
|
78
|
+
icon: "playlist_add",
|
|
79
|
+
label: "Petitori",
|
|
113
80
|
actionMenuItems: [
|
|
114
81
|
{
|
|
115
82
|
icon: "open_in_new",
|
|
116
83
|
label: "Analítiques",
|
|
117
84
|
callbackFn: async (): Promise<void> => {
|
|
118
|
-
|
|
85
|
+
navigateToEcapWithoutClosingWithCip("LABORATORI");
|
|
119
86
|
},
|
|
120
87
|
},
|
|
121
88
|
{
|
|
122
89
|
icon: "open_in_new",
|
|
123
|
-
label: "
|
|
90
|
+
label: "Ordres Clíniques",
|
|
124
91
|
callbackFn: async (): Promise<void> => {
|
|
125
|
-
|
|
126
|
-
publishEcapNoCloseWithCip("RESULT_OC");
|
|
92
|
+
navigateToEcapWithoutClosingWithCip("RESULT_OC");
|
|
127
93
|
},
|
|
128
94
|
},
|
|
129
95
|
{
|
|
130
96
|
icon: "open_in_new",
|
|
131
97
|
label: "OC Exprés",
|
|
132
98
|
callbackFn: async (): Promise<void> => {
|
|
133
|
-
|
|
134
|
-
publishEcapNoCloseWithCip("OC_EXPRES");
|
|
99
|
+
navigateToEcapWithoutClosingWithCip("OC_EXPRES");
|
|
135
100
|
},
|
|
136
101
|
},
|
|
137
102
|
{
|
|
138
103
|
icon: "open_in_new",
|
|
139
104
|
label: "Sol·licitud de trasllat",
|
|
140
105
|
callbackFn: async (): Promise<void> => {
|
|
141
|
-
|
|
142
|
-
publishEcapNoCloseWithCip("TRANSPORT");
|
|
106
|
+
navigateToEcapWithoutClosingWithCip("TRANSPORT");
|
|
143
107
|
},
|
|
144
108
|
},
|
|
145
109
|
],
|
|
146
110
|
});
|
|
147
111
|
return Promise.resolve(menuItem);
|
|
148
112
|
},
|
|
113
|
+
sortHint: "000500",
|
|
149
114
|
});
|
|
150
115
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
151
116
|
id: "results-reports",
|
|
152
117
|
factory: () => {
|
|
153
118
|
const menuItem = new PrimariaNavTreeMenu({
|
|
154
|
-
icon: "
|
|
155
|
-
label: "
|
|
119
|
+
icon: "folder",
|
|
120
|
+
label: "Documents",
|
|
156
121
|
actionMenuItems: [
|
|
157
122
|
{
|
|
158
123
|
icon: "open_in_new",
|
|
@@ -163,9 +128,8 @@ const registerUpperNavMenuViews = () => {
|
|
|
163
128
|
icon: "open_in_new",
|
|
164
129
|
label: "Documents usuari",
|
|
165
130
|
callbackFn: async (): Promise<void> => {
|
|
166
|
-
const CIP = await getPatientCip();
|
|
167
131
|
setTimeout(() => {
|
|
168
|
-
|
|
132
|
+
navigateToEcapWithoutClosingWithCip("CRIDA_DOCS_USU");
|
|
169
133
|
}, 0);
|
|
170
134
|
},
|
|
171
135
|
},
|
|
@@ -173,92 +137,104 @@ const registerUpperNavMenuViews = () => {
|
|
|
173
137
|
});
|
|
174
138
|
return Promise.resolve(menuItem);
|
|
175
139
|
},
|
|
140
|
+
sortHint: "000700",
|
|
176
141
|
});
|
|
177
142
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
178
|
-
id: "
|
|
143
|
+
id: "communication",
|
|
179
144
|
factory: () => {
|
|
180
145
|
const menuItem = new PrimariaNavTreeMenu({
|
|
181
|
-
icon: "
|
|
182
|
-
label: "
|
|
146
|
+
icon: "3p",
|
|
147
|
+
label: "Comunicació",
|
|
183
148
|
actionMenuItems: [
|
|
184
149
|
{
|
|
185
150
|
icon: "open_in_new",
|
|
186
|
-
label: "
|
|
187
|
-
callbackFn: async () => {
|
|
188
|
-
const CIP = await getPatientCip();
|
|
189
|
-
|
|
151
|
+
label: "SMS",
|
|
152
|
+
callbackFn: async (): Promise<void> => {
|
|
153
|
+
const CIP = await getPatientCip(shellApi);
|
|
154
|
+
shellApi.ecapEventManager.publish("MISSATGES_DEV", "NO_TANCAR", {
|
|
155
|
+
CIP: CIP || "",
|
|
156
|
+
TipusMissatge: "SMS",
|
|
157
|
+
});
|
|
190
158
|
},
|
|
191
159
|
},
|
|
192
160
|
{
|
|
193
161
|
icon: "open_in_new",
|
|
194
|
-
label: "
|
|
195
|
-
callbackFn:
|
|
196
|
-
const CIP = await getPatientCip();
|
|
197
|
-
publishEcapNoCloseWithCip("NEN_SA");
|
|
198
|
-
},
|
|
162
|
+
label: "Econsulta",
|
|
163
|
+
callbackFn: (): void => {},
|
|
199
164
|
},
|
|
200
165
|
{
|
|
201
166
|
icon: "open_in_new",
|
|
202
|
-
label: "
|
|
167
|
+
label: "Mail",
|
|
203
168
|
callbackFn: (): void => {},
|
|
204
169
|
},
|
|
205
170
|
{
|
|
206
171
|
icon: "open_in_new",
|
|
207
|
-
label: "
|
|
208
|
-
callbackFn: async () => {
|
|
209
|
-
|
|
210
|
-
publishEcapNoCloseWithCip("ODONTOLOGO");
|
|
172
|
+
label: "Veu IP",
|
|
173
|
+
callbackFn: async (): Promise<void> => {
|
|
174
|
+
navigateToEcapWithoutClosingWithCip("VOIP");
|
|
211
175
|
},
|
|
212
176
|
},
|
|
213
177
|
{
|
|
214
178
|
icon: "open_in_new",
|
|
215
|
-
label: "
|
|
216
|
-
callbackFn:
|
|
217
|
-
const CIP = await getPatientCip();
|
|
218
|
-
publishEcapNoCloseWithCip("SIT_ESPEC_CURA_DEV");
|
|
219
|
-
},
|
|
179
|
+
label: "Videoconsulta",
|
|
180
|
+
callbackFn: (): void => {},
|
|
220
181
|
},
|
|
221
182
|
],
|
|
222
183
|
});
|
|
223
184
|
return Promise.resolve(menuItem);
|
|
224
185
|
},
|
|
186
|
+
sortHint: "001200",
|
|
225
187
|
});
|
|
226
188
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
227
|
-
id: "
|
|
189
|
+
id: "visits",
|
|
228
190
|
factory: () => {
|
|
229
191
|
const menuItem = new PrimariaNavItem({
|
|
230
|
-
icon: "
|
|
231
|
-
label: "
|
|
232
|
-
callbackFn: async () => {
|
|
233
|
-
|
|
234
|
-
publishEcapNoCloseWithCip("SIA_DEV");
|
|
192
|
+
icon: "today",
|
|
193
|
+
label: "Visites",
|
|
194
|
+
callbackFn: async (): Promise<void> => {
|
|
195
|
+
navigateToEcapWithoutClosingWithCip("CONSULTA_VISITES");
|
|
235
196
|
},
|
|
236
197
|
});
|
|
237
198
|
return Promise.resolve(menuItem);
|
|
238
199
|
},
|
|
200
|
+
sortHint: "001300",
|
|
239
201
|
});
|
|
240
202
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
241
|
-
id:
|
|
203
|
+
id: pocTestEventsId,
|
|
242
204
|
factory: () => {
|
|
243
205
|
const menuItem = new PrimariaNavItem({
|
|
244
|
-
icon: "
|
|
245
|
-
label: "
|
|
206
|
+
icon: "bolt",
|
|
207
|
+
label: "Prova Events ECAP",
|
|
246
208
|
callbackFn: () => {
|
|
247
|
-
shellApi.regionManager.activateMainView(
|
|
248
|
-
shellApi.broker.publish(shellEvents.openClinicalMonitoringRequested);
|
|
209
|
+
shellApi.regionManager.activateMainView(pocTestEventsId);
|
|
249
210
|
},
|
|
250
211
|
});
|
|
251
212
|
return Promise.resolve(menuItem);
|
|
252
213
|
},
|
|
253
214
|
});
|
|
215
|
+
|
|
254
216
|
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
255
|
-
id: "
|
|
217
|
+
id: "it",
|
|
256
218
|
factory: () => {
|
|
257
219
|
const menuItem = new PrimariaNavItem({
|
|
258
220
|
icon: "add_box",
|
|
259
|
-
label: "
|
|
260
|
-
callbackFn: () => {
|
|
261
|
-
|
|
221
|
+
label: "IT",
|
|
222
|
+
callbackFn: async (): Promise<void> => {
|
|
223
|
+
navigateToEcapWithoutClosingWithCip("REV_IT");
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
return Promise.resolve(menuItem);
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
shellApi.regionManager.registerView(shellRegions.navigationMenu, {
|
|
231
|
+
id: "variable activities",
|
|
232
|
+
factory: () => {
|
|
233
|
+
const menuItem = new PrimariaNavItem({
|
|
234
|
+
icon: "add_box",
|
|
235
|
+
label: "Activitats variables",
|
|
236
|
+
callbackFn: async () => {
|
|
237
|
+
navigateToEcapWithoutClosingWithCip("SIA_DEV");
|
|
262
238
|
},
|
|
263
239
|
});
|
|
264
240
|
return Promise.resolve(menuItem);
|
|
@@ -271,7 +247,7 @@ const registerLowerNavMenuViews = () => {
|
|
|
271
247
|
id: "configuration-center",
|
|
272
248
|
factory: () => {
|
|
273
249
|
const menuItem = new PrimariaNavItem({
|
|
274
|
-
icon: "
|
|
250
|
+
icon: "settings",
|
|
275
251
|
label: "Centre de configuració",
|
|
276
252
|
callbackFn: () => {
|
|
277
253
|
// shellApi.regionManager.activateView(shellRegions.main, "");
|
|
@@ -283,14 +259,6 @@ const registerLowerNavMenuViews = () => {
|
|
|
283
259
|
};
|
|
284
260
|
|
|
285
261
|
const registerMainViews = () => {
|
|
286
|
-
shellApi.regionManager.registerMainView({
|
|
287
|
-
id: clinicalMonitoringId,
|
|
288
|
-
factory: () => {
|
|
289
|
-
const mainItem = new ClinicalMonitoring();
|
|
290
|
-
return Promise.resolve(mainItem as unknown as HTMLElement);
|
|
291
|
-
},
|
|
292
|
-
isDefault: true,
|
|
293
|
-
});
|
|
294
262
|
shellApi.regionManager.registerMainView({
|
|
295
263
|
id: pocTestEventsId,
|
|
296
264
|
factory: () => {
|
|
@@ -299,21 +267,11 @@ const registerMainViews = () => {
|
|
|
299
267
|
},
|
|
300
268
|
});
|
|
301
269
|
|
|
302
|
-
|
|
303
|
-
id: pdfViewerId,
|
|
304
|
-
factory: () => {
|
|
305
|
-
const mainItem = new PdfVisor();
|
|
306
|
-
return Promise.resolve(mainItem as unknown as HTMLElement);
|
|
307
|
-
},
|
|
308
|
-
});
|
|
270
|
+
registerPDFVisorMainView();
|
|
309
271
|
};
|
|
310
272
|
|
|
311
|
-
export const
|
|
273
|
+
export const useInternalViews = () => {
|
|
312
274
|
registerMainViews();
|
|
313
275
|
registerUpperNavMenuViews();
|
|
314
276
|
registerLowerNavMenuViews();
|
|
315
277
|
};
|
|
316
|
-
|
|
317
|
-
export const activateDefaultView = () => {
|
|
318
|
-
shellApi.regionManager.activateMainView(clinicalMonitoringId);
|
|
319
|
-
};
|