@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,109 +0,0 @@
|
|
|
1
|
-
import { Injectable, Inject } from '@angular/core';
|
|
2
|
-
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
3
|
-
import { TenantConfiguration } from '../tenant-configuration';
|
|
4
|
-
import { Tenant, TenantBasic } from '../models/tenant.model';
|
|
5
|
-
import { TenantCreate, TenantCreated } from '../models/tenant.create.model';
|
|
6
|
-
import { TenantUpdate } from '../models/tenant.update.model';
|
|
7
|
-
import { TenantStatus } from '../models/tenant.status';
|
|
8
|
-
import { TableQueryResult } from '../models/table.query-result';
|
|
9
|
-
import { Observable } from 'rxjs';
|
|
10
|
-
import { TenantSetting } from '../models/tenant.setting.model';
|
|
11
|
-
|
|
12
|
-
@Injectable({
|
|
13
|
-
providedIn: 'root'
|
|
14
|
-
})
|
|
15
|
-
export class TenantAdminService {
|
|
16
|
-
|
|
17
|
-
constructor(private http: HttpClient, private options: TenantConfiguration) {
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public getTenants(filterText: string = "", statuses: TenantStatus[] = [],
|
|
22
|
-
sortColumns: string[] = [], sortDirections: string[]=[],
|
|
23
|
-
pageIndex: number =0, pageSize: number = 20): Observable<TableQueryResult<TenantBasic>> {
|
|
24
|
-
|
|
25
|
-
var params = new HttpParams()
|
|
26
|
-
.set('q', filterText)
|
|
27
|
-
.set('page', pageIndex+1)
|
|
28
|
-
.set('pageSize', pageSize);
|
|
29
|
-
|
|
30
|
-
if (statuses.length > 0) {
|
|
31
|
-
for (var i = 0; i < statuses.length; i++) {
|
|
32
|
-
params = params.append('statuses', statuses[i]);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if(sortColumns.length > 0) {
|
|
36
|
-
if(sortDirections.length != sortColumns.length) throw new Error("sortColumns and sortDirections must be the same length");
|
|
37
|
-
for (var i = 0; i < sortColumns.length; i++) {
|
|
38
|
-
params = params.set("sorts["+i+"].property", sortColumns[i])
|
|
39
|
-
.set("sorts["+i+"].sortDir", sortDirections[i]);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return this.http.get<TableQueryResult<TenantBasic>>(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/tenants`,
|
|
43
|
-
{params: params});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
public getTenant(identifier: string) {
|
|
48
|
-
return this.http.get<Tenant>(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${identifier}`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public getSummary(identifier: string) {
|
|
52
|
-
return this.http.get<TenantBasic>(`${this.options.apiEndpoint}/${identifier}/api/v${this.options.apiVersion}/operation`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public createTenant(tenant: TenantCreate) {
|
|
56
|
-
return this.http.post<TenantCreated>(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin`, tenant);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public updateTenant(id: string, tenant: TenantUpdate) {
|
|
60
|
-
return this.http.put(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}`, tenant);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public deleteTenant(id: string) {
|
|
64
|
-
return this.http.delete(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public activateTenant(id: string) {
|
|
68
|
-
return this.http.post(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/activate`, null);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public deactivateTenant(id: string) {
|
|
72
|
-
return this.http.post(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/deactivate`, null);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public reactivateTenant(id: string) {
|
|
76
|
-
return this.http.post(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/reactivate`, null);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public suspendTenant(id: string) {
|
|
80
|
-
return this.http.post(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/suspend`, null);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public approveTenant(id: string) {
|
|
84
|
-
return this.http.post(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/approve`, null);
|
|
85
|
-
}
|
|
86
|
-
public rejectTenant(id: string) {
|
|
87
|
-
return this.http.post(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/reject`, null);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public abandonTenant(id: string) {
|
|
91
|
-
return this.http.put(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/abandon`, null);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public getTenantSettings(id: string) {
|
|
95
|
-
return this.http.get<TenantSetting[]>(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/settings`);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public updateTenantSettings(id: string, settings: TenantSetting[]) {
|
|
99
|
-
return this.http.put(`${this.options.apiEndpoint}/api/v${this.options.apiVersion}/admin/${id}/settings`, settings);
|
|
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
|
-
}
|
|
109
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { TenantAdminService } from './tenant-admin.service';
|
|
4
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
5
|
-
import { TenantConfiguration } from '../tenant-configuration';
|
|
6
|
-
|
|
7
|
-
describe('TenantsService', () => {
|
|
8
|
-
let service: TenantAdminService;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
TestBed.configureTestingModule({
|
|
12
|
-
imports: [
|
|
13
|
-
HttpClientModule
|
|
14
|
-
],
|
|
15
|
-
providers: [
|
|
16
|
-
{
|
|
17
|
-
provide: TenantConfiguration,
|
|
18
|
-
useValue: {}
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
});
|
|
22
|
-
service = TestBed.inject(TenantAdminService);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should be created', () => {
|
|
26
|
-
expect(service).toBeTruthy();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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,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,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,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,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
|
-
});
|