oip-common 0.0.5 → 0.0.7
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/README.md +3 -0
- package/ng-package.json +19 -0
- package/package.json +19 -31
- package/src/api/FolderModule.ts +124 -0
- package/src/api/Menu.ts +134 -0
- package/src/api/Module.ts +92 -0
- package/src/api/Security.ts +40 -0
- package/src/api/Service.ts +57 -0
- package/src/api/data-contracts.ts +186 -0
- package/src/api/http-client.ts +276 -0
- package/src/components/app-configurator.component.ts +491 -0
- package/src/components/app-floating-configurator.component.ts +47 -0
- package/src/components/app-modules.component.ts +144 -0
- package/src/components/app.layout.component.ts +130 -0
- package/src/components/auth/access/access.component.ts +42 -0
- package/src/components/auth/error/error.component.ts +42 -0
- package/src/components/auth/login/login.component.ts +120 -0
- package/src/components/auth/unauthorized/unauthorized.component.ts +51 -0
- package/src/components/base-module.component.ts +258 -0
- package/src/components/config.component.ts +131 -0
- package/src/components/db-migration/db-migration.component.ts +164 -0
- package/src/components/db-migration.component.ts +156 -0
- package/src/components/footer.component.ts +17 -0
- package/src/components/logo.component.ts +34 -0
- package/src/components/menu/menu-item-create-dialog.component.ts +119 -0
- package/src/components/menu/menu-item-edit-dialog.component.ts +124 -0
- package/src/components/menu/menu-item.component.ts +295 -0
- package/src/components/menu/menu.component.ts +85 -0
- package/src/components/notfound.component.ts +31 -0
- package/src/components/profile.component.ts +44 -0
- package/src/components/security.component.ts +102 -0
- package/src/components/sidebar.component.ts +12 -0
- package/src/components/top-bar.component.ts +147 -0
- package/src/dtos/context-menu-item.dto.ts +23 -0
- package/src/dtos/edit-module-instance.dto.ts +8 -0
- package/src/dtos/no-settings.dto.ts +4 -0
- package/src/dtos/put-security.dto.ts +6 -0
- package/src/dtos/security.dto.ts +6 -0
- package/src/dtos/top-bar.dto.ts +13 -0
- package/src/events/menu-change.event.ts +23 -0
- package/src/helpers/date.helper.ts +94 -0
- package/src/intercepts/i18n-intercept.service.ts +13 -0
- package/src/modules/http-loader.factory.ts +40 -0
- package/src/modules/secure.pipe.ts +19 -0
- package/src/public-api.ts +42 -0
- package/src/services/app-title.service.ts +22 -0
- package/src/services/app.layout.service.ts +236 -0
- package/src/services/app.menu.service.ts +64 -0
- package/src/services/auth.service.ts +58 -0
- package/src/services/base-data.service.ts +74 -0
- package/src/services/l10n.service.ts +71 -0
- package/src/services/msg.service.ts +76 -0
- package/src/services/security-data.service.ts +19 -0
- package/src/services/security-storage.service.ts +21 -0
- package/src/services/security.service.ts +116 -0
- package/src/services/top-bar.service.ts +44 -0
- package/src/services/user.service.ts +77 -0
- package/src/test.ts +11 -0
- package/src/user-api/UserProfile.ts +85 -0
- package/src/user-api/data-contracts.ts +42 -0
- package/src/user-api/http-client.ts +253 -0
- package/tsconfig.lib.json +12 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +9 -0
- package/fesm2022/oip-common.mjs +0 -4267
- package/fesm2022/oip-common.mjs.map +0 -1
- package/index.d.ts +0 -1028
- /package/{assets → src/assets}/demo/code.scss +0 -0
- /package/{assets → src/assets}/demo/demo.scss +0 -0
- /package/{assets → src/assets}/demo/flags/flags.scss +0 -0
- /package/{assets → src/assets}/demo/flags/flags_responsive.png +0 -0
- /package/{assets → src/assets}/demo/images/access/asset-access.svg +0 -0
- /package/{assets → src/assets}/demo/images/error/asset-error.svg +0 -0
- /package/{assets → src/assets}/demo/images/flag/flag_placeholder.png +0 -0
- /package/{assets → src/assets}/favicon.svg +0 -0
- /package/{assets → src/assets}/i18n/app-modules.en.json +0 -0
- /package/{assets → src/assets}/i18n/app-modules.ru.json +0 -0
- /package/{assets → src/assets}/i18n/config.en.json +0 -0
- /package/{assets → src/assets}/i18n/config.ru.json +0 -0
- /package/{assets → src/assets}/layout/_core.scss +0 -0
- /package/{assets → src/assets}/layout/_footer.scss +0 -0
- /package/{assets → src/assets}/layout/_logo.scss +0 -0
- /package/{assets → src/assets}/layout/_main.scss +0 -0
- /package/{assets → src/assets}/layout/_menu.scss +0 -0
- /package/{assets → src/assets}/layout/_mixins.scss +0 -0
- /package/{assets → src/assets}/layout/_preloading.scss +0 -0
- /package/{assets → src/assets}/layout/_responsive.scss +0 -0
- /package/{assets → src/assets}/layout/_topbar.scss +0 -0
- /package/{assets → src/assets}/layout/_typography.scss +0 -0
- /package/{assets → src/assets}/layout/_utils.scss +0 -0
- /package/{assets → src/assets}/layout/layout.scss +0 -0
- /package/{assets → src/assets}/layout/variables/_common.scss +0 -0
- /package/{assets → src/assets}/layout/variables/_dark.scss +0 -0
- /package/{assets → src/assets}/layout/variables/_light.scss +0 -0
- /package/{assets → src/assets}/oip-common.scss +0 -0
- /package/{assets → src/assets}/tailwind.css +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Component, Renderer2, ViewChild, OnDestroy, inject } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
|
4
|
+
import { filter, Subscription } from 'rxjs';
|
|
5
|
+
import { AppTopbar } from './top-bar.component';
|
|
6
|
+
import { FooterComponent } from './footer.component';
|
|
7
|
+
import { LayoutService } from './../services/app.layout.service';
|
|
8
|
+
import { SidebarComponent } from './sidebar.component';
|
|
9
|
+
import { Menu } from '../api/Menu';
|
|
10
|
+
import { MenuService } from '../services/app.menu.service';
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'app-layout',
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [CommonModule, AppTopbar, SidebarComponent, RouterModule, FooterComponent],
|
|
16
|
+
template: `
|
|
17
|
+
<div class="layout-wrapper" [ngClass]="containerClass">
|
|
18
|
+
<app-topbar></app-topbar>
|
|
19
|
+
<app-sidebar></app-sidebar>
|
|
20
|
+
<div class="layout-main-container">
|
|
21
|
+
<div class="layout-main">
|
|
22
|
+
<router-outlet></router-outlet>
|
|
23
|
+
</div>
|
|
24
|
+
<app-footer></app-footer>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="layout-mask animate-fadein"></div>
|
|
27
|
+
</div>
|
|
28
|
+
`,
|
|
29
|
+
providers: [MenuService, Menu]
|
|
30
|
+
})
|
|
31
|
+
export class AppLayoutComponent implements OnDestroy {
|
|
32
|
+
protected layoutService = inject(LayoutService);
|
|
33
|
+
protected router = inject(Router);
|
|
34
|
+
protected renderer = inject(Renderer2);
|
|
35
|
+
overlayMenuOpenSubscription: Subscription;
|
|
36
|
+
|
|
37
|
+
menuOutsideClickListener: () => void;
|
|
38
|
+
|
|
39
|
+
@ViewChild(SidebarComponent) appSidebar!: SidebarComponent;
|
|
40
|
+
|
|
41
|
+
@ViewChild(AppTopbar) appTopBar!: AppTopbar;
|
|
42
|
+
|
|
43
|
+
constructor() {
|
|
44
|
+
this.overlayMenuOpenSubscription = this.layoutService.overlayOpen$.subscribe(() => {
|
|
45
|
+
if (!this.menuOutsideClickListener) {
|
|
46
|
+
this.menuOutsideClickListener = this.renderer.listen('document', 'click', (event) => {
|
|
47
|
+
if (this.isOutsideClicked(event)) {
|
|
48
|
+
this.hideMenu();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (this.layoutService.layoutState().staticMenuMobileActive) {
|
|
54
|
+
this.blockBodyScroll();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
this.router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => {
|
|
59
|
+
this.hideMenu();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
isOutsideClicked(event: MouseEvent) {
|
|
64
|
+
const sidebarEl = document.querySelector('.layout-sidebar');
|
|
65
|
+
const topbarEl = document.querySelector('.layout-menu-button');
|
|
66
|
+
const eventTarget = event.target as Node;
|
|
67
|
+
|
|
68
|
+
return !(
|
|
69
|
+
sidebarEl?.isSameNode(eventTarget) ||
|
|
70
|
+
sidebarEl?.contains(eventTarget) ||
|
|
71
|
+
topbarEl?.isSameNode(eventTarget) ||
|
|
72
|
+
topbarEl?.contains(eventTarget)
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
hideMenu() {
|
|
77
|
+
this.layoutService.layoutState.update((prev) => ({
|
|
78
|
+
...prev,
|
|
79
|
+
overlayMenuActive: false,
|
|
80
|
+
staticMenuMobileActive: false,
|
|
81
|
+
menuHoverActive: false
|
|
82
|
+
}));
|
|
83
|
+
if (this.menuOutsideClickListener) {
|
|
84
|
+
this.menuOutsideClickListener();
|
|
85
|
+
this.menuOutsideClickListener = null;
|
|
86
|
+
}
|
|
87
|
+
this.unblockBodyScroll();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
blockBodyScroll(): void {
|
|
91
|
+
if (document.body.classList) {
|
|
92
|
+
document.body.classList.add('blocked-scroll');
|
|
93
|
+
} else {
|
|
94
|
+
document.body.className += ' blocked-scroll';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
unblockBodyScroll(): void {
|
|
99
|
+
if (document.body.classList) {
|
|
100
|
+
document.body.classList.remove('blocked-scroll');
|
|
101
|
+
} else {
|
|
102
|
+
document.body.className = document.body.className.replace(
|
|
103
|
+
new RegExp('(^|\\b)' + 'blocked-scroll'.split(' ').join('|') + '(\\b|$)', 'gi'),
|
|
104
|
+
' '
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
get containerClass() {
|
|
110
|
+
return {
|
|
111
|
+
'layout-overlay': this.layoutService.layoutConfig().menuMode === 'overlay',
|
|
112
|
+
'layout-static': this.layoutService.layoutConfig().menuMode === 'static',
|
|
113
|
+
'layout-static-inactive':
|
|
114
|
+
this.layoutService.layoutState().staticMenuDesktopInactive &&
|
|
115
|
+
this.layoutService.layoutConfig().menuMode === 'static',
|
|
116
|
+
'layout-overlay-active': this.layoutService.layoutState().overlayMenuActive,
|
|
117
|
+
'layout-mobile-active': this.layoutService.layoutState().staticMenuMobileActive
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
ngOnDestroy() {
|
|
122
|
+
if (this.overlayMenuOpenSubscription) {
|
|
123
|
+
this.overlayMenuOpenSubscription.unsubscribe();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (this.menuOutsideClickListener) {
|
|
127
|
+
this.menuOutsideClickListener();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { RouterLink } from '@angular/router';
|
|
3
|
+
import { ButtonModule } from 'primeng/button';
|
|
4
|
+
import { RippleModule } from 'primeng/ripple';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-access',
|
|
8
|
+
template: `<div
|
|
9
|
+
class="surface-ground flex align-items-center justify-content-center min-h-screen min-w-screen overflow-hidden">
|
|
10
|
+
<div class="flex flex-column align-items-center justify-content-center">
|
|
11
|
+
<img alt="Sakai logo" class="mb-5 w-6rem flex-shrink-0" src="assets/demo/images/access/logo-orange.svg" />
|
|
12
|
+
<div
|
|
13
|
+
style="border-radius:56px; padding:0.3rem; background: linear-gradient(180deg, rgba(247, 149, 48, 0.4) 10%, rgba(247, 149, 48, 0) 30%);">
|
|
14
|
+
<div
|
|
15
|
+
class="w-full surface-card py-8 px-5 sm:px-8 flex flex-column align-items-center"
|
|
16
|
+
style="border-radius:53px">
|
|
17
|
+
<div class="grid flex flex-column align-items-center">
|
|
18
|
+
<div
|
|
19
|
+
class="flex justify-content-center align-items-center bg-orange-500 border-circle"
|
|
20
|
+
style="width:3.2rem; height:3.2rem;">
|
|
21
|
+
<i class="text-50 pi pi-fw pi-lock text-2xl"></i>
|
|
22
|
+
</div>
|
|
23
|
+
<h1 class="text-900 font-bold text-4xl lg:text-5xl mb-2">Access Denied</h1>
|
|
24
|
+
<span class="text-600 mb-5">You do not have the necessary permisions. Please contact admins.</span>
|
|
25
|
+
<img alt="Access denied" class="mb-5" src="assets/demo/images/access/asset-access.svg" width="80%" />
|
|
26
|
+
<button
|
|
27
|
+
class="p-button-text"
|
|
28
|
+
icon="pi pi-arrow-left"
|
|
29
|
+
id="oip-app-access-go-to-dashboard-button"
|
|
30
|
+
label="Go to Dashboard"
|
|
31
|
+
pButton
|
|
32
|
+
pRipple
|
|
33
|
+
[routerLink]="['/']"></button>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>`,
|
|
39
|
+
imports: [RouterLink, ButtonModule, RippleModule],
|
|
40
|
+
standalone: true
|
|
41
|
+
})
|
|
42
|
+
export class AccessComponent {}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ButtonModule } from 'primeng/button';
|
|
3
|
+
import { RippleModule } from 'primeng/ripple';
|
|
4
|
+
import { RouterLink } from '@angular/router';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-error',
|
|
8
|
+
template: `<div
|
|
9
|
+
class="surface-ground flex align-items-center justify-content-center min-h-screen min-w-screen overflow-hidden">
|
|
10
|
+
<div class="flex flex-column align-items-center justify-content-center">
|
|
11
|
+
<img alt="Sakai logo" class="mb-5 w-6rem flex-shrink-0" src="assets/demo/images/error/logo-error.svg" />
|
|
12
|
+
<div
|
|
13
|
+
style="border-radius:56px; padding:0.3rem; background: linear-gradient(180deg, rgba(233, 30, 99, 0.4) 10%, rgba(33, 150, 243, 0) 30%);">
|
|
14
|
+
<div
|
|
15
|
+
class="w-full surface-card py-8 px-5 sm:px-8 flex flex-column align-items-center"
|
|
16
|
+
style="border-radius:53px">
|
|
17
|
+
<div class="grid flex flex-column align-items-center">
|
|
18
|
+
<div
|
|
19
|
+
class="flex justify-content-center align-items-center bg-pink-500 border-circle"
|
|
20
|
+
style="height:3.2rem; width:3.2rem;">
|
|
21
|
+
<i class="pi pi-fw pi-exclamation-circle text-2xl text-white"></i>
|
|
22
|
+
</div>
|
|
23
|
+
<h1 class="text-900 font-bold text-5xl mb-2">Error Occured</h1>
|
|
24
|
+
<span class="text-600 mb-5">Requested resource is not available.</span>
|
|
25
|
+
<img alt="Error" class="mb-5" src="assets/demo/images/error/asset-error.svg" width="80%" />
|
|
26
|
+
<button
|
|
27
|
+
class="p-button-text"
|
|
28
|
+
icon="pi pi-arrow-left"
|
|
29
|
+
id="oip-app-error-go-to-dashboard-button"
|
|
30
|
+
label="Go to Dashboard"
|
|
31
|
+
pButton
|
|
32
|
+
pRipple
|
|
33
|
+
[routerLink]="['/']"></button>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>`,
|
|
39
|
+
standalone: true,
|
|
40
|
+
imports: [ButtonModule, RippleModule, RouterLink]
|
|
41
|
+
})
|
|
42
|
+
export class ErrorComponent {}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { RouterModule } from '@angular/router';
|
|
4
|
+
import { ButtonModule } from 'primeng/button';
|
|
5
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
6
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
7
|
+
import { PasswordModule } from 'primeng/password';
|
|
8
|
+
import { RippleModule } from 'primeng/ripple';
|
|
9
|
+
import { AppFloatingConfiguratorComponent } from '../../app-floating-configurator.component';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'app-login',
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [
|
|
15
|
+
ButtonModule,
|
|
16
|
+
CheckboxModule,
|
|
17
|
+
InputTextModule,
|
|
18
|
+
PasswordModule,
|
|
19
|
+
FormsModule,
|
|
20
|
+
RouterModule,
|
|
21
|
+
RippleModule,
|
|
22
|
+
AppFloatingConfiguratorComponent
|
|
23
|
+
],
|
|
24
|
+
template: `
|
|
25
|
+
<app-floating-configurator />
|
|
26
|
+
<div
|
|
27
|
+
class="bg-surface-50 dark:bg-surface-950 flex items-center justify-center min-h-screen min-w-[100vw] overflow-hidden">
|
|
28
|
+
<div class="flex flex-col items-center justify-center">
|
|
29
|
+
<div
|
|
30
|
+
style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)">
|
|
31
|
+
<div class="w-full bg-surface-0 dark:bg-surface-900 py-20 px-8 sm:px-20" style="border-radius: 53px">
|
|
32
|
+
<div class="text-center mb-8">
|
|
33
|
+
<svg
|
|
34
|
+
class="mb-8 w-16 shrink-0 mx-auto"
|
|
35
|
+
fill="none"
|
|
36
|
+
viewBox="0 0 54 40"
|
|
37
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
38
|
+
<path
|
|
39
|
+
clip-rule="evenodd"
|
|
40
|
+
d="M17.1637 19.2467C17.1566 19.4033 17.1529 19.561 17.1529 19.7194C17.1529 25.3503 21.7203 29.915 27.3546 29.915C32.9887 29.915 37.5561 25.3503 37.5561 19.7194C37.5561 19.5572 37.5524 19.3959 37.5449 19.2355C38.5617 19.0801 39.5759 18.9013 40.5867 18.6994L40.6926 18.6782C40.7191 19.0218 40.7326 19.369 40.7326 19.7194C40.7326 27.1036 34.743 33.0896 27.3546 33.0896C19.966 33.0896 13.9765 27.1036 13.9765 19.7194C13.9765 19.374 13.9896 19.0316 14.0154 18.6927L14.0486 18.6994C15.0837 18.9062 16.1223 19.0886 17.1637 19.2467ZM33.3284 11.4538C31.6493 10.2396 29.5855 9.52381 27.3546 9.52381C25.1195 9.52381 23.0524 10.2421 21.3717 11.4603C20.0078 11.3232 18.6475 11.1387 17.2933 10.907C19.7453 8.11308 23.3438 6.34921 27.3546 6.34921C31.36 6.34921 34.9543 8.10844 37.4061 10.896C36.0521 11.1292 34.692 11.3152 33.3284 11.4538ZM43.826 18.0518C43.881 18.6003 43.9091 19.1566 43.9091 19.7194C43.9091 28.8568 36.4973 36.2642 27.3546 36.2642C18.2117 36.2642 10.8 28.8568 10.8 19.7194C10.8 19.1615 10.8276 18.61 10.8816 18.0663L7.75383 17.4411C7.66775 18.1886 7.62354 18.9488 7.62354 19.7194C7.62354 30.6102 16.4574 39.4388 27.3546 39.4388C38.2517 39.4388 47.0855 30.6102 47.0855 19.7194C47.0855 18.9439 47.0407 18.1789 46.9536 17.4267L43.826 18.0518ZM44.2613 9.54743L40.9084 10.2176C37.9134 5.95821 32.9593 3.1746 27.3546 3.1746C21.7442 3.1746 16.7856 5.96385 13.7915 10.2305L10.4399 9.56057C13.892 3.83178 20.1756 0 27.3546 0C34.5281 0 40.8075 3.82591 44.2613 9.54743Z"
|
|
41
|
+
fill="var(--primary-color)"
|
|
42
|
+
fill-rule="evenodd" />
|
|
43
|
+
<mask
|
|
44
|
+
height="11"
|
|
45
|
+
id="mask0_1413_1551"
|
|
46
|
+
maskUnits="userSpaceOnUse"
|
|
47
|
+
style="mask-type: alpha"
|
|
48
|
+
width="54"
|
|
49
|
+
x="0"
|
|
50
|
+
y="8">
|
|
51
|
+
<path
|
|
52
|
+
d="M27 18.3652C10.5114 19.1944 0 8.88892 0 8.88892C0 8.88892 16.5176 14.5866 27 14.5866C37.4824 14.5866 54 8.88892 54 8.88892C54 8.88892 43.4886 17.5361 27 18.3652Z"
|
|
53
|
+
fill="var(--primary-color)" />
|
|
54
|
+
</mask>
|
|
55
|
+
<g mask="url(#mask0_1413_1551)">
|
|
56
|
+
<path
|
|
57
|
+
d="M-4.673e-05 8.88887L3.73084 -1.91434L-8.00806 17.0473L-4.673e-05 8.88887ZM27 18.3652L26.4253 6.95109L27 18.3652ZM54 8.88887L61.2673 17.7127L50.2691 -1.91434L54 8.88887ZM-4.673e-05 8.88887C-8.00806 17.0473 -8.00469 17.0505 -8.00132 17.0538C-8.00018 17.055 -7.99675 17.0583 -7.9944 17.0607C-7.98963 17.0653 -7.98474 17.0701 -7.97966 17.075C-7.96949 17.0849 -7.95863 17.0955 -7.94707 17.1066C-7.92401 17.129 -7.89809 17.1539 -7.86944 17.1812C-7.8122 17.236 -7.74377 17.3005 -7.66436 17.3743C-7.50567 17.5218 -7.30269 17.7063 -7.05645 17.9221C-6.56467 18.3532 -5.89662 18.9125 -5.06089 19.5534C-3.39603 20.83 -1.02575 22.4605 1.98012 24.0457C7.97874 27.2091 16.7723 30.3226 27.5746 29.7793L26.4253 6.95109C20.7391 7.23699 16.0326 5.61231 12.6534 3.83024C10.9703 2.94267 9.68222 2.04866 8.86091 1.41888C8.45356 1.10653 8.17155 0.867278 8.0241 0.738027C7.95072 0.673671 7.91178 0.637576 7.90841 0.634492C7.90682 0.63298 7.91419 0.639805 7.93071 0.65557C7.93897 0.663455 7.94952 0.673589 7.96235 0.686039C7.96883 0.692262 7.97582 0.699075 7.98338 0.706471C7.98719 0.710167 7.99113 0.714014 7.99526 0.718014C7.99729 0.720008 8.00047 0.723119 8.00148 0.724116C8.00466 0.727265 8.00796 0.730446 -4.673e-05 8.88887ZM27.5746 29.7793C37.6904 29.2706 45.9416 26.3684 51.6602 23.6054C54.5296 22.2191 56.8064 20.8465 58.4186 19.7784C59.2265 19.2431 59.873 18.7805 60.3494 18.4257C60.5878 18.2482 60.7841 18.0971 60.9374 17.977C61.014 17.9169 61.0799 17.8645 61.1349 17.8203C61.1624 17.7981 61.1872 17.7781 61.2093 17.7602C61.2203 17.7512 61.2307 17.7427 61.2403 17.7348C61.2452 17.7308 61.2499 17.727 61.2544 17.7233C61.2566 17.7215 61.2598 17.7188 61.261 17.7179C61.2642 17.7153 61.2673 17.7127 54 8.88887C46.7326 0.0650536 46.7357 0.0625219 46.7387 0.0600241C46.7397 0.0592345 46.7427 0.0567658 46.7446 0.0551857C46.7485 0.0520238 46.7521 0.0489887 46.7557 0.0460799C46.7628 0.0402623 46.7694 0.0349487 46.7753 0.0301318C46.7871 0.0204986 46.7966 0.0128495 46.8037 0.00712562C46.818 -0.00431848 46.8228 -0.00808311 46.8184 -0.00463784C46.8096 0.00228345 46.764 0.0378652 46.6828 0.0983779C46.5199 0.219675 46.2165 0.439161 45.7812 0.727519C44.9072 1.30663 43.5257 2.14765 41.7061 3.02677C38.0469 4.79468 32.7981 6.63058 26.4253 6.95109L27.5746 29.7793ZM54 8.88887C50.2691 -1.91433 50.27 -1.91467 50.271 -1.91498C50.2712 -1.91506 50.272 -1.91535 50.2724 -1.9155C50.2733 -1.91581 50.274 -1.91602 50.2743 -1.91616C50.2752 -1.91643 50.275 -1.91636 50.2738 -1.91595C50.2714 -1.91515 50.2652 -1.91302 50.2552 -1.9096C50.2351 -1.90276 50.1999 -1.89078 50.1503 -1.874C50.0509 -1.84043 49.8938 -1.78773 49.6844 -1.71863C49.2652 -1.58031 48.6387 -1.377 47.8481 -1.13035C46.2609 -0.635237 44.0427 0.0249875 41.5325 0.6823C36.215 2.07471 30.6736 3.15796 27 3.15796V26.0151C33.8087 26.0151 41.7672 24.2495 47.3292 22.7931C50.2586 22.026 52.825 21.2618 54.6625 20.6886C55.5842 20.4011 56.33 20.1593 56.8551 19.986C57.1178 19.8993 57.3258 19.8296 57.4735 19.7797C57.5474 19.7548 57.6062 19.7348 57.6493 19.72C57.6709 19.7127 57.6885 19.7066 57.7021 19.7019C57.7089 19.6996 57.7147 19.6976 57.7195 19.696C57.7219 19.6952 57.7241 19.6944 57.726 19.6938C57.7269 19.6934 57.7281 19.693 57.7286 19.6929C57.7298 19.6924 57.7309 19.692 54 8.88887ZM27 3.15796C23.3263 3.15796 17.7849 2.07471 12.4674 0.6823C9.95717 0.0249875 7.73904 -0.635237 6.15184 -1.13035C5.36118 -1.377 4.73467 -1.58031 4.3155 -1.71863C4.10609 -1.78773 3.94899 -1.84043 3.84961 -1.874C3.79994 -1.89078 3.76474 -1.90276 3.74471 -1.9096C3.73469 -1.91302 3.72848 -1.91515 3.72613 -1.91595C3.72496 -1.91636 3.72476 -1.91643 3.72554 -1.91616C3.72593 -1.91602 3.72657 -1.91581 3.72745 -1.9155C3.72789 -1.91535 3.72874 -1.91506 3.72896 -1.91498C3.72987 -1.91467 3.73084 -1.91433 -4.673e-05 8.88887C-3.73093 19.692 -3.72983 19.6924 -3.72868 19.6929C-3.72821 19.693 -3.72698 19.6934 -3.72603 19.6938C-3.72415 19.6944 -3.72201 19.6952 -3.71961 19.696C-3.71482 19.6976 -3.70901 19.6996 -3.7022 19.7019C-3.68858 19.7066 -3.67095 19.7127 -3.6494 19.72C-3.60629 19.7348 -3.54745 19.7548 -3.47359 19.7797C-3.32589 19.8296 -3.11788 19.8993 -2.85516 19.986C-2.33008 20.1593 -1.58425 20.4011 -0.662589 20.6886C1.17485 21.2618 3.74125 22.026 6.67073 22.7931C12.2327 24.2495 20.1913 26.0151 27 26.0151V3.15796Z"
|
|
58
|
+
fill="var(--primary-color)" />
|
|
59
|
+
</g>
|
|
60
|
+
</svg>
|
|
61
|
+
<div class="text-surface-900 dark:text-surface-0 text-3xl font-medium mb-4">Welcome to PrimeLand!</div>
|
|
62
|
+
<span class="text-muted-color font-medium">Sign in to continue</span>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div>
|
|
66
|
+
<label
|
|
67
|
+
class="block text-surface-900 dark:text-surface-0 text-xl font-medium mb-2"
|
|
68
|
+
for="oip-app-login-email-address-input"
|
|
69
|
+
>Email</label
|
|
70
|
+
>
|
|
71
|
+
<input
|
|
72
|
+
class="w-full md:w-[30rem] mb-8"
|
|
73
|
+
id="oip-app-login-email-address-input"
|
|
74
|
+
pInputText
|
|
75
|
+
placeholder="Email address"
|
|
76
|
+
type="text"
|
|
77
|
+
[(ngModel)]="email" />
|
|
78
|
+
|
|
79
|
+
<label
|
|
80
|
+
class="block text-surface-900 dark:text-surface-0 font-medium text-xl mb-2"
|
|
81
|
+
for="oip-app-login-password"
|
|
82
|
+
>Password</label
|
|
83
|
+
>
|
|
84
|
+
<p-password
|
|
85
|
+
id="oip-app-login-password"
|
|
86
|
+
placeholder="Password"
|
|
87
|
+
styleClass="mb-4"
|
|
88
|
+
[feedback]="false"
|
|
89
|
+
[fluid]="true"
|
|
90
|
+
[toggleMask]="true"
|
|
91
|
+
[(ngModel)]="password"></p-password>
|
|
92
|
+
|
|
93
|
+
<div class="flex items-center justify-between mt-2 mb-8 gap-8">
|
|
94
|
+
<div class="flex items-center">
|
|
95
|
+
<p-checkbox
|
|
96
|
+
binary
|
|
97
|
+
class="mr-2"
|
|
98
|
+
id="oip-app-login-remember-me-checkbox"
|
|
99
|
+
[(ngModel)]="checked"></p-checkbox>
|
|
100
|
+
<label for="oip-app-login-remember-me-checkbox">Remember me</label>
|
|
101
|
+
</div>
|
|
102
|
+
<span class="font-medium no-underline ml-2 text-right cursor-pointer text-primary"
|
|
103
|
+
>Forgot password?</span
|
|
104
|
+
>
|
|
105
|
+
</div>
|
|
106
|
+
<p-button id="oip-app-login-sign-in-button" label="Sign In" routerLink="/" styleClass="w-full"></p-button>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
`
|
|
113
|
+
})
|
|
114
|
+
export class LoginComponent {
|
|
115
|
+
email: string = '';
|
|
116
|
+
|
|
117
|
+
password: string = '';
|
|
118
|
+
|
|
119
|
+
checked: boolean = false;
|
|
120
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { ButtonModule } from 'primeng/button';
|
|
3
|
+
import { RippleModule } from 'primeng/ripple';
|
|
4
|
+
import { LogoComponent } from '../../logo.component';
|
|
5
|
+
import { SecurityService } from '../../../services/security.service';
|
|
6
|
+
import { AppFloatingConfiguratorComponent } from '../../app-floating-configurator.component';
|
|
7
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
8
|
+
import { TranslatePipe } from '@ngx-translate/core';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
template: `
|
|
12
|
+
<app-floating-configurator />
|
|
13
|
+
<div
|
|
14
|
+
class="bg-surface-50 dark:bg-surface-950 flex items-center justify-center min-h-screen min-w-[100vw] overflow-hidden">
|
|
15
|
+
<div class="flex flex-col items-center justify-center">
|
|
16
|
+
<div
|
|
17
|
+
style="border-radius: 56px; padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)">
|
|
18
|
+
<div class="w-full bg-surface-0 dark:bg-surface-900 py-20 px-8 sm:px-20" style="border-radius: 53px">
|
|
19
|
+
<div class="flex flex-col items-center justify-center">
|
|
20
|
+
<logo [height]="96" [width]="96" />
|
|
21
|
+
</div>
|
|
22
|
+
<div class="text-center mb-8">
|
|
23
|
+
<div class="text-surface-900 dark:text-surface-0 text-3xl font-medium mb-4">
|
|
24
|
+
{{ 'unauthorized.welcomeToOip' | translate }}
|
|
25
|
+
</div>
|
|
26
|
+
<span class="text-muted-color font-medium">{{ 'unauthorized.signInToContinue' | translate }}</span>
|
|
27
|
+
</div>
|
|
28
|
+
<div>
|
|
29
|
+
<p-button
|
|
30
|
+
id="oip-unauthorized-error-sign-in-button"
|
|
31
|
+
label="{{ 'unauthorized.signIn' | translate }}"
|
|
32
|
+
styleClass="w-full"
|
|
33
|
+
(click)="securityService.authorize()"></p-button>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
`,
|
|
40
|
+
imports: [
|
|
41
|
+
ButtonModule,
|
|
42
|
+
RippleModule,
|
|
43
|
+
LogoComponent,
|
|
44
|
+
AppFloatingConfiguratorComponent,
|
|
45
|
+
ReactiveFormsModule,
|
|
46
|
+
TranslatePipe
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
export class UnauthorizedComponent {
|
|
50
|
+
protected readonly securityService = inject(SecurityService);
|
|
51
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Component, effect, inject, OnDestroy, OnInit, signal, WritableSignal } from '@angular/core';
|
|
2
|
+
import { TopBarDto } from '../dtos/top-bar.dto';
|
|
3
|
+
import { TopBarService } from '../services/top-bar.service';
|
|
4
|
+
import { MsgService } from '../services/msg.service';
|
|
5
|
+
import { ActivatedRoute } from '@angular/router';
|
|
6
|
+
import { BaseDataService } from '../services/base-data.service';
|
|
7
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
8
|
+
import { Subject, Subscription } from 'rxjs';
|
|
9
|
+
import { AppTitleService } from '../services/app-title.service';
|
|
10
|
+
|
|
11
|
+
interface BaseComponentLocalization {
|
|
12
|
+
security: string;
|
|
13
|
+
settings: string;
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Component({ standalone: true, template: '' })
|
|
18
|
+
export abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSettings> implements OnInit, OnDestroy {
|
|
19
|
+
/**
|
|
20
|
+
* Provides access to topbar related functionality, such as managing visibility and content.
|
|
21
|
+
* @type {TopBarService}
|
|
22
|
+
*/
|
|
23
|
+
public readonly topBarService: TopBarService = inject(TopBarService);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provides access to information about the current route.
|
|
27
|
+
* This includes route parameters, data, and the route's path.
|
|
28
|
+
*/
|
|
29
|
+
public readonly route: ActivatedRoute = inject(ActivatedRoute);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Provides access to messaging services.
|
|
33
|
+
*/
|
|
34
|
+
public readonly msgService = inject(MsgService);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Provides access to base data service functionality.
|
|
38
|
+
* @deprecated The method should not be used
|
|
39
|
+
*/
|
|
40
|
+
public readonly baseDataService: BaseDataService = inject(BaseDataService);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Provides access to translation functionality.
|
|
44
|
+
*/
|
|
45
|
+
public readonly translateService = inject(TranslateService);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Provides access to the application's title service.
|
|
49
|
+
*/
|
|
50
|
+
public readonly appTitleService = inject(AppTitleService);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Reference to the ChangeDetector. Used to trigger change detection manually.
|
|
54
|
+
*/
|
|
55
|
+
private changeDetectorRef: ChangeDetectorRef = inject(ChangeDetectorRef);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Represents a subscription to an observable.
|
|
59
|
+
* Manages the lifecycle of receiving data from the observable and allows unsubscribing to stop receiving data.
|
|
60
|
+
* @type {Subscription}
|
|
61
|
+
*/
|
|
62
|
+
private subscriptions: Subscription[] = [];
|
|
63
|
+
/**
|
|
64
|
+
* Configuration object for backend storage
|
|
65
|
+
* @type {TBackendStoreSettings}
|
|
66
|
+
*/
|
|
67
|
+
public settings: TBackendStoreSettings = {} as TBackendStoreSettings;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Configuration object for local storage.
|
|
71
|
+
* @type {TLocalStoreSettings}
|
|
72
|
+
*/
|
|
73
|
+
public _localSettings: TLocalStoreSettings = {} as TLocalStoreSettings;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A signal representing the local application settings. Changes to this signal
|
|
77
|
+
* propagate updates to the underlying local store settings.
|
|
78
|
+
* @type {WritableSignal<TLocalStoreSettings>}
|
|
79
|
+
*/
|
|
80
|
+
public localSettings: WritableSignal<TLocalStoreSettings> = signal<TLocalStoreSettings>(this._localSettings);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A Subject emitting updates to local store settings. Observables can subscribe to this Subject to react to changes in local settings.
|
|
84
|
+
* @type {Subject<TLocalStoreSettings>}
|
|
85
|
+
*/
|
|
86
|
+
public localSettingsUpdate: Subject<TLocalStoreSettings> = new Subject<TLocalStoreSettings>();
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The title of the component. Get from Title in ngOnInit
|
|
90
|
+
* @type {string}
|
|
91
|
+
*/
|
|
92
|
+
public title: string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Updates local settings and persists them to local storage.
|
|
96
|
+
* @return {void}
|
|
97
|
+
*/
|
|
98
|
+
private onConfigUpdate(): void {
|
|
99
|
+
if (Object.keys(this.localSettings()).length > 0) {
|
|
100
|
+
this._localSettings = { ...this.localSettings() };
|
|
101
|
+
this.localSettingsUpdate.next(this._localSettings);
|
|
102
|
+
localStorage.setItem(`Instance_${this.id}`, JSON.stringify(this._localSettings));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private getLocalStorageSettings() {
|
|
107
|
+
try {
|
|
108
|
+
const localStorageSettingsString = localStorage.getItem(`Instance_${this.id}`);
|
|
109
|
+
if (localStorageSettingsString != null) {
|
|
110
|
+
this.localSettings.set(JSON.parse(localStorageSettingsString) as TLocalStoreSettings);
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
this.msgService.error(error, 'Error parsing layoutConfig:');
|
|
114
|
+
this.localSettings.set({} as TLocalStoreSettings);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A unique numerical identifier for the module.
|
|
120
|
+
* @type {number}
|
|
121
|
+
*/
|
|
122
|
+
id: number | undefined = undefined;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The name of the controller currently handling the request.
|
|
126
|
+
* @type {string}
|
|
127
|
+
*/
|
|
128
|
+
controller: string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Checks if the content ID is present.
|
|
132
|
+
* @returns {boolean} True if the content ID is present, false otherwise.
|
|
133
|
+
*/
|
|
134
|
+
get isContent(): boolean {
|
|
135
|
+
return this.topBarService.checkId('content');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Checks if the settings ID is present.
|
|
140
|
+
* @returns {boolean} True if the settings ID is present, false otherwise.
|
|
141
|
+
*/
|
|
142
|
+
get isSettings(): boolean {
|
|
143
|
+
return this.topBarService.checkId('settings');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Checks if the security ID is present.
|
|
148
|
+
* @returns {boolean} True if the security ID is present, false otherwise.
|
|
149
|
+
*/
|
|
150
|
+
get isSecurity(): boolean {
|
|
151
|
+
return this.topBarService.checkId('security');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Defines the top bar items.
|
|
156
|
+
*/
|
|
157
|
+
public topBarItems: TopBarDto[] = [
|
|
158
|
+
{ id: 'content', icon: 'pi-box', caption: '' },
|
|
159
|
+
{ id: 'settings', icon: 'pi-cog', caption: '' },
|
|
160
|
+
{ id: 'security', icon: 'pi-lock', caption: '' }
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Initializes the component and subscribes to local settings updates.
|
|
165
|
+
*/
|
|
166
|
+
constructor() {
|
|
167
|
+
effect(() => {
|
|
168
|
+
const config = this.localSettings();
|
|
169
|
+
if (config) {
|
|
170
|
+
this.onConfigUpdate();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
this.subscriptions.push(
|
|
174
|
+
this.route.url.subscribe((url) => {
|
|
175
|
+
this.controller = url[0].path;
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
this.subscriptions.push(
|
|
179
|
+
this.route.paramMap.subscribe((params) => {
|
|
180
|
+
this.id = +params.get('id');
|
|
181
|
+
this.getLocalStorageSettings();
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Lifecycle hook that is called when a component is destroyed.
|
|
188
|
+
* Unsubscribes from all subscriptions to prevent memory leaks,
|
|
189
|
+
* resets the top bar items to an empty array, and sets the active ID
|
|
190
|
+
* to the ID of the first top bar item (if available).
|
|
191
|
+
*/
|
|
192
|
+
ngOnDestroy() {
|
|
193
|
+
this.topBarService.setTopBarItems([]);
|
|
194
|
+
this.topBarService.activeId = this.topBarItems[0].id;
|
|
195
|
+
this.subscriptions.forEach((s) => s.unsubscribe());
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Initializes the component. Subscribes to translation service to set captions for top bar items,
|
|
200
|
+
* sets the top bar items via the top bar service, sets the active ID,
|
|
201
|
+
* subscribes to route parameters to get the ID, and retrieves settings.
|
|
202
|
+
* @return {Promise<void>} A promise that resolves when the initialization is complete.
|
|
203
|
+
*/
|
|
204
|
+
async ngOnInit(): Promise<void> {
|
|
205
|
+
this.subscriptions.push(
|
|
206
|
+
this.translateService.get('baseComponent').subscribe((value: BaseComponentLocalization) => {
|
|
207
|
+
this.topBarItems[0].caption = value.content;
|
|
208
|
+
this.topBarItems[1].caption = value.settings;
|
|
209
|
+
this.topBarItems[2].caption = value.security;
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
this.topBarService.setTopBarItems(this.topBarItems);
|
|
214
|
+
this.topBarService.activeId = this.topBarItems[0].id;
|
|
215
|
+
|
|
216
|
+
await this.getSettings();
|
|
217
|
+
|
|
218
|
+
this.subscriptions.push(
|
|
219
|
+
this.appTitleService.title$.subscribe((title) => {
|
|
220
|
+
this.title = title;
|
|
221
|
+
this.changeDetectorRef.detectChanges();
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Retrieves module instance settings.
|
|
228
|
+
* @return {Promise<void>} A promise that resolves when settings are retrieved.
|
|
229
|
+
*/
|
|
230
|
+
async getSettings(): Promise<void> {
|
|
231
|
+
try {
|
|
232
|
+
this.settings = await this.baseDataService.sendRequest<TBackendStoreSettings>(
|
|
233
|
+
`${this.baseDataService.baseUrl}api/${this.controller}/get-module-instance-settings?id=${this.id}`
|
|
234
|
+
);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
this.msgService.error(error);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Saves the provided settings to the backend.
|
|
242
|
+
* @param {TLocalStoreSettings} settings - The settings object to save.
|
|
243
|
+
* @return {Promise<void>} A promise that resolves when the settings are saved. Reject if an error occurs.
|
|
244
|
+
*/
|
|
245
|
+
async saveSettings(settings: TBackendStoreSettings): Promise<void> {
|
|
246
|
+
await this.baseDataService
|
|
247
|
+
.sendRequest(`api/${this.controller}/put-module-instance-settings`, 'PUT', {
|
|
248
|
+
id: this.id,
|
|
249
|
+
settings: settings
|
|
250
|
+
})
|
|
251
|
+
.then(() => {
|
|
252
|
+
this.msgService.success(this.translateService.instant('baseComponent.success'));
|
|
253
|
+
})
|
|
254
|
+
.catch((error) => {
|
|
255
|
+
this.msgService.error(error);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|