@juice-js/tenants 1.0.6-alpha.5 → 1.0.6

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.
Files changed (84) hide show
  1. package/esm2020/juice-js-tenants.mjs +5 -0
  2. package/esm2020/lib/confirm-dialog/confirm-dialog.component.mjs +53 -0
  3. package/esm2020/lib/shared/custom-error-state-matcher.mjs +8 -0
  4. package/esm2020/lib/shared/material.module.mjs +124 -0
  5. package/esm2020/lib/shared/models/table.query-result.mjs +2 -0
  6. package/esm2020/lib/shared/models/tenant.create.model.mjs +17 -0
  7. package/esm2020/lib/shared/models/tenant.model.mjs +2 -0
  8. package/esm2020/lib/shared/models/tenant.setting.model.mjs +13 -0
  9. package/esm2020/lib/shared/models/tenant.status.mjs +42 -0
  10. package/esm2020/lib/shared/models/tenant.update.model.mjs +8 -0
  11. package/esm2020/lib/shared/services/tenant-admin.service.mjs +88 -0
  12. package/esm2020/lib/shared/tenant-configuration.mjs +11 -0
  13. package/esm2020/lib/tenant-create/tenant-create.component.mjs +69 -0
  14. package/esm2020/lib/tenant-detail/tenant-detail.component.mjs +36 -0
  15. package/esm2020/lib/tenant-summary/tenant-summary.component.mjs +30 -0
  16. package/esm2020/lib/tenant-update/tenant-update.component.mjs +77 -0
  17. package/esm2020/lib/tenants.component.mjs +502 -0
  18. package/esm2020/lib/tenants.module.mjs +86 -0
  19. package/esm2020/public-api.mjs +12 -0
  20. package/fesm2015/juice-js-tenants.mjs +1109 -0
  21. package/fesm2015/juice-js-tenants.mjs.map +1 -0
  22. package/fesm2020/juice-js-tenants.mjs +1101 -0
  23. package/fesm2020/juice-js-tenants.mjs.map +1 -0
  24. package/index.d.ts +5 -0
  25. package/lib/confirm-dialog/confirm-dialog.component.d.ts +29 -0
  26. package/lib/shared/custom-error-state-matcher.d.ts +6 -0
  27. package/lib/shared/material.module.d.ts +33 -0
  28. package/{src/lib/shared/models/table.query-result.ts → lib/shared/models/table.query-result.d.ts} +2 -3
  29. package/lib/shared/models/tenant.create.model.d.ts +12 -0
  30. package/{src/lib/shared/models/tenant.model.ts → lib/shared/models/tenant.model.d.ts} +1 -3
  31. package/lib/shared/models/tenant.setting.model.d.ts +7 -0
  32. package/lib/shared/models/tenant.status.d.ts +16 -0
  33. package/lib/shared/models/tenant.update.model.d.ts +5 -0
  34. package/lib/shared/services/tenant-admin.service.d.ts +34 -0
  35. package/lib/shared/tenant-configuration.d.ts +12 -0
  36. package/lib/tenant-create/tenant-create.component.d.ts +28 -0
  37. package/lib/tenant-detail/tenant-detail.component.d.ts +17 -0
  38. package/lib/tenant-summary/tenant-summary.component.d.ts +14 -0
  39. package/lib/tenant-update/tenant-update.component.d.ts +30 -0
  40. package/lib/tenants.component.d.ts +76 -0
  41. package/lib/tenants.module.d.ts +21 -0
  42. package/package.json +26 -5
  43. package/{src/public-api.ts → public-api.d.ts} +0 -4
  44. package/.releaserc +0 -7
  45. package/ng-package.json +0 -10
  46. package/src/lib/confirm-dialog/confirm-dialog.component.html +0 -10
  47. package/src/lib/confirm-dialog/confirm-dialog.component.scss +0 -9
  48. package/src/lib/confirm-dialog/confirm-dialog.component.spec.ts +0 -33
  49. package/src/lib/confirm-dialog/confirm-dialog.component.ts +0 -49
  50. package/src/lib/shared/custom-error-state-matcher.ts +0 -15
  51. package/src/lib/shared/material.module.ts +0 -62
  52. package/src/lib/shared/models/tenant.create.model.ts +0 -13
  53. package/src/lib/shared/models/tenant.setting.model.ts +0 -14
  54. package/src/lib/shared/models/tenant.status.ts +0 -32
  55. package/src/lib/shared/models/tenant.update.model.ts +0 -5
  56. package/src/lib/shared/services/tenant-admin.service.ts +0 -109
  57. package/src/lib/shared/services/tenant.service.spec.ts +0 -28
  58. package/src/lib/shared/tenant-configuration.ts +0 -18
  59. package/src/lib/shared/tenant-testing.ts +0 -44
  60. package/src/lib/tenant-create/tenant-create.component.css +0 -10
  61. package/src/lib/tenant-create/tenant-create.component.html +0 -45
  62. package/src/lib/tenant-create/tenant-create.component.spec.ts +0 -32
  63. package/src/lib/tenant-create/tenant-create.component.ts +0 -68
  64. package/src/lib/tenant-detail/tenant-detail.component.html +0 -50
  65. package/src/lib/tenant-detail/tenant-detail.component.scss +0 -3
  66. package/src/lib/tenant-detail/tenant-detail.component.spec.ts +0 -29
  67. package/src/lib/tenant-detail/tenant-detail.component.ts +0 -31
  68. package/src/lib/tenant-summary/tenant-summary.component.css +0 -4
  69. package/src/lib/tenant-summary/tenant-summary.component.html +0 -28
  70. package/src/lib/tenant-summary/tenant-summary.component.spec.ts +0 -29
  71. package/src/lib/tenant-summary/tenant-summary.component.ts +0 -28
  72. package/src/lib/tenant-update/tenant-update.component.html +0 -32
  73. package/src/lib/tenant-update/tenant-update.component.scss +0 -9
  74. package/src/lib/tenant-update/tenant-update.component.spec.ts +0 -29
  75. package/src/lib/tenant-update/tenant-update.component.ts +0 -77
  76. package/src/lib/tenants.component.html +0 -117
  77. package/src/lib/tenants.component.scss +0 -56
  78. package/src/lib/tenants.component.spec.ts +0 -30
  79. package/src/lib/tenants.component.ts +0 -565
  80. package/src/lib/tenants.module.ts +0 -60
  81. package/tsconfig.lib.json +0 -14
  82. package/tsconfig.lib.prod.json +0 -10
  83. package/tsconfig.spec.json +0 -14
  84. /package/{src → theming}/_tenants.component-theme.scss +0 -0
