@juice-js/tenants 1.0.3 → 1.0.6-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/juice-js-tenants.mjs +5 -0
- package/esm2020/lib/confirm-dialog/confirm-dialog.component.mjs +53 -0
- package/esm2020/lib/shared/custom-error-state-matcher.mjs +8 -0
- package/esm2020/lib/shared/material.module.mjs +124 -0
- package/esm2020/lib/shared/models/table.query-result.mjs +2 -0
- package/esm2020/lib/shared/models/tenant.create.model.mjs +17 -0
- package/esm2020/lib/shared/models/tenant.model.mjs +2 -0
- package/esm2020/lib/shared/models/tenant.setting.model.mjs +13 -0
- package/esm2020/lib/shared/models/tenant.status.mjs +42 -0
- package/esm2020/lib/shared/models/tenant.update.model.mjs +8 -0
- package/esm2020/lib/shared/services/tenant-admin.service.mjs +88 -0
- package/esm2020/lib/shared/tenant-configuration.mjs +11 -0
- package/esm2020/lib/tenant-create/tenant-create.component.mjs +69 -0
- package/esm2020/lib/tenant-detail/tenant-detail.component.mjs +36 -0
- package/esm2020/lib/tenant-summary/tenant-summary.component.mjs +30 -0
- package/esm2020/lib/tenant-update/tenant-update.component.mjs +77 -0
- package/esm2020/lib/tenants.component.mjs +502 -0
- package/esm2020/lib/tenants.module.mjs +86 -0
- package/esm2020/public-api.mjs +12 -0
- package/fesm2015/juice-js-tenants.mjs +1109 -0
- package/fesm2015/juice-js-tenants.mjs.map +1 -0
- package/fesm2020/juice-js-tenants.mjs +1101 -0
- package/fesm2020/juice-js-tenants.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/confirm-dialog/confirm-dialog.component.d.ts +29 -0
- package/lib/shared/custom-error-state-matcher.d.ts +6 -0
- package/lib/shared/material.module.d.ts +33 -0
- package/{src/lib/shared/models/table.query-result.ts → lib/shared/models/table.query-result.d.ts} +6 -7
- package/lib/shared/models/tenant.create.model.d.ts +12 -0
- package/{src/lib/shared/models/tenant.model.ts → lib/shared/models/tenant.model.d.ts} +13 -15
- package/lib/shared/models/tenant.setting.model.d.ts +7 -0
- package/lib/shared/models/tenant.status.d.ts +16 -0
- package/lib/shared/models/tenant.update.model.d.ts +5 -0
- package/lib/shared/services/tenant-admin.service.d.ts +34 -0
- package/lib/shared/tenant-configuration.d.ts +12 -0
- package/lib/tenant-create/tenant-create.component.d.ts +28 -0
- package/lib/tenant-detail/tenant-detail.component.d.ts +17 -0
- package/lib/tenant-summary/tenant-summary.component.d.ts +14 -0
- package/lib/tenant-update/tenant-update.component.d.ts +30 -0
- package/lib/tenants.component.d.ts +76 -0
- package/lib/tenants.module.d.ts +21 -0
- package/package.json +31 -6
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/{src → theming}/_tenants.component-theme.scss +64 -64
- package/ng-package.json +0 -10
- package/src/lib/confirm-dialog/confirm-dialog.component.html +0 -10
- package/src/lib/confirm-dialog/confirm-dialog.component.scss +0 -9
- package/src/lib/confirm-dialog/confirm-dialog.component.spec.ts +0 -33
- package/src/lib/confirm-dialog/confirm-dialog.component.ts +0 -49
- package/src/lib/shared/custom-error-state-matcher.ts +0 -15
- package/src/lib/shared/material.module.ts +0 -62
- package/src/lib/shared/models/tenant.create.model.ts +0 -13
- package/src/lib/shared/models/tenant.setting.model.ts +0 -14
- package/src/lib/shared/models/tenant.status.ts +0 -32
- package/src/lib/shared/models/tenant.update.model.ts +0 -5
- package/src/lib/shared/services/tenant-admin.service.ts +0 -109
- package/src/lib/shared/services/tenant.service.spec.ts +0 -28
- package/src/lib/shared/tenant-configuration.ts +0 -18
- package/src/lib/shared/tenant-testing.ts +0 -44
- package/src/lib/tenant-create/tenant-create.component.css +0 -10
- package/src/lib/tenant-create/tenant-create.component.html +0 -45
- package/src/lib/tenant-create/tenant-create.component.spec.ts +0 -32
- package/src/lib/tenant-create/tenant-create.component.ts +0 -68
- package/src/lib/tenant-detail/tenant-detail.component.html +0 -50
- package/src/lib/tenant-detail/tenant-detail.component.scss +0 -3
- package/src/lib/tenant-detail/tenant-detail.component.spec.ts +0 -29
- package/src/lib/tenant-detail/tenant-detail.component.ts +0 -31
- package/src/lib/tenant-summary/tenant-summary.component.css +0 -4
- package/src/lib/tenant-summary/tenant-summary.component.html +0 -28
- package/src/lib/tenant-summary/tenant-summary.component.spec.ts +0 -29
- package/src/lib/tenant-summary/tenant-summary.component.ts +0 -28
- package/src/lib/tenant-update/tenant-update.component.html +0 -32
- package/src/lib/tenant-update/tenant-update.component.scss +0 -9
- package/src/lib/tenant-update/tenant-update.component.spec.ts +0 -29
- package/src/lib/tenant-update/tenant-update.component.ts +0 -77
- package/src/lib/tenants.component.html +0 -117
- package/src/lib/tenants.component.scss +0 -56
- package/src/lib/tenants.component.spec.ts +0 -30
- package/src/lib/tenants.component.ts +0 -565
- package/src/lib/tenants.module.ts +0 -60
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
|
2
|
-
import { TenantUpdate } from '../shared/models/tenant.update.model';
|
|
3
|
-
import { TenantAdminService } from '../../public-api';
|
|
4
|
-
import {
|
|
5
|
-
FormControl,
|
|
6
|
-
FormGroup,
|
|
7
|
-
Validators
|
|
8
|
-
} from '@angular/forms';
|
|
9
|
-
import { CustomErrorStateMatcher } from '../shared/custom-error-state-matcher';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'juice-tenant-update',
|
|
14
|
-
templateUrl: './tenant-update.component.html',
|
|
15
|
-
styleUrls: ['./tenant-update.component.scss']
|
|
16
|
-
})
|
|
17
|
-
export class TenantUpdateComponent{
|
|
18
|
-
|
|
19
|
-
@Input() id!: string;
|
|
20
|
-
|
|
21
|
-
model: TenantUpdate = new TenantUpdate();
|
|
22
|
-
|
|
23
|
-
identifierFormControl = new FormControl(this.model.identifier, [Validators.required]);
|
|
24
|
-
nameFormControl = new FormControl(this.model.name, [Validators.required]);
|
|
25
|
-
coneectionFormControl = new FormControl(this.model.connectionString, []);
|
|
26
|
-
|
|
27
|
-
updateForm = new FormGroup({
|
|
28
|
-
identifier: this.identifierFormControl,
|
|
29
|
-
name: this.nameFormControl,
|
|
30
|
-
connectionString: this.coneectionFormControl
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
matcher = new CustomErrorStateMatcher();
|
|
34
|
-
|
|
35
|
-
@Output() updated = new EventEmitter<string>();
|
|
36
|
-
@Output() cancelled = new EventEmitter<string>();
|
|
37
|
-
|
|
38
|
-
constructor(private tenantService: TenantAdminService) { }
|
|
39
|
-
|
|
40
|
-
ngOnChanges(): void {
|
|
41
|
-
this.tenantService.getTenant(this.id).subscribe((result) => {
|
|
42
|
-
this.updateForm.patchValue(result);
|
|
43
|
-
this.updateModel();
|
|
44
|
-
if(this.id == result.identifier){
|
|
45
|
-
this.id = result.id;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
updateModel(){
|
|
51
|
-
var value = this.updateForm.value;
|
|
52
|
-
this.model.identifier = value.identifier?? '';
|
|
53
|
-
this.model.name = value.name??'';
|
|
54
|
-
this.model.connectionString = value.connectionString??'';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// for modal control
|
|
58
|
-
setId(value: string){
|
|
59
|
-
this.id = value;
|
|
60
|
-
this.ngOnChanges();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
submit(){
|
|
64
|
-
if(this.updateForm.valid){
|
|
65
|
-
this.updateModel();
|
|
66
|
-
this.tenantService.updateTenant(this.id, this.model).subscribe((_) => {
|
|
67
|
-
this.updateForm.reset();
|
|
68
|
-
this.model = new TenantUpdate();
|
|
69
|
-
this.updated.emit(this.id);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
cancel(){
|
|
75
|
-
this.cancelled.emit(this.id);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<div class="mat-elevation-z2 minimum-density">
|
|
2
|
-
<form [formGroup]="form" class="table-form">
|
|
3
|
-
<mat-form-field [style.width.px]="300">
|
|
4
|
-
<input matInput type="text" placeholder="{{ 'Search' | translate }}" formControlName="filterText" (keyup.enter)="getData()">
|
|
5
|
-
<button *ngIf="filterText?.value" type="button" matSuffix mat-icon-button aria-label="Clear" (click)="clearFilterText();">
|
|
6
|
-
<mat-icon>close</mat-icon>
|
|
7
|
-
</button>
|
|
8
|
-
</mat-form-field>
|
|
9
|
-
<mat-form-field [style.width.px]="200">
|
|
10
|
-
<mat-label>{{ 'Statuses' | translate }}</mat-label>
|
|
11
|
-
<mat-select formControlName="statuses" multiple [compareWith]="statusCompareFn" placeholder="{{ 'Any status' | translate }}">
|
|
12
|
-
<mat-select-trigger>
|
|
13
|
-
{{statusOptions[statuses?.value?.[0]||-1] || ''}}
|
|
14
|
-
<span *ngIf="(statuses?.value?.length || 0) > 1" class="additional-selection">
|
|
15
|
-
(+{{(statuses?.value?.length || 0) - 1}} {{statuses?.value?.length === 2 ? 'other' : 'others'}})
|
|
16
|
-
</span>
|
|
17
|
-
</mat-select-trigger>
|
|
18
|
-
<option class="clear-statuses" (click)="clearStatuses()">{{'Any status' | translate}}</option>
|
|
19
|
-
<mat-option *ngFor="let s of statusOptions | keyvalue" [value]="s.key">
|
|
20
|
-
{{s.value}}
|
|
21
|
-
</mat-option>
|
|
22
|
-
</mat-select>
|
|
23
|
-
</mat-form-field>
|
|
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>
|
|
28
|
-
<button type="button" mat-button (click)="add()" color="primary"><mat-icon>add</mat-icon> {{ 'New Organization'}}</button>
|
|
29
|
-
</div>
|
|
30
|
-
</form>
|
|
31
|
-
<table mat-table [dataSource]="table.dataSource" matMultiSort (matSortChange)="table.onSortEvent()">
|
|
32
|
-
|
|
33
|
-
<!--- Note that these columns can be defined in any order.
|
|
34
|
-
The actual rendered columns are set as a property on the row definition" -->
|
|
35
|
-
<ng-container matColumnDef="identifier">
|
|
36
|
-
<th mat-header-cell *matHeaderCellDef mat-multi-sort-header="identifier" disableClear="true"> {{ 'Identifier' | translate }} </th>
|
|
37
|
-
<td class="button-cell" mat-cell *matCellDef="let row"> {{row.identifier}}
|
|
38
|
-
<button mat-icon-button [cdkCopyToClipboard]="row.identifier"
|
|
39
|
-
[attr.aria-label]="'Copy' | translate">
|
|
40
|
-
<mat-icon>content_copy</mat-icon>
|
|
41
|
-
</button>
|
|
42
|
-
</td>
|
|
43
|
-
</ng-container>
|
|
44
|
-
<ng-container matColumnDef="name">
|
|
45
|
-
<th mat-header-cell *matHeaderCellDef > {{'Name'|translate}} </th>
|
|
46
|
-
<td mat-cell *matCellDef="let row">
|
|
47
|
-
{{row.name}}
|
|
48
|
-
</td>
|
|
49
|
-
</ng-container>
|
|
50
|
-
<ng-container matColumnDef="status">
|
|
51
|
-
<th mat-header-cell *matHeaderCellDef > {{'Status'|translate}} </th>
|
|
52
|
-
<td mat-cell *matCellDef="let row" [class]="statusHelper.getColor(row.status)">
|
|
53
|
-
{{row.status}}
|
|
54
|
-
</td>
|
|
55
|
-
</ng-container>
|
|
56
|
-
|
|
57
|
-
<ng-container matColumnDef="actions">
|
|
58
|
-
<th mat-header-cell *matHeaderCellDef style="text-align: center;"> {{'Actions'|translate}} </th>
|
|
59
|
-
<td mat-cell *matCellDef="let row" >
|
|
60
|
-
<div class="actions-cell">
|
|
61
|
-
<button mat-button (click)="settings(row.id)">
|
|
62
|
-
<mat-icon>settings</mat-icon>{{'Settings' | translate}}
|
|
63
|
-
</button>
|
|
64
|
-
<button mat-button (click)="detail(row.id)">
|
|
65
|
-
<mat-icon>info</mat-icon>{{'Detail' | translate}}
|
|
66
|
-
</button>
|
|
67
|
-
<button mat-button (click)="edit(row.id)">
|
|
68
|
-
<mat-icon>edit</mat-icon>{{'Edit' | translate}}
|
|
69
|
-
</button>
|
|
70
|
-
|
|
71
|
-
<button mat-icon-button [matMenuTriggerFor]="appMenu" [matMenuTriggerData]="{id: row.id, status: row.status}">
|
|
72
|
-
<mat-icon>more_vert</mat-icon>
|
|
73
|
-
</button>
|
|
74
|
-
</div>
|
|
75
|
-
</td>
|
|
76
|
-
</ng-container>
|
|
77
|
-
|
|
78
|
-
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
|
79
|
-
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
80
|
-
</table>
|
|
81
|
-
<mat-paginator [pageSize]="table.pageSize" [pageIndex]="table.pageIndex"
|
|
82
|
-
[pageSizeOptions]="table.pageSizeOptions"
|
|
83
|
-
[length]="table.totalElements ? table.totalElements : 0"
|
|
84
|
-
(page)="table.onPaginationEvent($event)"
|
|
85
|
-
aria-label="Items per page"
|
|
86
|
-
showFirstLastButtons>
|
|
87
|
-
</mat-paginator>
|
|
88
|
-
|
|
89
|
-
</div>
|
|
90
|
-
<mat-menu #appMenu="matMenu" class="minimum-density">
|
|
91
|
-
<ng-template matMenuContent let-id="id" let-status="status">
|
|
92
|
-
<button *ngIf="canApproval(status)" class="color-success" mat-menu-item (click)="approve(id)">
|
|
93
|
-
<mat-icon>check_circle_outline</mat-icon>{{'Approve' | translate}}
|
|
94
|
-
</button>
|
|
95
|
-
<button *ngIf="canApproval(status)" class="color-warn" mat-menu-item (click)="reject(id)">
|
|
96
|
-
<mat-icon>highlight_off</mat-icon>{{'Reject' | translate}}
|
|
97
|
-
</button>
|
|
98
|
-
<button *ngIf="canActivate(status)" class="color-success" mat-menu-item (click)="activate(id)">
|
|
99
|
-
<mat-icon>present_to_all</mat-icon>{{'Activate' | translate}}
|
|
100
|
-
</button>
|
|
101
|
-
<button *ngIf="canReactivate(status)" class="color-success" mat-menu-item (click)="reactivate(id)">
|
|
102
|
-
<mat-icon >present_to_all</mat-icon>{{'Activate' | translate}}
|
|
103
|
-
</button>
|
|
104
|
-
<button *ngIf="canDeactivate(status)" class="color-warn" mat-menu-item (click)="deactivate(id)">
|
|
105
|
-
<mat-icon >cancel_presentation</mat-icon>{{'Deactivate' | translate}}
|
|
106
|
-
</button>
|
|
107
|
-
<button *ngIf="canSuspend(status)" class="color-warn" mat-menu-item (click)="suspend(id)">
|
|
108
|
-
<mat-icon >cancel_presentation</mat-icon>{{'Suspend' | translate}}
|
|
109
|
-
</button>
|
|
110
|
-
<button [disabled]="!canAbandon(status)" mat-menu-item (click)="abandon(id)" class="color-warn">
|
|
111
|
-
<mat-icon >delete</mat-icon>{{'Abandon' | translate}}
|
|
112
|
-
</button>
|
|
113
|
-
<button *ngIf="canDelete(status)" class="color-warn" mat-menu-item (click)="delete(id)">
|
|
114
|
-
<mat-icon >delete</mat-icon>{{'Delete' | translate}}
|
|
115
|
-
</button>
|
|
116
|
-
</ng-template>
|
|
117
|
-
</mat-menu>
|
|
@@ -1,56 +0,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
|
-
}
|
|
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,30 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { RouterTestingModule } from "@angular/router/testing";
|
|
3
|
-
import { TenantsComponent } from './tenants.component';
|
|
4
|
-
import { TenantsTestingModule } from './shared/tenant-testing';
|
|
5
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
6
|
-
|
|
7
|
-
describe('TenantsComponent', () => {
|
|
8
|
-
let component: TenantsComponent;
|
|
9
|
-
let fixture: ComponentFixture<TenantsComponent>;
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
await TestBed.configureTestingModule({
|
|
13
|
-
imports: [
|
|
14
|
-
RouterTestingModule,
|
|
15
|
-
TranslateModule.forRoot(),
|
|
16
|
-
TenantsTestingModule.forTest({}),
|
|
17
|
-
],
|
|
18
|
-
declarations: [ TenantsComponent ]
|
|
19
|
-
})
|
|
20
|
-
.compileComponents();
|
|
21
|
-
|
|
22
|
-
fixture = TestBed.createComponent(TenantsComponent);
|
|
23
|
-
component = fixture.componentInstance;
|
|
24
|
-
fixture.detectChanges();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should create', () => {
|
|
28
|
-
expect(component).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
});
|