@uxland/primary-shell 5.6.9 → 5.6.10
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 +8 -18
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +5 -5
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/disposer.d.ts +3 -1
- package/dist/primary/shell/src/features/exit/handler.d.ts +1 -1
- package/dist/primary/shell/src/features/exit/request.d.ts +6 -1
- package/package.json +1 -1
- package/src/UI/internal-views/upper-nav-views.ts +1 -10
- package/src/disposer.ts +3 -2
- package/src/features/exit/handler.test.ts +32 -10
- package/src/features/exit/handler.ts +6 -6
- package/src/features/exit/request.ts +6 -1
- package/src/features/visit/finalize-visit/handler.ts +2 -1
- package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/template.ts +11 -9
- package/src/internal-plugins/activity-history/activity-history-item/list/merge-history-items-and-subgroups/merge-history-items-and-subgroups.ts +1 -1
- package/dist/primary/shell/src/features/open-hes-visor/open-hes-visor.d.ts +0 -1
- package/src/features/open-hes-visor/open-hes-visor.ts +0 -6
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ExitShellPayload } from './features/exit/request';
|
|
2
|
+
|
|
1
3
|
export declare const disposeShell: () => void;
|
|
2
4
|
export declare const raiseCloseEvent: () => void;
|
|
3
|
-
export declare const raiseCustomCloseEvent: (event:
|
|
5
|
+
export declare const raiseCustomCloseEvent: (event: ExitShellPayload) => void;
|
|
@@ -4,7 +4,7 @@ import { ExitShell } from './request';
|
|
|
4
4
|
export declare class ExitShellHandler {
|
|
5
5
|
private api;
|
|
6
6
|
constructor(api: PrimariaApi);
|
|
7
|
-
handle(
|
|
7
|
+
handle(exitEvent: ExitShell): Promise<void>;
|
|
8
8
|
private askForClose;
|
|
9
9
|
private timeout;
|
|
10
10
|
private emitClose;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { IRequest } from '../..';
|
|
2
2
|
|
|
3
|
+
export interface ExitShellPayload {
|
|
4
|
+
ecapEvent?: string;
|
|
5
|
+
payload?: any;
|
|
6
|
+
}
|
|
3
7
|
export declare class ExitShell implements IRequest<void> {
|
|
4
8
|
ecapEvent?: string | undefined;
|
|
5
|
-
|
|
9
|
+
payload?: {} | undefined;
|
|
10
|
+
constructor(ecapEvent?: string | undefined, payload?: {} | undefined);
|
|
6
11
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,6 @@ import { QuickActionItem } from "../shared-components/quick-action-item/quick-ac
|
|
|
8
8
|
import { PrimariaNavItem } from "../shared-components/primaria-nav-item/primaria-nav-item";
|
|
9
9
|
import { PrimariaNavTreeMenu } from "../shared-components/primaria-nav-tree-menu/primaria-nav-tree-menu";
|
|
10
10
|
import { GetVisitId } from "../../features/visit/get-visit-id/request";
|
|
11
|
-
import { openHesVisor } from "../../features/open-hes-visor/open-hes-visor";
|
|
12
11
|
|
|
13
12
|
type MenuItemConfig =
|
|
14
13
|
| {
|
|
@@ -212,15 +211,7 @@ const upperNavMenuItems: MenuItemConfig[] = [
|
|
|
212
211
|
type: "item",
|
|
213
212
|
sortHint: "0130",
|
|
214
213
|
callbackFn: () => navigateToEcapWithoutClosingWithCip("CONSULTA_VISITES"),
|
|
215
|
-
}
|
|
216
|
-
{
|
|
217
|
-
id: "visor",
|
|
218
|
-
icon: "window",
|
|
219
|
-
label: "Visor",
|
|
220
|
-
type: "item",
|
|
221
|
-
sortHint: "0140",
|
|
222
|
-
callbackFn: openHesVisor,
|
|
223
|
-
},
|
|
214
|
+
}
|
|
224
215
|
];
|
|
225
216
|
|
|
226
217
|
export const registerUpperNavMenuViews = () => {
|
package/src/disposer.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { shellApi } from "./api/api";
|
|
2
2
|
import { disposeFeatures } from "./features/bootstrapper";
|
|
3
|
+
import { ExitShellPayload } from "./features/exit/request";
|
|
3
4
|
export const disposeShell = () => {
|
|
4
5
|
disposeFeatures(shellApi);
|
|
5
6
|
};
|
|
@@ -8,6 +9,6 @@ export const raiseCloseEvent = () => {
|
|
|
8
9
|
shellApi.ecapEventManager.publish("CLOSE_FORM", "", {});
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
export const raiseCustomCloseEvent = (event:
|
|
12
|
-
shellApi.ecapEventManager.publish(event, "",
|
|
12
|
+
export const raiseCustomCloseEvent = (event: ExitShellPayload) => {
|
|
13
|
+
shellApi.ecapEventManager.publish(event.ecapEvent as string, "", event.payload);
|
|
13
14
|
};
|
|
@@ -2,9 +2,10 @@ import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
|
2
2
|
import { ExitShellHandler } from "./handler";
|
|
3
3
|
import { ExitShell } from "./request";
|
|
4
4
|
import { disposePlugins } from "../../handle-plugins";
|
|
5
|
-
import { disposeShell, raiseCloseEvent } from "../../disposer";
|
|
5
|
+
import { disposeShell, raiseCloseEvent, raiseCustomCloseEvent } from "../../disposer";
|
|
6
6
|
import { PluginBusyTask } from "../../api/plugin-busy-manager/plugin-busy-manager";
|
|
7
7
|
import { PrimariaApi } from "@uxland/primary-shell";
|
|
8
|
+
import { PluginBusyList } from "../../api/plugin-busy-manager/plugin-busy-list/component";
|
|
8
9
|
|
|
9
10
|
vi.mock("../../handle-plugins", () => ({
|
|
10
11
|
disposePlugins: vi.fn(),
|
|
@@ -13,6 +14,7 @@ vi.mock("../../handle-plugins", () => ({
|
|
|
13
14
|
vi.mock("../../disposer", () => ({
|
|
14
15
|
disposeShell: vi.fn(),
|
|
15
16
|
raiseCloseEvent: vi.fn(),
|
|
17
|
+
raiseCustomCloseEvent: vi.fn(),
|
|
16
18
|
}));
|
|
17
19
|
|
|
18
20
|
const createMockApi = (): PrimariaApi =>
|
|
@@ -39,7 +41,7 @@ describe("ExitShellHandler", () => {
|
|
|
39
41
|
vi.clearAllMocks();
|
|
40
42
|
});
|
|
41
43
|
|
|
42
|
-
it("should dispose and raise close event if no busy tasks", async () => {
|
|
44
|
+
it("should dispose and raise custom close event if no busy tasks", async () => {
|
|
43
45
|
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
44
46
|
(disposePlugins as any).mockResolvedValue(undefined);
|
|
45
47
|
|
|
@@ -47,7 +49,7 @@ describe("ExitShellHandler", () => {
|
|
|
47
49
|
|
|
48
50
|
expect(disposePlugins).toHaveBeenCalled();
|
|
49
51
|
expect(disposeShell).toHaveBeenCalled();
|
|
50
|
-
expect(
|
|
52
|
+
expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
it("should ask for confirmation if there are busy tasks", async () => {
|
|
@@ -58,10 +60,19 @@ describe("ExitShellHandler", () => {
|
|
|
58
60
|
|
|
59
61
|
await handler.handle(message);
|
|
60
62
|
|
|
61
|
-
expect(mockApi.interactionService.confirm).
|
|
63
|
+
expect(mockApi.interactionService.confirm).toHaveBeenCalledWith(
|
|
64
|
+
{ busyTasks },
|
|
65
|
+
PluginBusyList,
|
|
66
|
+
{
|
|
67
|
+
title: expect.any(String),
|
|
68
|
+
state: "error",
|
|
69
|
+
confirmButtonText: "Sí",
|
|
70
|
+
cancelButtonText: "No",
|
|
71
|
+
}
|
|
72
|
+
);
|
|
62
73
|
expect(disposePlugins).toHaveBeenCalled();
|
|
63
74
|
expect(disposeShell).toHaveBeenCalled();
|
|
64
|
-
expect(
|
|
75
|
+
expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
|
|
65
76
|
});
|
|
66
77
|
|
|
67
78
|
it("should not continue if confirmation is declined", async () => {
|
|
@@ -74,10 +85,10 @@ describe("ExitShellHandler", () => {
|
|
|
74
85
|
expect(mockApi.interactionService.confirm).toHaveBeenCalled();
|
|
75
86
|
expect(disposePlugins).not.toHaveBeenCalled();
|
|
76
87
|
expect(disposeShell).not.toHaveBeenCalled();
|
|
77
|
-
expect(
|
|
88
|
+
expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
|
|
78
89
|
});
|
|
79
90
|
|
|
80
|
-
it("should handle errors and raise close event", async () => {
|
|
91
|
+
it("should handle errors and raise custom close event", async () => {
|
|
81
92
|
const error = new Error("Something went wrong");
|
|
82
93
|
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
83
94
|
(disposePlugins as any).mockRejectedValue(error);
|
|
@@ -85,19 +96,30 @@ describe("ExitShellHandler", () => {
|
|
|
85
96
|
await handler.handle(message);
|
|
86
97
|
|
|
87
98
|
expect(mockApi.notificationService.error).toHaveBeenCalledWith("Something went wrong");
|
|
88
|
-
expect(
|
|
99
|
+
expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
|
|
89
100
|
});
|
|
90
101
|
|
|
91
102
|
it("should proceed if disposePlugins takes longer than 5 seconds", async () => {
|
|
92
103
|
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
93
104
|
(disposePlugins as any).mockImplementation(
|
|
94
|
-
() => new Promise((resolve) => setTimeout(resolve, 6000))
|
|
105
|
+
() => new Promise((resolve) => setTimeout(resolve, 6000))
|
|
95
106
|
);
|
|
96
107
|
|
|
97
108
|
await handler.handle(message);
|
|
98
109
|
|
|
99
110
|
expect(disposePlugins).toHaveBeenCalled();
|
|
111
|
+
expect(disposeShell).toHaveBeenCalled();
|
|
112
|
+
expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it("should raise raiseCloseEvent if no exitEvent is passed", async () => {
|
|
116
|
+
mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
|
|
117
|
+
(disposePlugins as any).mockResolvedValue(undefined);
|
|
118
|
+
|
|
119
|
+
await handler.handle(undefined as any);
|
|
120
|
+
|
|
100
121
|
expect(disposeShell).toHaveBeenCalled();
|
|
101
122
|
expect(raiseCloseEvent).toHaveBeenCalled();
|
|
123
|
+
expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
|
|
102
124
|
});
|
|
103
|
-
});
|
|
125
|
+
});
|
|
@@ -10,7 +10,7 @@ import { translate } from "../../locales";
|
|
|
10
10
|
|
|
11
11
|
export class ExitShellHandler {
|
|
12
12
|
constructor(@inject(TYPES.primaryApi) private api: PrimariaApi) {}
|
|
13
|
-
async handle(
|
|
13
|
+
async handle(exitEvent: ExitShell): Promise<void> {
|
|
14
14
|
try {
|
|
15
15
|
const busyTasks = this.api.pluginBusyManager.getBusyPluginTasks();
|
|
16
16
|
if (busyTasks.length > 0) {
|
|
@@ -24,10 +24,10 @@ export class ExitShellHandler {
|
|
|
24
24
|
this.timeout(5000), // Si passen 5s, es segueix amb l'execució
|
|
25
25
|
]);
|
|
26
26
|
disposeShell();
|
|
27
|
-
this.emitClose(
|
|
27
|
+
this.emitClose(exitEvent);
|
|
28
28
|
} catch (error) {
|
|
29
29
|
this.api.notificationService.error(error.message);
|
|
30
|
-
this.emitClose(
|
|
30
|
+
this.emitClose(exitEvent);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -44,9 +44,9 @@ export class ExitShellHandler {
|
|
|
44
44
|
return new Promise<void>((resolve) => setTimeout(resolve, ms));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
private emitClose(
|
|
48
|
-
if (
|
|
49
|
-
raiseCustomCloseEvent(
|
|
47
|
+
private emitClose(exitEvent?: ExitShell): void {
|
|
48
|
+
if (exitEvent) {
|
|
49
|
+
raiseCustomCloseEvent(exitEvent);
|
|
50
50
|
} else {
|
|
51
51
|
raiseCloseEvent();
|
|
52
52
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { IRequest } from "@uxland/primary-shell";
|
|
2
2
|
|
|
3
|
+
export interface ExitShellPayload {
|
|
4
|
+
ecapEvent?: string;
|
|
5
|
+
payload?: any;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
export class ExitShell implements IRequest<void> {
|
|
4
|
-
constructor(public ecapEvent?: string) {}
|
|
9
|
+
constructor(public ecapEvent?: string, public payload?: {}) {}
|
|
5
10
|
}
|
|
@@ -2,13 +2,14 @@ import { TYPES } from "../../../infrastructure/ioc/types";
|
|
|
2
2
|
import { inject } from "inversify";
|
|
3
3
|
import { PrimariaApi } from "../../../api/api";
|
|
4
4
|
import { FinalizeVisit } from "./request";
|
|
5
|
+
import { ExitShell } from "../../exit/request";
|
|
5
6
|
|
|
6
7
|
export class FinalizeVisitHandler {
|
|
7
8
|
constructor(@inject(TYPES.primaryApi) private api: PrimariaApi) {}
|
|
8
9
|
async handle(data: FinalizeVisit) {
|
|
9
10
|
try {
|
|
10
11
|
const visitIdData = data.visitId;
|
|
11
|
-
this.api.
|
|
12
|
+
this.api.broker.send(new ExitShell("RESOL_VISITA", { VisiID: visitIdData }))
|
|
12
13
|
} catch (error) {
|
|
13
14
|
this.api.notificationService.error(error.message);
|
|
14
15
|
}
|
package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/template.ts
CHANGED
|
@@ -81,23 +81,25 @@ export const template = (props: ActivityHistoryTimeline) => {
|
|
|
81
81
|
`;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
const noGroupsTemplate = (props: ActivityHistoryTimeline)=> html
|
|
85
|
-
${
|
|
86
|
-
|
|
84
|
+
const noGroupsTemplate = (props: ActivityHistoryTimeline) => html`
|
|
85
|
+
${
|
|
86
|
+
props.searchString?.length > 1
|
|
87
|
+
? html`
|
|
87
88
|
<dss-user-feedback
|
|
88
89
|
class="feedback"
|
|
89
90
|
imagesrc=${notFound}
|
|
90
91
|
title=${translate("noResults")}>
|
|
91
92
|
</dss-user-feedback>
|
|
92
93
|
`
|
|
93
|
-
|
|
94
|
+
: props.renderGroupsControlTimeExpired
|
|
94
95
|
? html`<dss-user-feedback
|
|
95
96
|
class="feedback"
|
|
96
97
|
imagesrc=${notFound}
|
|
97
98
|
title=${translate("noData.title")}
|
|
98
99
|
description=${translate("noData.description")}>
|
|
99
100
|
</dss-user-feedback>`
|
|
100
|
-
: html`<activity-history-is-grouping-busy></activity-history-is-grouping-busy>`
|
|
101
|
+
: html`<activity-history-is-grouping-busy></activity-history-is-grouping-busy>`
|
|
102
|
+
}`;
|
|
101
103
|
|
|
102
104
|
const visitHeaderTemplate = (props: ActivityHistoryTimeline, item: IActivityHistoryItem | undefined) => {
|
|
103
105
|
if (!item) return nothing;
|
|
@@ -129,14 +131,14 @@ const renderProfessionalValues = (props: ActivityHistoryTimeline, item: IActivit
|
|
|
129
131
|
values.push(props.highlighted(item.professional.role.description));
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
if (item.up?.description) {
|
|
133
|
-
values.push(props.highlighted(item.up.description));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
134
|
if (item.professional?.speciality?.description) {
|
|
137
135
|
values.push(props.highlighted(item.professional.speciality.description));
|
|
138
136
|
}
|
|
139
137
|
|
|
138
|
+
if (item.up?.description) {
|
|
139
|
+
values.push(props.highlighted(item.up.description));
|
|
140
|
+
}
|
|
141
|
+
|
|
140
142
|
if (item.service?.description) {
|
|
141
143
|
values.push(props.highlighted(item.service.description));
|
|
142
144
|
}
|
|
@@ -19,7 +19,7 @@ export const mergeHistoryItemsAndSubgroups = (
|
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
21
|
// 2. Prepara los subGroups, usando la fecha del ítem más reciente de cada subgrupo
|
|
22
|
-
const subGroupEntries: ActivityHistoryEntry[] = group
|
|
22
|
+
const subGroupEntries: ActivityHistoryEntry[] = group?.subGroups.map((subGroup) => {
|
|
23
23
|
// Asumimos que subGroup.items ya está ordenado de más reciente a más antiguo
|
|
24
24
|
const mostRecent = subGroup?.items.length ? new Date(subGroup.items[0].date) : new Date(0);
|
|
25
25
|
return {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const openHesVisor: () => void;
|