@@ -1,45 +0,0 @@
1
-
2
- <mat-card>
3
- <mat-card-header>
4
- <mat-card-title>{{ 'Create new organization' | translate }}</mat-card-title>
5
- </mat-card-header>
6
- <mat-card-content style="padding-top: 10px;">
7
- <mat-form-field>
8
- <mat-label>{{ 'Identifier' | translate }}</mat-label>
9
- <input matInput [formControl]="identifierFormControl" [errorStateMatcher]="matcher">
10
- <mat-error *ngIf="identifierFormControl.hasError('required')">
11
- {{ 'Please enter an identifier' | translate }}
12
- </mat-error>
13
- </mat-form-field>
14
-
15
- <mat-form-field>
16
- <mat-label>{{ 'Organization name' | translate }}</mat-label>
17
- <input matInput [formControl]="nameFormControl" [errorStateMatcher]="matcher">
18
- <mat-error *ngIf="nameFormControl.hasError('required')">
19
- {{ 'Please enter a name' | translate }}
20
- </mat-error>
21
- </mat-form-field>
22
-
23
- <mat-form-field>
24
- <mat-label>{{ 'Admin user' | translate }}</mat-label>
25
- <input matInput [(ngModel)]="model.adminUser">
26
- </mat-form-field>
27
-
28
- <mat-form-field>
29
- <mat-label>{{ 'Admin email' | translate }}</mat-label>
30
- <input matInput [formControl]="emailFormControl" [errorStateMatcher]="matcher">
31
- <mat-error *ngIf="emailFormControl.hasError('email') && !emailFormControl.hasError('required')">
32
- {{ 'Please enter a valid email address' | translate }}
33
- </mat-error>
34
- </mat-form-field>
35
-
36
- <mat-form-field>
37
- <mat-label>{{ 'DB connection' | translate }}</mat-label>
38
- <input matInput [(ngModel)]="model.connectionString">
39
- </mat-form-field>
40
- </mat-card-content>
41
- <mat-card-actions align="end">
42
- <button mat-raised-button color="primary" (click)="submit()" [disabled]="createForm.invalid"><mat-icon>save</mat-icon>{{ 'Submit' | translate }}</button>
43
- <button mat-raised-button (click)="cancel()"><mat-icon>cancel</mat-icon>{{ 'Cancel' | translate }}</button>
44
- </mat-card-actions>
45
- </mat-card>
@@ -1,32 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TenantCreateComponent } from './tenant-create.component';
4
- import { HttpClientModule } from '@angular/common/http';
5
- import { TenantConfiguration } from '../shared/tenant-configuration';
6
- import { MaterialModule } from '../shared/material.module';
7
- import { TranslateModule } from '@ngx-translate/core';
8
- import { TenantsTestingModule } from '../shared/tenant-testing';
9
-
10
- describe('TenantCreateComponent', () => {
11
- let component: TenantCreateComponent;
12
- let fixture: ComponentFixture<TenantCreateComponent>;
13
-
14
- beforeEach(async () => {
15
- await TestBed.configureTestingModule({
16
- imports: [
17
- TranslateModule.forRoot(),
18
- TenantsTestingModule.forTest({}),
19
- ],
20
- declarations: [ TenantCreateComponent ]
21
- })
22
- .compileComponents();
23
-
24
- fixture = TestBed.createComponent(TenantCreateComponent);
25
- component = fixture.componentInstance;
26
- fixture.detectChanges();
27
- });
28
-
29
- it('should create', () => {
30
- expect(component).toBeTruthy();
31
- });
32
- });
@@ -1,68 +0,0 @@
1
- import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
2
-
3
- import { TenantCreate, TenantCreated } from '../shared/models/tenant.create.model';
4
- import { TenantAdminService } from '../../public-api';
5
-
6
- import {
7
- FormControl,
8
- FormGroup,
9
- Validators
10
- } from '@angular/forms';
11
- import { CustomErrorStateMatcher } from '../shared/custom-error-state-matcher';
12
-
13
- @Component({
14
- selector: 'juice-tenant-create',
15
- templateUrl: './tenant-create.component.html',
16
- styleUrls: ['./tenant-create.component.css']
17
- })
18
- export class TenantCreateComponent implements OnInit{
19
- model: TenantCreate = new TenantCreate();
20
-
21
- emailFormControl = new FormControl('', [Validators.email]);
22
- identifierFormControl = new FormControl('', [Validators.required]);
23
- nameFormControl = new FormControl('', [Validators.required]);
24
-
25
- createForm = new FormGroup({
26
- identifier: this.identifierFormControl,
27
- name: this.nameFormControl,
28
- email: this.emailFormControl
29
- });
30
-
31
- matcher = new CustomErrorStateMatcher();
32
-
33
- @Output() created = new EventEmitter<TenantCreated>();
34
- @Output() cancelled = new EventEmitter();
35
-
36
- constructor(private tenantService: TenantAdminService) { }
37
-
38
- ngOnInit(): void {
39
-
40
- }
41
- updateModel(){
42
- var value = this.createForm.value;
43
- this.model.identifier = value.identifier?? '';
44
- this.model.name = value.name??'';
45
- this.model.adminEmail = value.email??'';
46
- }
47
-
48
- submit(){
49
- if(this.createForm.valid){
50
- this.updateModel();
51
- this.tenantService.createTenant(this.model).subscribe({
52
- next:(result) => {
53
- if(this.created!=null){
54
- this.created.emit(result);
55
- }
56
- this.createForm.reset();
57
- this.model = new TenantCreate();
58
- },
59
- error:(err) => {
60
-
61
- }
62
- });
63
- }
64
- }
65
- cancel(){
66
- this.cancelled.emit();
67
- }
68
- }
@@ -1,50 +0,0 @@
1
- <mat-card>
2
- <mat-card-header>
3
- <mat-card-title>{{ 'Organization information' | translate }}</mat-card-title>
4
- </mat-card-header>
5
-
6
- <mat-card-content>
7
- <div *ngIf="tenant">
8
- <h3>{{ tenant.name }}</h3>
9
-
10
- <mat-list>
11
- <mat-list-item>
12
- <span matListItemTitle>{{ 'Unique Id' | translate }}</span>
13
- <span matListItemLine>{{ tenant.id }}
14
- <button style="margin-left: 6px;" mat-icon-button [cdkCopyToClipboard]="tenant.id"
15
- [attr.aria-label]="'Copy' | translate">
16
- <mat-icon>content_copy</mat-icon>
17
- </button>
18
- </span>
19
- </mat-list-item>
20
-
21
- <mat-list-item>
22
- <span matListItemTitle>{{ 'Identifier' | translate }}</span>
23
- <span matListItemLine>{{ tenant.identifier }}</span>
24
- </mat-list-item>
25
-
26
- <mat-list-item>
27
- <span matListItemTitle>{{ 'Status' | translate }}</span>
28
- <span matListItemLine [class]="statusHelper.getColor(tenant.status)">{{ tenant.status }}</span>
29
- </mat-list-item>
30
-
31
- <mat-list-item>
32
- <span matListItemTitle>{{ 'ConnectionString' | translate }}</span>
33
- <span matListItemLine>{{ tenant.connectionString }}</span>
34
- </mat-list-item>
35
-
36
- <mat-list-item>
37
- <span matListItemTitle>{{ 'Owner' | translate }}</span>
38
- <span matListItemLine>{{ tenant.ownerName }}</span>
39
- </mat-list-item>
40
-
41
- <mat-list-item>
42
- <span matListItemTitle>{{ 'Properties' | translate }}</span>
43
- <span matListItemLine *ngFor="let property of properties | keyvalue">
44
- {{ property.key }}: {{ property.value }}
45
- </span>
46
- </mat-list-item>
47
- </mat-list>
48
- </div>
49
- </mat-card-content>
50
- </mat-card>
@@ -1,3 +0,0 @@
1
- :host{
2
- display: block;
3
- }
@@ -1,29 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TenantDetailComponent } from './tenant-detail.component';
4
- import { TranslateModule } from '@ngx-translate/core';
5
- import { TenantsTestingModule } from '../shared/tenant-testing';
6
-
7
- describe('TenantDetailComponent', () => {
8
- let component: TenantDetailComponent;
9
- let fixture: ComponentFixture<TenantDetailComponent>;
10
-
11
- beforeEach(async () => {
12
- await TestBed.configureTestingModule({
13
- imports: [
14
- TranslateModule.forRoot(),
15
- TenantsTestingModule.forTest({}),
16
- ],
17
- declarations: [ TenantDetailComponent ]
18
- })
19
- .compileComponents();
20
-
21
- fixture = TestBed.createComponent(TenantDetailComponent);
22
- component = fixture.componentInstance;
23
- fixture.detectChanges();
24
- });
25
-
26
- it('should create', () => {
27
- expect(component).toBeTruthy();
28
- });
29
- });
@@ -1,31 +0,0 @@
1
- import { Component, OnInit, Input, OnChanges } from '@angular/core';
2
- import { TenantAdminService } from '../shared/services/tenant-admin.service';
3
- import { Tenant } from '../shared/models/tenant.model';
4
- import { TenantStatusHelper } from '../shared/models/tenant.status';
5
-
6
- @Component({
7
- selector: 'juice-tenant-detail',
8
- templateUrl: './tenant-detail.component.html',
9
- styleUrls: ['./tenant-detail.component.scss']
10
- })
11
- export class TenantDetailComponent implements OnChanges {
12
-
13
- @Input() tenantIdentifier: string = "";
14
-
15
- tenant!: Tenant;
16
- properties: any;
17
- statusHelper = TenantStatusHelper;
18
-
19
- constructor(private tenantService: TenantAdminService) { }
20
-
21
- public loadTenant(identifier: string){
22
- this.tenantService.getTenant(identifier).subscribe(tenant => {
23
- this.tenant = tenant;
24
- this.properties = JSON.parse(tenant.serializedProperties);
25
- });
26
- }
27
-
28
- ngOnChanges(): void {
29
- this.loadTenant(this.tenantIdentifier);
30
- }
31
- }
@@ -1,4 +0,0 @@
1
- :host{
2
- display: block;
3
- margin: 10px;
4
- }
@@ -1,28 +0,0 @@
1
- <mat-card>
2
- <mat-card-header>
3
- <mat-card-title>{{ 'Organization summary' | translate }}</mat-card-title>
4
- </mat-card-header>
5
- <mat-card-content>
6
- <div *ngIf="tenant">
7
- <h3>{{ tenant.name }}</h3>
8
-
9
- <mat-list>
10
- <mat-list-item>
11
- <span matListItemTitle>{{ 'Unique Id' | translate }}</span>
12
- <span matListItemLine>{{ tenant.id }}</span>
13
- </mat-list-item>
14
-
15
- <mat-list-item>
16
- <span matListItemTitle>{{ 'Identifier' | translate }}</span>
17
- <span matListItemLine>{{ tenant.identifier }}</span>
18
- </mat-list-item>
19
-
20
- <mat-list-item>
21
- <span matListItemTitle>{{ 'Status' | translate }}</span>
22
- <span matListItemLine>{{ tenant.status }}</span>
23
- </mat-list-item>
24
-
25
- </mat-list>
26
- </div>
27
- </mat-card-content>
28
- </mat-card>
@@ -1,29 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TenantSummaryComponent } from './tenant-summary.component';
4
- import { TenantsTestingModule } from '../shared/tenant-testing';
5
- import { TranslateModule } from '@ngx-translate/core';
6
-
7
- describe('TenantSummaryComponent', () => {
8
- let component: TenantSummaryComponent;
9
- let fixture: ComponentFixture<TenantSummaryComponent>;
10
-
11
- beforeEach(async () => {
12
- await TestBed.configureTestingModule({
13
- imports:[
14
- TranslateModule.forRoot(),
15
- TenantsTestingModule.forTest({}),
16
- ],
17
- declarations: [ TenantSummaryComponent ]
18
- })
19
- .compileComponents();
20
-
21
- fixture = TestBed.createComponent(TenantSummaryComponent);
22
- component = fixture.componentInstance;
23
- fixture.detectChanges();
24
- });
25
-
26
- it('should create', () => {
27
- expect(component).toBeTruthy();
28
- });
29
- });
@@ -1,28 +0,0 @@
1
- import { Component, Input, OnChanges } from '@angular/core';
2
- import { TenantBasic } from '../shared/models/tenant.model';
3
- import { TenantAdminService } from '../shared/services/tenant-admin.service';
4
-
5
- @Component({
6
- selector: 'juice-tenant-summary',
7
- templateUrl: './tenant-summary.component.html',
8
- styleUrls: ['./tenant-summary.component.css']
9
- })
10
- export class TenantSummaryComponent implements OnChanges{
11
-
12
- @Input()
13
- tenantIdentifier: string = "";
14
-
15
- tenant!: TenantBasic;
16
-
17
- constructor(private tenantService: TenantAdminService) { }
18
-
19
- public loadTenant(identifier: string){
20
- this.tenantService.getSummary(identifier).subscribe(tenant => {
21
- this.tenant = tenant;
22
- });
23
- }
24
-
25
- ngOnChanges(): void {
26
- this.loadTenant(this.tenantIdentifier);
27
- }
28
- }
@@ -1,32 +0,0 @@
1
-
2
- <mat-card>
3
- <mat-card-header>
4
- <mat-card-title>{{ 'Update organization information' | translate }}</mat-card-title>
5
- </mat-card-header>
6
- <mat-card-content style="padding-top: 10px;">
7
- <mat-form-field>
8
- <mat-label>{{ 'Identifier' | translate }}</mat-label>
9
- <input matInput [formControl]="identifierFormControl" [errorStateMatcher]="matcher">
10
- <mat-error *ngIf="identifierFormControl.hasError('required')">
11
- {{ 'Please enter an identifier' | translate }}
12
- </mat-error>
13
- </mat-form-field>
14
-
15
- <mat-form-field>
16
- <mat-label>{{ 'Organization name' | translate }}</mat-label>
17
- <input matInput [formControl]="nameFormControl" [errorStateMatcher]="matcher">
18
- <mat-error *ngIf="nameFormControl.hasError('required')">
19
- {{ 'Please enter a name' | translate }}
20
- </mat-error>
21
- </mat-form-field>
22
-
23
- <mat-form-field>
24
- <mat-label>{{ 'DB connection' | translate }}</mat-label>
25
- <input matInput [formControl]="coneectionFormControl">
26
- </mat-form-field>
27
- </mat-card-content>
28
- <mat-card-actions align="end">
29
- <button mat-raised-button color="primary" (click)="submit()" [disabled]="updateForm.invalid"><mat-icon>save</mat-icon>{{ 'Submit' | translate }}</button>
30
- <button mat-raised-button (click)="cancel()"><mat-icon>cancel</mat-icon>{{ 'Cancel' | translate }}</button>
31
- </mat-card-actions>
32
- </mat-card>
@@ -1,9 +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
- }
@@ -1,29 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TenantUpdateComponent } from './tenant-update.component';
4
- import { TranslateModule } from '@ngx-translate/core';
5
- import { TenantsTestingModule } from '../shared/tenant-testing';
6
-
7
- describe('TenantUpdateComponent', () => {
8
- let component: TenantUpdateComponent;
9
- let fixture: ComponentFixture<TenantUpdateComponent>;
10
-
11
- beforeEach(async () => {
12
- await TestBed.configureTestingModule({
13
- imports: [
14
- TranslateModule.forRoot(),
15
- TenantsTestingModule.forTest({}),
16
- ],
17
- declarations: [ TenantUpdateComponent ]
18
- })
19
- .compileComponents();
20
-
21
- fixture = TestBed.createComponent(TenantUpdateComponent);
22
- component = fixture.componentInstance;
23
- fixture.detectChanges();
24
- });
25
-
26
- it('should create', () => {
27
- expect(component).toBeTruthy();
28
- });
29
- });
@@ -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>