dash-button-web 0.0.24 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/dash-button_4.cjs.entry.js +11790 -0
- package/dist/cjs/index-CyJNVLIY.js +1623 -0
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +5 -7
- package/dist/cjs/web-compnont.cjs.js +15 -15
- package/dist/collection/collection-manifest.json +13 -3
- package/dist/collection/components/my-component/dash-button.css +58 -0
- package/dist/collection/components/my-component/dash-button.js +213 -88
- package/dist/collection/index.js +0 -1
- package/dist/collection/services/config.js +3 -5
- package/dist/collection/services/menu.js +4 -5
- package/dist/components/dash-button.js +1 -4310
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -3
- package/dist/components/loading-component.js +1 -0
- package/dist/components/loading-component2.js +1 -0
- package/dist/components/notification-component.js +1 -0
- package/dist/components/notification-component2.js +1 -0
- package/dist/components/notification-table.js +1 -0
- package/dist/components/notification-table2.js +2 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/dash-button_4.entry.js +11785 -0
- package/dist/esm/index-NLvZO6-E.js +1615 -0
- package/dist/esm/index.js +0 -2
- package/dist/esm/loader.js +6 -6
- package/dist/esm/web-compnont.js +15 -14
- package/dist/types/components/my-component/dash-button.d.ts +11 -1
- package/dist/types/components.d.ts +83 -2
- package/dist/types/services/menu.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +268 -70
- package/dist/web-compnont/index.esm.js +0 -2
- package/dist/web-compnont/p-DQuL1Twl.js +1 -0
- package/dist/web-compnont/p-NLvZO6-E.js +3 -0
- package/dist/web-compnont/p-ce35027b.entry.js +2 -0
- package/dist/web-compnont/web-compnont.esm.js +1 -2
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +4 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/package.json +3 -2
- package/dist/cjs/dash-button.cjs.entry.js +0 -4274
- package/dist/cjs/dash-button.cjs.entry.js.map +0 -1
- package/dist/cjs/index-bc7ebbee.js +0 -1817
- package/dist/cjs/index-bc7ebbee.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/web-compnont.cjs.js.map +0 -1
- package/dist/collection/components/my-component/dash-button.e2e.js +0 -26
- package/dist/collection/components/my-component/dash-button.e2e.js.map +0 -1
- package/dist/collection/components/my-component/dash-button.js.map +0 -1
- package/dist/collection/components/my-component/dash-button.spec.js +0 -35
- package/dist/collection/components/my-component/dash-button.spec.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/services/config.js.map +0 -1
- package/dist/collection/services/menu.js.map +0 -1
- package/dist/components/dash-button.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/esm/dash-button.entry.js +0 -4270
- package/dist/esm/dash-button.entry.js.map +0 -1
- package/dist/esm/index-51aa24d3.js +0 -1790
- package/dist/esm/index-51aa24d3.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/web-compnont.js.map +0 -1
- package/dist/web-compnont/index.esm.js.map +0 -1
- package/dist/web-compnont/p-06623215.js +0 -3
- package/dist/web-compnont/p-06623215.js.map +0 -1
- package/dist/web-compnont/p-55f91c48.entry.js +0 -10
- package/dist/web-compnont/p-55f91c48.entry.js.map +0 -1
- package/dist/web-compnont/web-compnont.esm.js.map +0 -1
- package/loader/package.json +0 -11
|
@@ -3,49 +3,58 @@ import Keycloak from "keycloak-js";
|
|
|
3
3
|
import { toSvg } from "jdenticon";
|
|
4
4
|
import { configService } from "../../services/config";
|
|
5
5
|
import { menuService } from "../../services/menu";
|
|
6
|
+
import "ice-notification-component";
|
|
6
7
|
export class DashButtonComponent {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
8
|
+
el;
|
|
9
|
+
showPostLoginText = false;
|
|
10
|
+
silentCheckSso = false;
|
|
11
|
+
redirectUri;
|
|
12
|
+
authMethod = "check-sso";
|
|
13
|
+
portalApiUrl = "";
|
|
14
|
+
plmUrl = "https://productlicensemanager-zdzw.cloud.zdzw-project.com";
|
|
15
|
+
showUnauthorizedModal = false;
|
|
16
|
+
primaryColor = "";
|
|
17
|
+
accentColor = "";
|
|
18
|
+
keycloak = null;
|
|
19
|
+
isAuth = false;
|
|
20
|
+
givenUserName = "";
|
|
21
|
+
silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
|
|
22
|
+
appList = [];
|
|
23
|
+
avatarSvg = toSvg("init-avatar", 40);
|
|
24
|
+
isLoading = false;
|
|
25
|
+
config;
|
|
26
|
+
localMenuLinks;
|
|
27
|
+
organizationUrl;
|
|
28
|
+
isRestricted = false;
|
|
29
|
+
showNotification = true;
|
|
30
|
+
notificationPosition = 'left';
|
|
31
|
+
// Accordion: at most one of the two sections is collapsed at a time.
|
|
32
|
+
// Collapsing one always leaves the other expanded.
|
|
33
|
+
collapsedModuleSection = null;
|
|
34
|
+
gridLocalListEl;
|
|
35
|
+
listLocalScrollEl;
|
|
36
|
+
toggleGlobalModules = () => {
|
|
37
|
+
this.collapsedModuleSection = this.collapsedModuleSection === 'global' ? null : 'global';
|
|
38
|
+
};
|
|
39
|
+
toggleLocalModules = () => {
|
|
40
|
+
this.collapsedModuleSection = this.collapsedModuleSection === 'local' ? null : 'local';
|
|
41
|
+
};
|
|
42
|
+
// The dropdown only becomes visible via CSS :hover (no JS "opened" event),
|
|
43
|
+
// and componentDidRender's measurement can run while it's still
|
|
44
|
+
// display:none — offsetHeight is always 0 for a hidden subtree, so that
|
|
45
|
+
// first measurement can permanently stick maxHeight at 0px. Re-measuring
|
|
46
|
+
// on mouseenter (when the dropdown is guaranteed visible) fixes it.
|
|
47
|
+
handleDropdownMouseEnter = () => {
|
|
48
|
+
this.capToRowPeek(this.gridLocalListEl, 2.5);
|
|
49
|
+
this.capToRowPeek(this.listLocalScrollEl, 2.5);
|
|
50
|
+
};
|
|
45
51
|
componentDidRender() {
|
|
46
52
|
this.capToRowPeek(this.gridLocalListEl, 2.5);
|
|
47
53
|
this.capToRowPeek(this.listLocalScrollEl, 2.5);
|
|
48
54
|
}
|
|
55
|
+
componentDidLoad() {
|
|
56
|
+
document.addEventListener('click', this.handleNotificationLinkClick, true);
|
|
57
|
+
}
|
|
49
58
|
// Caps a container to `rows` times its first item's rendered height, so
|
|
50
59
|
// Local Modules always shows a partial next row as a "scroll for more"
|
|
51
60
|
// cue instead of a clean cut. Measured off the real item (icon size,
|
|
@@ -62,19 +71,35 @@ export class DashButtonComponent {
|
|
|
62
71
|
}
|
|
63
72
|
container.style.maxHeight = `${firstItem.offsetHeight * rows}px`;
|
|
64
73
|
}
|
|
74
|
+
disconnectedCallback() {
|
|
75
|
+
document.removeEventListener('click', this.handleNotificationLinkClick, true);
|
|
76
|
+
}
|
|
77
|
+
// Fix notification home icon click not opening a new tab
|
|
78
|
+
// (workaround for ice-notification-component shadow DOM click bug)
|
|
79
|
+
handleNotificationLinkClick = (event) => {
|
|
80
|
+
const path = event.composedPath();
|
|
81
|
+
const insideNotification = path.some((node) => node.tagName === 'NOTIFICATION-COMPONENT');
|
|
82
|
+
if (!insideNotification)
|
|
83
|
+
return;
|
|
84
|
+
const anchor = path.find((node) => node.tagName === 'A' && node.target === '_blank');
|
|
85
|
+
if (!anchor || !anchor.href)
|
|
86
|
+
return;
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
window.open(anchor.href, '_blank', 'noopener');
|
|
90
|
+
};
|
|
65
91
|
async componentWillLoad() {
|
|
66
|
-
var _a, _b, _c, _d;
|
|
67
92
|
// Fetch config from API
|
|
68
93
|
this.config = await configService.fetchConfig(this.portalApiUrl);
|
|
69
94
|
console.log(this.config);
|
|
70
95
|
if (!this.config)
|
|
71
96
|
return; // prevent Keycloak init if fetch failed
|
|
72
97
|
// render will show spinner
|
|
73
|
-
if (
|
|
98
|
+
if (this.config?.loading?.isLoading) {
|
|
74
99
|
this.isLoading = true;
|
|
75
100
|
setTimeout(() => {
|
|
76
101
|
this.isLoading = false;
|
|
77
|
-
},
|
|
102
|
+
}, this.config?.loading?.duration);
|
|
78
103
|
}
|
|
79
104
|
// Initialize Keycloak
|
|
80
105
|
this.keycloak = new Keycloak({
|
|
@@ -105,39 +130,39 @@ export class DashButtonComponent {
|
|
|
105
130
|
checkLoginIframe: false,
|
|
106
131
|
silentCheckSsoRedirectUri: this.silentCheckSso ? this.silentCheckSsoRedirectUri : '',
|
|
107
132
|
}).then((res) => {
|
|
108
|
-
var _a, _b, _c;
|
|
109
133
|
if (res) {
|
|
110
134
|
this.isAuth = true;
|
|
111
135
|
localStorage.setItem("keycloak", JSON.stringify(this.keycloak));
|
|
112
136
|
// document.cookie = "DASH_BTN=" + JSON.parse(localStorage.getItem('keycloak')).token;
|
|
113
|
-
document.cookie = this.config.cookieName + "=" + JSON.parse(
|
|
137
|
+
document.cookie = this.config.cookieName + "=" + JSON.parse(localStorage.getItem('keycloak') ?? '{}').token;
|
|
114
138
|
// Set userName
|
|
115
|
-
this.givenUserName = JSON.parse(
|
|
139
|
+
this.givenUserName = JSON.parse(localStorage.getItem('keycloak') ?? '{}').idTokenParsed.preferred_username;
|
|
116
140
|
// Set user avatar
|
|
117
|
-
this.avatarSvg = toSvg(JSON.parse(
|
|
141
|
+
this.avatarSvg = toSvg(JSON.parse(localStorage.getItem('keycloak') ?? '{}').idTokenParsed.sub, 40);
|
|
118
142
|
}
|
|
119
143
|
});
|
|
120
144
|
}
|
|
121
145
|
async loadOrganizationUrlAndLinks() {
|
|
122
|
-
var _a, _b, _c;
|
|
123
146
|
// Read org URL safely
|
|
124
147
|
try {
|
|
125
148
|
const kc = JSON.parse(localStorage.getItem("keycloak") || "{}");
|
|
126
|
-
this.organizationUrl =
|
|
149
|
+
this.organizationUrl = kc?.idTokenParsed?.organizationUrl || null;
|
|
127
150
|
}
|
|
128
|
-
catch
|
|
151
|
+
catch {
|
|
129
152
|
this.organizationUrl = null;
|
|
130
153
|
}
|
|
131
154
|
// If no organization, do nothing
|
|
132
155
|
if (!this.organizationUrl)
|
|
133
156
|
return;
|
|
134
157
|
// If config or menu not ready, skip
|
|
135
|
-
if (!
|
|
158
|
+
if (!this.config?.menu?.local)
|
|
136
159
|
return;
|
|
137
160
|
// Only load when custom menu is NOT enabled
|
|
138
161
|
if (!this.config.menu.local.enableCustomLocalMenu) {
|
|
139
162
|
try {
|
|
140
163
|
this.localMenuLinks = await menuService.getMenuLinks(this.organizationUrl);
|
|
164
|
+
console.log("======");
|
|
165
|
+
console.log(this.localMenuLinks);
|
|
141
166
|
}
|
|
142
167
|
catch (e) {
|
|
143
168
|
console.error("Failed to load local menu", e);
|
|
@@ -149,26 +174,25 @@ export class DashButtonComponent {
|
|
|
149
174
|
// Then, check the token's organization URL
|
|
150
175
|
// Finally, check against dashbutton configuration: allowedGlobalDomain and whitelistedUrls
|
|
151
176
|
validateAppAccessByUrl() {
|
|
152
|
-
var _a, _b, _c, _d, _e, _f;
|
|
153
177
|
const normalizeUrl = (url) => url.replace(/\/+$/, '');
|
|
154
178
|
const currentUrl = normalizeUrl(window.location.href);
|
|
155
179
|
const currentOrigin = normalizeUrl(window.location.origin);
|
|
156
|
-
const globalLinks =
|
|
157
|
-
const allowedGlobalDomain =
|
|
158
|
-
const whitelistedUrls =
|
|
180
|
+
const globalLinks = this.config?.menu?.global?.links || [];
|
|
181
|
+
const allowedGlobalDomain = this.config?.allowedGlobalDomain || '';
|
|
182
|
+
const whitelistedUrls = this.config?.whitelistedUrls || '';
|
|
159
183
|
// First, check global links
|
|
160
184
|
const matchGlobal = globalLinks.some(link => {
|
|
161
185
|
try {
|
|
162
186
|
const linkOrigin = normalizeUrl(new URL(link.url).origin);
|
|
163
187
|
return currentOrigin === linkOrigin;
|
|
164
188
|
}
|
|
165
|
-
catch
|
|
189
|
+
catch {
|
|
166
190
|
return false;
|
|
167
191
|
}
|
|
168
192
|
});
|
|
169
193
|
// Then check the token organization URL
|
|
170
|
-
const tokenParsed =
|
|
171
|
-
const allowedOrg = tokenParsed
|
|
194
|
+
const tokenParsed = this.keycloak?.tokenParsed;
|
|
195
|
+
const allowedOrg = tokenParsed?.organizationUrl;
|
|
172
196
|
const matchOrganization = allowedOrg && currentUrl.includes(normalizeUrl(allowedOrg));
|
|
173
197
|
// Check allowedGlobalDomain (single domain)
|
|
174
198
|
const matchAllowedDomain = allowedGlobalDomain &&
|
|
@@ -197,55 +221,99 @@ export class DashButtonComponent {
|
|
|
197
221
|
// Normalizes the "Modules" list so grid view and list view can render it
|
|
198
222
|
// with the exact same markup/classes used for the global "Applications" links.
|
|
199
223
|
get moduleLinks() {
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
224
|
+
const useCustom = this.config?.menu?.local?.enableCustomLocalMenu;
|
|
225
|
+
const links = useCustom
|
|
226
|
+
? (this.config?.menu?.local?.links || []).map(item => ({
|
|
227
|
+
name: item.name,
|
|
228
|
+
url: item.url,
|
|
229
|
+
icon: item.icon,
|
|
230
|
+
disabled: !item.url,
|
|
231
|
+
}))
|
|
232
|
+
: (this.localMenuLinks || []).map(item => ({
|
|
204
233
|
name: item.name,
|
|
205
234
|
url: item.url,
|
|
206
235
|
icon: item.icon,
|
|
207
236
|
disabled: !item.url,
|
|
208
237
|
}));
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
238
|
+
return links.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: 'base' }));
|
|
239
|
+
}
|
|
240
|
+
isContainerizationModule(item) {
|
|
241
|
+
const name = (item.name || '')
|
|
242
|
+
.trim()
|
|
243
|
+
.toLowerCase()
|
|
244
|
+
.replace(/[\s_-]+/g, '');
|
|
245
|
+
return /^(containerization|containerisation)(module)?$/.test(name);
|
|
246
|
+
}
|
|
247
|
+
get containerizationModule() {
|
|
248
|
+
return this.moduleLinks.find(item => this.isContainerizationModule(item));
|
|
216
249
|
}
|
|
217
|
-
|
|
218
|
-
return (
|
|
250
|
+
get visibleModuleLinks() {
|
|
251
|
+
return this.moduleLinks.filter(item => !this.isContainerizationModule(item));
|
|
252
|
+
}
|
|
253
|
+
renderSectionLabel(icon, label, count, collapsed, onToggle, shortcut) {
|
|
254
|
+
return (h("div", { class: "menu-section-header", onClick: onToggle }, h("div", { class: "menu-section-header-left" }, h("span", { class: "menu-section-icon" }, h("i", { class: icon })), h("span", { class: "menu-section-title" }, label), h("span", { class: "menu-section-count" }, count)), h("div", { class: "menu-section-header-actions" }, shortcut && (h("a", { class: "footer-icon-btn footer-icon-btn-portal local-module-shortcut", href: shortcut.disabled ? undefined : shortcut.url, target: shortcut.disabled ? undefined : "_blank", rel: shortcut.disabled ? undefined : "noopener noreferrer", "aria-label": shortcut.name, "aria-disabled": shortcut.disabled ? "true" : undefined, tabIndex: shortcut.disabled ? -1 : undefined, "data-tooltip": shortcut.name, onClick: (event) => {
|
|
255
|
+
event.stopPropagation();
|
|
256
|
+
if (shortcut.disabled)
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
} }, h("i", { class: "fa-solid fa-server" }))), h("span", { class: "menu-section-chevron-btn" +
|
|
259
|
+
(collapsed ? " menu-section-chevron-btn-collapsed" : "") }, h("i", { class: "fa-solid fa-chevron-down" })))));
|
|
260
|
+
}
|
|
261
|
+
renderNotificationComponent() {
|
|
262
|
+
const token = this.keycloak?.idTokenParsed;
|
|
263
|
+
const owner = token?.preferred_username || token?.sub || '';
|
|
264
|
+
const organizationUrl = String(token?.organizationUrl || '').trim();
|
|
265
|
+
if (!owner || !organizationUrl)
|
|
266
|
+
return null;
|
|
267
|
+
let orgHost;
|
|
268
|
+
try {
|
|
269
|
+
const url = /^https?:\/\//i.test(organizationUrl)
|
|
270
|
+
? organizationUrl
|
|
271
|
+
: `https://${organizationUrl}`;
|
|
272
|
+
orgHost = new URL(url).hostname;
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
return (h("notification-component", { owner: owner, "max-records": 10, "display-type": "icon", "notification-url": `https://notifications.${orgHost}/notifications-api`, "socket-connect": true, "socket-url": `wss://repository.${orgHost}/socket`, "list-url": `https://notifications.${orgHost}/notifications` }));
|
|
219
278
|
}
|
|
220
279
|
render() {
|
|
221
|
-
return h("div", { key: '
|
|
222
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
280
|
+
return h("div", { key: 'f4302fb8824c5bc6df03aaff56eacbc9cf764767' }, h("div", { key: 'cd8204369b6489a41e85fdbc18b7fb859f11446b' }, (() => {
|
|
223
281
|
// GLOBAL LOADING SPINNER
|
|
224
282
|
if (this.isLoading) {
|
|
225
283
|
return (h("a", { id: "login-btn", class: "button button-link" }, h("div", { class: "lds-ring" }, h("div", null), h("div", null), h("div", null), h("div", null))));
|
|
226
284
|
}
|
|
227
285
|
if (this.isRestricted) {
|
|
228
|
-
return (h("div", { class: "restricted-overlay" }, h("div", { class: "restricted-card" }, h("div", { class: "restricted-icon" }, h("i", { class: "fa-solid fa-shield-halved" })), h("h2", null, "Access Restricted"), h("p", { class: "restricted-message" }, "You do not have permission to access this application. Please contact your administrator if you believe this is an error."),
|
|
286
|
+
return (h("div", { class: "restricted-overlay" }, h("div", { class: "restricted-card" }, h("div", { class: "restricted-icon" }, h("i", { class: "fa-solid fa-shield-halved" })), h("h2", null, "Access Restricted"), h("p", { class: "restricted-message" }, "You do not have permission to access this application. Please contact your administrator if you believe this is an error."), this.config?.menu?.global?.links?.length > 0 && (h("div", { class: "restricted-links" }, h("h4", null, "Publicly Available Modules"), h("div", { class: "link-grid" }, this.config.menu.global.links.map(item => (h("a", { href: item.url, target: "_blank", class: "restricted-link" }, h("i", { class: item.icon }), h("span", null, item.name))))))), h("div", { class: "restricted-actions" }, this.config?.defaultLink?.url && (h("a", { href: this.config.defaultLink.url, target: "_blank", class: "btn-primary" }, "Go to Portal")), h("button", { class: "btn-danger", onClick: this.logout.bind(this) }, "Logout")))));
|
|
229
287
|
}
|
|
230
288
|
if (this.isAuth && this.showPostLoginText) {
|
|
231
289
|
return (h("a", { style: { background: this.primaryColor != undefined ? this.primaryColor : "" }, href: this.redirectUri, id: "login-btn", class: "button button-link" }, h("span", { style: { color: this.accentColor != undefined ? this.accentColor : "" }, class: "button-text button-text-full-width" }, "Go to Dashboard")));
|
|
232
290
|
}
|
|
233
291
|
else if (this.isAuth) {
|
|
234
|
-
return (h("div", { class: "profile-actions", style: { display: "inline-flex", alignItems: "center", gap: "15px" } },
|
|
292
|
+
return (h("div", { class: "profile-actions", style: { display: "inline-flex", alignItems: "center", gap: "15px" } }, this.showNotification &&
|
|
293
|
+
this.notificationPosition === 'left' &&
|
|
294
|
+
this.renderNotificationComponent(), h("div", { id: "profile-btn", class: "dropdown", onMouseEnter: this.handleDropdownMouseEnter }, h("button", { style: { background: this.primaryColor != undefined ? this.primaryColor : "" }, type: "button", class: "button" }, h("span", { class: "button-profile" }, JSON.parse(localStorage.getItem('keycloak') ?? '{}').idTokenParsed.imageUrl ?
|
|
235
295
|
h("img", { class: "profile-image", src: "https://s-damith.github.io/test-avatar/images/e24da9c5-0b1f-46fa-82cd-7c711c77b5c7.png" })
|
|
236
296
|
:
|
|
237
|
-
h("div", { innerHTML: this.avatarSvg })), h("span", { style: { color: this.accentColor != undefined ? this.accentColor : "" }, id: "given-name", class: "button-text" }, this.givenUserName), h("div", { class: "button-icon" }, (this.config.menuViewType == "grid") ? h("i", { class: "fa-solid fa-grip-vertical" }) : h("i", { class: "fa-solid fa-bars" }))), h("div", { class: "dropdown-content" }, h("div", { class: "dropdown-user-profile" }, h("div", { class: "user-profile-info" }, h("div", { class: "username" }, "@", this.givenUserName), h("div", { class: "first-last-name" }, JSON.parse(
|
|
297
|
+
h("div", { innerHTML: this.avatarSvg })), h("span", { style: { color: this.accentColor != undefined ? this.accentColor : "" }, id: "given-name", class: "button-text" }, this.givenUserName), h("div", { class: "button-icon" }, (this.config.menuViewType == "grid") ? h("i", { class: "fa-solid fa-grip-vertical" }) : h("i", { class: "fa-solid fa-bars" }))), h("div", { class: "dropdown-content" }, h("div", { class: "dropdown-user-profile" }, h("div", { class: "user-profile-info" }, h("div", { class: "username" }, "@", this.givenUserName), h("div", { class: "first-last-name" }, JSON.parse(localStorage.getItem('keycloak') ?? '{}').idTokenParsed.name)), h("div", { class: "user-profile-actions" }, h("a", { href: this.config.defaultLink.url, target: "_blank", rel: "noopener noreferrer", class: "footer-icon-btn footer-icon-btn-portal", "aria-label": this.config.defaultLink.name || "Portal", "data-tooltip": this.config.defaultLink.name || "Portal" }, h("i", { class: "fa-solid fa-globe" })), h("button", { type: "button", onClick: this.logout.bind(this), class: "footer-icon-btn footer-icon-btn-logout", "aria-label": "Logout", "data-tooltip": "Logout" }, h("i", { class: "fa-solid fa-right-from-bracket" })))), (this.config.menuViewType == "grid") ? (h("div", null, this.moduleLinks.length > 0 && this.renderSectionLabel("fa-solid fa-earth-americas", "Global Modules", this.config.menu.global.links.length, (this.collapsedModuleSection === 'global'), this.toggleGlobalModules), (this.moduleLinks.length === 0 || this.collapsedModuleSection !== 'global') && (h("div", { class: "grid-view-menu" }, this.config.menu.global.links.map(item => {
|
|
238
298
|
return (h("a", { href: item.url, target: '_blank', rel: "noopener noreferrer", class: "grid-view-link" }, h("i", { class: item.icon + " fa-2x" }), h("div", { class: "grid-view-link-text" }, item.name)));
|
|
239
|
-
}))), this.moduleLinks.length > 0 && (h("div", { style: { display: "contents" } }, h("hr", { class: "solid" }), this.renderSectionLabel("fa-solid fa-building", "Local Modules", this.
|
|
299
|
+
}))), this.moduleLinks.length > 0 && (h("div", { style: { display: "contents" } }, h("hr", { class: "solid" }), this.renderSectionLabel("fa-solid fa-building", "Local Modules", this.visibleModuleLinks.length, this.collapsedModuleSection === 'local', this.toggleLocalModules, this.containerizationModule), !(this.collapsedModuleSection === 'local') && (h("div", { class: "grid-view-menu", ref: (el) => this.gridLocalListEl = el }, this.visibleModuleLinks.map(item => {
|
|
300
|
+
const isImageUrl = item.icon && /^https?:\/\//i.test(item.icon);
|
|
301
|
+
const iconClass = item.icon && !isImageUrl
|
|
302
|
+
? item.icon
|
|
303
|
+
: "fa-solid fa-cube";
|
|
304
|
+
return (h("a", { class: "grid-view-link" + (item.disabled ? " grid-view-link-disabled" : ""), href: item.disabled ? undefined : item.url, target: item.disabled ? undefined : "_blank", rel: item.disabled ? undefined : "noopener noreferrer", onClick: item.disabled ? (e) => e.preventDefault() : undefined }, isImageUrl ? (h("img", { src: item.icon, alt: item.name, class: "grid-view-link-image" })) : (h("i", { class: iconClass + " fa-2x" })), h("div", { class: "grid-view-link-text" }, item.name)));
|
|
305
|
+
}))))))) : (
|
|
240
306
|
// List View
|
|
241
307
|
h("div", { class: "dropdown-content-link" }, this.moduleLinks.length > 0 && this.renderSectionLabel("fa-solid fa-earth-americas", "Global Modules", this.config.menu.global.links.length, (this.collapsedModuleSection === 'global'), this.toggleGlobalModules), (this.moduleLinks.length === 0 || this.collapsedModuleSection !== 'global') && (this.config.menu.global.links.map(item => {
|
|
242
308
|
return (h("a", { href: item.url, target: '_blank', rel: "noopener noreferrer", id: "applications-btn" }, h("i", { class: item.icon + " menu-bar-icons" }), item.name));
|
|
243
|
-
})), this.moduleLinks.length > 0 && (h("div", { style: { display: "contents" } }, this.renderSectionLabel("fa-solid fa-building", "Local Modules", this.moduleLinks.length, (this.collapsedModuleSection === 'local'), this.toggleLocalModules), !(this.collapsedModuleSection === 'local') && (h("div", { class: "local-modules-scroll", ref: (el) => this.listLocalScrollEl = el }, this.moduleLinks.map(item => (h("a", { id: "applications-btn", class: item.disabled ? "applications-btn-disabled" : undefined, href: item.disabled ? undefined : item.url, target: item.disabled ? undefined : "_blank", rel: item.disabled ? undefined : "noopener noreferrer", onClick: item.disabled ? (e) => e.preventDefault() : undefined }, h("i", { class: (item.icon || "fa-solid fa-cube") + " menu-bar-icons" }), item.name))))))))))
|
|
309
|
+
})), this.moduleLinks.length > 0 && (h("div", { style: { display: "contents" } }, this.renderSectionLabel("fa-solid fa-building", "Local Modules", this.moduleLinks.length, (this.collapsedModuleSection === 'local'), this.toggleLocalModules), !(this.collapsedModuleSection === 'local') && (h("div", { class: "local-modules-scroll", ref: (el) => this.listLocalScrollEl = el }, this.moduleLinks.map(item => (h("a", { id: "applications-btn", class: item.disabled ? "applications-btn-disabled" : undefined, href: item.disabled ? undefined : item.url, target: item.disabled ? undefined : "_blank", rel: item.disabled ? undefined : "noopener noreferrer", onClick: item.disabled ? (e) => e.preventDefault() : undefined }, h("i", { class: (item.icon || "fa-solid fa-cube") + " menu-bar-icons" }), item.name)))))))))), this.showNotification &&
|
|
310
|
+
this.notificationPosition === 'right' &&
|
|
311
|
+
this.renderNotificationComponent())));
|
|
244
312
|
}
|
|
245
313
|
else {
|
|
246
314
|
return (h("button", { style: { background: this.primaryColor != undefined ? this.primaryColor : "" }, onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { style: { color: this.accentColor != undefined ? this.accentColor : "" }, class: "button-text" }, "Login")));
|
|
247
315
|
}
|
|
248
|
-
})()), h("div", { key: '
|
|
316
|
+
})()), h("div", { key: '34bb14b2332370430752853150d0dec2643c5b85', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: '4d0d68d78c1958d60712a79b780cb18e7c3e4b81', class: "modal-content" }, h("img", { key: 'd8a50635f3c14f424763525469df6d7d88524413', src: "data:image/png;base64,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" }), h("h2", { key: '0f064131a4fe8a22968e8447efdbfb2877f45508', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '2bc49be7296bb8f0410a689eb468a42f6e523c9c', class: "green-text" }, "Please contact the administration."), (this.config.defaultLink.url && this.showUnauthorizedModal) ?
|
|
249
317
|
h("div", null, h("h4", { class: "gray-text" }, "You will be automatically redirected to the portal."), h("div", { id: "countdown" }, h("div", { id: "countdown-number" }), h("svg", null, h("circle", { r: "18", cx: "20", cy: "20" }))))
|
|
250
318
|
: h("div", null))));
|
|
251
319
|
}
|
|
@@ -277,8 +345,10 @@ export class DashButtonComponent {
|
|
|
277
345
|
"tags": [],
|
|
278
346
|
"text": ""
|
|
279
347
|
},
|
|
280
|
-
"
|
|
348
|
+
"getter": false,
|
|
349
|
+
"setter": false,
|
|
281
350
|
"reflect": false,
|
|
351
|
+
"attribute": "show-post-login-text",
|
|
282
352
|
"defaultValue": "false"
|
|
283
353
|
},
|
|
284
354
|
"silentCheckSso": {
|
|
@@ -295,8 +365,10 @@ export class DashButtonComponent {
|
|
|
295
365
|
"tags": [],
|
|
296
366
|
"text": ""
|
|
297
367
|
},
|
|
298
|
-
"
|
|
368
|
+
"getter": false,
|
|
369
|
+
"setter": false,
|
|
299
370
|
"reflect": false,
|
|
371
|
+
"attribute": "silent-check-sso",
|
|
300
372
|
"defaultValue": "false"
|
|
301
373
|
},
|
|
302
374
|
"redirectUri": {
|
|
@@ -313,8 +385,10 @@ export class DashButtonComponent {
|
|
|
313
385
|
"tags": [],
|
|
314
386
|
"text": ""
|
|
315
387
|
},
|
|
316
|
-
"
|
|
317
|
-
"
|
|
388
|
+
"getter": false,
|
|
389
|
+
"setter": false,
|
|
390
|
+
"reflect": false,
|
|
391
|
+
"attribute": "redirect-uri"
|
|
318
392
|
},
|
|
319
393
|
"authMethod": {
|
|
320
394
|
"type": "string",
|
|
@@ -330,8 +404,10 @@ export class DashButtonComponent {
|
|
|
330
404
|
"tags": [],
|
|
331
405
|
"text": ""
|
|
332
406
|
},
|
|
333
|
-
"
|
|
407
|
+
"getter": false,
|
|
408
|
+
"setter": false,
|
|
334
409
|
"reflect": false,
|
|
410
|
+
"attribute": "auth-method",
|
|
335
411
|
"defaultValue": "\"check-sso\""
|
|
336
412
|
},
|
|
337
413
|
"portalApiUrl": {
|
|
@@ -348,8 +424,10 @@ export class DashButtonComponent {
|
|
|
348
424
|
"tags": [],
|
|
349
425
|
"text": ""
|
|
350
426
|
},
|
|
351
|
-
"
|
|
427
|
+
"getter": false,
|
|
428
|
+
"setter": false,
|
|
352
429
|
"reflect": false,
|
|
430
|
+
"attribute": "portal-api-url",
|
|
353
431
|
"defaultValue": "\"\""
|
|
354
432
|
},
|
|
355
433
|
"plmUrl": {
|
|
@@ -366,8 +444,10 @@ export class DashButtonComponent {
|
|
|
366
444
|
"tags": [],
|
|
367
445
|
"text": ""
|
|
368
446
|
},
|
|
369
|
-
"
|
|
447
|
+
"getter": false,
|
|
448
|
+
"setter": false,
|
|
370
449
|
"reflect": false,
|
|
450
|
+
"attribute": "plm-url",
|
|
371
451
|
"defaultValue": "\"https://productlicensemanager-zdzw.cloud.zdzw-project.com\""
|
|
372
452
|
},
|
|
373
453
|
"showUnauthorizedModal": {
|
|
@@ -384,8 +464,10 @@ export class DashButtonComponent {
|
|
|
384
464
|
"tags": [],
|
|
385
465
|
"text": ""
|
|
386
466
|
},
|
|
387
|
-
"
|
|
467
|
+
"getter": false,
|
|
468
|
+
"setter": false,
|
|
388
469
|
"reflect": false,
|
|
470
|
+
"attribute": "show-unauthorized-modal",
|
|
389
471
|
"defaultValue": "false"
|
|
390
472
|
},
|
|
391
473
|
"primaryColor": {
|
|
@@ -402,8 +484,10 @@ export class DashButtonComponent {
|
|
|
402
484
|
"tags": [],
|
|
403
485
|
"text": ""
|
|
404
486
|
},
|
|
405
|
-
"
|
|
487
|
+
"getter": false,
|
|
488
|
+
"setter": false,
|
|
406
489
|
"reflect": false,
|
|
490
|
+
"attribute": "primary-color",
|
|
407
491
|
"defaultValue": "\"\""
|
|
408
492
|
},
|
|
409
493
|
"accentColor": {
|
|
@@ -420,9 +504,51 @@ export class DashButtonComponent {
|
|
|
420
504
|
"tags": [],
|
|
421
505
|
"text": ""
|
|
422
506
|
},
|
|
423
|
-
"
|
|
507
|
+
"getter": false,
|
|
508
|
+
"setter": false,
|
|
424
509
|
"reflect": false,
|
|
510
|
+
"attribute": "accent-color",
|
|
425
511
|
"defaultValue": "\"\""
|
|
512
|
+
},
|
|
513
|
+
"showNotification": {
|
|
514
|
+
"type": "boolean",
|
|
515
|
+
"mutable": false,
|
|
516
|
+
"complexType": {
|
|
517
|
+
"original": "boolean",
|
|
518
|
+
"resolved": "boolean",
|
|
519
|
+
"references": {}
|
|
520
|
+
},
|
|
521
|
+
"required": false,
|
|
522
|
+
"optional": false,
|
|
523
|
+
"docs": {
|
|
524
|
+
"tags": [],
|
|
525
|
+
"text": ""
|
|
526
|
+
},
|
|
527
|
+
"getter": false,
|
|
528
|
+
"setter": false,
|
|
529
|
+
"reflect": false,
|
|
530
|
+
"attribute": "show-notification",
|
|
531
|
+
"defaultValue": "true"
|
|
532
|
+
},
|
|
533
|
+
"notificationPosition": {
|
|
534
|
+
"type": "string",
|
|
535
|
+
"mutable": false,
|
|
536
|
+
"complexType": {
|
|
537
|
+
"original": "'left' | 'right'",
|
|
538
|
+
"resolved": "\"left\" | \"right\"",
|
|
539
|
+
"references": {}
|
|
540
|
+
},
|
|
541
|
+
"required": false,
|
|
542
|
+
"optional": false,
|
|
543
|
+
"docs": {
|
|
544
|
+
"tags": [],
|
|
545
|
+
"text": ""
|
|
546
|
+
},
|
|
547
|
+
"getter": false,
|
|
548
|
+
"setter": false,
|
|
549
|
+
"reflect": false,
|
|
550
|
+
"attribute": "notification-position",
|
|
551
|
+
"defaultValue": "'left'"
|
|
426
552
|
}
|
|
427
553
|
};
|
|
428
554
|
}
|
|
@@ -444,4 +570,3 @@ export class DashButtonComponent {
|
|
|
444
570
|
}
|
|
445
571
|
static get elementRef() { return "el"; }
|
|
446
572
|
}
|
|
447
|
-
//# sourceMappingURL=dash-button.js.map
|
package/dist/collection/index.js
CHANGED
|
@@ -27,9 +27,8 @@ const DEFAULT_CONFIG = {
|
|
|
27
27
|
};
|
|
28
28
|
// Fetch config from API
|
|
29
29
|
class ConfigService {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
static instance;
|
|
31
|
+
_config = DEFAULT_CONFIG;
|
|
33
32
|
static getInstance() {
|
|
34
33
|
if (!ConfigService.instance) {
|
|
35
34
|
ConfigService.instance = new ConfigService();
|
|
@@ -42,7 +41,7 @@ class ConfigService {
|
|
|
42
41
|
if (!res.ok)
|
|
43
42
|
throw new Error('Failed to fetch config');
|
|
44
43
|
const data = await res.json();
|
|
45
|
-
this._config =
|
|
44
|
+
this._config = { ...DEFAULT_CONFIG, ...data }; // Merge API data with defaults
|
|
46
45
|
}
|
|
47
46
|
catch (e) {
|
|
48
47
|
console.warn('Using default config due to API failure', e);
|
|
@@ -58,4 +57,3 @@ class ConfigService {
|
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
export const configService = ConfigService.getInstance();
|
|
61
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -43,7 +43,7 @@ class MenuService {
|
|
|
43
43
|
throw new Error('API error');
|
|
44
44
|
return await res.json();
|
|
45
45
|
}
|
|
46
|
-
catch
|
|
46
|
+
catch {
|
|
47
47
|
return { data: [], total: 0, page: 1, perPage: 0, totalPages: 0 };
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -63,17 +63,16 @@ class MenuService {
|
|
|
63
63
|
urlObj.hostname = `containerisationbackend.${urlObj.hostname}`;
|
|
64
64
|
const { data } = await this.getMenuConfig(`${urlObj.origin}/developer/charts/installed`);
|
|
65
65
|
return data.map(d => {
|
|
66
|
-
|
|
67
|
-
const frontendUrlPrefix = (_a = d.metadata) === null || _a === void 0 ? void 0 : _a.frontendUrlPrefix;
|
|
66
|
+
const frontendUrlPrefix = d.metadata?.frontendUrlPrefix;
|
|
68
67
|
const rootDomain = getRootDomain(BASE_URL);
|
|
69
68
|
const generatedUrl = `${getUrlProtocol(BASE_URL)}${frontendUrlPrefix}.${rootDomain}`;
|
|
70
69
|
return {
|
|
71
70
|
name: d.installChartName,
|
|
72
71
|
url: frontendUrlPrefix ? generatedUrl : "",
|
|
73
|
-
category:
|
|
72
|
+
category: d.metadata?.category ?? "",
|
|
73
|
+
icon: d.metadata?.icon ?? "",
|
|
74
74
|
};
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
export const menuService = new MenuService();
|
|
79
|
-
//# sourceMappingURL=menu.js.map
|