@juice-js/tenants 1.0.2 → 1.0.6-alpha.5
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/.releaserc +7 -0
- package/package.json +13 -5
- package/src/_tenants.component-theme.scss +64 -64
- package/src/lib/confirm-dialog/confirm-dialog.component.scss +9 -9
- package/src/lib/shared/custom-error-state-matcher.ts +15 -15
- package/src/lib/shared/material.module.ts +62 -62
- package/src/lib/shared/models/table.query-result.ts +6 -6
- package/src/lib/shared/models/tenant.create.model.ts +12 -12
- package/src/lib/shared/models/tenant.model.ts +14 -14
- package/src/lib/shared/models/tenant.setting.model.ts +13 -13
- package/src/lib/shared/models/tenant.status.ts +31 -31
- package/src/lib/shared/models/tenant.update.model.ts +4 -4
- package/src/lib/shared/services/tenant-admin.service.ts +8 -0
- package/src/lib/shared/tenant-configuration.ts +17 -17
- package/src/lib/shared/tenant-testing.ts +44 -44
- package/src/lib/tenant-create/tenant-create.component.css +9 -9
- package/src/lib/tenant-detail/tenant-detail.component.scss +2 -2
- package/src/lib/tenant-summary/tenant-summary.component.css +3 -3
- package/src/lib/tenant-update/tenant-update.component.scss +8 -8
- package/src/lib/tenants.component.html +3 -0
- package/src/lib/tenants.component.scss +56 -56
- package/src/lib/tenants.component.ts +45 -5
package/.releaserc
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juice-js/tenants",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6-alpha.5",
|
|
4
4
|
"description": "Juice tenants admin module",
|
|
5
5
|
"author": "jack@creatorflow.io",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,13 +8,21 @@
|
|
|
8
8
|
"url": "https://github.com/creatorflow-io/juice-tenants/issues"
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://github.com/creatorflow-io/juice-tenants#readme",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
11
14
|
"peerDependencies": {
|
|
12
|
-
"@angular/common": "^
|
|
13
|
-
"@angular/core": "^
|
|
14
|
-
"@angular/material": "^
|
|
15
|
+
"@angular/common": "^15.2.9",
|
|
16
|
+
"@angular/core": "^15.2.9",
|
|
17
|
+
"@angular/material": "^15.2.9",
|
|
15
18
|
"@ngx-translate/core": "^14.0.0",
|
|
16
19
|
"ngx-mat-multi-sort": "^0.10.2",
|
|
17
|
-
"@juice-js/dict-builder": "^1.0.
|
|
20
|
+
"@juice-js/dict-builder": "^1.0.3"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
"./theming": {
|
|
24
|
+
"sass": "./theming/_tenants.component-theme.scss"
|
|
25
|
+
}
|
|
18
26
|
},
|
|
19
27
|
"dependencies": {
|
|
20
28
|
"tslib": "^2.3.0"
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
@use 'sass:map';
|
|
2
|
-
@use '@angular/material' as mat;
|
|
3
|
-
|
|
4
|
-
@mixin color($theme){
|
|
5
|
-
// Get the color config from the theme.
|
|
6
|
-
$color-config: mat.get-color-config($theme);
|
|
7
|
-
// Get the primary color palette from the color-config.
|
|
8
|
-
$primary-palette: map.get($color-config, 'primary');
|
|
9
|
-
$accent-palette: map.get($color-config, 'accent');
|
|
10
|
-
$warn-palette: map.get($color-config, 'warn');
|
|
11
|
-
$green-palette: mat.define-palette(mat.$green-palette, 500, 300, 700);
|
|
12
|
-
.color-primary {
|
|
13
|
-
color: mat.get-color-from-palette($primary-palette, 'darker') !important;
|
|
14
|
-
.mdc-list-item__primary-text{
|
|
15
|
-
color: mat.get-color-from-palette($primary-palette, 'darker') !important;
|
|
16
|
-
}
|
|
17
|
-
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
18
|
-
color: mat.get-color-from-palette($primary-palette, 'darker') !important;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.color-accent {
|
|
23
|
-
color: mat.get-color-from-palette($accent-palette, 'darker') !important;
|
|
24
|
-
.mdc-list-item__primary-text{
|
|
25
|
-
color: mat.get-color-from-palette($accent-palette, 'darker') !important;
|
|
26
|
-
}
|
|
27
|
-
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
28
|
-
color: mat.get-color-from-palette($accent-palette, 'darker') !important;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.color-warn {
|
|
33
|
-
color: mat.get-color-from-palette($warn-palette, 'darker') !important;
|
|
34
|
-
.mdc-list-item__primary-text{
|
|
35
|
-
color: mat.get-color-from-palette($warn-palette, 'darker') !important;
|
|
36
|
-
}
|
|
37
|
-
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
38
|
-
color: mat.get-color-from-palette($warn-palette, 'darker') !important;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.color-success,
|
|
43
|
-
.mat-success.mat-mdc-button:not(:disabled){
|
|
44
|
-
color: mat.get-color-from-palette($green-palette, 'darker') !important;
|
|
45
|
-
.mdc-list-item__primary-text{
|
|
46
|
-
color: mat.get-color-from-palette($green-palette, 'darker') !important;
|
|
47
|
-
}
|
|
48
|
-
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
49
|
-
color: mat.get-color-from-palette($green-palette, 'darker') !important;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.bg-accent {
|
|
54
|
-
background-color: mat.get-color-from-palette($accent-palette, 'lighter') !important;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.bg-warn {
|
|
58
|
-
background-color: mat.get-color-from-palette($warn-palette, 'lighter') !important;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.bg-success{
|
|
62
|
-
background-color: mat.get-color-from-palette($green-palette, 'lighter') !important;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
|
|
4
|
+
@mixin color($theme){
|
|
5
|
+
// Get the color config from the theme.
|
|
6
|
+
$color-config: mat.get-color-config($theme);
|
|
7
|
+
// Get the primary color palette from the color-config.
|
|
8
|
+
$primary-palette: map.get($color-config, 'primary');
|
|
9
|
+
$accent-palette: map.get($color-config, 'accent');
|
|
10
|
+
$warn-palette: map.get($color-config, 'warn');
|
|
11
|
+
$green-palette: mat.define-palette(mat.$green-palette, 500, 300, 700);
|
|
12
|
+
.color-primary {
|
|
13
|
+
color: mat.get-color-from-palette($primary-palette, 'darker') !important;
|
|
14
|
+
.mdc-list-item__primary-text{
|
|
15
|
+
color: mat.get-color-from-palette($primary-palette, 'darker') !important;
|
|
16
|
+
}
|
|
17
|
+
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
18
|
+
color: mat.get-color-from-palette($primary-palette, 'darker') !important;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.color-accent {
|
|
23
|
+
color: mat.get-color-from-palette($accent-palette, 'darker') !important;
|
|
24
|
+
.mdc-list-item__primary-text{
|
|
25
|
+
color: mat.get-color-from-palette($accent-palette, 'darker') !important;
|
|
26
|
+
}
|
|
27
|
+
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
28
|
+
color: mat.get-color-from-palette($accent-palette, 'darker') !important;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.color-warn {
|
|
33
|
+
color: mat.get-color-from-palette($warn-palette, 'darker') !important;
|
|
34
|
+
.mdc-list-item__primary-text{
|
|
35
|
+
color: mat.get-color-from-palette($warn-palette, 'darker') !important;
|
|
36
|
+
}
|
|
37
|
+
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
38
|
+
color: mat.get-color-from-palette($warn-palette, 'darker') !important;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.color-success,
|
|
43
|
+
.mat-success.mat-mdc-button:not(:disabled){
|
|
44
|
+
color: mat.get-color-from-palette($green-palette, 'darker') !important;
|
|
45
|
+
.mdc-list-item__primary-text{
|
|
46
|
+
color: mat.get-color-from-palette($green-palette, 'darker') !important;
|
|
47
|
+
}
|
|
48
|
+
&.mat-mdc-menu-item .mat-icon-no-color{
|
|
49
|
+
color: mat.get-color-from-palette($green-palette, 'darker') !important;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.bg-accent {
|
|
54
|
+
background-color: mat.get-color-from-palette($accent-palette, 'lighter') !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.bg-warn {
|
|
58
|
+
background-color: mat.get-color-from-palette($warn-palette, 'lighter') !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.bg-success{
|
|
62
|
+
background-color: mat.get-color-from-palette($green-palette, 'lighter') !important;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
:host{
|
|
2
|
-
mat-card{
|
|
3
|
-
width: 350px;
|
|
4
|
-
}
|
|
5
|
-
mat-card-subtitle{
|
|
6
|
-
padding-top: 12px !important;
|
|
7
|
-
padding: 12px;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
:host{
|
|
2
|
+
mat-card{
|
|
3
|
+
width: 350px;
|
|
4
|
+
}
|
|
5
|
+
mat-card-subtitle{
|
|
6
|
+
padding-top: 12px !important;
|
|
7
|
+
padding: 12px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FormControl,
|
|
3
|
-
FormGroupDirective,
|
|
4
|
-
NgForm,
|
|
5
|
-
} from '@angular/forms';
|
|
6
|
-
|
|
7
|
-
import {ErrorStateMatcher} from '@angular/material/core';
|
|
8
|
-
|
|
9
|
-
/** Error when invalid control is dirty, touched, or submitted. */
|
|
10
|
-
export class CustomErrorStateMatcher implements ErrorStateMatcher {
|
|
11
|
-
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
|
12
|
-
const isSubmitted = form && form.submitted;
|
|
13
|
-
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
FormControl,
|
|
3
|
+
FormGroupDirective,
|
|
4
|
+
NgForm,
|
|
5
|
+
} from '@angular/forms';
|
|
6
|
+
|
|
7
|
+
import {ErrorStateMatcher} from '@angular/material/core';
|
|
8
|
+
|
|
9
|
+
/** Error when invalid control is dirty, touched, or submitted. */
|
|
10
|
+
export class CustomErrorStateMatcher implements ErrorStateMatcher {
|
|
11
|
+
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
|
|
12
|
+
const isSubmitted = form && form.submitted;
|
|
13
|
+
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import {NgModule} from '@angular/core';
|
|
2
|
-
import {MatButtonModule} from '@angular/material/button';
|
|
3
|
-
import {MatCardModule} from '@angular/material/card';
|
|
4
|
-
import {MatCheckboxModule} from '@angular/material/checkbox';
|
|
5
|
-
import {MatDatepickerModule} from '@angular/material/datepicker';
|
|
6
|
-
import {MatDialogModule} from '@angular/material/dialog';
|
|
7
|
-
import {MatDividerModule} from '@angular/material/divider';
|
|
8
|
-
import {MatExpansionModule} from '@angular/material/expansion';
|
|
9
|
-
import {MatGridListModule} from '@angular/material/grid-list';
|
|
10
|
-
import {MatIconModule} from '@angular/material/icon';
|
|
11
|
-
import {MatInputModule} from '@angular/material/input';
|
|
12
|
-
import {MatListModule} from '@angular/material/list';
|
|
13
|
-
import {MatMenuModule} from '@angular/material/menu';
|
|
14
|
-
import {MatNativeDateModule, MatRippleModule} from '@angular/material/core';
|
|
15
|
-
import {MatPaginatorModule} from '@angular/material/paginator';
|
|
16
|
-
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
|
17
|
-
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
|
|
18
|
-
import {MatRadioModule} from '@angular/material/radio';
|
|
19
|
-
import {MatSelectModule} from '@angular/material/select';
|
|
20
|
-
import {MatSliderModule} from '@angular/material/slider';
|
|
21
|
-
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
|
|
22
|
-
import {MatSnackBarModule} from '@angular/material/snack-bar';
|
|
23
|
-
import {MatSortModule} from '@angular/material/sort';
|
|
24
|
-
import {MatTableModule} from '@angular/material/table';
|
|
25
|
-
import {MatTabsModule} from '@angular/material/tabs';
|
|
26
|
-
import {MatToolbarModule} from '@angular/material/toolbar';
|
|
27
|
-
import {MatTooltipModule} from '@angular/material/tooltip';
|
|
28
|
-
import {MatTreeModule} from '@angular/material/tree';
|
|
29
|
-
|
|
30
|
-
@NgModule({
|
|
31
|
-
exports: [
|
|
32
|
-
MatButtonModule,
|
|
33
|
-
MatCardModule,
|
|
34
|
-
MatCheckboxModule,
|
|
35
|
-
MatDatepickerModule,
|
|
36
|
-
MatDialogModule,
|
|
37
|
-
MatDividerModule,
|
|
38
|
-
MatExpansionModule,
|
|
39
|
-
MatGridListModule,
|
|
40
|
-
MatIconModule,
|
|
41
|
-
MatInputModule,
|
|
42
|
-
MatListModule,
|
|
43
|
-
MatMenuModule,
|
|
44
|
-
MatNativeDateModule,
|
|
45
|
-
MatPaginatorModule,
|
|
46
|
-
MatProgressBarModule,
|
|
47
|
-
MatProgressSpinnerModule,
|
|
48
|
-
MatRadioModule,
|
|
49
|
-
MatRippleModule,
|
|
50
|
-
MatSelectModule,
|
|
51
|
-
MatSliderModule,
|
|
52
|
-
MatSlideToggleModule,
|
|
53
|
-
MatSnackBarModule,
|
|
54
|
-
MatSortModule,
|
|
55
|
-
MatTableModule,
|
|
56
|
-
MatTabsModule,
|
|
57
|
-
MatToolbarModule,
|
|
58
|
-
MatTooltipModule,
|
|
59
|
-
MatTreeModule
|
|
60
|
-
]
|
|
61
|
-
})
|
|
62
|
-
export class MaterialModule {}
|
|
1
|
+
import {NgModule} from '@angular/core';
|
|
2
|
+
import {MatButtonModule} from '@angular/material/button';
|
|
3
|
+
import {MatCardModule} from '@angular/material/card';
|
|
4
|
+
import {MatCheckboxModule} from '@angular/material/checkbox';
|
|
5
|
+
import {MatDatepickerModule} from '@angular/material/datepicker';
|
|
6
|
+
import {MatDialogModule} from '@angular/material/dialog';
|
|
7
|
+
import {MatDividerModule} from '@angular/material/divider';
|
|
8
|
+
import {MatExpansionModule} from '@angular/material/expansion';
|
|
9
|
+
import {MatGridListModule} from '@angular/material/grid-list';
|
|
10
|
+
import {MatIconModule} from '@angular/material/icon';
|
|
11
|
+
import {MatInputModule} from '@angular/material/input';
|
|
12
|
+
import {MatListModule} from '@angular/material/list';
|
|
13
|
+
import {MatMenuModule} from '@angular/material/menu';
|
|
14
|
+
import {MatNativeDateModule, MatRippleModule} from '@angular/material/core';
|
|
15
|
+
import {MatPaginatorModule} from '@angular/material/paginator';
|
|
16
|
+
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
|
17
|
+
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
|
|
18
|
+
import {MatRadioModule} from '@angular/material/radio';
|
|
19
|
+
import {MatSelectModule} from '@angular/material/select';
|
|
20
|
+
import {MatSliderModule} from '@angular/material/slider';
|
|
21
|
+
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
|
|
22
|
+
import {MatSnackBarModule} from '@angular/material/snack-bar';
|
|
23
|
+
import {MatSortModule} from '@angular/material/sort';
|
|
24
|
+
import {MatTableModule} from '@angular/material/table';
|
|
25
|
+
import {MatTabsModule} from '@angular/material/tabs';
|
|
26
|
+
import {MatToolbarModule} from '@angular/material/toolbar';
|
|
27
|
+
import {MatTooltipModule} from '@angular/material/tooltip';
|
|
28
|
+
import {MatTreeModule} from '@angular/material/tree';
|
|
29
|
+
|
|
30
|
+
@NgModule({
|
|
31
|
+
exports: [
|
|
32
|
+
MatButtonModule,
|
|
33
|
+
MatCardModule,
|
|
34
|
+
MatCheckboxModule,
|
|
35
|
+
MatDatepickerModule,
|
|
36
|
+
MatDialogModule,
|
|
37
|
+
MatDividerModule,
|
|
38
|
+
MatExpansionModule,
|
|
39
|
+
MatGridListModule,
|
|
40
|
+
MatIconModule,
|
|
41
|
+
MatInputModule,
|
|
42
|
+
MatListModule,
|
|
43
|
+
MatMenuModule,
|
|
44
|
+
MatNativeDateModule,
|
|
45
|
+
MatPaginatorModule,
|
|
46
|
+
MatProgressBarModule,
|
|
47
|
+
MatProgressSpinnerModule,
|
|
48
|
+
MatRadioModule,
|
|
49
|
+
MatRippleModule,
|
|
50
|
+
MatSelectModule,
|
|
51
|
+
MatSliderModule,
|
|
52
|
+
MatSlideToggleModule,
|
|
53
|
+
MatSnackBarModule,
|
|
54
|
+
MatSortModule,
|
|
55
|
+
MatTableModule,
|
|
56
|
+
MatTabsModule,
|
|
57
|
+
MatToolbarModule,
|
|
58
|
+
MatTooltipModule,
|
|
59
|
+
MatTreeModule
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
export class MaterialModule {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export interface TableQueryResult<TModel>{
|
|
3
|
-
page: number;
|
|
4
|
-
pageSize: number;
|
|
5
|
-
data: TModel[];
|
|
6
|
-
count: number;
|
|
1
|
+
|
|
2
|
+
export interface TableQueryResult<TModel>{
|
|
3
|
+
page: number;
|
|
4
|
+
pageSize: number;
|
|
5
|
+
data: TModel[];
|
|
6
|
+
count: number;
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export class TenantCreate {
|
|
2
|
-
public name: string = "";
|
|
3
|
-
public identifier: string = "";
|
|
4
|
-
public connectionString: string = "";
|
|
5
|
-
public adminUser: string = "";
|
|
6
|
-
public adminEmail: string = "";
|
|
7
|
-
public properties: any = {};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class TenantCreated{
|
|
11
|
-
public id: string = "";
|
|
12
|
-
public identifier: string = "";
|
|
1
|
+
export class TenantCreate {
|
|
2
|
+
public name: string = "";
|
|
3
|
+
public identifier: string = "";
|
|
4
|
+
public connectionString: string = "";
|
|
5
|
+
public adminUser: string = "";
|
|
6
|
+
public adminEmail: string = "";
|
|
7
|
+
public properties: any = {};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class TenantCreated{
|
|
11
|
+
public id: string = "";
|
|
12
|
+
public identifier: string = "";
|
|
13
13
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { TenantStatus } from "./tenant.status";
|
|
2
|
-
|
|
3
|
-
export interface TenantBasic {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
identifier: string;
|
|
7
|
-
status: TenantStatus;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface Tenant extends TenantBasic {
|
|
11
|
-
connectionString: string;
|
|
12
|
-
ownerUser: string;
|
|
13
|
-
ownerName: string;
|
|
14
|
-
serializedProperties: string;
|
|
1
|
+
import { TenantStatus } from "./tenant.status";
|
|
2
|
+
|
|
3
|
+
export interface TenantBasic {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
identifier: string;
|
|
7
|
+
status: TenantStatus;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Tenant extends TenantBasic {
|
|
11
|
+
connectionString: string;
|
|
12
|
+
ownerUser: string;
|
|
13
|
+
ownerName: string;
|
|
14
|
+
serializedProperties: string;
|
|
15
15
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
export class TenantSetting{
|
|
3
|
-
public key: string = "";
|
|
4
|
-
public value: string = "";
|
|
5
|
-
public inherited: boolean = false;
|
|
6
|
-
public overridden: boolean = false;
|
|
7
|
-
|
|
8
|
-
constructor(key: string, value: string, inherited: boolean = false, overridden: boolean = false){
|
|
9
|
-
this.key = key;
|
|
10
|
-
this.value = value;
|
|
11
|
-
this.inherited = inherited;
|
|
12
|
-
this.overridden = overridden;
|
|
13
|
-
}
|
|
1
|
+
|
|
2
|
+
export class TenantSetting{
|
|
3
|
+
public key: string = "";
|
|
4
|
+
public value: string = "";
|
|
5
|
+
public inherited: boolean = false;
|
|
6
|
+
public overridden: boolean = false;
|
|
7
|
+
|
|
8
|
+
constructor(key: string, value: string, inherited: boolean = false, overridden: boolean = false){
|
|
9
|
+
this.key = key;
|
|
10
|
+
this.value = value;
|
|
11
|
+
this.inherited = inherited;
|
|
12
|
+
this.overridden = overridden;
|
|
13
|
+
}
|
|
14
14
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
export enum TenantStatus {
|
|
3
|
-
New, PendingApproval, Approved, Rejected, Initializing, Initialized, PendingToActive, Inactive, Active, Suspended, Abandoned
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class TenantStatusHelper{
|
|
7
|
-
static getColor(status: TenantStatus){
|
|
8
|
-
var s = (typeof status == "string" ? TenantStatus[status] : status) as TenantStatus;
|
|
9
|
-
switch(s){
|
|
10
|
-
case TenantStatus.New:
|
|
11
|
-
return "accent-color";
|
|
12
|
-
case TenantStatus.Initialized:
|
|
13
|
-
return "success-color";
|
|
14
|
-
case TenantStatus.Approved:
|
|
15
|
-
return "success-color";
|
|
16
|
-
case TenantStatus.PendingApproval:
|
|
17
|
-
return "accent-color";
|
|
18
|
-
case TenantStatus.PendingToActive:
|
|
19
|
-
return "accent-color";
|
|
20
|
-
case TenantStatus.Active:
|
|
21
|
-
return "success-color";
|
|
22
|
-
case TenantStatus.Inactive:
|
|
23
|
-
return "warn-color";
|
|
24
|
-
case TenantStatus.Suspended:
|
|
25
|
-
return "warn-color";
|
|
26
|
-
case TenantStatus.Abandoned:
|
|
27
|
-
return "warn-color";
|
|
28
|
-
default:
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
|
|
2
|
+
export enum TenantStatus {
|
|
3
|
+
New, PendingApproval, Approved, Rejected, Initializing, Initialized, PendingToActive, Inactive, Active, Suspended, Abandoned
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export class TenantStatusHelper{
|
|
7
|
+
static getColor(status: TenantStatus){
|
|
8
|
+
var s = (typeof status == "string" ? TenantStatus[status] : status) as TenantStatus;
|
|
9
|
+
switch(s){
|
|
10
|
+
case TenantStatus.New:
|
|
11
|
+
return "accent-color";
|
|
12
|
+
case TenantStatus.Initialized:
|
|
13
|
+
return "success-color";
|
|
14
|
+
case TenantStatus.Approved:
|
|
15
|
+
return "success-color";
|
|
16
|
+
case TenantStatus.PendingApproval:
|
|
17
|
+
return "accent-color";
|
|
18
|
+
case TenantStatus.PendingToActive:
|
|
19
|
+
return "accent-color";
|
|
20
|
+
case TenantStatus.Active:
|
|
21
|
+
return "success-color";
|
|
22
|
+
case TenantStatus.Inactive:
|
|
23
|
+
return "warn-color";
|
|
24
|
+
case TenantStatus.Suspended:
|
|
25
|
+
return "warn-color";
|
|
26
|
+
case TenantStatus.Abandoned:
|
|
27
|
+
return "warn-color";
|
|
28
|
+
default:
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export class TenantUpdate {
|
|
2
|
-
public name: string = "";
|
|
3
|
-
public identifier: string = "";
|
|
4
|
-
public connectionString: string = "";
|
|
1
|
+
export class TenantUpdate {
|
|
2
|
+
public name: string = "";
|
|
3
|
+
public identifier: string = "";
|
|
4
|
+
public connectionString: string = "";
|
|
5
5
|
}
|
|
@@ -98,4 +98,12 @@ export class TenantAdminService {
|
|
|
98
98
|
public updateTenantSettings(id: string, settings: TenantSetting[]) {
|
|
99
99
|
return this.http.put(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/settings`, settings);
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
public getRootSettings() {
|
|
103
|
+
return this.http.get<TenantSetting[]>(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/settings`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public updateRootSettings(settings: TenantSetting[]){
|
|
107
|
+
return this.http.put(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/settings`, settings);
|
|
108
|
+
}
|
|
101
109
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// import { InjectionToken } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
// export const TENANT_OPTIONS_TOKEN = new InjectionToken<TenantConfiguration>('tenant.options');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export class TenantConfiguration {
|
|
7
|
-
apiEndpoint: string = "";
|
|
8
|
-
apiVersion: string = "2";
|
|
9
|
-
dialogWidth: string = "800px";
|
|
10
|
-
dialogMaxHeight: string = "600px";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface TenantConfigurationParams {
|
|
14
|
-
apiEndpoint?: string;
|
|
15
|
-
apiVersion?: string;
|
|
16
|
-
dialogWidth?: string;
|
|
17
|
-
dialogMaxHeight?: string;
|
|
1
|
+
// import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
// export const TENANT_OPTIONS_TOKEN = new InjectionToken<TenantConfiguration>('tenant.options');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class TenantConfiguration {
|
|
7
|
+
apiEndpoint: string = "";
|
|
8
|
+
apiVersion: string = "2";
|
|
9
|
+
dialogWidth: string = "800px";
|
|
10
|
+
dialogMaxHeight: string = "600px";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TenantConfigurationParams {
|
|
14
|
+
apiEndpoint?: string;
|
|
15
|
+
apiVersion?: string;
|
|
16
|
+
dialogWidth?: string;
|
|
17
|
+
dialogMaxHeight?: string;
|
|
18
18
|
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { NgModule, ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { TenantAdminService } from './services/tenant-admin.service';
|
|
5
|
-
import { TenantConfiguration, TenantConfigurationParams } from './tenant-configuration';
|
|
6
|
-
import { MaterialModule } from './material.module';
|
|
7
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
8
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
9
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@NgModule({
|
|
13
|
-
imports: [
|
|
14
|
-
FormsModule,
|
|
15
|
-
ReactiveFormsModule,
|
|
16
|
-
CommonModule,
|
|
17
|
-
MaterialModule,
|
|
18
|
-
HttpClientModule,
|
|
19
|
-
BrowserModule,
|
|
20
|
-
BrowserAnimationsModule
|
|
21
|
-
],
|
|
22
|
-
exports: [
|
|
23
|
-
MaterialModule,
|
|
24
|
-
FormsModule,
|
|
25
|
-
ReactiveFormsModule,
|
|
26
|
-
CommonModule
|
|
27
|
-
]
|
|
28
|
-
})
|
|
29
|
-
export class TenantsTestingModule {
|
|
30
|
-
|
|
31
|
-
public static forTest(environment: TenantConfigurationParams): ModuleWithProviders<TenantsTestingModule> {
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
ngModule: TenantsTestingModule,
|
|
35
|
-
providers: [
|
|
36
|
-
TenantAdminService,
|
|
37
|
-
{
|
|
38
|
-
provide: TenantConfiguration,
|
|
39
|
-
useValue: environment
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import { NgModule, ModuleWithProviders } from '@angular/core';
|
|
2
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { TenantAdminService } from './services/tenant-admin.service';
|
|
5
|
+
import { TenantConfiguration, TenantConfigurationParams } from './tenant-configuration';
|
|
6
|
+
import { MaterialModule } from './material.module';
|
|
7
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
8
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
9
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [
|
|
14
|
+
FormsModule,
|
|
15
|
+
ReactiveFormsModule,
|
|
16
|
+
CommonModule,
|
|
17
|
+
MaterialModule,
|
|
18
|
+
HttpClientModule,
|
|
19
|
+
BrowserModule,
|
|
20
|
+
BrowserAnimationsModule
|
|
21
|
+
],
|
|
22
|
+
exports: [
|
|
23
|
+
MaterialModule,
|
|
24
|
+
FormsModule,
|
|
25
|
+
ReactiveFormsModule,
|
|
26
|
+
CommonModule
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
export class TenantsTestingModule {
|
|
30
|
+
|
|
31
|
+
public static forTest(environment: TenantConfigurationParams): ModuleWithProviders<TenantsTestingModule> {
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
ngModule: TenantsTestingModule,
|
|
35
|
+
providers: [
|
|
36
|
+
TenantAdminService,
|
|
37
|
+
{
|
|
38
|
+
provide: TenantConfiguration,
|
|
39
|
+
useValue: environment
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
:host{
|
|
3
|
-
display: block;
|
|
4
|
-
}
|
|
5
|
-
mat-form-field{
|
|
6
|
-
width: 100%;
|
|
7
|
-
}
|
|
8
|
-
.mat-mdc-button-base {
|
|
9
|
-
margin: 0 8px 8px 0;
|
|
1
|
+
|
|
2
|
+
:host{
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
mat-form-field{
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
.mat-mdc-button-base {
|
|
9
|
+
margin: 0 8px 8px 0;
|
|
10
10
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
:host{
|
|
2
|
-
display: block;
|
|
1
|
+
:host{
|
|
2
|
+
display: block;
|
|
3
3
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
:host{
|
|
2
|
-
display: block;
|
|
3
|
-
margin: 10px;
|
|
1
|
+
:host{
|
|
2
|
+
display: block;
|
|
3
|
+
margin: 10px;
|
|
4
4
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
:host{
|
|
2
|
-
display: block;
|
|
3
|
-
}
|
|
4
|
-
mat-form-field{
|
|
5
|
-
width: 100%;
|
|
6
|
-
}
|
|
7
|
-
.mat-mdc-button-base {
|
|
8
|
-
margin: 0 8px 8px 0;
|
|
1
|
+
:host{
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
mat-form-field{
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
.mat-mdc-button-base {
|
|
8
|
+
margin: 0 8px 8px 0;
|
|
9
9
|
}
|
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
</mat-select>
|
|
23
23
|
</mat-form-field>
|
|
24
24
|
<div style="flex: 1 auto; text-align: right;">
|
|
25
|
+
<button mat-button (click)="rootSettings()">
|
|
26
|
+
<mat-icon>settings</mat-icon>{{'Settings' | translate}}
|
|
27
|
+
</button>
|
|
25
28
|
<button type="button" mat-button (click)="add()" color="primary"><mat-icon>add</mat-icon> {{ 'New Organization'}}</button>
|
|
26
29
|
</div>
|
|
27
30
|
</form>
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
:host{
|
|
2
|
-
display: block;
|
|
3
|
-
}
|
|
4
|
-
mat-form-field{
|
|
5
|
-
width: 100%;
|
|
6
|
-
}
|
|
7
|
-
.mat-mdc-button-base {
|
|
8
|
-
margin: 0 8px 8px 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.additional-selection{
|
|
12
|
-
opacity: 0.75;
|
|
13
|
-
font-size: 0.75em;
|
|
14
|
-
line-height: 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.clear-statuses{
|
|
18
|
-
padding: 10px;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.button-cell{
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
align-items: center;
|
|
26
|
-
padding-top: 2px;
|
|
27
|
-
padding-bottom: 2px;
|
|
28
|
-
button{
|
|
29
|
-
margin-top: 6px;
|
|
30
|
-
height: 28px;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.actions-cell{
|
|
35
|
-
display: flex;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
align-items: center;
|
|
38
|
-
padding-top: 2px;
|
|
39
|
-
padding-bottom: 2px;
|
|
40
|
-
button{
|
|
41
|
-
height: 28px;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.table-form{
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: row;
|
|
48
|
-
align-items: baseline;
|
|
49
|
-
mat-card-actions{
|
|
50
|
-
flex: 1 1 auto;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.mat-mdc-menu-item{
|
|
55
|
-
min-height: 38px;
|
|
56
|
-
}
|
|
1
|
+
:host{
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
mat-form-field{
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
.mat-mdc-button-base {
|
|
8
|
+
margin: 0 8px 8px 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.additional-selection{
|
|
12
|
+
opacity: 0.75;
|
|
13
|
+
font-size: 0.75em;
|
|
14
|
+
line-height: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.clear-statuses{
|
|
18
|
+
padding: 10px;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.button-cell{
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
padding-top: 2px;
|
|
27
|
+
padding-bottom: 2px;
|
|
28
|
+
button{
|
|
29
|
+
margin-top: 6px;
|
|
30
|
+
height: 28px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.actions-cell{
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
padding-top: 2px;
|
|
39
|
+
padding-bottom: 2px;
|
|
40
|
+
button{
|
|
41
|
+
height: 28px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.table-form{
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
align-items: baseline;
|
|
49
|
+
mat-card-actions{
|
|
50
|
+
flex: 1 1 auto;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.mat-mdc-menu-item{
|
|
55
|
+
min-height: 38px;
|
|
56
|
+
}
|
|
@@ -75,15 +75,16 @@ export class TenantsComponent implements AfterViewInit{
|
|
|
75
75
|
filterText: [],
|
|
76
76
|
statuses: []
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
let firstLoad = true;
|
|
80
80
|
this.route.queryParams.subscribe(params =>{
|
|
81
81
|
console.debug("route.queryParams.subscribe", params);
|
|
82
|
+
|
|
82
83
|
if(firstLoad){
|
|
83
84
|
firstLoad = false;
|
|
84
85
|
this.initFormAndTableEvents();
|
|
85
|
-
return;
|
|
86
86
|
}
|
|
87
|
+
|
|
87
88
|
var q = params['q'] || "";
|
|
88
89
|
this.filterText?.setValue(q);
|
|
89
90
|
if(params['statuses']=='any'){
|
|
@@ -125,7 +126,6 @@ export class TenantsComponent implements AfterViewInit{
|
|
|
125
126
|
ngAfterViewInit(): void {
|
|
126
127
|
|
|
127
128
|
this.table.dataSource.sort = this.sort;
|
|
128
|
-
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
//#region filters
|
|
@@ -139,7 +139,7 @@ export class TenantsComponent implements AfterViewInit{
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
getData(fromRoute: boolean = false) {
|
|
142
|
-
var q = this.filterText?.value;
|
|
142
|
+
var q = this.filterText?.value ?? "";
|
|
143
143
|
|
|
144
144
|
if(!fromRoute){
|
|
145
145
|
var statuses = this.statuses?.value;
|
|
@@ -411,6 +411,7 @@ export class TenantsComponent implements AfterViewInit{
|
|
|
411
411
|
});
|
|
412
412
|
|
|
413
413
|
let instance = dialogRef.componentInstance;
|
|
414
|
+
instance.title = "Tenant settings";
|
|
414
415
|
instance.loading = true;
|
|
415
416
|
instance.type = ModelType.Configuration;
|
|
416
417
|
|
|
@@ -428,7 +429,7 @@ export class TenantsComponent implements AfterViewInit{
|
|
|
428
429
|
var settings = instance.models.map(m => new TenantSetting(m.key, m.value, m.inherited));
|
|
429
430
|
this.tenantService.updateTenantSettings(id, settings).subscribe({
|
|
430
431
|
next: () => {
|
|
431
|
-
this.openSnackBar("Tenant
|
|
432
|
+
this.openSnackBar("Tenant settings was updated!");
|
|
432
433
|
dialogRef.close();
|
|
433
434
|
}, error: (error: any) => {
|
|
434
435
|
this.openSnackBar("Error updating tenant settings!");
|
|
@@ -441,6 +442,45 @@ export class TenantsComponent implements AfterViewInit{
|
|
|
441
442
|
dialogRef.close();
|
|
442
443
|
});
|
|
443
444
|
}
|
|
445
|
+
|
|
446
|
+
rootSettings(){
|
|
447
|
+
const dialogRef = this.dialog.open(DictBuilderComponent, {
|
|
448
|
+
width: this.options.dialogWidth,
|
|
449
|
+
maxHeight: this.options.dialogMaxHeight,
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
let instance = dialogRef.componentInstance;
|
|
453
|
+
instance.title = "Root settings";
|
|
454
|
+
instance.loading = true;
|
|
455
|
+
instance.type = ModelType.Configuration;
|
|
456
|
+
|
|
457
|
+
this.tenantService.getRootSettings().subscribe({
|
|
458
|
+
next: (settings: TenantSetting[]) => {
|
|
459
|
+
instance.loading = false;
|
|
460
|
+
instance.models = settings.map(s => new KeyValue(s.key, s.value, false, false));
|
|
461
|
+
}, error: (error: any) => {
|
|
462
|
+
this.openSnackBar("Error getting root settings!");
|
|
463
|
+
console.debug(error);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
instance.saved.subscribe((model: any) => {
|
|
468
|
+
var settings = instance.models.map(m => new TenantSetting(m.key, m.value, false));
|
|
469
|
+
this.tenantService.updateRootSettings(settings).subscribe({
|
|
470
|
+
next: () => {
|
|
471
|
+
this.openSnackBar("Root settings was updated!");
|
|
472
|
+
dialogRef.close();
|
|
473
|
+
}, error: (error: any) => {
|
|
474
|
+
this.openSnackBar("Error updating root settings!");
|
|
475
|
+
console.debug(error);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
instance.cancelled.subscribe(() => {
|
|
480
|
+
this.openSnackBar("Root setting was cancelled!");
|
|
481
|
+
dialogRef.close();
|
|
482
|
+
});
|
|
483
|
+
}
|
|
444
484
|
//#endregion
|
|
445
485
|
|
|
446
486
|
//#region status rules
|