@platform-mesh/portal-ui-lib 0.73.0 → 0.74.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/assets/platform-mesh-portal-ui-wc.js +285 -275
- package/fesm2022/platform-mesh-portal-ui-lib-models.mjs +8 -14
- package/fesm2022/platform-mesh-portal-ui-lib-models.mjs.map +1 -1
- package/fesm2022/platform-mesh-portal-ui-lib-portal-options.mjs +1945 -1448
- package/fesm2022/platform-mesh-portal-ui-lib-portal-options.mjs.map +1 -1
- package/fesm2022/platform-mesh-portal-ui-lib-services.mjs +985 -970
- package/fesm2022/platform-mesh-portal-ui-lib-services.mjs.map +1 -1
- package/fesm2022/platform-mesh-portal-ui-lib-utils.mjs +180 -264
- package/fesm2022/platform-mesh-portal-ui-lib-utils.mjs.map +1 -1
- package/fesm2022/platform-mesh-portal-ui-lib.mjs +2 -9
- package/fesm2022/platform-mesh-portal-ui-lib.mjs.map +1 -1
- package/package.json +4 -4
- package/types/platform-mesh-portal-ui-lib-models.d.ts +177 -187
- package/types/platform-mesh-portal-ui-lib-portal-options.d.ts +117 -129
- package/types/platform-mesh-portal-ui-lib-services.d.ts +239 -254
- package/types/platform-mesh-portal-ui-lib-utils.d.ts +38 -51
- package/types/platform-mesh-portal-ui-lib.d.ts +1 -3
|
@@ -1,1513 +1,2010 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
15
|
-
|
|
1
|
+
import { AuthService, ConfigService, EntityType, EnvConfigService, I18nService, LocalStorageKeys, LuigiCoreService, LuigiNodesService } from "@openmfp/portal-ui-lib";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ApplicationRef, ChangeDetectionStrategy, Component, DestroyRef, EnvironmentInjector, Injectable, ViewChild, computed, createComponent, inject, signal } from "@angular/core";
|
|
4
|
+
import { ALL_NAMESPACE, kcpRootOrgsPath } from "@platform-mesh/portal-ui-lib/models";
|
|
5
|
+
import "@ui5/webcomponents/dist/Input.js";
|
|
6
|
+
import "@ui5/webcomponents/dist/Popover.js";
|
|
7
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
8
|
+
import { AccountInfoService, ErrorHandlerService, GatewayService, InstancePermissionsService, NamespaceService, OrganizationReadyService, ResourceService } from "@platform-mesh/portal-ui-lib/services";
|
|
9
|
+
import { generateGraphQLFields, isNamespacedResource, mergeListWithSubscriptionResult, permissionKey, resolveViewUrlPlaceholders } from "@platform-mesh/portal-ui-lib/utils";
|
|
10
|
+
import { Subject, defer, firstValueFrom, of } from "rxjs";
|
|
11
|
+
import { catchError, retry, scan, shareReplay, startWith, switchMap, takeUntil, tap } from "rxjs/operators";
|
|
12
|
+
import { CommonModule } from "@angular/common";
|
|
13
|
+
import { DomSanitizer } from "@angular/platform-browser";
|
|
16
14
|
const errorView = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
viewUrl: "/assets/platform-mesh-portal-ui-wc.js#error-component",
|
|
16
|
+
webcomponent: {
|
|
17
|
+
selfRegistered: true,
|
|
18
|
+
type: "module"
|
|
19
|
+
}
|
|
22
20
|
};
|
|
23
21
|
function toEntityErrorNode(node, code) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
return {
|
|
23
|
+
...node,
|
|
24
|
+
...errorView,
|
|
25
|
+
compound: void 0,
|
|
26
|
+
viewGroup: void 0,
|
|
27
|
+
virtualTree: void 0,
|
|
28
|
+
...node.virtualTree && {
|
|
29
|
+
keepSelectedForChildren: true,
|
|
30
|
+
children: () => [createEntityErrorNode(code)]
|
|
31
|
+
},
|
|
32
|
+
context: {
|
|
33
|
+
...node.context,
|
|
34
|
+
entityErrorCode: code
|
|
35
|
+
}
|
|
36
|
+
};
|
|
36
37
|
}
|
|
37
38
|
function createEntityErrorNode(code) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
return toEntityErrorNode({
|
|
40
|
+
pathSegment: ":errorPath",
|
|
41
|
+
entityType: EntityType.ENTITY_ERROR,
|
|
42
|
+
hideFromNav: true,
|
|
43
|
+
context: {},
|
|
44
|
+
children: () => [createEntityErrorNode(code)]
|
|
45
|
+
}, code);
|
|
45
46
|
}
|
|
46
|
-
const errorComponentConfig = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const errorComponentConfig = { handleEntityRetrievalError: (_entityDefinition, errorCode) => [createEntityErrorNode(errorCode)] };
|
|
48
|
+
var CustomGlobalNodesServiceImpl = class CustomGlobalNodesServiceImpl {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.i18nService = inject(I18nService);
|
|
51
|
+
}
|
|
52
|
+
async getCustomGlobalNodes() {
|
|
53
|
+
return [{
|
|
54
|
+
pathSegment: "error",
|
|
55
|
+
order: 1e3,
|
|
56
|
+
hideFromNav: true,
|
|
57
|
+
showBreadcrumbs: false,
|
|
58
|
+
context: {},
|
|
59
|
+
children: [{
|
|
60
|
+
pathSegment: ":id",
|
|
61
|
+
entityType: EntityType.ENTITY_ERROR,
|
|
62
|
+
hideFromNav: true,
|
|
63
|
+
hideSideNav: true,
|
|
64
|
+
...errorView,
|
|
65
|
+
context: {
|
|
66
|
+
id: ":id",
|
|
67
|
+
translationTable: this.i18nService.translationTable
|
|
68
|
+
}
|
|
69
|
+
}]
|
|
70
|
+
}, {
|
|
71
|
+
pathSegment: "users",
|
|
72
|
+
showBreadcrumbs: false,
|
|
73
|
+
hideSideNav: true,
|
|
74
|
+
hideFromNav: true,
|
|
75
|
+
context: {},
|
|
76
|
+
entityType: "global",
|
|
77
|
+
children: [{
|
|
78
|
+
pathSegment: ":userId",
|
|
79
|
+
hideSideNav: true,
|
|
80
|
+
hideFromNav: true,
|
|
81
|
+
defineEntity: { id: "user" },
|
|
82
|
+
context: { userId: ":userId" },
|
|
83
|
+
children: [{
|
|
84
|
+
pathSegment: "overview",
|
|
85
|
+
context: {},
|
|
86
|
+
hideSideNav: true,
|
|
87
|
+
hideFromNav: true,
|
|
88
|
+
defineEntity: { id: "overview" },
|
|
89
|
+
compound: { children: [] }
|
|
90
|
+
}]
|
|
91
|
+
}]
|
|
92
|
+
}];
|
|
93
|
+
}
|
|
94
|
+
static {
|
|
95
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
96
|
+
minVersion: "12.0.0",
|
|
97
|
+
version: "22.2.6",
|
|
98
|
+
ngImport: i0,
|
|
99
|
+
type: CustomGlobalNodesServiceImpl,
|
|
100
|
+
deps: [],
|
|
101
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
static {
|
|
105
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
106
|
+
minVersion: "12.0.0",
|
|
107
|
+
version: "22.2.6",
|
|
108
|
+
ngImport: i0,
|
|
109
|
+
type: CustomGlobalNodesServiceImpl,
|
|
110
|
+
providedIn: "root"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
115
|
+
minVersion: "12.0.0",
|
|
116
|
+
version: "22.2.6",
|
|
117
|
+
ngImport: i0,
|
|
118
|
+
type: CustomGlobalNodesServiceImpl,
|
|
119
|
+
decorators: [{
|
|
120
|
+
type: Injectable,
|
|
121
|
+
args: [{ providedIn: "root" }]
|
|
122
|
+
}]
|
|
123
|
+
});
|
|
124
|
+
var CustomNodeProcessingServiceImpl = class CustomNodeProcessingServiceImpl {
|
|
125
|
+
constructor() {
|
|
126
|
+
this.luigiNodesService = inject(LuigiNodesService);
|
|
127
|
+
this.entityChildrenWrappers = /* @__PURE__ */ new WeakSet();
|
|
128
|
+
this.failedEntityNodeStates = /* @__PURE__ */ new WeakMap();
|
|
129
|
+
}
|
|
130
|
+
async processNode(ctx, node) {
|
|
131
|
+
this.wrapEntityChildren(node);
|
|
132
|
+
return ctx?.entityErrorCode ? toEntityErrorNode(node, ctx.entityErrorCode) : node;
|
|
133
|
+
}
|
|
134
|
+
wrapEntityChildren(node) {
|
|
135
|
+
const children = node.children;
|
|
136
|
+
if (!node.defineEntity || typeof children !== "function" || this.entityChildrenWrappers.has(children)) return;
|
|
137
|
+
const wrapper = (ctx) => this.resolveEntityChildren(node, children, ctx);
|
|
138
|
+
this.entityChildrenWrappers.add(wrapper);
|
|
139
|
+
node.children = wrapper;
|
|
140
|
+
}
|
|
141
|
+
async resolveEntityChildren(node, children, ctx) {
|
|
142
|
+
this.restoreEntityNode(node, ctx);
|
|
143
|
+
const isBelowFailedEntity = !!ctx.entityErrorCode;
|
|
144
|
+
const result = await children(ctx) ?? [];
|
|
145
|
+
const retrievalFailure = result.find((child) => child.entityType === EntityType.ENTITY_ERROR);
|
|
146
|
+
const code = ctx.entityErrorCode ?? retrievalFailure?.context.entityErrorCode;
|
|
147
|
+
if (!code) return result;
|
|
148
|
+
ctx.entityErrorCode = code;
|
|
149
|
+
if (!isBelowFailedEntity) this.luigiNodesService.clearNodeCache();
|
|
150
|
+
if (retrievalFailure || !result.length && !isBelowFailedEntity) {
|
|
151
|
+
this.showErrorOnEntityNode(node, code);
|
|
152
|
+
return [createEntityErrorNode(code)];
|
|
153
|
+
}
|
|
154
|
+
return result.map((child) => toEntityErrorNode(child, code));
|
|
155
|
+
}
|
|
156
|
+
restoreEntityNode(node, ctx) {
|
|
157
|
+
const state = this.failedEntityNodeStates.get(node);
|
|
158
|
+
if (state) {
|
|
159
|
+
this.failedEntityNodeStates.delete(node);
|
|
160
|
+
delete ctx.entityErrorCode;
|
|
161
|
+
Object.assign(node, state);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
showErrorOnEntityNode(node, code) {
|
|
165
|
+
this.failedEntityNodeStates.set(node, {
|
|
166
|
+
keepSelectedForChildren: node.keepSelectedForChildren,
|
|
167
|
+
viewUrl: node.viewUrl,
|
|
168
|
+
webcomponent: node.webcomponent,
|
|
169
|
+
compound: node.compound,
|
|
170
|
+
context: node.context
|
|
171
|
+
});
|
|
172
|
+
Object.assign(node, errorView, {
|
|
173
|
+
keepSelectedForChildren: void 0,
|
|
174
|
+
compound: void 0,
|
|
175
|
+
context: {
|
|
176
|
+
...node.context,
|
|
177
|
+
entityErrorCode: code
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
static {
|
|
182
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
183
|
+
minVersion: "12.0.0",
|
|
184
|
+
version: "22.2.6",
|
|
185
|
+
ngImport: i0,
|
|
186
|
+
type: CustomNodeProcessingServiceImpl,
|
|
187
|
+
deps: [],
|
|
188
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
static {
|
|
192
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
193
|
+
minVersion: "12.0.0",
|
|
194
|
+
version: "22.2.6",
|
|
195
|
+
ngImport: i0,
|
|
196
|
+
type: CustomNodeProcessingServiceImpl,
|
|
197
|
+
providedIn: "root"
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
202
|
+
minVersion: "12.0.0",
|
|
203
|
+
version: "22.2.6",
|
|
204
|
+
ngImport: i0,
|
|
205
|
+
type: CustomNodeProcessingServiceImpl,
|
|
206
|
+
decorators: [{
|
|
207
|
+
type: Injectable,
|
|
208
|
+
args: [{ providedIn: "root" }]
|
|
209
|
+
}]
|
|
210
|
+
});
|
|
211
|
+
const createElement = (tag, className) => {
|
|
212
|
+
const element = document.createElement(tag);
|
|
213
|
+
element.className = className;
|
|
214
|
+
return element;
|
|
215
|
+
};
|
|
216
|
+
const createIcon = (name, className) => {
|
|
217
|
+
const icon = createElement("span", `${className} sap-icon--${name}`);
|
|
218
|
+
icon.setAttribute("aria-hidden", "true");
|
|
219
|
+
return icon;
|
|
50
220
|
};
|
|
221
|
+
const styleElementId = "pm-header-bar-styles";
|
|
222
|
+
const styles = `
|
|
223
|
+
.fd-tool-layout .lui-breadcrumb-container.lui-breadcrumb-container:has(.pm-breadcrumbs) {
|
|
224
|
+
align-items: center;
|
|
225
|
+
flex-wrap: wrap;
|
|
226
|
+
gap: 0.5rem;
|
|
227
|
+
row-gap: var(--sapContent_Space_S);
|
|
228
|
+
padding-top: 0.5rem;
|
|
229
|
+
padding-right: 1rem;
|
|
230
|
+
padding-bottom: 0.5rem;
|
|
231
|
+
margin-bottom: 0.5rem;
|
|
232
|
+
background: var(--sapObjectHeader_Background);
|
|
233
|
+
border-bottom: 1px solid var(--sapGroup_TitleBorderColor);
|
|
234
|
+
box-shadow: var(--sapContent_HeaderShadow);
|
|
235
|
+
}
|
|
51
236
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
pathSegment: 'error',
|
|
60
|
-
order: 1000,
|
|
61
|
-
hideFromNav: true,
|
|
62
|
-
showBreadcrumbs: false,
|
|
63
|
-
context: {},
|
|
64
|
-
children: [
|
|
65
|
-
{
|
|
66
|
-
pathSegment: ':id',
|
|
67
|
-
entityType: EntityType.ENTITY_ERROR,
|
|
68
|
-
hideFromNav: true,
|
|
69
|
-
hideSideNav: true,
|
|
70
|
-
...errorView,
|
|
71
|
-
context: {
|
|
72
|
-
id: ':id',
|
|
73
|
-
translationTable: this.i18nService.translationTable,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
pathSegment: 'users',
|
|
80
|
-
showBreadcrumbs: false,
|
|
81
|
-
hideSideNav: true,
|
|
82
|
-
hideFromNav: true,
|
|
83
|
-
context: {},
|
|
84
|
-
entityType: 'global',
|
|
85
|
-
children: [
|
|
86
|
-
{
|
|
87
|
-
pathSegment: ':userId',
|
|
88
|
-
hideSideNav: true,
|
|
89
|
-
hideFromNav: true,
|
|
90
|
-
defineEntity: {
|
|
91
|
-
id: 'user',
|
|
92
|
-
},
|
|
93
|
-
context: {
|
|
94
|
-
userId: ':userId',
|
|
95
|
-
},
|
|
96
|
-
children: [
|
|
97
|
-
{
|
|
98
|
-
pathSegment: 'overview',
|
|
99
|
-
context: {},
|
|
100
|
-
hideSideNav: true,
|
|
101
|
-
hideFromNav: true,
|
|
102
|
-
defineEntity: {
|
|
103
|
-
id: 'overview',
|
|
104
|
-
},
|
|
105
|
-
compound: {
|
|
106
|
-
children: [],
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CustomGlobalNodesServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
116
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CustomGlobalNodesServiceImpl, providedIn: 'root' }); }
|
|
237
|
+
.vega .lui-breadcrumb-container:has(.pm-breadcrumbs) {
|
|
238
|
+
height: auto !important;
|
|
239
|
+
align-items: center;
|
|
240
|
+
flex-wrap: wrap;
|
|
241
|
+
gap: 0.5rem;
|
|
242
|
+
row-gap: var(--sapContent_Space_S);
|
|
243
|
+
padding: 0.5rem var(--sapContent_Space_S) !important;
|
|
117
244
|
}
|
|
118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CustomGlobalNodesServiceImpl, decorators: [{
|
|
119
|
-
type: Injectable,
|
|
120
|
-
args: [{ providedIn: 'root' }]
|
|
121
|
-
}] });
|
|
122
245
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.luigiNodesService = inject(LuigiNodesService);
|
|
126
|
-
this.entityChildrenWrappers = new WeakSet();
|
|
127
|
-
this.failedEntityNodeStates = new WeakMap();
|
|
128
|
-
}
|
|
129
|
-
async processNode(ctx, node) {
|
|
130
|
-
this.wrapEntityChildren(node);
|
|
131
|
-
return ctx?.entityErrorCode
|
|
132
|
-
? toEntityErrorNode(node, ctx.entityErrorCode)
|
|
133
|
-
: node;
|
|
134
|
-
}
|
|
135
|
-
wrapEntityChildren(node) {
|
|
136
|
-
const children = node.children;
|
|
137
|
-
if (!node.defineEntity ||
|
|
138
|
-
typeof children !== 'function' ||
|
|
139
|
-
this.entityChildrenWrappers.has(children)) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const wrapper = (ctx) => this.resolveEntityChildren(node, children, ctx);
|
|
143
|
-
this.entityChildrenWrappers.add(wrapper);
|
|
144
|
-
node.children = wrapper;
|
|
145
|
-
}
|
|
146
|
-
async resolveEntityChildren(node, children, ctx) {
|
|
147
|
-
this.restoreEntityNode(node, ctx);
|
|
148
|
-
const isBelowFailedEntity = !!ctx.entityErrorCode;
|
|
149
|
-
const result = (await children(ctx)) ?? [];
|
|
150
|
-
const retrievalFailure = result.find((child) => child.entityType === EntityType.ENTITY_ERROR);
|
|
151
|
-
const code = ctx.entityErrorCode ?? retrievalFailure?.context.entityErrorCode;
|
|
152
|
-
if (!code) {
|
|
153
|
-
return result;
|
|
154
|
-
}
|
|
155
|
-
ctx.entityErrorCode = code;
|
|
156
|
-
if (!isBelowFailedEntity) {
|
|
157
|
-
this.luigiNodesService.clearNodeCache();
|
|
158
|
-
}
|
|
159
|
-
if (retrievalFailure || (!result.length && !isBelowFailedEntity)) {
|
|
160
|
-
this.showErrorOnEntityNode(node, code);
|
|
161
|
-
return [createEntityErrorNode(code)];
|
|
162
|
-
}
|
|
163
|
-
return result.map((child) => toEntityErrorNode(child, code));
|
|
164
|
-
}
|
|
165
|
-
restoreEntityNode(node, ctx) {
|
|
166
|
-
const state = this.failedEntityNodeStates.get(node);
|
|
167
|
-
if (state) {
|
|
168
|
-
this.failedEntityNodeStates.delete(node);
|
|
169
|
-
delete ctx.entityErrorCode;
|
|
170
|
-
Object.assign(node, state);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
showErrorOnEntityNode(node, code) {
|
|
174
|
-
this.failedEntityNodeStates.set(node, {
|
|
175
|
-
keepSelectedForChildren: node.keepSelectedForChildren,
|
|
176
|
-
viewUrl: node.viewUrl,
|
|
177
|
-
webcomponent: node.webcomponent,
|
|
178
|
-
compound: node.compound,
|
|
179
|
-
context: node.context,
|
|
180
|
-
});
|
|
181
|
-
Object.assign(node, errorView, {
|
|
182
|
-
keepSelectedForChildren: undefined,
|
|
183
|
-
compound: undefined,
|
|
184
|
-
context: { ...node.context, entityErrorCode: code },
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CustomNodeProcessingServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
188
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CustomNodeProcessingServiceImpl, providedIn: 'root' }); }
|
|
246
|
+
.vega .pm-breadcrumbs__list {
|
|
247
|
+
padding-left: 0;
|
|
189
248
|
}
|
|
190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CustomNodeProcessingServiceImpl, decorators: [{
|
|
191
|
-
type: Injectable,
|
|
192
|
-
args: [{ providedIn: 'root' }]
|
|
193
|
-
}] });
|
|
194
249
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
250
|
+
.lui-breadcrumb-container > div {
|
|
251
|
+
min-width: 0;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.lui-breadcrumb-container:has(.pm-breadcrumbs) > div:has(.pm-namespace-selector) {
|
|
255
|
+
margin-inline: auto;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.pm-breadcrumbs-container {
|
|
259
|
+
display: flex;
|
|
260
|
+
align-items: center;
|
|
261
|
+
width: 100%;
|
|
262
|
+
min-width: 0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.pm-breadcrumbs {
|
|
266
|
+
min-width: 0;
|
|
267
|
+
font-family: var(--sapFontFamily);
|
|
268
|
+
font-size: var(--sapFontSize);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.pm-breadcrumbs__list {
|
|
272
|
+
display: flex;
|
|
273
|
+
align-items: center;
|
|
274
|
+
gap: 0.375rem;
|
|
275
|
+
min-width: 0;
|
|
276
|
+
margin: 0;
|
|
277
|
+
padding: 0 0 0 0.5rem;
|
|
278
|
+
list-style: none;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.pm-breadcrumbs__item {
|
|
282
|
+
display: flex;
|
|
283
|
+
align-items: center;
|
|
284
|
+
gap: 0.375rem;
|
|
285
|
+
min-width: 0;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.pm-breadcrumbs__separator {
|
|
289
|
+
flex: none;
|
|
290
|
+
font-size: 0.75rem;
|
|
291
|
+
color: var(--sapContent_LabelColor);
|
|
292
|
+
opacity: 0.6;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.pm-breadcrumbs__link,
|
|
296
|
+
.pm-breadcrumbs__current {
|
|
297
|
+
display: inline-flex;
|
|
298
|
+
align-items: center;
|
|
299
|
+
gap: 0.375rem;
|
|
300
|
+
min-width: 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.pm-breadcrumbs__link {
|
|
304
|
+
border-radius: 0.25rem;
|
|
305
|
+
color: var(--sapLinkColor);
|
|
306
|
+
text-decoration: none;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.pm-breadcrumbs__link:hover .pm-breadcrumbs__label {
|
|
310
|
+
text-decoration: underline;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.pm-breadcrumbs__link:focus-visible,
|
|
314
|
+
.pm-namespace-selector__button:focus-visible,
|
|
315
|
+
.pm-namespace-menu__option:focus-visible {
|
|
316
|
+
outline: var(--sapContent_FocusWidth) var(--sapContent_FocusStyle) var(--sapContent_FocusColor);
|
|
317
|
+
outline-offset: 1px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.pm-breadcrumbs__current {
|
|
321
|
+
color: var(--sapTextColor);
|
|
322
|
+
font-weight: bold;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.pm-breadcrumbs__icon {
|
|
326
|
+
flex: none;
|
|
327
|
+
font-size: 1rem;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.pm-breadcrumbs__avatar {
|
|
331
|
+
display: inline-flex;
|
|
332
|
+
flex: none;
|
|
333
|
+
align-items: center;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
width: 1.25rem;
|
|
336
|
+
height: 1.25rem;
|
|
337
|
+
border-radius: 50%;
|
|
338
|
+
background: var(--sapAccentColor6);
|
|
339
|
+
color: var(--sapContent_ContrastTextColor);
|
|
340
|
+
font-size: 0.6875rem;
|
|
341
|
+
font-weight: bold;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.pm-breadcrumbs__label {
|
|
345
|
+
max-width: 14rem;
|
|
346
|
+
overflow: hidden;
|
|
347
|
+
text-overflow: ellipsis;
|
|
348
|
+
white-space: nowrap;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.pm-namespace-selector {
|
|
352
|
+
display: flex;
|
|
353
|
+
max-width: 100%;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.pm-namespace-selector__button {
|
|
357
|
+
display: inline-flex;
|
|
358
|
+
align-items: center;
|
|
359
|
+
gap: 0.5rem;
|
|
360
|
+
width: 17rem;
|
|
361
|
+
max-width: 100%;
|
|
362
|
+
box-sizing: border-box;
|
|
363
|
+
padding: 0.375rem 0.75rem;
|
|
364
|
+
border: 1px solid var(--sapButton_BorderColor);
|
|
365
|
+
border-radius: 0.5rem;
|
|
366
|
+
background: var(--sapButton_Background);
|
|
367
|
+
color: var(--sapTextColor);
|
|
368
|
+
font-family: var(--sapFontFamily);
|
|
369
|
+
font-size: var(--sapFontSize);
|
|
370
|
+
text-align: left;
|
|
371
|
+
cursor: pointer;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.pm-namespace-selector__button:hover {
|
|
375
|
+
background: var(--sapButton_Hover_Background);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.pm-namespace-selector__icon,
|
|
379
|
+
.pm-namespace-menu__icon {
|
|
380
|
+
flex: none;
|
|
381
|
+
color: var(--sapContent_IconColor);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.pm-namespace-selector__text,
|
|
385
|
+
.pm-namespace-menu__name {
|
|
386
|
+
flex: 1;
|
|
387
|
+
min-width: 0;
|
|
388
|
+
overflow: hidden;
|
|
389
|
+
text-overflow: ellipsis;
|
|
390
|
+
white-space: nowrap;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.pm-namespace-selector__label {
|
|
394
|
+
color: var(--sapContent_LabelColor);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.pm-namespace-selector__value {
|
|
398
|
+
font-weight: bold;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.pm-namespace-selector__popover::part(content) {
|
|
402
|
+
padding: 0.25rem;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.pm-namespace-menu {
|
|
406
|
+
display: flex;
|
|
407
|
+
flex-direction: column;
|
|
408
|
+
font-family: var(--sapFontFamily);
|
|
409
|
+
font-size: var(--sapFontSize);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.pm-namespace-menu__option {
|
|
413
|
+
display: flex;
|
|
414
|
+
align-items: center;
|
|
415
|
+
gap: 0.5rem;
|
|
416
|
+
width: 100%;
|
|
417
|
+
box-sizing: border-box;
|
|
418
|
+
padding: 0.5rem 0.75rem;
|
|
419
|
+
border: 0;
|
|
420
|
+
border-radius: 0.375rem;
|
|
421
|
+
background: transparent;
|
|
422
|
+
color: var(--sapTextColor);
|
|
423
|
+
font: inherit;
|
|
424
|
+
text-align: left;
|
|
425
|
+
cursor: pointer;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.pm-namespace-menu__option:hover {
|
|
429
|
+
background: var(--sapList_Hover_Background);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.pm-namespace-menu__option[aria-selected='true'] {
|
|
433
|
+
background: var(--sapList_SelectionBackgroundColor);
|
|
434
|
+
font-weight: bold;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.pm-namespace-menu__check {
|
|
438
|
+
flex: none;
|
|
439
|
+
color: var(--sapSelectedColor);
|
|
440
|
+
visibility: hidden;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.pm-namespace-menu__option[aria-selected='true'] .pm-namespace-menu__check {
|
|
444
|
+
visibility: visible;
|
|
445
|
+
}
|
|
220
446
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
];
|
|
227
|
-
class NamespaceSelectionRendererService {
|
|
228
|
-
constructor() {
|
|
229
|
-
this.resourceService = inject(ResourceService);
|
|
230
|
-
this.authService = inject(AuthService);
|
|
231
|
-
this.luigiCoreService = inject(LuigiCoreService);
|
|
232
|
-
this.destroyRef = inject(DestroyRef);
|
|
233
|
-
}
|
|
234
|
-
create(portalConfig) {
|
|
235
|
-
return (containerElement, nodeItems, _clickHandler) => {
|
|
236
|
-
containerElement.style.paddingBottom = '0.5rem';
|
|
237
|
-
const lastNode = nodeItems.at(-1)?.node;
|
|
238
|
-
const namespace = this.luigiCoreService
|
|
239
|
-
.routing()
|
|
240
|
-
.getSearchParams().namespace;
|
|
241
|
-
const kcpPath = lastNode?.context?.kcpPath;
|
|
242
|
-
if (lastNode?.context && !isNamespacedResource(lastNode.context)) {
|
|
243
|
-
return containerElement;
|
|
244
|
-
}
|
|
245
|
-
const ui5combobox = this.createCombobox(containerElement);
|
|
246
|
-
this.addComboboxItems(portalConfig, ui5combobox, namespace, kcpPath);
|
|
247
|
-
ui5combobox.addEventListener('change', (event) => {
|
|
248
|
-
const value = event?.target?.value.trim() ?? '';
|
|
249
|
-
this.changeNamespace(value);
|
|
250
|
-
});
|
|
251
|
-
return ui5combobox;
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
createCombobox(containerElement) {
|
|
255
|
-
const ui5combobox = document.createElement('ui5-combobox');
|
|
256
|
-
ui5combobox.setAttribute('placeholder', 'Namespaces');
|
|
257
|
-
ui5combobox.setAttribute('data-testid', 'namespace-selection-combobox');
|
|
258
|
-
containerElement.appendChild(ui5combobox);
|
|
259
|
-
return ui5combobox;
|
|
260
|
-
}
|
|
261
|
-
addComboboxItems(portalConfig, ui5combobox, namespace, kcpPath) {
|
|
262
|
-
this.getNamespaceResourcesCached(portalConfig, kcpPath).subscribe((resources) => {
|
|
263
|
-
this.syncComboboxItems(ui5combobox, resources);
|
|
264
|
-
this.setSelectedValue(ui5combobox, resources, namespace);
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
getNamespaceResourcesCached(portalConfig, kcpPath) {
|
|
268
|
-
const cacheKey = this.getNamespaceResourcesCacheKey(kcpPath);
|
|
269
|
-
if (this.namespaceResourcesCache?.key === cacheKey) {
|
|
270
|
-
return this.namespaceResourcesCache.value$;
|
|
271
|
-
}
|
|
272
|
-
if (this.namespaceResourcesCache) {
|
|
273
|
-
this.namespaceResourcesCache.stop$.next();
|
|
274
|
-
this.namespaceResourcesCache.stop$.complete();
|
|
275
|
-
this.namespaceResourcesCache = undefined;
|
|
276
|
-
}
|
|
277
|
-
const stop$ = new Subject();
|
|
278
|
-
const value$ = this.getNamespaceResources(portalConfig, kcpPath, stop$).pipe(shareReplay(1), takeUntilDestroyed(this.destroyRef));
|
|
279
|
-
this.namespaceResourcesCache = {
|
|
280
|
-
key: cacheKey,
|
|
281
|
-
value$,
|
|
282
|
-
stop$,
|
|
283
|
-
};
|
|
284
|
-
return value$;
|
|
285
|
-
}
|
|
286
|
-
getNamespaceResourcesCacheKey(kcpPath) {
|
|
287
|
-
return kcpPath ?? '';
|
|
288
|
-
}
|
|
289
|
-
syncComboboxItems(ui5combobox, resources) {
|
|
290
|
-
ui5combobox.replaceChildren();
|
|
291
|
-
resources.forEach((resource) => {
|
|
292
|
-
const name = resource.metadata?.name;
|
|
293
|
-
if (!name) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const resourceOption = document.createElement('ui5-cb-item');
|
|
297
|
-
resourceOption.setAttribute('text', name);
|
|
298
|
-
resourceOption.setAttribute('data-testid', `namespace-selection-combobox-item-${name}`);
|
|
299
|
-
ui5combobox.appendChild(resourceOption);
|
|
300
|
-
});
|
|
301
|
-
const allOption = document.createElement('ui5-cb-item');
|
|
302
|
-
allOption.setAttribute('text', ALL_NAMESPACE);
|
|
303
|
-
allOption.setAttribute('data-testid', 'namespace-selection-combobox-item-all');
|
|
304
|
-
ui5combobox.appendChild(allOption);
|
|
305
|
-
}
|
|
306
|
-
setSelectedValue(ui5combobox, resources, namespace) {
|
|
307
|
-
const currentNamespace = this.luigiCoreService
|
|
308
|
-
.routing()
|
|
309
|
-
.getSearchParams().namespace;
|
|
310
|
-
if (currentNamespace) {
|
|
311
|
-
ui5combobox.setAttribute('value', currentNamespace);
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
if (namespace &&
|
|
315
|
-
resources.find((resource) => resource.metadata?.name === namespace)) {
|
|
316
|
-
ui5combobox.setAttribute('value', namespace);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
ui5combobox.setAttribute('value', ALL_NAMESPACE);
|
|
320
|
-
this.changeNamespace(ALL_NAMESPACE);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
getNamespaceResources(portalConfig, kcpPath, stop$) {
|
|
324
|
-
const operation = 'v1_namespaces';
|
|
325
|
-
const fields = generateGraphQLFields(defaultColumns);
|
|
326
|
-
const context = {
|
|
327
|
-
portalContext: {
|
|
328
|
-
crdGatewayApiUrl: portalConfig.portalContext['crdGatewayApiUrl'],
|
|
329
|
-
},
|
|
330
|
-
resourceDefinition: {
|
|
331
|
-
version: 'v1',
|
|
332
|
-
entityCollection: 'Namespaces',
|
|
333
|
-
entity: 'Namespace',
|
|
334
|
-
scope: 'Cluster',
|
|
335
|
-
},
|
|
336
|
-
kcpPath,
|
|
337
|
-
token: this.authService.getToken(),
|
|
338
|
-
};
|
|
339
|
-
return defer(() => this.resourceService.list(operation, fields, context)).pipe(retry(3), takeUntil(stop$), switchMap((result) => this.resourceService
|
|
340
|
-
.resourceChangeSubscription(operation, fields, context, result.resourceVersion, false)
|
|
341
|
-
.pipe(startWith(undefined), scan((resources, subscriptionResult) => mergeListWithSubscriptionResult(resources, subscriptionResult, {
|
|
342
|
-
getItemKey: (resource) => resource.metadata?.name,
|
|
343
|
-
mapSubscriptionObjectToItem: (object) => object,
|
|
344
|
-
}), result.items), tap((result) => {
|
|
345
|
-
const namespaces = result.map((e) => e.metadata?.name);
|
|
346
|
-
this.luigiCoreService.setInGlobalContext({ namespaces });
|
|
347
|
-
}), takeUntil(stop$))), catchError((error) => {
|
|
348
|
-
console.error(`Failed to read entities from ${operation}`, error);
|
|
349
|
-
return of([]);
|
|
350
|
-
}));
|
|
351
|
-
}
|
|
352
|
-
changeNamespace(value) {
|
|
353
|
-
if (!value) {
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
const oldValue = this.luigiCoreService
|
|
357
|
-
.routing()
|
|
358
|
-
.getSearchParams().namespace;
|
|
359
|
-
if (oldValue === value) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
this.luigiCoreService.routing().addSearchParams({ namespace: value });
|
|
363
|
-
}
|
|
364
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NamespaceSelectionRendererService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
365
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NamespaceSelectionRendererService, providedIn: 'root' }); }
|
|
447
|
+
.pm-namespace-menu__divider {
|
|
448
|
+
height: 1px;
|
|
449
|
+
margin: 0.375rem 0;
|
|
450
|
+
background: var(--sapGroup_TitleBorderColor);
|
|
366
451
|
}
|
|
367
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NamespaceSelectionRendererService, decorators: [{
|
|
368
|
-
type: Injectable,
|
|
369
|
-
args: [{ providedIn: 'root' }]
|
|
370
|
-
}] });
|
|
371
452
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const portalConfig = await this.configService.getPortalConfig();
|
|
379
|
-
return {
|
|
380
|
-
pendingItemLabel: '...',
|
|
381
|
-
omitRoot: false,
|
|
382
|
-
clearBeforeRender: true,
|
|
383
|
-
autoHide: true,
|
|
384
|
-
leftRenderers: [breadcrumbRenderer],
|
|
385
|
-
rightRenderers: [
|
|
386
|
-
this.namespaceSelectionRendererService.create(portalConfig),
|
|
387
|
-
],
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: HeaderBarConfigServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
391
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: HeaderBarConfigServiceImpl, providedIn: 'root' }); }
|
|
453
|
+
.pm-namespace-menu__header {
|
|
454
|
+
padding: 0.25rem 0.75rem;
|
|
455
|
+
color: var(--sapContent_LabelColor);
|
|
456
|
+
font-size: var(--sapFontSmallSize);
|
|
457
|
+
letter-spacing: 0.04em;
|
|
458
|
+
text-transform: uppercase;
|
|
392
459
|
}
|
|
393
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: HeaderBarConfigServiceImpl, decorators: [{
|
|
394
|
-
type: Injectable,
|
|
395
|
-
args: [{
|
|
396
|
-
providedIn: 'root',
|
|
397
|
-
}]
|
|
398
|
-
}] });
|
|
399
460
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
async createLuigiExtendedGlobalContext() {
|
|
405
|
-
const idpName = (await this.envConfigService.getEnvConfig()).idpName;
|
|
406
|
-
if (idpName === 'welcome') {
|
|
407
|
-
return {};
|
|
408
|
-
}
|
|
409
|
-
return {
|
|
410
|
-
organization: idpName,
|
|
411
|
-
kcpPath: `${kcpRootOrgsPath}:${idpName}`,
|
|
412
|
-
entityName: idpName,
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: LuigiExtendedGlobalContextConfigServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
416
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: LuigiExtendedGlobalContextConfigServiceImpl, providedIn: 'root' }); }
|
|
461
|
+
.pm-namespace-menu__search {
|
|
462
|
+
width: auto;
|
|
463
|
+
margin: 0.25rem 0.5rem;
|
|
417
464
|
}
|
|
418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: LuigiExtendedGlobalContextConfigServiceImpl, decorators: [{
|
|
419
|
-
type: Injectable,
|
|
420
|
-
args: [{ providedIn: 'root' }]
|
|
421
|
-
}] });
|
|
422
465
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
saveRedirectUrl(url) {
|
|
428
|
-
if (url.startsWith('/error')) {
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
localStorage.setItem(LocalStorageKeys.LAST_NAVIGATION_URL, url);
|
|
432
|
-
}
|
|
433
|
-
clearRedirectUrl() {
|
|
434
|
-
localStorage.removeItem(LocalStorageKeys.LAST_NAVIGATION_URL);
|
|
435
|
-
}
|
|
436
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NavigationRedirectStrategyServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
437
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NavigationRedirectStrategyServiceImpl, providedIn: 'root' }); }
|
|
466
|
+
.pm-namespace-menu__options {
|
|
467
|
+
max-height: 18rem;
|
|
468
|
+
overflow-y: auto;
|
|
438
469
|
}
|
|
439
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NavigationRedirectStrategyServiceImpl, decorators: [{
|
|
440
|
-
type: Injectable,
|
|
441
|
-
args: [{ providedIn: 'root' }]
|
|
442
|
-
}] });
|
|
443
470
|
|
|
444
|
-
|
|
471
|
+
.pm-namespace-menu__empty {
|
|
472
|
+
padding: 0.5rem 0.75rem;
|
|
473
|
+
color: var(--sapContent_LabelColor);
|
|
474
|
+
}
|
|
475
|
+
`;
|
|
476
|
+
const ensureHeaderBarStyles = () => {
|
|
477
|
+
if (document.getElementById(styleElementId)) return;
|
|
478
|
+
const style = document.createElement("style");
|
|
479
|
+
style.id = styleElementId;
|
|
480
|
+
style.textContent = styles;
|
|
481
|
+
document.head.appendChild(style);
|
|
482
|
+
};
|
|
483
|
+
const homeIcon = "home";
|
|
484
|
+
const separatorIcon = "slim-arrow-right";
|
|
485
|
+
const iconNamePattern = /^[a-z0-9-]+$/;
|
|
486
|
+
const dynamicPathSegmentPrefix = ":";
|
|
487
|
+
const breadcrumbBarSelector = ".lui-breadcrumb-container";
|
|
488
|
+
const vegaLayoutSelector = ".vega";
|
|
489
|
+
const breadcrumbBarHeightProperty = "--luigi__breadcrumb--height";
|
|
490
|
+
let breadcrumbBarObserver;
|
|
491
|
+
let observedBreadcrumbBar;
|
|
492
|
+
const breadcrumbRenderer = (containerElement, nodeItems, clickHandler) => {
|
|
493
|
+
ensureHeaderBarStyles();
|
|
494
|
+
followVegaBreadcrumbBarHeight(containerElement);
|
|
495
|
+
containerElement.classList.add("pm-breadcrumbs-container");
|
|
496
|
+
const items = nodeItems.filter((item) => !item.node?.hideFromBreadcrumb);
|
|
497
|
+
const list = createElement("ol", "pm-breadcrumbs__list");
|
|
498
|
+
items.forEach((item, index) => {
|
|
499
|
+
const listItem = createElement("li", "pm-breadcrumbs__item");
|
|
500
|
+
if (index > 0) listItem.appendChild(createIcon(separatorIcon, "pm-breadcrumbs__separator"));
|
|
501
|
+
listItem.appendChild(index === items.length - 1 ? createCurrent(item) : createLink(item, index === 0, clickHandler));
|
|
502
|
+
list.appendChild(listItem);
|
|
503
|
+
});
|
|
504
|
+
const nav = createElement("nav", "pm-breadcrumbs");
|
|
505
|
+
nav.setAttribute("aria-label", "Breadcrumb");
|
|
506
|
+
nav.appendChild(list);
|
|
507
|
+
containerElement.appendChild(nav);
|
|
508
|
+
return nav;
|
|
509
|
+
};
|
|
510
|
+
const followVegaBreadcrumbBarHeight = (containerElement) => {
|
|
511
|
+
const breadcrumbBar = containerElement.closest(breadcrumbBarSelector);
|
|
512
|
+
if (!breadcrumbBar?.closest(vegaLayoutSelector) || breadcrumbBar === observedBreadcrumbBar) return;
|
|
513
|
+
breadcrumbBarObserver ??= new ResizeObserver((entries) => {
|
|
514
|
+
entries.filter((entry) => entry.target === observedBreadcrumbBar).forEach((entry) => document.documentElement.style.setProperty(breadcrumbBarHeightProperty, `${entry.borderBoxSize[0].blockSize}px`));
|
|
515
|
+
});
|
|
516
|
+
if (observedBreadcrumbBar) breadcrumbBarObserver.unobserve(observedBreadcrumbBar);
|
|
517
|
+
observedBreadcrumbBar = breadcrumbBar;
|
|
518
|
+
breadcrumbBarObserver.observe(breadcrumbBar);
|
|
519
|
+
};
|
|
520
|
+
const createLink = (item, isHome, clickHandler) => {
|
|
521
|
+
const link = createElement("a", "pm-breadcrumbs__link");
|
|
522
|
+
if (item.route) link.setAttribute("href", item.route);
|
|
523
|
+
link.title = item.label ?? "";
|
|
524
|
+
link.addEventListener("click", (event) => {
|
|
525
|
+
if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey) return;
|
|
526
|
+
event.preventDefault();
|
|
527
|
+
clickHandler(item);
|
|
528
|
+
});
|
|
529
|
+
if (isHome) link.append(createIcon(homeIcon, "pm-breadcrumbs__icon"), createLabel(item));
|
|
530
|
+
else link.append(...createContent(item));
|
|
531
|
+
return link;
|
|
532
|
+
};
|
|
533
|
+
const createCurrent = (item) => {
|
|
534
|
+
const current = createElement("span", "pm-breadcrumbs__current");
|
|
535
|
+
current.setAttribute("aria-current", "page");
|
|
536
|
+
current.append(...createContent(item));
|
|
537
|
+
return current;
|
|
538
|
+
};
|
|
539
|
+
const createContent = (item) => {
|
|
540
|
+
const label = createLabel(item);
|
|
541
|
+
const marker = createMarker(item);
|
|
542
|
+
return marker ? [marker, label] : [label];
|
|
543
|
+
};
|
|
544
|
+
const createLabel = (item) => {
|
|
545
|
+
const label = createElement("span", "pm-breadcrumbs__label");
|
|
546
|
+
label.textContent = item.label ?? "";
|
|
547
|
+
label.title = item.label ?? "";
|
|
548
|
+
return label;
|
|
549
|
+
};
|
|
550
|
+
const createMarker = (item) => {
|
|
551
|
+
if (isEntityInstance(item)) {
|
|
552
|
+
const avatar = createElement("span", "pm-breadcrumbs__avatar");
|
|
553
|
+
avatar.setAttribute("aria-hidden", "true");
|
|
554
|
+
avatar.textContent = item.label.charAt(0).toUpperCase();
|
|
555
|
+
return avatar;
|
|
556
|
+
}
|
|
557
|
+
const icon = item.node?.icon;
|
|
558
|
+
return typeof icon === "string" && iconNamePattern.test(icon) ? createIcon(icon, "pm-breadcrumbs__icon") : void 0;
|
|
559
|
+
};
|
|
560
|
+
const isEntityInstance = (item) => !item.pending && !!item.label && !!item.node?.pathSegment?.startsWith(dynamicPathSegmentPrefix);
|
|
561
|
+
const allNamespacesLabel = "All namespaces";
|
|
562
|
+
const allNamespacesIcon = "dimension";
|
|
563
|
+
const namespaceIcon = "folder-blank";
|
|
564
|
+
const arrowIcon = "slim-arrow-down";
|
|
565
|
+
const checkIcon = "accept";
|
|
566
|
+
const createNamespaceSelector = (onSelect) => {
|
|
567
|
+
ensureHeaderBarStyles();
|
|
568
|
+
let selected = ALL_NAMESPACE;
|
|
569
|
+
let namespaces = [];
|
|
570
|
+
const button = createElement("button", "pm-namespace-selector__button");
|
|
571
|
+
button.setAttribute("type", "button");
|
|
572
|
+
button.setAttribute("aria-haspopup", "listbox");
|
|
573
|
+
button.setAttribute("aria-expanded", "false");
|
|
574
|
+
button.setAttribute("data-testid", "namespace-selection-combobox");
|
|
575
|
+
const allOption = createOption(ALL_NAMESPACE, allNamespacesLabel, allNamespacesIcon);
|
|
576
|
+
allOption.setAttribute("data-testid", "namespace-selection-combobox-item-all");
|
|
577
|
+
const header = createElement("div", "pm-namespace-menu__header");
|
|
578
|
+
const search = createElement("ui5-input", "pm-namespace-menu__search");
|
|
579
|
+
search.setAttribute("placeholder", "Search namespaces");
|
|
580
|
+
search.setAttribute("data-testid", "namespace-selection-search");
|
|
581
|
+
const options = createElement("div", "pm-namespace-menu__options");
|
|
582
|
+
const menu = createElement("div", "pm-namespace-menu");
|
|
583
|
+
menu.setAttribute("role", "listbox");
|
|
584
|
+
menu.setAttribute("aria-label", "Namespaces");
|
|
585
|
+
menu.append(allOption, createElement("div", "pm-namespace-menu__divider"), header, search, options);
|
|
586
|
+
const popover = createElement("ui5-popover", "pm-namespace-selector__popover");
|
|
587
|
+
popover.setAttribute("placement", "Bottom");
|
|
588
|
+
popover.setAttribute("horizontal-align", "Stretch");
|
|
589
|
+
popover.setAttribute("hide-arrow", "");
|
|
590
|
+
popover.setAttribute("data-testid", "namespace-selection-popover");
|
|
591
|
+
popover.opener = button;
|
|
592
|
+
popover.appendChild(menu);
|
|
593
|
+
const element = createElement("div", "pm-namespace-selector");
|
|
594
|
+
element.append(button, popover);
|
|
595
|
+
const renderButton = () => {
|
|
596
|
+
const isAll = selected === ALL_NAMESPACE;
|
|
597
|
+
const text = createElement("span", "pm-namespace-selector__text");
|
|
598
|
+
if (!isAll) {
|
|
599
|
+
const label = createElement("span", "pm-namespace-selector__label");
|
|
600
|
+
label.textContent = "Namespace: ";
|
|
601
|
+
text.appendChild(label);
|
|
602
|
+
}
|
|
603
|
+
const value = createElement("span", "pm-namespace-selector__value");
|
|
604
|
+
value.textContent = isAll ? allNamespacesLabel : selected;
|
|
605
|
+
text.appendChild(value);
|
|
606
|
+
button.title = text.textContent ?? "";
|
|
607
|
+
button.setAttribute("data-value", selected);
|
|
608
|
+
button.replaceChildren(createIcon(isAll ? allNamespacesIcon : namespaceIcon, "pm-namespace-selector__icon"), text, createIcon(arrowIcon, "pm-namespace-selector__icon"));
|
|
609
|
+
};
|
|
610
|
+
const renderOptions = () => {
|
|
611
|
+
const filter = (search.value ?? "").trim().toLowerCase();
|
|
612
|
+
const matches = namespaces.filter((name) => name.toLowerCase().includes(filter));
|
|
613
|
+
header.textContent = `Namespaces (${namespaces.length})`;
|
|
614
|
+
if (matches.length) options.replaceChildren(...matches.map((name) => createNamespaceOption(name)));
|
|
615
|
+
else {
|
|
616
|
+
const empty = createElement("div", "pm-namespace-menu__empty");
|
|
617
|
+
empty.textContent = namespaces.length ? "No matching namespaces" : "No namespaces";
|
|
618
|
+
options.replaceChildren(empty);
|
|
619
|
+
}
|
|
620
|
+
menu.querySelectorAll("[data-value]").forEach((option) => {
|
|
621
|
+
option.setAttribute("aria-selected", String(option.dataset["value"] === selected));
|
|
622
|
+
});
|
|
623
|
+
};
|
|
624
|
+
const select = (value) => {
|
|
625
|
+
selected = value;
|
|
626
|
+
renderButton();
|
|
627
|
+
renderOptions();
|
|
628
|
+
};
|
|
629
|
+
button.addEventListener("click", () => {
|
|
630
|
+
popover.open = !popover.open;
|
|
631
|
+
});
|
|
632
|
+
popover.addEventListener("open", () => button.setAttribute("aria-expanded", "true"));
|
|
633
|
+
popover.addEventListener("close", () => {
|
|
634
|
+
button.setAttribute("aria-expanded", "false");
|
|
635
|
+
search.value = "";
|
|
636
|
+
renderOptions();
|
|
637
|
+
});
|
|
638
|
+
search.addEventListener("input", renderOptions);
|
|
639
|
+
menu.addEventListener("click", (event) => {
|
|
640
|
+
const option = event.target.closest("[data-value]");
|
|
641
|
+
if (!option) return;
|
|
642
|
+
const value = option.dataset["value"];
|
|
643
|
+
popover.open = false;
|
|
644
|
+
select(value);
|
|
645
|
+
onSelect(value);
|
|
646
|
+
});
|
|
647
|
+
select(selected);
|
|
648
|
+
return {
|
|
649
|
+
element,
|
|
650
|
+
setNamespaces(names) {
|
|
651
|
+
namespaces = names;
|
|
652
|
+
renderOptions();
|
|
653
|
+
},
|
|
654
|
+
select
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
const createNamespaceOption = (name) => {
|
|
658
|
+
const option = createOption(name, name, namespaceIcon);
|
|
659
|
+
option.setAttribute("data-testid", `namespace-selection-combobox-item-${name}`);
|
|
660
|
+
option.title = name;
|
|
661
|
+
return option;
|
|
662
|
+
};
|
|
663
|
+
const createOption = (value, label, icon) => {
|
|
664
|
+
const option = createElement("button", "pm-namespace-menu__option");
|
|
665
|
+
option.setAttribute("type", "button");
|
|
666
|
+
option.setAttribute("role", "option");
|
|
667
|
+
option.dataset["value"] = value;
|
|
668
|
+
const name = createElement("span", "pm-namespace-menu__name");
|
|
669
|
+
name.textContent = label;
|
|
670
|
+
option.append(createIcon(icon, "pm-namespace-menu__icon"), name, createIcon(checkIcon, "pm-namespace-menu__check"));
|
|
671
|
+
return option;
|
|
672
|
+
};
|
|
673
|
+
const defaultColumns = [{
|
|
674
|
+
label: "Name",
|
|
675
|
+
property: "metadata.name"
|
|
676
|
+
}];
|
|
677
|
+
var NamespaceSelectionRendererService = class NamespaceSelectionRendererService {
|
|
678
|
+
constructor() {
|
|
679
|
+
this.resourceService = inject(ResourceService);
|
|
680
|
+
this.authService = inject(AuthService);
|
|
681
|
+
this.luigiCoreService = inject(LuigiCoreService);
|
|
682
|
+
this.destroyRef = inject(DestroyRef);
|
|
683
|
+
}
|
|
684
|
+
create(portalConfig) {
|
|
685
|
+
return (containerElement, nodeItems, _clickHandler) => {
|
|
686
|
+
const lastNode = nodeItems.at(-1)?.node;
|
|
687
|
+
const namespace = this.luigiCoreService.routing().getSearchParams().namespace;
|
|
688
|
+
const kcpPath = lastNode?.context?.kcpPath;
|
|
689
|
+
if (lastNode?.context && !isNamespacedResource(lastNode.context)) return containerElement;
|
|
690
|
+
const selector = createNamespaceSelector((value) => this.changeNamespace(value));
|
|
691
|
+
containerElement.appendChild(selector.element);
|
|
692
|
+
this.getNamespaceResourcesCached(portalConfig, kcpPath).subscribe((resources) => {
|
|
693
|
+
selector.setNamespaces(resources.map((resource) => resource.metadata?.name).filter((name) => !!name));
|
|
694
|
+
this.setSelectedValue(selector, resources, namespace);
|
|
695
|
+
});
|
|
696
|
+
return selector.element;
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
getNamespaceResourcesCached(portalConfig, kcpPath) {
|
|
700
|
+
const cacheKey = this.getNamespaceResourcesCacheKey(kcpPath);
|
|
701
|
+
if (this.namespaceResourcesCache?.key === cacheKey) return this.namespaceResourcesCache.value$;
|
|
702
|
+
if (this.namespaceResourcesCache) {
|
|
703
|
+
this.namespaceResourcesCache.stop$.next();
|
|
704
|
+
this.namespaceResourcesCache.stop$.complete();
|
|
705
|
+
this.namespaceResourcesCache = void 0;
|
|
706
|
+
}
|
|
707
|
+
const stop$ = new Subject();
|
|
708
|
+
const value$ = this.getNamespaceResources(portalConfig, kcpPath, stop$).pipe(shareReplay(1), takeUntilDestroyed(this.destroyRef));
|
|
709
|
+
this.namespaceResourcesCache = {
|
|
710
|
+
key: cacheKey,
|
|
711
|
+
value$,
|
|
712
|
+
stop$
|
|
713
|
+
};
|
|
714
|
+
return value$;
|
|
715
|
+
}
|
|
716
|
+
getNamespaceResourcesCacheKey(kcpPath) {
|
|
717
|
+
return kcpPath ?? "";
|
|
718
|
+
}
|
|
719
|
+
setSelectedValue(selector, resources, namespace) {
|
|
720
|
+
const currentNamespace = this.luigiCoreService.routing().getSearchParams().namespace;
|
|
721
|
+
if (currentNamespace) {
|
|
722
|
+
selector.select(currentNamespace);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
if (namespace && resources.find((resource) => resource.metadata?.name === namespace)) selector.select(namespace);
|
|
726
|
+
else {
|
|
727
|
+
selector.select(ALL_NAMESPACE);
|
|
728
|
+
this.changeNamespace(ALL_NAMESPACE);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
getNamespaceResources(portalConfig, kcpPath, stop$) {
|
|
732
|
+
const operation = "v1_namespaces";
|
|
733
|
+
const fields = generateGraphQLFields(defaultColumns);
|
|
734
|
+
const context = {
|
|
735
|
+
portalContext: { crdGatewayApiUrl: portalConfig.portalContext["crdGatewayApiUrl"] },
|
|
736
|
+
resourceDefinition: {
|
|
737
|
+
version: "v1",
|
|
738
|
+
entityCollection: "Namespaces",
|
|
739
|
+
entity: "Namespace",
|
|
740
|
+
scope: "Cluster"
|
|
741
|
+
},
|
|
742
|
+
kcpPath,
|
|
743
|
+
token: this.authService.getToken()
|
|
744
|
+
};
|
|
745
|
+
return defer(() => this.resourceService.list(operation, fields, context)).pipe(retry(3), takeUntil(stop$), switchMap((result) => this.resourceService.resourceChangeSubscription(operation, fields, context, result.resourceVersion, false).pipe(startWith(void 0), scan((resources, subscriptionResult) => mergeListWithSubscriptionResult(resources, subscriptionResult, {
|
|
746
|
+
getItemKey: (resource) => resource.metadata?.name,
|
|
747
|
+
mapSubscriptionObjectToItem: (object) => object
|
|
748
|
+
}), result.items), tap((result) => {
|
|
749
|
+
const namespaces = result.map((e) => e.metadata?.name);
|
|
750
|
+
this.luigiCoreService.setInGlobalContext({ namespaces });
|
|
751
|
+
}), takeUntil(stop$))), catchError((error) => {
|
|
752
|
+
console.error(`Failed to read entities from ${operation}`, error);
|
|
753
|
+
return of([]);
|
|
754
|
+
}));
|
|
755
|
+
}
|
|
756
|
+
changeNamespace(value) {
|
|
757
|
+
if (this.luigiCoreService.routing().getSearchParams().namespace === value) return;
|
|
758
|
+
this.luigiCoreService.routing().addSearchParams({ namespace: value });
|
|
759
|
+
}
|
|
760
|
+
static {
|
|
761
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
762
|
+
minVersion: "12.0.0",
|
|
763
|
+
version: "22.2.6",
|
|
764
|
+
ngImport: i0,
|
|
765
|
+
type: NamespaceSelectionRendererService,
|
|
766
|
+
deps: [],
|
|
767
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
static {
|
|
771
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
772
|
+
minVersion: "12.0.0",
|
|
773
|
+
version: "22.2.6",
|
|
774
|
+
ngImport: i0,
|
|
775
|
+
type: NamespaceSelectionRendererService,
|
|
776
|
+
providedIn: "root"
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
781
|
+
minVersion: "12.0.0",
|
|
782
|
+
version: "22.2.6",
|
|
783
|
+
ngImport: i0,
|
|
784
|
+
type: NamespaceSelectionRendererService,
|
|
785
|
+
decorators: [{
|
|
786
|
+
type: Injectable,
|
|
787
|
+
args: [{ providedIn: "root" }]
|
|
788
|
+
}]
|
|
789
|
+
});
|
|
790
|
+
var HeaderBarConfigServiceImpl = class HeaderBarConfigServiceImpl {
|
|
791
|
+
constructor() {
|
|
792
|
+
this.configService = inject(ConfigService);
|
|
793
|
+
this.namespaceSelectionRendererService = inject(NamespaceSelectionRendererService);
|
|
794
|
+
}
|
|
795
|
+
async getConfig() {
|
|
796
|
+
const portalConfig = await this.configService.getPortalConfig();
|
|
797
|
+
return {
|
|
798
|
+
pendingItemLabel: "...",
|
|
799
|
+
omitRoot: false,
|
|
800
|
+
clearBeforeRender: true,
|
|
801
|
+
autoHide: true,
|
|
802
|
+
leftRenderers: [breadcrumbRenderer],
|
|
803
|
+
rightRenderers: [this.namespaceSelectionRendererService.create(portalConfig)]
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
static {
|
|
807
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
808
|
+
minVersion: "12.0.0",
|
|
809
|
+
version: "22.2.6",
|
|
810
|
+
ngImport: i0,
|
|
811
|
+
type: HeaderBarConfigServiceImpl,
|
|
812
|
+
deps: [],
|
|
813
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
static {
|
|
817
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
818
|
+
minVersion: "12.0.0",
|
|
819
|
+
version: "22.2.6",
|
|
820
|
+
ngImport: i0,
|
|
821
|
+
type: HeaderBarConfigServiceImpl,
|
|
822
|
+
providedIn: "root"
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
827
|
+
minVersion: "12.0.0",
|
|
828
|
+
version: "22.2.6",
|
|
829
|
+
ngImport: i0,
|
|
830
|
+
type: HeaderBarConfigServiceImpl,
|
|
831
|
+
decorators: [{
|
|
832
|
+
type: Injectable,
|
|
833
|
+
args: [{ providedIn: "root" }]
|
|
834
|
+
}]
|
|
835
|
+
});
|
|
836
|
+
var LuigiExtendedGlobalContextConfigServiceImpl = class LuigiExtendedGlobalContextConfigServiceImpl {
|
|
837
|
+
constructor() {
|
|
838
|
+
this.envConfigService = inject(EnvConfigService);
|
|
839
|
+
}
|
|
840
|
+
async createLuigiExtendedGlobalContext() {
|
|
841
|
+
const idpName = (await this.envConfigService.getEnvConfig()).idpName;
|
|
842
|
+
if (idpName === "welcome") return {};
|
|
843
|
+
return {
|
|
844
|
+
organization: idpName,
|
|
845
|
+
kcpPath: `${kcpRootOrgsPath}:${idpName}`,
|
|
846
|
+
entityName: idpName
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
static {
|
|
850
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
851
|
+
minVersion: "12.0.0",
|
|
852
|
+
version: "22.2.6",
|
|
853
|
+
ngImport: i0,
|
|
854
|
+
type: LuigiExtendedGlobalContextConfigServiceImpl,
|
|
855
|
+
deps: [],
|
|
856
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
static {
|
|
860
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
861
|
+
minVersion: "12.0.0",
|
|
862
|
+
version: "22.2.6",
|
|
863
|
+
ngImport: i0,
|
|
864
|
+
type: LuigiExtendedGlobalContextConfigServiceImpl,
|
|
865
|
+
providedIn: "root"
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
870
|
+
minVersion: "12.0.0",
|
|
871
|
+
version: "22.2.6",
|
|
872
|
+
ngImport: i0,
|
|
873
|
+
type: LuigiExtendedGlobalContextConfigServiceImpl,
|
|
874
|
+
decorators: [{
|
|
875
|
+
type: Injectable,
|
|
876
|
+
args: [{ providedIn: "root" }]
|
|
877
|
+
}]
|
|
878
|
+
});
|
|
879
|
+
var NavigationRedirectStrategyServiceImpl = class NavigationRedirectStrategyServiceImpl {
|
|
880
|
+
getRedirectUrl() {
|
|
881
|
+
return localStorage.getItem(LocalStorageKeys.LAST_NAVIGATION_URL) || "";
|
|
882
|
+
}
|
|
883
|
+
saveRedirectUrl(url) {
|
|
884
|
+
if (url.startsWith("/error")) return;
|
|
885
|
+
localStorage.setItem(LocalStorageKeys.LAST_NAVIGATION_URL, url);
|
|
886
|
+
}
|
|
887
|
+
clearRedirectUrl() {
|
|
888
|
+
localStorage.removeItem(LocalStorageKeys.LAST_NAVIGATION_URL);
|
|
889
|
+
}
|
|
890
|
+
static {
|
|
891
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
892
|
+
minVersion: "12.0.0",
|
|
893
|
+
version: "22.2.6",
|
|
894
|
+
ngImport: i0,
|
|
895
|
+
type: NavigationRedirectStrategyServiceImpl,
|
|
896
|
+
deps: [],
|
|
897
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
static {
|
|
901
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
902
|
+
minVersion: "12.0.0",
|
|
903
|
+
version: "22.2.6",
|
|
904
|
+
ngImport: i0,
|
|
905
|
+
type: NavigationRedirectStrategyServiceImpl,
|
|
906
|
+
providedIn: "root"
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
911
|
+
minVersion: "12.0.0",
|
|
912
|
+
version: "22.2.6",
|
|
913
|
+
ngImport: i0,
|
|
914
|
+
type: NavigationRedirectStrategyServiceImpl,
|
|
915
|
+
decorators: [{
|
|
916
|
+
type: Injectable,
|
|
917
|
+
args: [{ providedIn: "root" }]
|
|
918
|
+
}]
|
|
919
|
+
});
|
|
920
|
+
const OPEN_PERSISTENT_PANEL_MESSAGE = "portal.open-provider-panel";
|
|
445
921
|
const PROVIDER_PANEL_MESSAGE = {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
922
|
+
close: "portal.provider-panel.close",
|
|
923
|
+
closeFailed: "portal.provider-panel.close-failed",
|
|
924
|
+
closed: "portal.provider-panel.closed",
|
|
925
|
+
context: "portal.provider-panel.context",
|
|
926
|
+
ready: "portal.provider-panel.ready",
|
|
927
|
+
requestClose: "portal.provider-panel.request-close"
|
|
452
928
|
};
|
|
453
929
|
function mergePersistentPanelTargets(current, update) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return structuredClone(update);
|
|
462
|
-
}
|
|
463
|
-
// Provider nodes normally contain only panel capability metadata. Keep the
|
|
464
|
-
// target tracked by navigation and overlay any bounded scope that the
|
|
465
|
-
// requesting node does carry.
|
|
466
|
-
return structuredClone({ ...current, ...update });
|
|
930
|
+
const organizationChanged = current.organization !== void 0 && update.organization !== void 0 && current.organization !== update.organization;
|
|
931
|
+
const accountChanged = current.account !== void 0 && update.account !== void 0 && current.account !== update.account;
|
|
932
|
+
if (organizationChanged || accountChanged) return structuredClone(update);
|
|
933
|
+
return structuredClone({
|
|
934
|
+
...current,
|
|
935
|
+
...update
|
|
936
|
+
});
|
|
467
937
|
}
|
|
468
938
|
const panelIdPattern = /^[a-z0-9](?:[a-z0-9.-]{0,62}[a-z0-9])?$/;
|
|
469
939
|
const workspaceSegmentPattern = /^[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?$/;
|
|
470
|
-
function parsePersistentPanelConfig(message, providerNode, portalOrigin) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
url.password) {
|
|
493
|
-
throw new Error('Registered provider UI URL is invalid');
|
|
494
|
-
}
|
|
495
|
-
return { id, title, url: url.toString(), origin: url.origin };
|
|
940
|
+
function parsePersistentPanelConfig(message, providerNode, portalOrigin, placeholderSources = {}) {
|
|
941
|
+
if (message.id !== "portal.open-provider-panel") throw new Error("Persistent panel request is invalid");
|
|
942
|
+
const capability = recordValue(providerNode?.context?.persistentPanel);
|
|
943
|
+
const id = boundedString(capability["id"], 64);
|
|
944
|
+
const title = boundedString(capability["title"], 80);
|
|
945
|
+
if (!id || !panelIdPattern.test(id)) throw new Error("Registered persistent panel id is invalid");
|
|
946
|
+
if (!title) throw new Error("Registered persistent panel title is invalid");
|
|
947
|
+
const registeredViewUrl = boundedString(providerNode?.viewUrl, 2048);
|
|
948
|
+
if (!registeredViewUrl) throw new Error("Registered provider UI URL is missing");
|
|
949
|
+
const resolvedViewUrl = resolveViewUrlPlaceholders(registeredViewUrl, placeholderSources);
|
|
950
|
+
if (resolvedViewUrl === void 0) throw new Error("Registered provider UI URL has unresolved placeholders");
|
|
951
|
+
const viewUrl = boundedString(resolvedViewUrl, 2048);
|
|
952
|
+
if (!viewUrl) throw new Error("Registered provider UI URL is invalid");
|
|
953
|
+
const portalURL = new URL(portalOrigin);
|
|
954
|
+
const url = new URL(viewUrl, portalURL);
|
|
955
|
+
if (url.origin === portalURL.origin || !allowedPanelURL(url, portalURL) || url.username || url.password) throw new Error("Registered provider UI URL is invalid");
|
|
956
|
+
return {
|
|
957
|
+
id,
|
|
958
|
+
title,
|
|
959
|
+
url: url.toString(),
|
|
960
|
+
origin: url.origin
|
|
961
|
+
};
|
|
496
962
|
}
|
|
497
963
|
function allowedPanelURL(url, portalURL) {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
964
|
+
if (url.protocol === "https:") return true;
|
|
965
|
+
return portalURL.protocol === "http:" && url.protocol === "http:" && [
|
|
966
|
+
"localhost",
|
|
967
|
+
"127.0.0.1",
|
|
968
|
+
"[::1]"
|
|
969
|
+
].includes(url.hostname);
|
|
970
|
+
}
|
|
971
|
+
function withResolvedPathParams(nodeContext, resolvedContext) {
|
|
972
|
+
return Object.fromEntries(Object.entries(nodeContext ?? {}).filter(([key, value]) => !isPathParamPlaceholder(value) || Object.hasOwn(resolvedContext, key)).map(([key, value]) => [key, isPathParamPlaceholder(value) ? resolvedContext[key] : value]));
|
|
973
|
+
}
|
|
974
|
+
function isPathParamPlaceholder(value) {
|
|
975
|
+
return typeof value === "string" && value.length > 1 && value.startsWith(":");
|
|
504
976
|
}
|
|
505
977
|
function persistentPanelTarget(globalContext, nodeContext) {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
});
|
|
539
|
-
return compact({
|
|
540
|
-
organization,
|
|
541
|
-
organizationId,
|
|
542
|
-
account,
|
|
543
|
-
accountPath,
|
|
544
|
-
workspacePath,
|
|
545
|
-
namespace,
|
|
546
|
-
resource: Object.keys(resource).length > 0 ? resource : undefined,
|
|
547
|
-
});
|
|
978
|
+
const context = {
|
|
979
|
+
...globalContext,
|
|
980
|
+
...nodeContext ?? {}
|
|
981
|
+
};
|
|
982
|
+
const accountContext = recordValue(recordValue(context["entityContext"])["account"]);
|
|
983
|
+
const resourceDefinition = recordValue(context["resourceDefinition"]);
|
|
984
|
+
const organization = boundedString(context["organization"], 253);
|
|
985
|
+
const organizationId = boundedString(context["organizationId"], 512);
|
|
986
|
+
const rawAccountPath = boundedString(context["accountPath"], 1024);
|
|
987
|
+
const account = boundedString(accountContext["id"], 253) || boundedString(context["accountId"], 253) || boundedString(context["core_platform-mesh_io_accountId"], 253) || accountFromPath(rawAccountPath, organization) || accountFromEntity(context);
|
|
988
|
+
if (!account) return compact({
|
|
989
|
+
organization,
|
|
990
|
+
organizationId
|
|
991
|
+
});
|
|
992
|
+
const accountPath = validatedAccountPath(rawAccountPath, organization, account);
|
|
993
|
+
const workspacePath = validatedWorkspacePath(context["workspacePath"], organization, account) || validatedWorkspacePath(context["kcpPath"], organization, account) || validatedWorkspacePath(rawAccountPath, organization, account) || canonicalAccountPath(organization, account);
|
|
994
|
+
const namespace = boundedString(context["namespaceId"], 253) || boundedString(resourceDefinition["namespace"], 253);
|
|
995
|
+
const resource = compact({
|
|
996
|
+
group: boundedString(resourceDefinition["group"], 253) || boundedString(resourceDefinition["apiGroup"], 253),
|
|
997
|
+
version: boundedString(resourceDefinition["version"], 63),
|
|
998
|
+
kind: boundedString(resourceDefinition["kind"], 253) || boundedString(context["entityKind"], 253),
|
|
999
|
+
name: boundedString(context["entityName"], 253)
|
|
1000
|
+
});
|
|
1001
|
+
return compact({
|
|
1002
|
+
organization,
|
|
1003
|
+
organizationId,
|
|
1004
|
+
account,
|
|
1005
|
+
accountPath,
|
|
1006
|
+
workspacePath,
|
|
1007
|
+
namespace,
|
|
1008
|
+
resource: Object.keys(resource).length > 0 ? resource : void 0
|
|
1009
|
+
});
|
|
548
1010
|
}
|
|
549
1011
|
function accountFromPath(accountPath, organization) {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
const segments = accountPath.split(':');
|
|
557
|
-
if (segments.length < 4 ||
|
|
558
|
-
segments[0] !== 'root' ||
|
|
559
|
-
segments[1] !== 'orgs' ||
|
|
560
|
-
segments.some((segment) => !workspaceSegmentPattern.test(segment)) ||
|
|
561
|
-
(organization !== undefined && segments[2] !== organization)) {
|
|
562
|
-
return undefined;
|
|
563
|
-
}
|
|
564
|
-
return boundedString(segments.at(-1), 253);
|
|
1012
|
+
if (!accountPath) return;
|
|
1013
|
+
if (workspaceSegmentPattern.test(accountPath)) return accountPath;
|
|
1014
|
+
const segments = accountPath.split(":");
|
|
1015
|
+
if (segments.length < 4 || segments[0] !== "root" || segments[1] !== "orgs" || segments.some((segment) => !workspaceSegmentPattern.test(segment)) || organization !== void 0 && segments[2] !== organization) return;
|
|
1016
|
+
return boundedString(segments.at(-1), 253);
|
|
565
1017
|
}
|
|
566
1018
|
function accountFromEntity(context) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
return boundedString(context['entityName'], 253);
|
|
1019
|
+
if (boundedString(context["entityKind"], 253) !== "Account") return;
|
|
1020
|
+
return boundedString(context["entityName"], 253);
|
|
571
1021
|
}
|
|
572
1022
|
function canonicalWorkspacePath(accountPath) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (segments.length < 3 ||
|
|
578
|
-
segments.some((segment) => !workspaceSegmentPattern.test(segment))) {
|
|
579
|
-
return undefined;
|
|
580
|
-
}
|
|
581
|
-
return accountPath;
|
|
1023
|
+
if (!accountPath?.startsWith("root:")) return;
|
|
1024
|
+
const segments = accountPath.split(":");
|
|
1025
|
+
if (segments.length < 3 || segments.some((segment) => !workspaceSegmentPattern.test(segment))) return;
|
|
1026
|
+
return accountPath;
|
|
582
1027
|
}
|
|
583
1028
|
function validatedWorkspacePath(value, organization, account) {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
if (!segments ||
|
|
590
|
-
segments.length < 4 ||
|
|
591
|
-
segments[0] !== 'root' ||
|
|
592
|
-
segments[1] !== 'orgs' ||
|
|
593
|
-
segments[2] !== organization ||
|
|
594
|
-
segments.at(-1) !== account) {
|
|
595
|
-
return undefined;
|
|
596
|
-
}
|
|
597
|
-
return path;
|
|
1029
|
+
if (!organization || !account) return;
|
|
1030
|
+
const path = canonicalWorkspacePath(boundedString(value, 1024));
|
|
1031
|
+
const segments = path?.split(":");
|
|
1032
|
+
if (!segments || segments.length < 4 || segments[0] !== "root" || segments[1] !== "orgs" || segments[2] !== organization || segments.at(-1) !== account) return;
|
|
1033
|
+
return path;
|
|
598
1034
|
}
|
|
599
1035
|
function validatedAccountPath(value, organization, account) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
if (workspaceSegmentPattern.test(value)) {
|
|
604
|
-
return value === account ? value : undefined;
|
|
605
|
-
}
|
|
606
|
-
return validatedWorkspacePath(value, organization, account);
|
|
1036
|
+
if (!value) return;
|
|
1037
|
+
if (workspaceSegmentPattern.test(value)) return value === account ? value : void 0;
|
|
1038
|
+
return validatedWorkspacePath(value, organization, account);
|
|
607
1039
|
}
|
|
608
1040
|
function canonicalAccountPath(organization, account) {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
!workspaceSegmentPattern.test(organization) ||
|
|
612
|
-
!workspaceSegmentPattern.test(account)) {
|
|
613
|
-
return undefined;
|
|
614
|
-
}
|
|
615
|
-
return `root:orgs:${organization}:${account}`;
|
|
1041
|
+
if (!organization || !account || !workspaceSegmentPattern.test(organization) || !workspaceSegmentPattern.test(account)) return;
|
|
1042
|
+
return `root:orgs:${organization}:${account}`;
|
|
616
1043
|
}
|
|
617
1044
|
function compact(value) {
|
|
618
|
-
|
|
1045
|
+
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0));
|
|
619
1046
|
}
|
|
620
1047
|
function boundedString(value, maxLength) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
if (!trimmed || trimmed.length > maxLength || trimmed.includes('\u0000')) {
|
|
626
|
-
return undefined;
|
|
627
|
-
}
|
|
628
|
-
return trimmed;
|
|
1048
|
+
if (typeof value !== "string") return;
|
|
1049
|
+
const trimmed = value.trim();
|
|
1050
|
+
if (!trimmed || trimmed.length > maxLength || trimmed.includes("\0")) return;
|
|
1051
|
+
return trimmed;
|
|
629
1052
|
}
|
|
630
1053
|
function isRecord$1(value) {
|
|
631
|
-
|
|
1054
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
632
1055
|
}
|
|
633
1056
|
function recordValue(value) {
|
|
634
|
-
|
|
1057
|
+
return isRecord$1(value) ? value : {};
|
|
635
1058
|
}
|
|
636
|
-
|
|
637
|
-
const PORTAL_MAIN_AREA_SELECTOR = '.iframeContainer';
|
|
1059
|
+
const PORTAL_MAIN_AREA_SELECTOR = ".iframeContainer";
|
|
638
1060
|
const PORTAL_LAYOUT_SELECTORS = [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
].join(
|
|
646
|
-
class PersistentPanelComponent {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
this.portalLayoutStyles.clear();
|
|
1014
|
-
}
|
|
1015
|
-
observePortalLayout() {
|
|
1016
|
-
this.observeMainAreaResize();
|
|
1017
|
-
if (this.observingPortalLayout) {
|
|
1018
|
-
return;
|
|
1019
|
-
}
|
|
1020
|
-
this.portalLayoutObserver.observe(document.body, {
|
|
1021
|
-
childList: true,
|
|
1022
|
-
subtree: true,
|
|
1023
|
-
});
|
|
1024
|
-
this.observingPortalLayout = true;
|
|
1025
|
-
}
|
|
1026
|
-
stopObservingPortalLayout() {
|
|
1027
|
-
this.portalLayoutObserver.disconnect();
|
|
1028
|
-
this.mainAreaResizeObserver?.disconnect();
|
|
1029
|
-
this.observedMainArea = null;
|
|
1030
|
-
this.observingPortalLayout = false;
|
|
1031
|
-
}
|
|
1032
|
-
observeMainAreaResize() {
|
|
1033
|
-
const mainArea = document.querySelector(PORTAL_MAIN_AREA_SELECTOR);
|
|
1034
|
-
if (!this.mainAreaResizeObserver || mainArea === this.observedMainArea) {
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
this.mainAreaResizeObserver.disconnect();
|
|
1038
|
-
this.observedMainArea = mainArea;
|
|
1039
|
-
if (mainArea) {
|
|
1040
|
-
this.mainAreaResizeObserver.observe(mainArea);
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
isMobileViewport() {
|
|
1044
|
-
return window.innerWidth <= 600;
|
|
1045
|
-
}
|
|
1046
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: PersistentPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1047
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: PersistentPanelComponent, isStandalone: true, selector: "pm-persistent-panel", viewQueries: [{ propertyName: "panelFrame", first: true, predicate: ["panelFrame"], descendants: true }, { propertyName: "reopenButton", first: true, predicate: ["reopenButton"], descendants: true }], ngImport: i0, template: "<section\n class=\"persistent-panel fd-dialog__content\"\n role=\"complementary\"\n aria-labelledby=\"persistent-panel-title\"\n [attr.aria-hidden]=\"state() === 'hidden'\"\n [class.maximized]=\"state() === 'maximized'\"\n [class.open]=\"state() !== 'hidden'\"\n [class.resizing]=\"resizing()\"\n [style.--pm-panel-width]=\"panelWidth() + 'px'\"\n>\n <div\n class=\"persistent-panel-resizer\"\n role=\"separator\"\n aria-label=\"Resize provider panel\"\n aria-orientation=\"vertical\"\n aria-controls=\"persistent-panel-content\"\n [attr.aria-valuemin]=\"minPanelWidth()\"\n [attr.aria-valuemax]=\"maxPanelWidth()\"\n [attr.aria-valuenow]=\"panelWidth()\"\n tabindex=\"0\"\n (pointerdown)=\"beginResize($event)\"\n (pointermove)=\"resize($event)\"\n (pointerup)=\"finishResize($event)\"\n (pointercancel)=\"finishResize($event)\"\n (lostpointercapture)=\"finishResize($event)\"\n (keydown)=\"resizeWithKeyboard($event)\"\n ></div>\n <header\n class=\"persistent-panel-header fd-dialog__header fd-bar fd-bar--header\"\n >\n <div class=\"fd-bar__left persistent-panel-title-area\">\n <div class=\"fd-bar__element persistent-panel-title-element\">\n <h2\n id=\"persistent-panel-title\"\n class=\"fd-title fd-title--h5 persistent-panel-title\"\n >\n {{ title() }}\n </h2>\n </div>\n </div>\n <div class=\"fd-bar__right persistent-panel-actions\">\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Toggle panel size\"\n [attr.aria-pressed]=\"state() === 'maximized'\"\n title=\"Toggle panel size\"\n type=\"button\"\n (click)=\"toggleSize()\"\n >\n <i\n class=\"sap-icon\"\n [class.sap-icon--exitfullscreen]=\"state() === 'maximized'\"\n [class.sap-icon--full-screen]=\"state() !== 'maximized'\"\n aria-hidden=\"true\"\n ></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Collapse panel\"\n title=\"Collapse panel\"\n type=\"button\"\n (click)=\"collapse()\"\n >\n <i class=\"sap-icon sap-icon--collapse\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Close panel\"\n title=\"Close panel\"\n type=\"button\"\n (click)=\"close()\"\n >\n <i class=\"sap-icon sap-icon--decline\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </header>\n <div class=\"persistent-panel-body fd-dialog__body\">\n @if (closeError()) {\n <p class=\"persistent-panel-error\" role=\"alert\">{{ closeError() }}</p>\n } @if (source()) {\n <iframe\n #panelFrame\n id=\"persistent-panel-content\"\n class=\"persistent-panel-frame\"\n referrerpolicy=\"no-referrer\"\n sandbox=\"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts\"\n [src]=\"source()\"\n [title]=\"title()\"\n (load)=\"frameLoaded()\"\n ></iframe>\n }\n </div>\n</section>\n\n@if (state() === 'hidden' && source() && !closing()) {\n<button\n #reopenButton\n class=\"persistent-panel-reopen fd-button fd-button--emphasized fd-button--compact\"\n [attr.aria-label]=\"'Open ' + title()\"\n type=\"button\"\n (click)=\"expand()\"\n>\n {{ title() }}\n</button>\n}\n", styles: [":host{font-family:var(--sapFontFamily, \"72\", Arial, sans-serif)}.persistent-panel{position:fixed;top:var(--luigi__shellbar--height, 3.25rem);right:0;bottom:0;z-index:1000;display:none;box-sizing:border-box;min-width:0;max-width:none;min-height:0;max-height:none;width:var(--pm-panel-width, min(34rem, 100vw));background:var(--sapGroup_ContentBackground, #fff);border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0 var(--sapElement_BorderCornerRadius, .75rem);box-shadow:var(--sapContent_Shadow3, 0 0 0 .0625rem rgba(34, 53, 72, .48), 0 1.25rem 5rem rgba(34, 53, 72, .3))}:host-context(.lui-breadcrumb) .persistent-panel{top:calc(var(--luigi__shellbar--height, 3.25rem) + var(--luigi__breadcrumb--height, 2.75rem))}.persistent-panel.open{display:grid;grid-template-rows:auto minmax(0,1fr)}.persistent-panel-resizer{position:absolute;top:0;bottom:0;left:-.375rem;z-index:1;width:.75rem;cursor:col-resize;touch-action:none}.persistent-panel-resizer:after{position:absolute;top:50%;left:50%;width:.125rem;height:3rem;background:var(--sapContent_FocusColor, #0064d9);border-radius:.125rem;content:\"\";opacity:0;pointer-events:none;transform:translate(-50%,-50%);transition:opacity .12s ease-in-out}.persistent-panel-resizer:hover:after,.persistent-panel-resizer:focus-visible:after,.persistent-panel.resizing .persistent-panel-resizer:after{opacity:1}.persistent-panel-resizer:focus-visible{outline:0}.persistent-panel-resizer:focus-visible:after{outline:var(--sapContent_FocusWidth, .125rem) solid var(--sapContent_FocusColor, #0032a5);outline-offset:.125rem}.persistent-panel.maximized .persistent-panel-resizer{display:none}.persistent-panel-header{min-width:0;border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0}.persistent-panel-title-area,.persistent-panel-title-element{min-width:0}.persistent-panel-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.persistent-panel-body{display:flex;min-width:0;min-height:0;flex-direction:column;padding:0;overflow:hidden}.persistent-panel-error{flex:none;margin:0;padding:.5rem 1rem;color:var(--sapNegativeTextColor, #aa0808);background:var(--sapErrorBackground, #ffeaf4);font-size:var(--sapFontSmallSize, .75rem)}.persistent-panel-frame{min-height:0;flex:1;width:100%;border:0;border-bottom-left-radius:var(--sapElement_BorderCornerRadius, .75rem)}.persistent-panel.resizing,.persistent-panel.resizing .persistent-panel-resizer{cursor:col-resize}.persistent-panel.resizing .persistent-panel-frame{pointer-events:none;-webkit-user-select:none;user-select:none}.persistent-panel-reopen{position:fixed;right:1rem;bottom:1rem;z-index:1000;overflow:hidden;max-width:calc(100vw - 2rem);text-overflow:ellipsis;white-space:nowrap}@media(max-width:600px){.persistent-panel,.persistent-panel.maximized{left:0;width:100vw;border-radius:0;box-shadow:none}.persistent-panel-resizer{display:none}.persistent-panel-header,.persistent-panel-body,.persistent-panel-frame{border-radius:0}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1048
|
-
}
|
|
1049
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: PersistentPanelComponent, decorators: [{
|
|
1050
|
-
type: Component,
|
|
1051
|
-
args: [{ selector: 'pm-persistent-panel', imports: [CommonModule], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<section\n class=\"persistent-panel fd-dialog__content\"\n role=\"complementary\"\n aria-labelledby=\"persistent-panel-title\"\n [attr.aria-hidden]=\"state() === 'hidden'\"\n [class.maximized]=\"state() === 'maximized'\"\n [class.open]=\"state() !== 'hidden'\"\n [class.resizing]=\"resizing()\"\n [style.--pm-panel-width]=\"panelWidth() + 'px'\"\n>\n <div\n class=\"persistent-panel-resizer\"\n role=\"separator\"\n aria-label=\"Resize provider panel\"\n aria-orientation=\"vertical\"\n aria-controls=\"persistent-panel-content\"\n [attr.aria-valuemin]=\"minPanelWidth()\"\n [attr.aria-valuemax]=\"maxPanelWidth()\"\n [attr.aria-valuenow]=\"panelWidth()\"\n tabindex=\"0\"\n (pointerdown)=\"beginResize($event)\"\n (pointermove)=\"resize($event)\"\n (pointerup)=\"finishResize($event)\"\n (pointercancel)=\"finishResize($event)\"\n (lostpointercapture)=\"finishResize($event)\"\n (keydown)=\"resizeWithKeyboard($event)\"\n ></div>\n <header\n class=\"persistent-panel-header fd-dialog__header fd-bar fd-bar--header\"\n >\n <div class=\"fd-bar__left persistent-panel-title-area\">\n <div class=\"fd-bar__element persistent-panel-title-element\">\n <h2\n id=\"persistent-panel-title\"\n class=\"fd-title fd-title--h5 persistent-panel-title\"\n >\n {{ title() }}\n </h2>\n </div>\n </div>\n <div class=\"fd-bar__right persistent-panel-actions\">\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Toggle panel size\"\n [attr.aria-pressed]=\"state() === 'maximized'\"\n title=\"Toggle panel size\"\n type=\"button\"\n (click)=\"toggleSize()\"\n >\n <i\n class=\"sap-icon\"\n [class.sap-icon--exitfullscreen]=\"state() === 'maximized'\"\n [class.sap-icon--full-screen]=\"state() !== 'maximized'\"\n aria-hidden=\"true\"\n ></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Collapse panel\"\n title=\"Collapse panel\"\n type=\"button\"\n (click)=\"collapse()\"\n >\n <i class=\"sap-icon sap-icon--collapse\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Close panel\"\n title=\"Close panel\"\n type=\"button\"\n (click)=\"close()\"\n >\n <i class=\"sap-icon sap-icon--decline\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </header>\n <div class=\"persistent-panel-body fd-dialog__body\">\n @if (closeError()) {\n <p class=\"persistent-panel-error\" role=\"alert\">{{ closeError() }}</p>\n } @if (source()) {\n <iframe\n #panelFrame\n id=\"persistent-panel-content\"\n class=\"persistent-panel-frame\"\n referrerpolicy=\"no-referrer\"\n sandbox=\"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts\"\n [src]=\"source()\"\n [title]=\"title()\"\n (load)=\"frameLoaded()\"\n ></iframe>\n }\n </div>\n</section>\n\n@if (state() === 'hidden' && source() && !closing()) {\n<button\n #reopenButton\n class=\"persistent-panel-reopen fd-button fd-button--emphasized fd-button--compact\"\n [attr.aria-label]=\"'Open ' + title()\"\n type=\"button\"\n (click)=\"expand()\"\n>\n {{ title() }}\n</button>\n}\n", styles: [":host{font-family:var(--sapFontFamily, \"72\", Arial, sans-serif)}.persistent-panel{position:fixed;top:var(--luigi__shellbar--height, 3.25rem);right:0;bottom:0;z-index:1000;display:none;box-sizing:border-box;min-width:0;max-width:none;min-height:0;max-height:none;width:var(--pm-panel-width, min(34rem, 100vw));background:var(--sapGroup_ContentBackground, #fff);border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0 var(--sapElement_BorderCornerRadius, .75rem);box-shadow:var(--sapContent_Shadow3, 0 0 0 .0625rem rgba(34, 53, 72, .48), 0 1.25rem 5rem rgba(34, 53, 72, .3))}:host-context(.lui-breadcrumb) .persistent-panel{top:calc(var(--luigi__shellbar--height, 3.25rem) + var(--luigi__breadcrumb--height, 2.75rem))}.persistent-panel.open{display:grid;grid-template-rows:auto minmax(0,1fr)}.persistent-panel-resizer{position:absolute;top:0;bottom:0;left:-.375rem;z-index:1;width:.75rem;cursor:col-resize;touch-action:none}.persistent-panel-resizer:after{position:absolute;top:50%;left:50%;width:.125rem;height:3rem;background:var(--sapContent_FocusColor, #0064d9);border-radius:.125rem;content:\"\";opacity:0;pointer-events:none;transform:translate(-50%,-50%);transition:opacity .12s ease-in-out}.persistent-panel-resizer:hover:after,.persistent-panel-resizer:focus-visible:after,.persistent-panel.resizing .persistent-panel-resizer:after{opacity:1}.persistent-panel-resizer:focus-visible{outline:0}.persistent-panel-resizer:focus-visible:after{outline:var(--sapContent_FocusWidth, .125rem) solid var(--sapContent_FocusColor, #0032a5);outline-offset:.125rem}.persistent-panel.maximized .persistent-panel-resizer{display:none}.persistent-panel-header{min-width:0;border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0}.persistent-panel-title-area,.persistent-panel-title-element{min-width:0}.persistent-panel-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.persistent-panel-body{display:flex;min-width:0;min-height:0;flex-direction:column;padding:0;overflow:hidden}.persistent-panel-error{flex:none;margin:0;padding:.5rem 1rem;color:var(--sapNegativeTextColor, #aa0808);background:var(--sapErrorBackground, #ffeaf4);font-size:var(--sapFontSmallSize, .75rem)}.persistent-panel-frame{min-height:0;flex:1;width:100%;border:0;border-bottom-left-radius:var(--sapElement_BorderCornerRadius, .75rem)}.persistent-panel.resizing,.persistent-panel.resizing .persistent-panel-resizer{cursor:col-resize}.persistent-panel.resizing .persistent-panel-frame{pointer-events:none;-webkit-user-select:none;user-select:none}.persistent-panel-reopen{position:fixed;right:1rem;bottom:1rem;z-index:1000;overflow:hidden;max-width:calc(100vw - 2rem);text-overflow:ellipsis;white-space:nowrap}@media(max-width:600px){.persistent-panel,.persistent-panel.maximized{left:0;width:100vw;border-radius:0;box-shadow:none}.persistent-panel-resizer{display:none}.persistent-panel-header,.persistent-panel-body,.persistent-panel-frame{border-radius:0}}\n"] }]
|
|
1052
|
-
}], ctorParameters: () => [], propDecorators: { panelFrame: [{
|
|
1053
|
-
type: ViewChild,
|
|
1054
|
-
args: ['panelFrame']
|
|
1055
|
-
}], reopenButton: [{
|
|
1056
|
-
type: ViewChild,
|
|
1057
|
-
args: ['reopenButton']
|
|
1058
|
-
}] } });
|
|
1061
|
+
PORTAL_MAIN_AREA_SELECTOR,
|
|
1062
|
+
".spinnerContainer.appSpinner",
|
|
1063
|
+
"#splitViewContainer",
|
|
1064
|
+
"#splitViewDragger",
|
|
1065
|
+
"#splitViewDraggerBackdrop",
|
|
1066
|
+
"#tabsContainer"
|
|
1067
|
+
].join(",");
|
|
1068
|
+
var PersistentPanelComponent = class PersistentPanelComponent {
|
|
1069
|
+
constructor() {
|
|
1070
|
+
this.dimensions = panelDimensions();
|
|
1071
|
+
this.preferredPanelWidth = signal(this.dimensions.defaultWidth, ...ngDevMode ? [{ debugName: "preferredPanelWidth" }] : /* istanbul ignore next */ []);
|
|
1072
|
+
this.state = signal("hidden", ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
1073
|
+
this.title = signal("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
1074
|
+
this.source = signal(null, ...ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []);
|
|
1075
|
+
this.closing = signal(false, ...ngDevMode ? [{ debugName: "closing" }] : /* istanbul ignore next */ []);
|
|
1076
|
+
this.closeError = signal("", ...ngDevMode ? [{ debugName: "closeError" }] : /* istanbul ignore next */ []);
|
|
1077
|
+
this.resizing = signal(false, ...ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []);
|
|
1078
|
+
this.maxPanelWidth = signal(this.availablePanelWidth(), ...ngDevMode ? [{ debugName: "maxPanelWidth" }] : /* istanbul ignore next */ []);
|
|
1079
|
+
this.minPanelWidth = computed(() => Math.min(this.dimensions.minimumWidth, this.maxPanelWidth()), ...ngDevMode ? [{ debugName: "minPanelWidth" }] : /* istanbul ignore next */ []);
|
|
1080
|
+
this.panelWidth = computed(() => Math.max(this.minPanelWidth(), Math.min(this.state() === "maximized" ? this.maxPanelWidth() : this.preferredPanelWidth(), this.maxPanelWidth())), ...ngDevMode ? [{ debugName: "panelWidth" }] : /* istanbul ignore next */ []);
|
|
1081
|
+
this.sanitizer = inject(DomSanitizer);
|
|
1082
|
+
this.config = null;
|
|
1083
|
+
this.target = {};
|
|
1084
|
+
this.sequence = 0;
|
|
1085
|
+
this.closeSequence = 0;
|
|
1086
|
+
this.closeTimeout = null;
|
|
1087
|
+
this.closeRequestIdSent = null;
|
|
1088
|
+
this.destroyed = false;
|
|
1089
|
+
this.ready = false;
|
|
1090
|
+
this.returnFocusElement = null;
|
|
1091
|
+
this.resizePointerId = null;
|
|
1092
|
+
this.observingPortalLayout = false;
|
|
1093
|
+
this.observedMainArea = null;
|
|
1094
|
+
this.portalLayoutStyles = /* @__PURE__ */ new Map();
|
|
1095
|
+
this.portalLayoutObserver = new MutationObserver(() => {
|
|
1096
|
+
if (this.state() === "hidden") return;
|
|
1097
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1098
|
+
this.syncPortalLayout();
|
|
1099
|
+
});
|
|
1100
|
+
this.mainAreaResizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
|
|
1101
|
+
if (this.state() === "hidden") return;
|
|
1102
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1103
|
+
this.syncPortalLayout();
|
|
1104
|
+
});
|
|
1105
|
+
this.onWindowResize = () => {
|
|
1106
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1107
|
+
this.syncPortalLayout();
|
|
1108
|
+
};
|
|
1109
|
+
this.onMessage = (event) => {
|
|
1110
|
+
const frame = this.panelFrame?.nativeElement;
|
|
1111
|
+
if (!frame || event.source !== frame.contentWindow || event.origin !== this.config?.origin || !isRecord(event.data)) return;
|
|
1112
|
+
if (event.data["type"] === PROVIDER_PANEL_MESSAGE.ready) {
|
|
1113
|
+
this.ready = true;
|
|
1114
|
+
if (this.closing()) this.requestCloseIfReady(this.closeSequence);
|
|
1115
|
+
else this.publishTarget();
|
|
1116
|
+
}
|
|
1117
|
+
if (event.data["type"] === PROVIDER_PANEL_MESSAGE.requestClose) this.close();
|
|
1118
|
+
if (event.data["type"] === PROVIDER_PANEL_MESSAGE.closeFailed && typeof event.data["requestId"] === "number" && event.data["requestId"] === this.closeRequestIdSent) this.failClose(event.data["requestId"]);
|
|
1119
|
+
if (event.data["type"] === PROVIDER_PANEL_MESSAGE.closed && typeof event.data["requestId"] === "number") this.finishClose(event.data["requestId"]);
|
|
1120
|
+
};
|
|
1121
|
+
window.addEventListener("message", this.onMessage);
|
|
1122
|
+
window.addEventListener("resize", this.onWindowResize);
|
|
1123
|
+
}
|
|
1124
|
+
ngOnDestroy() {
|
|
1125
|
+
this.destroyed = true;
|
|
1126
|
+
window.removeEventListener("message", this.onMessage);
|
|
1127
|
+
window.removeEventListener("resize", this.onWindowResize);
|
|
1128
|
+
this.clearCloseTimeout();
|
|
1129
|
+
this.resizePointerId = null;
|
|
1130
|
+
this.resizing.set(false);
|
|
1131
|
+
this.portalLayoutObserver.disconnect();
|
|
1132
|
+
this.mainAreaResizeObserver?.disconnect();
|
|
1133
|
+
this.restorePortalLayout();
|
|
1134
|
+
}
|
|
1135
|
+
open(config, target) {
|
|
1136
|
+
if (this.closing()) this.closeSequence += 1;
|
|
1137
|
+
this.clearCloseTimeout();
|
|
1138
|
+
this.closeRequestIdSent = null;
|
|
1139
|
+
this.closing.set(false);
|
|
1140
|
+
this.closeError.set("");
|
|
1141
|
+
const sourceChanged = this.config?.url !== config.url;
|
|
1142
|
+
if (!this.source()) this.returnFocusElement = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
1143
|
+
if (sourceChanged) this.ready = false;
|
|
1144
|
+
this.config = config;
|
|
1145
|
+
this.target = structuredClone(target);
|
|
1146
|
+
this.title.set(config.title);
|
|
1147
|
+
if (sourceChanged || !this.source()) this.source.set(this.sanitizer.bypassSecurityTrustResourceUrl(config.url));
|
|
1148
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1149
|
+
this.state.set("expanded");
|
|
1150
|
+
this.syncPortalLayout();
|
|
1151
|
+
queueMicrotask(() => {
|
|
1152
|
+
if (this.destroyed) return;
|
|
1153
|
+
this.publishTarget();
|
|
1154
|
+
this.focusPanel();
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
updateTarget(target) {
|
|
1158
|
+
this.target = structuredClone(target);
|
|
1159
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1160
|
+
this.syncPortalLayout();
|
|
1161
|
+
this.publishTarget();
|
|
1162
|
+
}
|
|
1163
|
+
collapse() {
|
|
1164
|
+
this.state.set("hidden");
|
|
1165
|
+
this.syncPortalLayout();
|
|
1166
|
+
queueMicrotask(() => {
|
|
1167
|
+
if (this.destroyed) return;
|
|
1168
|
+
this.reopenButton?.nativeElement.focus();
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
expand() {
|
|
1172
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1173
|
+
this.state.set("expanded");
|
|
1174
|
+
this.syncPortalLayout();
|
|
1175
|
+
queueMicrotask(() => {
|
|
1176
|
+
if (this.destroyed) return;
|
|
1177
|
+
this.focusPanel();
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
toggleSize() {
|
|
1181
|
+
this.state.update((state) => state === "maximized" ? "expanded" : "maximized");
|
|
1182
|
+
this.syncPortalLayout();
|
|
1183
|
+
}
|
|
1184
|
+
beginResize(event) {
|
|
1185
|
+
if (this.state() !== "expanded" || event.button !== 0 || event.isPrimary === false) return;
|
|
1186
|
+
this.resizePointerId = event.pointerId;
|
|
1187
|
+
this.resizing.set(true);
|
|
1188
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
1189
|
+
event.preventDefault();
|
|
1190
|
+
}
|
|
1191
|
+
resize(event) {
|
|
1192
|
+
if (event.pointerId !== this.resizePointerId) return;
|
|
1193
|
+
this.setPanelWidth(window.innerWidth - event.clientX);
|
|
1194
|
+
event.preventDefault();
|
|
1195
|
+
}
|
|
1196
|
+
finishResize(event) {
|
|
1197
|
+
if (event.pointerId !== this.resizePointerId) return;
|
|
1198
|
+
const handle = event.currentTarget;
|
|
1199
|
+
if (handle.hasPointerCapture(event.pointerId)) handle.releasePointerCapture(event.pointerId);
|
|
1200
|
+
this.resizePointerId = null;
|
|
1201
|
+
this.resizing.set(false);
|
|
1202
|
+
event.preventDefault();
|
|
1203
|
+
}
|
|
1204
|
+
resizeWithKeyboard(event) {
|
|
1205
|
+
let width;
|
|
1206
|
+
switch (event.key) {
|
|
1207
|
+
case "ArrowLeft":
|
|
1208
|
+
width = this.panelWidth() + this.dimensions.keyboardStep;
|
|
1209
|
+
break;
|
|
1210
|
+
case "ArrowRight":
|
|
1211
|
+
width = this.panelWidth() - this.dimensions.keyboardStep;
|
|
1212
|
+
break;
|
|
1213
|
+
case "Home":
|
|
1214
|
+
width = this.minPanelWidth();
|
|
1215
|
+
break;
|
|
1216
|
+
case "End":
|
|
1217
|
+
width = this.maxPanelWidth();
|
|
1218
|
+
break;
|
|
1219
|
+
default: return;
|
|
1220
|
+
}
|
|
1221
|
+
this.setPanelWidth(width);
|
|
1222
|
+
event.preventDefault();
|
|
1223
|
+
}
|
|
1224
|
+
close() {
|
|
1225
|
+
if (!this.source() || this.closing()) return;
|
|
1226
|
+
this.closeSequence += 1;
|
|
1227
|
+
const requestId = this.closeSequence;
|
|
1228
|
+
this.closeRequestIdSent = null;
|
|
1229
|
+
this.closing.set(true);
|
|
1230
|
+
this.closeError.set("");
|
|
1231
|
+
this.state.set("hidden");
|
|
1232
|
+
this.syncPortalLayout();
|
|
1233
|
+
this.focusReturnTarget();
|
|
1234
|
+
this.requestCloseIfReady(requestId);
|
|
1235
|
+
this.closeTimeout = window.setTimeout(() => {
|
|
1236
|
+
this.failClose(requestId);
|
|
1237
|
+
}, 3e4);
|
|
1238
|
+
}
|
|
1239
|
+
failClose(requestId) {
|
|
1240
|
+
if (!this.closing() || requestId !== this.closeSequence) return;
|
|
1241
|
+
this.clearCloseTimeout();
|
|
1242
|
+
this.closeRequestIdSent = null;
|
|
1243
|
+
this.closing.set(false);
|
|
1244
|
+
this.closeError.set("Provider cleanup is incomplete. Try closing again.");
|
|
1245
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1246
|
+
this.state.set("expanded");
|
|
1247
|
+
this.syncPortalLayout();
|
|
1248
|
+
queueMicrotask(() => {
|
|
1249
|
+
if (this.destroyed) return;
|
|
1250
|
+
this.focusPanel();
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
finishClose(requestId) {
|
|
1254
|
+
if (!this.closing() || requestId !== this.closeSequence || this.closeRequestIdSent !== requestId) return;
|
|
1255
|
+
this.clearCloseTimeout();
|
|
1256
|
+
this.closeRequestIdSent = null;
|
|
1257
|
+
this.closing.set(false);
|
|
1258
|
+
this.closeError.set("");
|
|
1259
|
+
this.config = null;
|
|
1260
|
+
this.ready = false;
|
|
1261
|
+
this.source.set(null);
|
|
1262
|
+
this.title.set("");
|
|
1263
|
+
this.state.set("hidden");
|
|
1264
|
+
this.syncPortalLayout();
|
|
1265
|
+
this.focusReturnTarget();
|
|
1266
|
+
this.returnFocusElement = null;
|
|
1267
|
+
}
|
|
1268
|
+
clearCloseTimeout() {
|
|
1269
|
+
if (this.closeTimeout !== null) {
|
|
1270
|
+
window.clearTimeout(this.closeTimeout);
|
|
1271
|
+
this.closeTimeout = null;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
frameLoaded() {
|
|
1275
|
+
this.maxPanelWidth.set(this.availablePanelWidth());
|
|
1276
|
+
this.syncPortalLayout();
|
|
1277
|
+
this.publishTarget();
|
|
1278
|
+
}
|
|
1279
|
+
publishTarget() {
|
|
1280
|
+
if (!this.config) return;
|
|
1281
|
+
this.sequence += 1;
|
|
1282
|
+
this.post({
|
|
1283
|
+
type: PROVIDER_PANEL_MESSAGE.context,
|
|
1284
|
+
panelId: this.config.id,
|
|
1285
|
+
sequence: this.sequence,
|
|
1286
|
+
target: this.target
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
requestCloseIfReady(requestId) {
|
|
1290
|
+
if (!this.ready || !this.closing() || requestId !== this.closeSequence || this.closeRequestIdSent === requestId) return;
|
|
1291
|
+
this.closeRequestIdSent = requestId;
|
|
1292
|
+
this.post({
|
|
1293
|
+
type: PROVIDER_PANEL_MESSAGE.close,
|
|
1294
|
+
requestId
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
focusPanel() {
|
|
1298
|
+
this.panelFrame?.nativeElement.focus?.();
|
|
1299
|
+
}
|
|
1300
|
+
focusReturnTarget() {
|
|
1301
|
+
if (this.returnFocusElement?.isConnected) this.returnFocusElement.focus();
|
|
1302
|
+
}
|
|
1303
|
+
post(message) {
|
|
1304
|
+
if (!this.config) return;
|
|
1305
|
+
this.panelFrame?.nativeElement.contentWindow?.postMessage(message, this.config.origin);
|
|
1306
|
+
}
|
|
1307
|
+
setPanelWidth(width) {
|
|
1308
|
+
this.preferredPanelWidth.set(Math.min(Math.max(width, this.minPanelWidth()), this.maxPanelWidth()));
|
|
1309
|
+
this.syncPortalLayout();
|
|
1310
|
+
}
|
|
1311
|
+
availablePanelWidth() {
|
|
1312
|
+
if (this.isMobileViewport()) return Math.max(1, window.innerWidth);
|
|
1313
|
+
return Math.max(1, Math.floor(this.availableMainAreaWidth() / 2));
|
|
1314
|
+
}
|
|
1315
|
+
availableMainAreaWidth() {
|
|
1316
|
+
const mainArea = document.querySelector(PORTAL_MAIN_AREA_SELECTOR);
|
|
1317
|
+
if (mainArea) return Math.max(1, window.innerWidth - mainArea.getBoundingClientRect().left);
|
|
1318
|
+
return Math.max(1, window.innerWidth);
|
|
1319
|
+
}
|
|
1320
|
+
syncPortalLayout() {
|
|
1321
|
+
if (this.state() === "hidden" || this.isMobileViewport()) {
|
|
1322
|
+
this.stopObservingPortalLayout();
|
|
1323
|
+
this.restorePortalLayout();
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
this.observePortalLayout();
|
|
1327
|
+
const offset = `${this.panelWidth()}px`;
|
|
1328
|
+
document.querySelectorAll(PORTAL_LAYOUT_SELECTORS).forEach((element) => {
|
|
1329
|
+
if (!this.portalLayoutStyles.has(element)) this.portalLayoutStyles.set(element, {
|
|
1330
|
+
value: element.style.getPropertyValue("right"),
|
|
1331
|
+
priority: element.style.getPropertyPriority("right")
|
|
1332
|
+
});
|
|
1333
|
+
element.style.setProperty("right", offset);
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
restorePortalLayout() {
|
|
1337
|
+
this.portalLayoutStyles.forEach(({ value, priority }, element) => {
|
|
1338
|
+
if (value) element.style.setProperty("right", value, priority);
|
|
1339
|
+
else element.style.removeProperty("right");
|
|
1340
|
+
});
|
|
1341
|
+
this.portalLayoutStyles.clear();
|
|
1342
|
+
}
|
|
1343
|
+
observePortalLayout() {
|
|
1344
|
+
this.observeMainAreaResize();
|
|
1345
|
+
if (this.observingPortalLayout) return;
|
|
1346
|
+
this.portalLayoutObserver.observe(document.body, {
|
|
1347
|
+
childList: true,
|
|
1348
|
+
subtree: true
|
|
1349
|
+
});
|
|
1350
|
+
this.observingPortalLayout = true;
|
|
1351
|
+
}
|
|
1352
|
+
stopObservingPortalLayout() {
|
|
1353
|
+
this.portalLayoutObserver.disconnect();
|
|
1354
|
+
this.mainAreaResizeObserver?.disconnect();
|
|
1355
|
+
this.observedMainArea = null;
|
|
1356
|
+
this.observingPortalLayout = false;
|
|
1357
|
+
}
|
|
1358
|
+
observeMainAreaResize() {
|
|
1359
|
+
const mainArea = document.querySelector(PORTAL_MAIN_AREA_SELECTOR);
|
|
1360
|
+
if (!this.mainAreaResizeObserver || mainArea === this.observedMainArea) return;
|
|
1361
|
+
this.mainAreaResizeObserver.disconnect();
|
|
1362
|
+
this.observedMainArea = mainArea;
|
|
1363
|
+
if (mainArea) this.mainAreaResizeObserver.observe(mainArea);
|
|
1364
|
+
}
|
|
1365
|
+
isMobileViewport() {
|
|
1366
|
+
return window.innerWidth <= 600;
|
|
1367
|
+
}
|
|
1368
|
+
static {
|
|
1369
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1370
|
+
minVersion: "12.0.0",
|
|
1371
|
+
version: "22.2.6",
|
|
1372
|
+
ngImport: i0,
|
|
1373
|
+
type: PersistentPanelComponent,
|
|
1374
|
+
deps: [],
|
|
1375
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
static {
|
|
1379
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1380
|
+
minVersion: "17.0.0",
|
|
1381
|
+
version: "22.2.6",
|
|
1382
|
+
type: PersistentPanelComponent,
|
|
1383
|
+
isStandalone: true,
|
|
1384
|
+
selector: "pm-persistent-panel",
|
|
1385
|
+
viewQueries: [{
|
|
1386
|
+
propertyName: "panelFrame",
|
|
1387
|
+
first: true,
|
|
1388
|
+
predicate: ["panelFrame"],
|
|
1389
|
+
descendants: true
|
|
1390
|
+
}, {
|
|
1391
|
+
propertyName: "reopenButton",
|
|
1392
|
+
first: true,
|
|
1393
|
+
predicate: ["reopenButton"],
|
|
1394
|
+
descendants: true
|
|
1395
|
+
}],
|
|
1396
|
+
ngImport: i0,
|
|
1397
|
+
template: "<section\n class=\"persistent-panel fd-dialog__content\"\n role=\"complementary\"\n aria-labelledby=\"persistent-panel-title\"\n [attr.aria-hidden]=\"state() === 'hidden'\"\n [class.maximized]=\"state() === 'maximized'\"\n [class.open]=\"state() !== 'hidden'\"\n [class.resizing]=\"resizing()\"\n [style.--pm-panel-width]=\"panelWidth() + 'px'\"\n>\n <div\n class=\"persistent-panel-resizer\"\n role=\"separator\"\n aria-label=\"Resize provider panel\"\n aria-orientation=\"vertical\"\n aria-controls=\"persistent-panel-content\"\n [attr.aria-valuemin]=\"minPanelWidth()\"\n [attr.aria-valuemax]=\"maxPanelWidth()\"\n [attr.aria-valuenow]=\"panelWidth()\"\n tabindex=\"0\"\n (pointerdown)=\"beginResize($event)\"\n (pointermove)=\"resize($event)\"\n (pointerup)=\"finishResize($event)\"\n (pointercancel)=\"finishResize($event)\"\n (lostpointercapture)=\"finishResize($event)\"\n (keydown)=\"resizeWithKeyboard($event)\"\n ></div>\n <header\n class=\"persistent-panel-header fd-dialog__header fd-bar fd-bar--header\"\n >\n <div class=\"fd-bar__left persistent-panel-title-area\">\n <div class=\"fd-bar__element persistent-panel-title-element\">\n <h2\n id=\"persistent-panel-title\"\n class=\"fd-title fd-title--h5 persistent-panel-title\"\n >\n {{ title() }}\n </h2>\n </div>\n </div>\n <div class=\"fd-bar__right persistent-panel-actions\">\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Toggle panel size\"\n [attr.aria-pressed]=\"state() === 'maximized'\"\n title=\"Toggle panel size\"\n type=\"button\"\n (click)=\"toggleSize()\"\n >\n <i\n class=\"sap-icon\"\n [class.sap-icon--exitfullscreen]=\"state() === 'maximized'\"\n [class.sap-icon--full-screen]=\"state() !== 'maximized'\"\n aria-hidden=\"true\"\n ></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Collapse panel\"\n title=\"Collapse panel\"\n type=\"button\"\n (click)=\"collapse()\"\n >\n <i class=\"sap-icon sap-icon--collapse\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Close panel\"\n title=\"Close panel\"\n type=\"button\"\n (click)=\"close()\"\n >\n <i class=\"sap-icon sap-icon--decline\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </header>\n <div class=\"persistent-panel-body fd-dialog__body\">\n @if (closeError()) {\n <p class=\"persistent-panel-error\" role=\"alert\">{{ closeError() }}</p>\n } @if (source()) {\n <iframe\n #panelFrame\n id=\"persistent-panel-content\"\n class=\"persistent-panel-frame\"\n referrerpolicy=\"no-referrer\"\n sandbox=\"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts\"\n [src]=\"source()\"\n [title]=\"title()\"\n (load)=\"frameLoaded()\"\n ></iframe>\n }\n </div>\n</section>\n\n@if (state() === 'hidden' && source() && !closing()) {\n<button\n #reopenButton\n class=\"persistent-panel-reopen fd-button fd-button--emphasized fd-button--compact\"\n [attr.aria-label]=\"'Open ' + title()\"\n type=\"button\"\n (click)=\"expand()\"\n>\n {{ title() }}\n</button>\n}\n",
|
|
1398
|
+
styles: [":host{font-family:var(--sapFontFamily, \"72\", Arial, sans-serif)}.persistent-panel{position:fixed;top:var(--luigi__shellbar--height, 3.25rem);right:0;bottom:0;z-index:1000;display:none;box-sizing:border-box;min-width:0;max-width:none;min-height:0;max-height:none;width:var(--pm-panel-width, min(34rem, 100vw));background:var(--sapGroup_ContentBackground, #fff);border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0 var(--sapElement_BorderCornerRadius, .75rem);box-shadow:var(--sapContent_Shadow3, 0 0 0 .0625rem rgba(34, 53, 72, .48), 0 1.25rem 5rem rgba(34, 53, 72, .3))}:host-context(.lui-breadcrumb) .persistent-panel{top:calc(var(--luigi__shellbar--height, 3.25rem) + var(--luigi__breadcrumb--height, 2.75rem))}.persistent-panel.open{display:grid;grid-template-rows:auto minmax(0,1fr)}.persistent-panel-resizer{position:absolute;top:0;bottom:0;left:-.375rem;z-index:1;width:.75rem;cursor:col-resize;touch-action:none}.persistent-panel-resizer:after{position:absolute;top:50%;left:50%;width:.125rem;height:3rem;background:var(--sapContent_FocusColor, #0064d9);border-radius:.125rem;content:\"\";opacity:0;pointer-events:none;transform:translate(-50%,-50%);transition:opacity .12s ease-in-out}.persistent-panel-resizer:hover:after,.persistent-panel-resizer:focus-visible:after,.persistent-panel.resizing .persistent-panel-resizer:after{opacity:1}.persistent-panel-resizer:focus-visible{outline:0}.persistent-panel-resizer:focus-visible:after{outline:var(--sapContent_FocusWidth, .125rem) solid var(--sapContent_FocusColor, #0032a5);outline-offset:.125rem}.persistent-panel.maximized .persistent-panel-resizer{display:none}.persistent-panel-header{min-width:0;border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0}.persistent-panel-title-area,.persistent-panel-title-element{min-width:0}.persistent-panel-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.persistent-panel-body{display:flex;min-width:0;min-height:0;flex-direction:column;padding:0;overflow:hidden}.persistent-panel-error{flex:none;margin:0;padding:.5rem 1rem;color:var(--sapNegativeTextColor, #aa0808);background:var(--sapErrorBackground, #ffeaf4);font-size:var(--sapFontSmallSize, .75rem)}.persistent-panel-frame{min-height:0;flex:1;width:100%;border:0;border-bottom-left-radius:var(--sapElement_BorderCornerRadius, .75rem)}.persistent-panel.resizing,.persistent-panel.resizing .persistent-panel-resizer{cursor:col-resize}.persistent-panel.resizing .persistent-panel-frame{pointer-events:none;-webkit-user-select:none;user-select:none}.persistent-panel-reopen{position:fixed;right:1rem;bottom:1rem;z-index:1000;overflow:hidden;max-width:calc(100vw - 2rem);text-overflow:ellipsis;white-space:nowrap}@media(max-width:600px){.persistent-panel,.persistent-panel.maximized{left:0;width:100vw;border-radius:0;box-shadow:none}.persistent-panel-resizer{display:none}.persistent-panel-header,.persistent-panel-body,.persistent-panel-frame{border-radius:0}}\n"],
|
|
1399
|
+
dependencies: [{
|
|
1400
|
+
kind: "ngmodule",
|
|
1401
|
+
type: CommonModule
|
|
1402
|
+
}],
|
|
1403
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1408
|
+
minVersion: "12.0.0",
|
|
1409
|
+
version: "22.2.6",
|
|
1410
|
+
ngImport: i0,
|
|
1411
|
+
type: PersistentPanelComponent,
|
|
1412
|
+
decorators: [{
|
|
1413
|
+
type: Component,
|
|
1414
|
+
args: [{
|
|
1415
|
+
selector: "pm-persistent-panel",
|
|
1416
|
+
imports: [CommonModule],
|
|
1417
|
+
standalone: true,
|
|
1418
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1419
|
+
template: "<section\n class=\"persistent-panel fd-dialog__content\"\n role=\"complementary\"\n aria-labelledby=\"persistent-panel-title\"\n [attr.aria-hidden]=\"state() === 'hidden'\"\n [class.maximized]=\"state() === 'maximized'\"\n [class.open]=\"state() !== 'hidden'\"\n [class.resizing]=\"resizing()\"\n [style.--pm-panel-width]=\"panelWidth() + 'px'\"\n>\n <div\n class=\"persistent-panel-resizer\"\n role=\"separator\"\n aria-label=\"Resize provider panel\"\n aria-orientation=\"vertical\"\n aria-controls=\"persistent-panel-content\"\n [attr.aria-valuemin]=\"minPanelWidth()\"\n [attr.aria-valuemax]=\"maxPanelWidth()\"\n [attr.aria-valuenow]=\"panelWidth()\"\n tabindex=\"0\"\n (pointerdown)=\"beginResize($event)\"\n (pointermove)=\"resize($event)\"\n (pointerup)=\"finishResize($event)\"\n (pointercancel)=\"finishResize($event)\"\n (lostpointercapture)=\"finishResize($event)\"\n (keydown)=\"resizeWithKeyboard($event)\"\n ></div>\n <header\n class=\"persistent-panel-header fd-dialog__header fd-bar fd-bar--header\"\n >\n <div class=\"fd-bar__left persistent-panel-title-area\">\n <div class=\"fd-bar__element persistent-panel-title-element\">\n <h2\n id=\"persistent-panel-title\"\n class=\"fd-title fd-title--h5 persistent-panel-title\"\n >\n {{ title() }}\n </h2>\n </div>\n </div>\n <div class=\"fd-bar__right persistent-panel-actions\">\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Toggle panel size\"\n [attr.aria-pressed]=\"state() === 'maximized'\"\n title=\"Toggle panel size\"\n type=\"button\"\n (click)=\"toggleSize()\"\n >\n <i\n class=\"sap-icon\"\n [class.sap-icon--exitfullscreen]=\"state() === 'maximized'\"\n [class.sap-icon--full-screen]=\"state() !== 'maximized'\"\n aria-hidden=\"true\"\n ></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Collapse panel\"\n title=\"Collapse panel\"\n type=\"button\"\n (click)=\"collapse()\"\n >\n <i class=\"sap-icon sap-icon--collapse\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fd-bar__element\">\n <button\n class=\"fd-button fd-button--transparent fd-button--compact\"\n aria-label=\"Close panel\"\n title=\"Close panel\"\n type=\"button\"\n (click)=\"close()\"\n >\n <i class=\"sap-icon sap-icon--decline\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </header>\n <div class=\"persistent-panel-body fd-dialog__body\">\n @if (closeError()) {\n <p class=\"persistent-panel-error\" role=\"alert\">{{ closeError() }}</p>\n } @if (source()) {\n <iframe\n #panelFrame\n id=\"persistent-panel-content\"\n class=\"persistent-panel-frame\"\n referrerpolicy=\"no-referrer\"\n sandbox=\"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts\"\n [src]=\"source()\"\n [title]=\"title()\"\n (load)=\"frameLoaded()\"\n ></iframe>\n }\n </div>\n</section>\n\n@if (state() === 'hidden' && source() && !closing()) {\n<button\n #reopenButton\n class=\"persistent-panel-reopen fd-button fd-button--emphasized fd-button--compact\"\n [attr.aria-label]=\"'Open ' + title()\"\n type=\"button\"\n (click)=\"expand()\"\n>\n {{ title() }}\n</button>\n}\n",
|
|
1420
|
+
styles: [":host{font-family:var(--sapFontFamily, \"72\", Arial, sans-serif)}.persistent-panel{position:fixed;top:var(--luigi__shellbar--height, 3.25rem);right:0;bottom:0;z-index:1000;display:none;box-sizing:border-box;min-width:0;max-width:none;min-height:0;max-height:none;width:var(--pm-panel-width, min(34rem, 100vw));background:var(--sapGroup_ContentBackground, #fff);border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0 var(--sapElement_BorderCornerRadius, .75rem);box-shadow:var(--sapContent_Shadow3, 0 0 0 .0625rem rgba(34, 53, 72, .48), 0 1.25rem 5rem rgba(34, 53, 72, .3))}:host-context(.lui-breadcrumb) .persistent-panel{top:calc(var(--luigi__shellbar--height, 3.25rem) + var(--luigi__breadcrumb--height, 2.75rem))}.persistent-panel.open{display:grid;grid-template-rows:auto minmax(0,1fr)}.persistent-panel-resizer{position:absolute;top:0;bottom:0;left:-.375rem;z-index:1;width:.75rem;cursor:col-resize;touch-action:none}.persistent-panel-resizer:after{position:absolute;top:50%;left:50%;width:.125rem;height:3rem;background:var(--sapContent_FocusColor, #0064d9);border-radius:.125rem;content:\"\";opacity:0;pointer-events:none;transform:translate(-50%,-50%);transition:opacity .12s ease-in-out}.persistent-panel-resizer:hover:after,.persistent-panel-resizer:focus-visible:after,.persistent-panel.resizing .persistent-panel-resizer:after{opacity:1}.persistent-panel-resizer:focus-visible{outline:0}.persistent-panel-resizer:focus-visible:after{outline:var(--sapContent_FocusWidth, .125rem) solid var(--sapContent_FocusColor, #0032a5);outline-offset:.125rem}.persistent-panel.maximized .persistent-panel-resizer{display:none}.persistent-panel-header{min-width:0;border-radius:var(--sapElement_BorderCornerRadius, .75rem) 0 0}.persistent-panel-title-area,.persistent-panel-title-element{min-width:0}.persistent-panel-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.persistent-panel-body{display:flex;min-width:0;min-height:0;flex-direction:column;padding:0;overflow:hidden}.persistent-panel-error{flex:none;margin:0;padding:.5rem 1rem;color:var(--sapNegativeTextColor, #aa0808);background:var(--sapErrorBackground, #ffeaf4);font-size:var(--sapFontSmallSize, .75rem)}.persistent-panel-frame{min-height:0;flex:1;width:100%;border:0;border-bottom-left-radius:var(--sapElement_BorderCornerRadius, .75rem)}.persistent-panel.resizing,.persistent-panel.resizing .persistent-panel-resizer{cursor:col-resize}.persistent-panel.resizing .persistent-panel-frame{pointer-events:none;-webkit-user-select:none;user-select:none}.persistent-panel-reopen{position:fixed;right:1rem;bottom:1rem;z-index:1000;overflow:hidden;max-width:calc(100vw - 2rem);text-overflow:ellipsis;white-space:nowrap}@media(max-width:600px){.persistent-panel,.persistent-panel.maximized{left:0;width:100vw;border-radius:0;box-shadow:none}.persistent-panel-resizer{display:none}.persistent-panel-header,.persistent-panel-body,.persistent-panel-frame{border-radius:0}}\n"]
|
|
1421
|
+
}]
|
|
1422
|
+
}],
|
|
1423
|
+
ctorParameters: () => [],
|
|
1424
|
+
propDecorators: {
|
|
1425
|
+
panelFrame: [{
|
|
1426
|
+
type: ViewChild,
|
|
1427
|
+
args: ["panelFrame"]
|
|
1428
|
+
}],
|
|
1429
|
+
reopenButton: [{
|
|
1430
|
+
type: ViewChild,
|
|
1431
|
+
args: ["reopenButton"]
|
|
1432
|
+
}]
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1059
1435
|
function isRecord(value) {
|
|
1060
|
-
|
|
1436
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1061
1437
|
}
|
|
1062
1438
|
function panelDimensions() {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1439
|
+
const rootFontSize = Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize);
|
|
1440
|
+
const rem = Number.isFinite(rootFontSize) && rootFontSize > 0 ? rootFontSize : 16;
|
|
1441
|
+
return {
|
|
1442
|
+
defaultWidth: 34 * rem,
|
|
1443
|
+
minimumWidth: 20 * rem,
|
|
1444
|
+
keyboardStep: 2 * rem
|
|
1445
|
+
};
|
|
1070
1446
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1447
|
+
var PersistentPanelService = class PersistentPanelService {
|
|
1448
|
+
constructor() {
|
|
1449
|
+
this.appRef = inject(ApplicationRef);
|
|
1450
|
+
this.environmentInjector = inject(EnvironmentInjector);
|
|
1451
|
+
this.panelRef = null;
|
|
1452
|
+
this.target = {};
|
|
1453
|
+
this.navigationContext = {};
|
|
1454
|
+
this.targetUpdateSequence = 0;
|
|
1455
|
+
}
|
|
1456
|
+
open(config, target) {
|
|
1457
|
+
this.target = target;
|
|
1458
|
+
if (!this.panelRef) {
|
|
1459
|
+
this.panelRef = createComponent(PersistentPanelComponent, { environmentInjector: this.environmentInjector });
|
|
1460
|
+
this.appRef.attachView(this.panelRef.hostView);
|
|
1461
|
+
document.body.appendChild(this.panelRef.location.nativeElement);
|
|
1462
|
+
}
|
|
1463
|
+
this.panelRef.instance.open(config, target);
|
|
1464
|
+
this.panelRef.changeDetectorRef.detectChanges();
|
|
1465
|
+
}
|
|
1466
|
+
beginTargetUpdate() {
|
|
1467
|
+
const targetUpdateSequence = ++this.targetUpdateSequence;
|
|
1468
|
+
return (context) => {
|
|
1469
|
+
if (targetUpdateSequence !== this.targetUpdateSequence) return;
|
|
1470
|
+
this.updateTarget(context);
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
updateTarget(context) {
|
|
1474
|
+
const target = persistentPanelTarget({}, context);
|
|
1475
|
+
this.target = target;
|
|
1476
|
+
this.navigationContext = { ...context };
|
|
1477
|
+
this.panelRef?.instance.updateTarget(target);
|
|
1478
|
+
}
|
|
1479
|
+
currentTarget() {
|
|
1480
|
+
return structuredClone(this.target);
|
|
1481
|
+
}
|
|
1482
|
+
currentNavigationContext() {
|
|
1483
|
+
return { ...this.navigationContext };
|
|
1484
|
+
}
|
|
1485
|
+
destroy() {
|
|
1486
|
+
this.targetUpdateSequence += 1;
|
|
1487
|
+
if (this.panelRef) {
|
|
1488
|
+
const host = this.panelRef.location.nativeElement;
|
|
1489
|
+
this.appRef.detachView(this.panelRef.hostView);
|
|
1490
|
+
this.panelRef.destroy();
|
|
1491
|
+
host.remove();
|
|
1492
|
+
this.panelRef = null;
|
|
1493
|
+
}
|
|
1494
|
+
this.target = {};
|
|
1495
|
+
this.navigationContext = {};
|
|
1496
|
+
}
|
|
1497
|
+
ngOnDestroy() {
|
|
1498
|
+
this.destroy();
|
|
1499
|
+
}
|
|
1500
|
+
static {
|
|
1501
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1502
|
+
minVersion: "12.0.0",
|
|
1503
|
+
version: "22.2.6",
|
|
1504
|
+
ngImport: i0,
|
|
1505
|
+
type: PersistentPanelService,
|
|
1506
|
+
deps: [],
|
|
1507
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
static {
|
|
1511
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1512
|
+
minVersion: "12.0.0",
|
|
1513
|
+
version: "22.2.6",
|
|
1514
|
+
ngImport: i0,
|
|
1515
|
+
type: PersistentPanelService,
|
|
1516
|
+
providedIn: "root"
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1521
|
+
minVersion: "12.0.0",
|
|
1522
|
+
version: "22.2.6",
|
|
1523
|
+
ngImport: i0,
|
|
1524
|
+
type: PersistentPanelService,
|
|
1525
|
+
decorators: [{
|
|
1526
|
+
type: Injectable,
|
|
1527
|
+
args: [{ providedIn: "root" }]
|
|
1528
|
+
}]
|
|
1529
|
+
});
|
|
1134
1530
|
function collectAccountNamesFromNodeHierarchy(node) {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1145
|
-
return accountNames;
|
|
1531
|
+
const accountNames = [];
|
|
1532
|
+
let currentNode = node;
|
|
1533
|
+
while (currentNode) {
|
|
1534
|
+
const entityName = currentNode.context?.entityName;
|
|
1535
|
+
const entityKind = currentNode.context?.entityKind;
|
|
1536
|
+
if (entityName && entityKind?.toLowerCase() === "account") accountNames.unshift(entityName);
|
|
1537
|
+
currentNode = currentNode.parent;
|
|
1538
|
+
}
|
|
1539
|
+
return accountNames;
|
|
1146
1540
|
}
|
|
1147
1541
|
function getInitialAccountId(entityId, kind) {
|
|
1148
|
-
|
|
1542
|
+
return kind?.toLowerCase() === "account" && entityId ? entityId : void 0;
|
|
1149
1543
|
}
|
|
1150
1544
|
function calculateAccountHierarchy(entityNode, entityId, kind) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
accountNames.push(initialAccountId);
|
|
1160
|
-
}
|
|
1161
|
-
return accountNames;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
class CrdGatewayKcpPatchResolver {
|
|
1165
|
-
constructor() {
|
|
1166
|
-
this.gatewayService = inject(GatewayService);
|
|
1167
|
-
this.envConfigService = inject(EnvConfigService);
|
|
1168
|
-
}
|
|
1169
|
-
async resolveCrdGatewayKcpPath(nextNode, entityId, kind) {
|
|
1170
|
-
if (nextNode.context?.kcpPath && !getInitialAccountId(entityId, kind)) {
|
|
1171
|
-
this.gatewayService.updateCrdGatewayUrlWithEntityPath(nextNode.context.kcpPath);
|
|
1172
|
-
return {
|
|
1173
|
-
kcpPath: nextNode.context.kcpPath,
|
|
1174
|
-
accountPath: nextNode.context.accountPath,
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
const accountNames = calculateAccountHierarchy(nextNode, entityId, kind);
|
|
1178
|
-
const accountPath = accountNames.length > 0 ? `${accountNames.join(':')}` : '';
|
|
1179
|
-
const org = (await this.envConfigService.getEnvConfig()).idpName;
|
|
1180
|
-
const kcpPath = `${kcpRootOrgsPath}:${org}${accountPath ? ':' + accountPath : ''}`;
|
|
1181
|
-
this.gatewayService.updateCrdGatewayUrlWithEntityPath(kcpPath);
|
|
1182
|
-
if (nextNode.context) {
|
|
1183
|
-
nextNode.context.kcpPath = kcpPath;
|
|
1184
|
-
nextNode.context.accountPath = accountPath;
|
|
1185
|
-
}
|
|
1186
|
-
return { kcpPath, accountPath };
|
|
1187
|
-
}
|
|
1188
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CrdGatewayKcpPatchResolver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1189
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CrdGatewayKcpPatchResolver, providedIn: 'root' }); }
|
|
1190
|
-
}
|
|
1191
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: CrdGatewayKcpPatchResolver, decorators: [{
|
|
1192
|
-
type: Injectable,
|
|
1193
|
-
args: [{ providedIn: 'root' }]
|
|
1194
|
-
}] });
|
|
1195
|
-
|
|
1196
|
-
class NamespacedResourceSelectionService {
|
|
1197
|
-
constructor() {
|
|
1198
|
-
this.luigiCoreService = inject(LuigiCoreService);
|
|
1199
|
-
}
|
|
1200
|
-
resolveNamespace(entityNode, entityId, kcpPath, ctx) {
|
|
1201
|
-
const searchNamespace = this.getSelectedSearchNamespace();
|
|
1202
|
-
if (!isNamespacedResource(ctx)) {
|
|
1203
|
-
return searchNamespace;
|
|
1204
|
-
}
|
|
1205
|
-
const entityTypeId = entityNode.defineEntity?.id;
|
|
1206
|
-
const namespace = searchNamespace ??
|
|
1207
|
-
this.getSelectedNamespace(entityTypeId, entityId, kcpPath);
|
|
1208
|
-
this.selection =
|
|
1209
|
-
entityTypeId && namespace
|
|
1210
|
-
? { entityTypeId, entityId, kcpPath, namespace }
|
|
1211
|
-
: undefined;
|
|
1212
|
-
return namespace;
|
|
1213
|
-
}
|
|
1214
|
-
restoreNamespaceSearchParam(nextNode, currentContext) {
|
|
1215
|
-
const selection = this.selection;
|
|
1216
|
-
if (!selection) {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
if (!this.isWithinSelectedResource(nextNode, currentContext, selection)) {
|
|
1220
|
-
this.selection = undefined;
|
|
1221
|
-
return;
|
|
1222
|
-
}
|
|
1223
|
-
if (this.getSelectedSearchNamespace()) {
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
this.luigiCoreService
|
|
1227
|
-
.routing()
|
|
1228
|
-
.addSearchParams({ namespace: selection.namespace }, false, true);
|
|
1229
|
-
}
|
|
1230
|
-
getSelectedSearchNamespace() {
|
|
1231
|
-
const namespace = this.luigiCoreService.routing().getSearchParams()
|
|
1232
|
-
.namespace;
|
|
1233
|
-
return namespace && namespace !== ALL_NAMESPACE ? namespace : undefined;
|
|
1234
|
-
}
|
|
1235
|
-
getSelectedNamespace(entityTypeId, entityId, kcpPath) {
|
|
1236
|
-
const selection = this.selection;
|
|
1237
|
-
if (!selection ||
|
|
1238
|
-
selection.entityTypeId !== entityTypeId ||
|
|
1239
|
-
selection.entityId !== entityId ||
|
|
1240
|
-
selection.kcpPath !== kcpPath) {
|
|
1241
|
-
return undefined;
|
|
1242
|
-
}
|
|
1243
|
-
return selection.namespace;
|
|
1244
|
-
}
|
|
1245
|
-
isWithinSelectedResource(node, currentContext, selection) {
|
|
1246
|
-
for (let current = node; current; current = current.parent) {
|
|
1247
|
-
if (current.defineEntity?.id === selection.entityTypeId &&
|
|
1248
|
-
this.getEntityId(current, currentContext) === selection.entityId) {
|
|
1249
|
-
return true;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
return false;
|
|
1253
|
-
}
|
|
1254
|
-
getEntityId(entityNode, currentContext) {
|
|
1255
|
-
const contextKey = entityNode.defineEntity?.contextKey;
|
|
1256
|
-
const dynamicEntityId = contextKey
|
|
1257
|
-
? currentContext[contextKey]
|
|
1258
|
-
: undefined;
|
|
1259
|
-
return (dynamicEntityId ||
|
|
1260
|
-
entityNode.context?.resourceDefinition?.name);
|
|
1261
|
-
}
|
|
1262
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NamespacedResourceSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1263
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NamespacedResourceSelectionService, providedIn: 'root' }); }
|
|
1264
|
-
}
|
|
1265
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NamespacedResourceSelectionService, decorators: [{
|
|
1266
|
-
type: Injectable,
|
|
1267
|
-
args: [{ providedIn: 'root' }]
|
|
1268
|
-
}] });
|
|
1269
|
-
|
|
1270
|
-
class NodeChangeHookConfigServiceImpl {
|
|
1271
|
-
constructor() {
|
|
1272
|
-
this.luigiCoreService = inject(LuigiCoreService);
|
|
1273
|
-
this.crdGatewayKcpPatchResolver = inject(CrdGatewayKcpPatchResolver);
|
|
1274
|
-
this.errorHandlerService = inject(ErrorHandlerService);
|
|
1275
|
-
this.persistentPanelService = inject(PersistentPanelService);
|
|
1276
|
-
this.namespacedResourceSelectionService = inject(NamespacedResourceSelectionService);
|
|
1277
|
-
}
|
|
1278
|
-
async nodeChangeHook(prevNode, nextNode, currentContext) {
|
|
1279
|
-
if (this.errorHandlerService.navigateToErrorPageIfForbidden(nextNode.context?.entityErrorCode)) {
|
|
1280
|
-
return;
|
|
1281
|
-
}
|
|
1282
|
-
this.namespacedResourceSelectionService.restoreNamespaceSearchParam(nextNode, currentContext);
|
|
1283
|
-
const updatePersistentPanelTarget = this.persistentPanelService.beginTargetUpdate();
|
|
1284
|
-
if (nextNode.initialRoute && nextNode.virtualTree) {
|
|
1285
|
-
this.luigiCoreService.navigation().navigate(nextNode.initialRoute);
|
|
1286
|
-
}
|
|
1287
|
-
this.accumulatePortalPermissions(prevNode, nextNode, currentContext);
|
|
1288
|
-
await this.crdGatewayKcpPatchResolver.resolveCrdGatewayKcpPath(nextNode);
|
|
1289
|
-
updatePersistentPanelTarget({
|
|
1290
|
-
...currentContext,
|
|
1291
|
-
...(nextNode.context ?? {}),
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
accumulatePortalPermissions(prevNode, nextNode, currentContext) {
|
|
1295
|
-
const portalPermissions = prevNode?.context?.portalPermissions ??
|
|
1296
|
-
currentContext?.portalPermissions ??
|
|
1297
|
-
{};
|
|
1298
|
-
nextNode.context?.nodesPermissions?.forEach((permission) => {
|
|
1299
|
-
portalPermissions[permission.resource] = permission.actions;
|
|
1300
|
-
});
|
|
1301
|
-
currentContext.portalPermissions = portalPermissions;
|
|
1302
|
-
if (nextNode.context) {
|
|
1303
|
-
nextNode.context.portalPermissions = portalPermissions;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NodeChangeHookConfigServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1307
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NodeChangeHookConfigServiceImpl, providedIn: 'root' }); }
|
|
1545
|
+
const initialAccountId = getInitialAccountId(entityId, kind);
|
|
1546
|
+
if (entityNode.defineEntity?.contextKey && initialAccountId) {
|
|
1547
|
+
entityNode.context.entityName = void 0;
|
|
1548
|
+
entityNode.context.entityKind = void 0;
|
|
1549
|
+
}
|
|
1550
|
+
const accountNames = collectAccountNamesFromNodeHierarchy(entityNode);
|
|
1551
|
+
if (initialAccountId) accountNames.push(initialAccountId);
|
|
1552
|
+
return accountNames;
|
|
1308
1553
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1554
|
+
var CrdGatewayKcpPatchResolver = class CrdGatewayKcpPatchResolver {
|
|
1555
|
+
constructor() {
|
|
1556
|
+
this.gatewayService = inject(GatewayService);
|
|
1557
|
+
this.envConfigService = inject(EnvConfigService);
|
|
1558
|
+
}
|
|
1559
|
+
async resolveCrdGatewayKcpPath(nextNode, entityId, kind) {
|
|
1560
|
+
if (nextNode.context?.kcpPath && !getInitialAccountId(entityId, kind)) {
|
|
1561
|
+
this.gatewayService.updateCrdGatewayUrlWithEntityPath(nextNode.context.kcpPath);
|
|
1562
|
+
return {
|
|
1563
|
+
kcpPath: nextNode.context.kcpPath,
|
|
1564
|
+
accountPath: nextNode.context.accountPath
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
const accountNames = calculateAccountHierarchy(nextNode, entityId, kind);
|
|
1568
|
+
const accountPath = accountNames.length > 0 ? `${accountNames.join(":")}` : "";
|
|
1569
|
+
const org = (await this.envConfigService.getEnvConfig()).idpName;
|
|
1570
|
+
const kcpPath = `${kcpRootOrgsPath}:${org}${accountPath ? ":" + accountPath : ""}`;
|
|
1571
|
+
this.gatewayService.updateCrdGatewayUrlWithEntityPath(kcpPath);
|
|
1572
|
+
if (nextNode.context) {
|
|
1573
|
+
nextNode.context.kcpPath = kcpPath;
|
|
1574
|
+
nextNode.context.accountPath = accountPath;
|
|
1575
|
+
}
|
|
1576
|
+
return {
|
|
1577
|
+
kcpPath,
|
|
1578
|
+
accountPath
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
static {
|
|
1582
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1583
|
+
minVersion: "12.0.0",
|
|
1584
|
+
version: "22.2.6",
|
|
1585
|
+
ngImport: i0,
|
|
1586
|
+
type: CrdGatewayKcpPatchResolver,
|
|
1587
|
+
deps: [],
|
|
1588
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
static {
|
|
1592
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1593
|
+
minVersion: "12.0.0",
|
|
1594
|
+
version: "22.2.6",
|
|
1595
|
+
ngImport: i0,
|
|
1596
|
+
type: CrdGatewayKcpPatchResolver,
|
|
1597
|
+
providedIn: "root"
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
};
|
|
1601
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1602
|
+
minVersion: "12.0.0",
|
|
1603
|
+
version: "22.2.6",
|
|
1604
|
+
ngImport: i0,
|
|
1605
|
+
type: CrdGatewayKcpPatchResolver,
|
|
1606
|
+
decorators: [{
|
|
1607
|
+
type: Injectable,
|
|
1608
|
+
args: [{ providedIn: "root" }]
|
|
1609
|
+
}]
|
|
1610
|
+
});
|
|
1611
|
+
var NamespacedResourceSelectionService = class NamespacedResourceSelectionService {
|
|
1612
|
+
constructor() {
|
|
1613
|
+
this.luigiCoreService = inject(LuigiCoreService);
|
|
1614
|
+
}
|
|
1615
|
+
resolveNamespace(entityNode, entityId, kcpPath, ctx) {
|
|
1616
|
+
const searchNamespace = this.getSelectedSearchNamespace();
|
|
1617
|
+
if (!isNamespacedResource(ctx)) return searchNamespace;
|
|
1618
|
+
const entityTypeId = entityNode.defineEntity?.id;
|
|
1619
|
+
const namespace = searchNamespace ?? this.getSelectedNamespace(entityTypeId, entityId, kcpPath);
|
|
1620
|
+
this.selection = entityTypeId && namespace ? {
|
|
1621
|
+
entityTypeId,
|
|
1622
|
+
entityId,
|
|
1623
|
+
kcpPath,
|
|
1624
|
+
namespace
|
|
1625
|
+
} : void 0;
|
|
1626
|
+
return namespace;
|
|
1627
|
+
}
|
|
1628
|
+
restoreNamespaceSearchParam(nextNode, currentContext) {
|
|
1629
|
+
const selection = this.selection;
|
|
1630
|
+
if (!selection) return;
|
|
1631
|
+
if (!this.isWithinSelectedResource(nextNode, currentContext, selection)) {
|
|
1632
|
+
this.selection = void 0;
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
if (this.getSelectedSearchNamespace()) return;
|
|
1636
|
+
this.luigiCoreService.routing().addSearchParams({ namespace: selection.namespace }, false, true);
|
|
1637
|
+
}
|
|
1638
|
+
getSelectedSearchNamespace() {
|
|
1639
|
+
const namespace = this.luigiCoreService.routing().getSearchParams().namespace;
|
|
1640
|
+
return namespace && namespace !== ALL_NAMESPACE ? namespace : void 0;
|
|
1641
|
+
}
|
|
1642
|
+
getSelectedNamespace(entityTypeId, entityId, kcpPath) {
|
|
1643
|
+
const selection = this.selection;
|
|
1644
|
+
if (!selection || selection.entityTypeId !== entityTypeId || selection.entityId !== entityId || selection.kcpPath !== kcpPath) return;
|
|
1645
|
+
return selection.namespace;
|
|
1646
|
+
}
|
|
1647
|
+
isWithinSelectedResource(node, currentContext, selection) {
|
|
1648
|
+
for (let current = node; current; current = current.parent) if (current.defineEntity?.id === selection.entityTypeId && this.getEntityId(current, currentContext) === selection.entityId) return true;
|
|
1649
|
+
return false;
|
|
1650
|
+
}
|
|
1651
|
+
getEntityId(entityNode, currentContext) {
|
|
1652
|
+
const contextKey = entityNode.defineEntity?.contextKey;
|
|
1653
|
+
return (contextKey ? currentContext[contextKey] : void 0) || entityNode.context?.resourceDefinition?.name;
|
|
1654
|
+
}
|
|
1655
|
+
static {
|
|
1656
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1657
|
+
minVersion: "12.0.0",
|
|
1658
|
+
version: "22.2.6",
|
|
1659
|
+
ngImport: i0,
|
|
1660
|
+
type: NamespacedResourceSelectionService,
|
|
1661
|
+
deps: [],
|
|
1662
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
static {
|
|
1666
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1667
|
+
minVersion: "12.0.0",
|
|
1668
|
+
version: "22.2.6",
|
|
1669
|
+
ngImport: i0,
|
|
1670
|
+
type: NamespacedResourceSelectionService,
|
|
1671
|
+
providedIn: "root"
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1676
|
+
minVersion: "12.0.0",
|
|
1677
|
+
version: "22.2.6",
|
|
1678
|
+
ngImport: i0,
|
|
1679
|
+
type: NamespacedResourceSelectionService,
|
|
1680
|
+
decorators: [{
|
|
1681
|
+
type: Injectable,
|
|
1682
|
+
args: [{ providedIn: "root" }]
|
|
1683
|
+
}]
|
|
1684
|
+
});
|
|
1685
|
+
var NodeChangeHookConfigServiceImpl = class NodeChangeHookConfigServiceImpl {
|
|
1686
|
+
constructor() {
|
|
1687
|
+
this.luigiCoreService = inject(LuigiCoreService);
|
|
1688
|
+
this.crdGatewayKcpPatchResolver = inject(CrdGatewayKcpPatchResolver);
|
|
1689
|
+
this.errorHandlerService = inject(ErrorHandlerService);
|
|
1690
|
+
this.persistentPanelService = inject(PersistentPanelService);
|
|
1691
|
+
this.namespacedResourceSelectionService = inject(NamespacedResourceSelectionService);
|
|
1692
|
+
}
|
|
1693
|
+
async nodeChangeHook(prevNode, nextNode, currentContext) {
|
|
1694
|
+
if (this.errorHandlerService.navigateToErrorPageIfForbidden(nextNode.context?.entityErrorCode)) return;
|
|
1695
|
+
this.namespacedResourceSelectionService.restoreNamespaceSearchParam(nextNode, currentContext);
|
|
1696
|
+
const updatePersistentPanelTarget = this.persistentPanelService.beginTargetUpdate();
|
|
1697
|
+
if (nextNode.initialRoute && nextNode.virtualTree) this.luigiCoreService.navigation().navigate(nextNode.initialRoute);
|
|
1698
|
+
this.accumulatePortalPermissions(prevNode, nextNode, currentContext);
|
|
1699
|
+
await this.crdGatewayKcpPatchResolver.resolveCrdGatewayKcpPath(nextNode);
|
|
1700
|
+
updatePersistentPanelTarget({
|
|
1701
|
+
...currentContext,
|
|
1702
|
+
...withResolvedPathParams(nextNode.context, currentContext)
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
accumulatePortalPermissions(prevNode, nextNode, currentContext) {
|
|
1706
|
+
const portalPermissions = prevNode?.context?.portalPermissions ?? currentContext?.portalPermissions ?? {};
|
|
1707
|
+
nextNode.context?.nodesPermissions?.forEach((permission) => {
|
|
1708
|
+
portalPermissions[permission.resource] = permission.actions;
|
|
1709
|
+
});
|
|
1710
|
+
currentContext.portalPermissions = portalPermissions;
|
|
1711
|
+
if (nextNode.context) nextNode.context.portalPermissions = portalPermissions;
|
|
1712
|
+
}
|
|
1713
|
+
static {
|
|
1714
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1715
|
+
minVersion: "12.0.0",
|
|
1716
|
+
version: "22.2.6",
|
|
1717
|
+
ngImport: i0,
|
|
1718
|
+
type: NodeChangeHookConfigServiceImpl,
|
|
1719
|
+
deps: [],
|
|
1720
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
static {
|
|
1724
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1725
|
+
minVersion: "12.0.0",
|
|
1726
|
+
version: "22.2.6",
|
|
1727
|
+
ngImport: i0,
|
|
1728
|
+
type: NodeChangeHookConfigServiceImpl,
|
|
1729
|
+
providedIn: "root"
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
};
|
|
1733
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1734
|
+
minVersion: "12.0.0",
|
|
1735
|
+
version: "22.2.6",
|
|
1736
|
+
ngImport: i0,
|
|
1737
|
+
type: NodeChangeHookConfigServiceImpl,
|
|
1738
|
+
decorators: [{
|
|
1739
|
+
type: Injectable,
|
|
1740
|
+
args: [{ providedIn: "root" }]
|
|
1741
|
+
}]
|
|
1742
|
+
});
|
|
1314
1743
|
const ORGANIZATION_NOT_READY_ERROR_CODE = 503;
|
|
1315
|
-
class NodeContextProcessingServiceImpl {
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1744
|
+
var NodeContextProcessingServiceImpl = class NodeContextProcessingServiceImpl {
|
|
1745
|
+
constructor() {
|
|
1746
|
+
this.crdGatewayKcpPatchResolver = inject(CrdGatewayKcpPatchResolver);
|
|
1747
|
+
this.accountInfoService = inject(AccountInfoService);
|
|
1748
|
+
this.instancePermissionsService = inject(InstancePermissionsService);
|
|
1749
|
+
this.organizationReadyService = inject(OrganizationReadyService);
|
|
1750
|
+
this.errorHandlerService = inject(ErrorHandlerService);
|
|
1751
|
+
this.namespaceService = inject(NamespaceService);
|
|
1752
|
+
this.namespacedResourceSelectionService = inject(NamespacedResourceSelectionService);
|
|
1753
|
+
}
|
|
1754
|
+
async processNodeContext(dynamicEntityId, entityNode, ctx) {
|
|
1755
|
+
const kind = entityNode.defineEntity?.type;
|
|
1756
|
+
const entityId = dynamicEntityId || entityNode.context.resourceDefinition?.name;
|
|
1757
|
+
if (!entityId || ctx.entityErrorCode) return;
|
|
1758
|
+
const { kcpPath, accountPath } = await this.crdGatewayKcpPatchResolver.resolveCrdGatewayKcpPath(entityNode, entityId, kind);
|
|
1759
|
+
const namespace = this.namespacedResourceSelectionService.resolveNamespace(entityNode, entityId, kcpPath, ctx);
|
|
1760
|
+
this.addFieldsToContext(ctx, entityId, kcpPath, accountPath, kind, namespace);
|
|
1761
|
+
this.addFieldsToContext(entityNode.context, entityId, kcpPath, accountPath, kind, namespace);
|
|
1762
|
+
await this.addNamespacesToContext(ctx, namespace);
|
|
1763
|
+
this.accamulatePortalPermissions(ctx);
|
|
1764
|
+
this.getEntityPermissions(ctx, namespace);
|
|
1765
|
+
try {
|
|
1766
|
+
const accountInfo = await firstValueFrom(this.accountInfoService.read({
|
|
1767
|
+
portalContext: { crdGatewayApiUrl: ctx.portalContext.crdGatewayApiUrl },
|
|
1768
|
+
token: ctx.token,
|
|
1769
|
+
accountId: entityId
|
|
1770
|
+
}));
|
|
1771
|
+
this.addFieldsToContextFromAccountInfo(ctx, entityId, accountInfo);
|
|
1772
|
+
this.addFieldsToContextFromAccountInfo(entityNode.context, entityId, accountInfo);
|
|
1773
|
+
if (!await this.organizationReadyService.isOrganizationReady()) ctx.entityErrorCode = ORGANIZATION_NOT_READY_ERROR_CODE;
|
|
1774
|
+
} catch (e) {
|
|
1775
|
+
ctx.entityErrorCode = this.errorHandlerService.errorCode(e);
|
|
1776
|
+
console.error("Failed to read account info.", e);
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
addFieldsToContext(ctx, entityId, kcpPath, accountPath, kind, namespace) {
|
|
1780
|
+
ctx.kcpPath = kcpPath;
|
|
1781
|
+
ctx.entityName = entityId;
|
|
1782
|
+
ctx.entityKind = kind;
|
|
1783
|
+
ctx.accountPath = accountPath;
|
|
1784
|
+
ctx.namespaceId = namespace;
|
|
1785
|
+
}
|
|
1786
|
+
async addNamespacesToContext(ctx, namespace) {
|
|
1787
|
+
if (!isNamespacedResource(ctx) || namespace) return;
|
|
1788
|
+
try {
|
|
1789
|
+
ctx.namespaces = await firstValueFrom(this.namespaceService.list(ctx));
|
|
1790
|
+
} catch (e) {
|
|
1791
|
+
this.errorHandlerService.handleError(e, "Failed to read namespaces.");
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
addFieldsToContextFromAccountInfo(ctx, entityId, accountInfo) {
|
|
1795
|
+
const accountOriginClusterId = accountInfo.spec.account.originClusterId;
|
|
1796
|
+
ctx.organizationId = `${accountInfo.spec.organization.originClusterId}/${accountInfo.spec.organization.name}`;
|
|
1797
|
+
ctx.entityId = `${accountOriginClusterId}/${entityId}`;
|
|
1798
|
+
ctx.kcpCA = btoa(accountInfo.spec.clusterInfo.ca);
|
|
1799
|
+
}
|
|
1800
|
+
getEntityPermissions(ctx, namespace) {
|
|
1801
|
+
const resourceDefinition = ctx.resourceDefinition;
|
|
1802
|
+
if (!resourceDefinition || !resourceDefinition?.permissionsDefinition) return;
|
|
1803
|
+
const name = ctx[resourceDefinition.permissionsDefinition.entityContextKey];
|
|
1804
|
+
if (!name) return;
|
|
1805
|
+
return this.instancePermissionsService.checkInstance(ctx, resourceDefinition.permissionsDefinition, {
|
|
1806
|
+
name,
|
|
1807
|
+
namespace
|
|
1808
|
+
}).subscribe((result) => {
|
|
1809
|
+
const portalPermissions = ctx.portalPermissions ?? {};
|
|
1810
|
+
result.forEach((permission) => {
|
|
1811
|
+
portalPermissions[`${permissionKey(permission)}`] = permission.actions;
|
|
1812
|
+
});
|
|
1813
|
+
ctx.portalPermissions = portalPermissions;
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
accamulatePortalPermissions(ctx) {
|
|
1817
|
+
const portalPermissions = ctx.portalPermissions ?? {};
|
|
1818
|
+
ctx.nodesPermissions?.forEach((permission) => {
|
|
1819
|
+
portalPermissions[permission.resource] = permission.actions;
|
|
1820
|
+
});
|
|
1821
|
+
ctx.portalPermissions = portalPermissions;
|
|
1822
|
+
}
|
|
1823
|
+
static {
|
|
1824
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1825
|
+
minVersion: "12.0.0",
|
|
1826
|
+
version: "22.2.6",
|
|
1827
|
+
ngImport: i0,
|
|
1828
|
+
type: NodeContextProcessingServiceImpl,
|
|
1829
|
+
deps: [],
|
|
1830
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
static {
|
|
1834
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1835
|
+
minVersion: "12.0.0",
|
|
1836
|
+
version: "22.2.6",
|
|
1837
|
+
ngImport: i0,
|
|
1838
|
+
type: NodeContextProcessingServiceImpl,
|
|
1839
|
+
providedIn: "root"
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
};
|
|
1843
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1844
|
+
minVersion: "12.0.0",
|
|
1845
|
+
version: "22.2.6",
|
|
1846
|
+
ngImport: i0,
|
|
1847
|
+
type: NodeContextProcessingServiceImpl,
|
|
1848
|
+
decorators: [{
|
|
1849
|
+
type: Injectable,
|
|
1850
|
+
args: [{ providedIn: "root" }]
|
|
1851
|
+
}]
|
|
1852
|
+
});
|
|
1853
|
+
var CustomRoutingConfigServiceImpl = class CustomRoutingConfigServiceImpl {
|
|
1854
|
+
constructor() {
|
|
1855
|
+
this.envConfigService = inject(EnvConfigService);
|
|
1856
|
+
this.envConfig = null;
|
|
1857
|
+
this.getEnvConfig();
|
|
1858
|
+
}
|
|
1859
|
+
async getEnvConfig() {
|
|
1860
|
+
this.envConfig = await this.envConfigService.getEnvConfig();
|
|
1861
|
+
}
|
|
1862
|
+
getRoutingConfig() {
|
|
1863
|
+
return { pageNotFoundHandler: () => {
|
|
1864
|
+
if (!this.envConfig?.baseDomain) return this.redirectTo("error/404");
|
|
1865
|
+
if (window.location.hostname === this.envConfig.baseDomain) return this.redirectTo("welcome");
|
|
1866
|
+
return this.redirectTo("error/404");
|
|
1867
|
+
} };
|
|
1868
|
+
}
|
|
1869
|
+
redirectTo(path, keepURL = true) {
|
|
1870
|
+
return {
|
|
1871
|
+
redirectTo: path,
|
|
1872
|
+
keepURL
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
static {
|
|
1876
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1877
|
+
minVersion: "12.0.0",
|
|
1878
|
+
version: "22.2.6",
|
|
1879
|
+
ngImport: i0,
|
|
1880
|
+
type: CustomRoutingConfigServiceImpl,
|
|
1881
|
+
deps: [],
|
|
1882
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1883
|
+
});
|
|
1884
|
+
}
|
|
1885
|
+
static {
|
|
1886
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1887
|
+
minVersion: "12.0.0",
|
|
1888
|
+
version: "22.2.6",
|
|
1889
|
+
ngImport: i0,
|
|
1890
|
+
type: CustomRoutingConfigServiceImpl
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1895
|
+
minVersion: "12.0.0",
|
|
1896
|
+
version: "22.2.6",
|
|
1897
|
+
ngImport: i0,
|
|
1898
|
+
type: CustomRoutingConfigServiceImpl,
|
|
1899
|
+
decorators: [{ type: Injectable }],
|
|
1900
|
+
ctorParameters: () => []
|
|
1901
|
+
});
|
|
1902
|
+
var UserProfileConfigServiceImpl = class UserProfileConfigServiceImpl {
|
|
1903
|
+
constructor() {
|
|
1904
|
+
this.authService = inject(AuthService);
|
|
1905
|
+
}
|
|
1906
|
+
async getProfile() {
|
|
1907
|
+
const { email } = this.authService.getUserInfo();
|
|
1908
|
+
return { items: [{
|
|
1909
|
+
label: "PROFILE_PROFILE",
|
|
1910
|
+
icon: "customer",
|
|
1911
|
+
link: `/users/${email}/overview`
|
|
1912
|
+
}] };
|
|
1913
|
+
}
|
|
1914
|
+
static {
|
|
1915
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1916
|
+
minVersion: "12.0.0",
|
|
1917
|
+
version: "22.2.6",
|
|
1918
|
+
ngImport: i0,
|
|
1919
|
+
type: UserProfileConfigServiceImpl,
|
|
1920
|
+
deps: [],
|
|
1921
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1924
|
+
static {
|
|
1925
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1926
|
+
minVersion: "12.0.0",
|
|
1927
|
+
version: "22.2.6",
|
|
1928
|
+
ngImport: i0,
|
|
1929
|
+
type: UserProfileConfigServiceImpl,
|
|
1930
|
+
providedIn: "root"
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
};
|
|
1934
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1935
|
+
minVersion: "12.0.0",
|
|
1936
|
+
version: "22.2.6",
|
|
1937
|
+
ngImport: i0,
|
|
1938
|
+
type: UserProfileConfigServiceImpl,
|
|
1939
|
+
decorators: [{
|
|
1940
|
+
type: Injectable,
|
|
1941
|
+
args: [{ providedIn: "root" }]
|
|
1942
|
+
}]
|
|
1943
|
+
});
|
|
1944
|
+
var OpenPersistentPanelListener = class OpenPersistentPanelListener {
|
|
1945
|
+
constructor() {
|
|
1946
|
+
this.luigiCoreService = inject(LuigiCoreService);
|
|
1947
|
+
this.persistentPanelService = inject(PersistentPanelService);
|
|
1948
|
+
}
|
|
1949
|
+
messageId() {
|
|
1950
|
+
return OPEN_PERSISTENT_PANEL_MESSAGE;
|
|
1951
|
+
}
|
|
1952
|
+
onCustomMessageReceived(customMessage, _microFrontend, microFrontendNode) {
|
|
1953
|
+
const globalContext = this.luigiCoreService.getGlobalContext();
|
|
1954
|
+
const navigationContext = {
|
|
1955
|
+
...globalContext,
|
|
1956
|
+
...this.persistentPanelService.currentNavigationContext()
|
|
1957
|
+
};
|
|
1958
|
+
const nodeContext = withResolvedPathParams(microFrontendNode?.context, navigationContext);
|
|
1959
|
+
const config = parsePersistentPanelConfig(customMessage, microFrontendNode, new URL(document.baseURI).origin, {
|
|
1960
|
+
context: {
|
|
1961
|
+
...navigationContext,
|
|
1962
|
+
...nodeContext
|
|
1963
|
+
},
|
|
1964
|
+
nodeParams: this.currentNodeParams()
|
|
1965
|
+
});
|
|
1966
|
+
const target = mergePersistentPanelTargets(this.persistentPanelService.currentTarget(), persistentPanelTarget(globalContext, nodeContext));
|
|
1967
|
+
this.persistentPanelService.open(config, target);
|
|
1968
|
+
}
|
|
1969
|
+
currentNodeParams() {
|
|
1970
|
+
const configuredPrefix = this.luigiCoreService.getConfigValue("routing.nodeParamPrefix");
|
|
1971
|
+
const prefix = configuredPrefix === false ? "" : configuredPrefix || "~";
|
|
1972
|
+
const searchParams = this.luigiCoreService.routing().getSearchParams();
|
|
1973
|
+
return Object.fromEntries(Object.entries(searchParams).filter(([key]) => key.startsWith(prefix)).map(([key, value]) => [key.slice(prefix.length), this.sanitizeNodeParam(value)]));
|
|
1974
|
+
}
|
|
1975
|
+
sanitizeNodeParam(value) {
|
|
1976
|
+
return String(value).replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/\//g, "/");
|
|
1977
|
+
}
|
|
1978
|
+
static {
|
|
1979
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1980
|
+
minVersion: "12.0.0",
|
|
1981
|
+
version: "22.2.6",
|
|
1982
|
+
ngImport: i0,
|
|
1983
|
+
type: OpenPersistentPanelListener,
|
|
1984
|
+
deps: [],
|
|
1985
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
static {
|
|
1989
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
1990
|
+
minVersion: "12.0.0",
|
|
1991
|
+
version: "22.2.6",
|
|
1992
|
+
ngImport: i0,
|
|
1993
|
+
type: OpenPersistentPanelListener,
|
|
1994
|
+
providedIn: "root"
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1999
|
+
minVersion: "12.0.0",
|
|
2000
|
+
version: "22.2.6",
|
|
2001
|
+
ngImport: i0,
|
|
2002
|
+
type: OpenPersistentPanelListener,
|
|
2003
|
+
decorators: [{
|
|
2004
|
+
type: Injectable,
|
|
2005
|
+
args: [{ providedIn: "root" }]
|
|
2006
|
+
}]
|
|
2007
|
+
});
|
|
1512
2008
|
export { CustomGlobalNodesServiceImpl, CustomNodeProcessingServiceImpl, CustomRoutingConfigServiceImpl, HeaderBarConfigServiceImpl, LuigiExtendedGlobalContextConfigServiceImpl, NavigationRedirectStrategyServiceImpl, NodeChangeHookConfigServiceImpl, NodeContextProcessingServiceImpl, OpenPersistentPanelListener, UserProfileConfigServiceImpl, errorComponentConfig };
|
|
1513
|
-
|
|
2009
|
+
|
|
2010
|
+
//# sourceMappingURL=platform-mesh-portal-ui-lib-portal-options.mjs.map
|