@uxland/primary-shell 5.6.11 → 5.6.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxland/primary-shell",
3
- "version": "5.6.11",
3
+ "version": "5.6.13",
4
4
  "description": "Primaria Shell",
5
5
  "author": "UXLand <dev@uxland.es>",
6
6
  "homepage": "https://github.com/uxland/harmonix/tree/app#readme",
@@ -83,7 +83,7 @@
83
83
  .bottom-content-first {
84
84
  display: flex;
85
85
  flex-direction: column;
86
- gap: 4px;
86
+ gap: 22px;
87
87
  }
88
88
  }
89
89
  &[expanded] {
@@ -165,3 +165,12 @@
165
165
  .toggle-button {
166
166
  margin-bottom: 24px;
167
167
  }
168
+ @media (max-width: 1024px) {
169
+ .toggle-button {
170
+ display: none;
171
+ }
172
+ .content {
173
+ overflow-y: auto;
174
+ }
175
+ }
176
+
@@ -34,3 +34,26 @@
34
34
  }
35
35
  }
36
36
  }
37
+
38
+ @media (max-width: 1024px) {
39
+ :host {
40
+ min-height: 100vh;
41
+ }
42
+ .wrapper {
43
+ flex-direction: column;
44
+ #widgets-sidebar-region {
45
+ width: 100%;
46
+ border-left: none;
47
+ }
48
+ .content {
49
+ #header-widgets-region {
50
+ grid-template-columns: 1fr;
51
+ gap: 16px;
52
+ }
53
+ #content-widgets-region {
54
+ height: 70vh;
55
+ flex: none;
56
+ }
57
+ }
58
+ }
59
+ }
@@ -33,7 +33,6 @@ const createMockApi = (): PrimariaApi =>
33
33
  describe("ExitShellHandler", () => {
34
34
  let handler: ExitShellHandler;
35
35
  let mockApi: PrimariaApi;
36
- const message = {} as ExitShell;
37
36
 
38
37
  beforeEach(() => {
39
38
  mockApi = createMockApi();
@@ -41,7 +40,8 @@ describe("ExitShellHandler", () => {
41
40
  vi.clearAllMocks();
42
41
  });
43
42
 
44
- it("should dispose and raise custom close event if no busy tasks", async () => {
43
+ it("should dispose and raise custom close event if no busy tasks and message has ecapEvent", async () => {
44
+ const message = { ecapEvent: {} } as ExitShell;
45
45
  mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
46
46
  (disposePlugins as any).mockResolvedValue(undefined);
47
47
 
@@ -52,24 +52,34 @@ describe("ExitShellHandler", () => {
52
52
  expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
53
53
  });
54
54
 
55
+ it("should dispose and raise default close event if no busy tasks and no ecapEvent in message", async () => {
56
+ const message = {} as ExitShell;
57
+ mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
58
+ (disposePlugins as any).mockResolvedValue(undefined);
59
+
60
+ await handler.handle(message);
61
+
62
+ expect(disposePlugins).toHaveBeenCalled();
63
+ expect(disposeShell).toHaveBeenCalled();
64
+ expect(raiseCloseEvent).toHaveBeenCalled();
65
+ expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
66
+ });
67
+
55
68
  it("should ask for confirmation if there are busy tasks", async () => {
56
69
  const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
70
+ const message = { ecapEvent: {} } as ExitShell;
57
71
  mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue(busyTasks);
58
72
  mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: true });
59
73
  (disposePlugins as any).mockResolvedValue(undefined);
60
74
 
61
75
  await handler.handle(message);
62
76
 
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
- );
77
+ expect(mockApi.interactionService.confirm).toHaveBeenCalledWith({ busyTasks }, PluginBusyList, {
78
+ title: expect.any(String),
79
+ state: "error",
80
+ confirmButtonText: "Sí",
81
+ cancelButtonText: "No",
82
+ });
73
83
  expect(disposePlugins).toHaveBeenCalled();
74
84
  expect(disposeShell).toHaveBeenCalled();
75
85
  expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
@@ -77,6 +87,7 @@ describe("ExitShellHandler", () => {
77
87
 
78
88
  it("should not continue if confirmation is declined", async () => {
79
89
  const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
90
+ const message = { ecapEvent: {} } as ExitShell;
80
91
  mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue(busyTasks);
81
92
  mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: false });
82
93
 
@@ -86,10 +97,12 @@ describe("ExitShellHandler", () => {
86
97
  expect(disposePlugins).not.toHaveBeenCalled();
87
98
  expect(disposeShell).not.toHaveBeenCalled();
88
99
  expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
100
+ expect(raiseCloseEvent).not.toHaveBeenCalled();
89
101
  });
90
102
 
91
- it("should handle errors and raise custom close event", async () => {
103
+ it("should handle errors and raise custom close event if message has ecapEvent", async () => {
92
104
  const error = new Error("Something went wrong");
105
+ const message = { ecapEvent: {} } as ExitShell;
93
106
  mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
94
107
  (disposePlugins as any).mockRejectedValue(error);
95
108
 
@@ -97,13 +110,26 @@ describe("ExitShellHandler", () => {
97
110
 
98
111
  expect(mockApi.notificationService.error).toHaveBeenCalledWith("Something went wrong");
99
112
  expect(raiseCustomCloseEvent).toHaveBeenCalledWith(message);
113
+ expect(raiseCloseEvent).not.toHaveBeenCalled();
114
+ });
115
+
116
+ it("should handle errors and raise default close event if message has no ecapEvent", async () => {
117
+ const error = new Error("Something went wrong");
118
+ const message = {} as ExitShell;
119
+ mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
120
+ (disposePlugins as any).mockRejectedValue(error);
121
+
122
+ await handler.handle(message);
123
+
124
+ expect(mockApi.notificationService.error).toHaveBeenCalledWith("Something went wrong");
125
+ expect(raiseCloseEvent).toHaveBeenCalled();
126
+ expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
100
127
  });
101
128
 
102
129
  it("should proceed if disposePlugins takes longer than 5 seconds", async () => {
130
+ const message = { ecapEvent: {} } as ExitShell;
103
131
  mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
104
- (disposePlugins as any).mockImplementation(
105
- () => new Promise((resolve) => setTimeout(resolve, 6000))
106
- );
132
+ (disposePlugins as any).mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 6000)));
107
133
 
108
134
  await handler.handle(message);
109
135
 
@@ -122,4 +148,4 @@ describe("ExitShellHandler", () => {
122
148
  expect(raiseCloseEvent).toHaveBeenCalled();
123
149
  expect(raiseCustomCloseEvent).not.toHaveBeenCalled();
124
150
  });
125
- });
151
+ });
@@ -11,6 +11,8 @@ import { translate } from "../../locales";
11
11
  export class ExitShellHandler {
12
12
  constructor(@inject(TYPES.primaryApi) private api: PrimariaApi) {}
13
13
  async handle(exitEvent: ExitShell): Promise<void> {
14
+ const evt = exitEvent && exitEvent.ecapEvent !== undefined ? exitEvent : undefined;
15
+
14
16
  try {
15
17
  const busyTasks = this.api.pluginBusyManager.getBusyPluginTasks();
16
18
  if (busyTasks.length > 0) {
@@ -24,10 +26,10 @@ export class ExitShellHandler {
24
26
  this.timeout(5000), // Si passen 5s, es segueix amb l'execució
25
27
  ]);
26
28
  disposeShell();
27
- this.emitClose(exitEvent);
29
+ this.emitClose(evt);
28
30
  } catch (error) {
29
31
  this.api.notificationService.error(error.message);
30
- this.emitClose(exitEvent);
32
+ this.emitClose(evt);
31
33
  }
32
34
  }
33
35