@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
@@ -0,0 +1,76 @@
1
+ import { AfterViewInit } from '@angular/core';
2
+ import { TenantAdminService } from './shared/services/tenant-admin.service';
3
+ import { MatMultiSort, TableData } from 'ngx-mat-multi-sort';
4
+ import { MatPaginator } from '@angular/material/paginator';
5
+ import { TenantBasic } from './shared/models/tenant.model';
6
+ import { ActivatedRoute, Router, UrlSerializer } from '@angular/router';
7
+ import { Location } from '@angular/common';
8
+ import { TenantStatus, TenantStatusHelper } from './shared/models/tenant.status';
9
+ import { FormBuilder, FormGroup } from '@angular/forms';
10
+ import { MatDialog } from '@angular/material/dialog';
11
+ import { MatSnackBar } from '@angular/material/snack-bar';
12
+ import { TranslateService } from '@ngx-translate/core';
13
+ import { TenantConfiguration } from './shared/tenant-configuration';
14
+ import * as i0 from "@angular/core";
15
+ export declare class TenantsComponent implements AfterViewInit {
16
+ private tenantService;
17
+ private router;
18
+ private route;
19
+ private location;
20
+ private serializer;
21
+ private fb;
22
+ dialog: MatDialog;
23
+ private snackBar;
24
+ private localizer;
25
+ private options;
26
+ displayedColumns: string[];
27
+ table: TableData<TenantBasic>;
28
+ tenantStatus: typeof TenantStatus;
29
+ statusHelper: typeof TenantStatusHelper;
30
+ statusOptions: TenantStatus[];
31
+ get statuses(): import("@angular/forms").AbstractControl<any, any> | null;
32
+ get filterText(): import("@angular/forms").AbstractControl<any, any> | null;
33
+ paginator: MatPaginator;
34
+ sort: MatMultiSort;
35
+ form: FormGroup;
36
+ constructor(tenantService: TenantAdminService, router: Router, route: ActivatedRoute, location: Location, serializer: UrlSerializer, fb: FormBuilder, dialog: MatDialog, snackBar: MatSnackBar, localizer: TranslateService, options: TenantConfiguration);
37
+ ngOnInit(): void;
38
+ initFormAndTableEvents(): void;
39
+ ngAfterViewInit(): void;
40
+ clearStatuses(): void;
41
+ clearFilterText(): void;
42
+ getData(fromRoute?: boolean): void;
43
+ add(): void;
44
+ edit(id: string): void;
45
+ detail(id: string): void;
46
+ delete(id: string): void;
47
+ doDelete(id: string): void;
48
+ activate(id: string): void;
49
+ doActivate(id: string): void;
50
+ reactivate(id: string): void;
51
+ doReactivate(id: string): void;
52
+ deactivate(id: string): void;
53
+ doDeactivate(id: string): void;
54
+ suspend(id: string): void;
55
+ doSuspend(id: string): void;
56
+ abandon(id: string): void;
57
+ doAbandon(id: string): void;
58
+ approve(id: string): void;
59
+ doApprove(id: string): void;
60
+ reject(id: string): void;
61
+ doReject(id: string): void;
62
+ settings(id: string): void;
63
+ rootSettings(): void;
64
+ canActivate(status: TenantStatus): boolean;
65
+ canReactivate(status: TenantStatus): boolean;
66
+ canDeactivate(status: TenantStatus): boolean;
67
+ canSuspend(status: TenantStatus): boolean;
68
+ canDelete(status: TenantStatus): boolean;
69
+ canAbandon(status: TenantStatus): boolean;
70
+ canApproval(status: TenantStatus): boolean;
71
+ statusCompareFn(o1: TenantStatus, o2: TenantStatus): boolean;
72
+ confirm(callback: Function, options: any): void;
73
+ openSnackBar(message: string): void;
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<TenantsComponent, never>;
75
+ static ɵcmp: i0.ɵɵComponentDeclaration<TenantsComponent, "juice-tenants", never, {}, {}, never, never, false, never>;
76
+ }
@@ -0,0 +1,21 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { TenantConfigurationParams } from './shared/tenant-configuration';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "./tenants.component";
5
+ import * as i2 from "./tenant-detail/tenant-detail.component";
6
+ import * as i3 from "./tenant-summary/tenant-summary.component";
7
+ import * as i4 from "./tenant-create/tenant-create.component";
8
+ import * as i5 from "./tenant-update/tenant-update.component";
9
+ import * as i6 from "./confirm-dialog/confirm-dialog.component";
10
+ import * as i7 from "@ngx-translate/core";
11
+ import * as i8 from "@angular/forms";
12
+ import * as i9 from "@angular/common";
13
+ import * as i10 from "./shared/material.module";
14
+ import * as i11 from "@angular/cdk/clipboard";
15
+ import * as i12 from "ngx-mat-multi-sort";
16
+ export declare class TenantsModule {
17
+ static forRoot(environment: TenantConfigurationParams): ModuleWithProviders<TenantsModule>;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<TenantsModule, never>;
19
+ static ɵmod: i0.ɵɵNgModuleDeclaration<TenantsModule, [typeof i1.TenantsComponent, typeof i2.TenantDetailComponent, typeof i3.TenantSummaryComponent, typeof i4.TenantCreateComponent, typeof i5.TenantUpdateComponent, typeof i6.ConfirmDialogComponent], [typeof i7.TranslateModule, typeof i8.FormsModule, typeof i8.ReactiveFormsModule, typeof i9.CommonModule, typeof i10.MaterialModule, typeof i11.ClipboardModule, typeof i12.MatMultiSortModule], [typeof i1.TenantsComponent, typeof i2.TenantDetailComponent, typeof i3.TenantSummaryComponent, typeof i4.TenantCreateComponent, typeof i5.TenantUpdateComponent, typeof i7.TranslateModule]>;
20
+ static ɵinj: i0.ɵɵInjectorDeclaration<TenantsModule>;
21
+ }
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "@juice-js/tenants",
3
- "version": "1.0.6-alpha.5",
3
+ "version": "1.0.6",
4
4
  "description": "Juice tenants admin module",
5
- "author": "jack@creatorflow.io",
5
+ "author": {
6
+ "name": "jack@creatorflow.io"
7
+ },
6
8
  "license": "MIT",
7
9
  "bugs": {
8
10
  "url": "https://github.com/creatorflow-io/juice-tenants/issues"
@@ -15,17 +17,36 @@
15
17
  "@angular/common": "^15.2.9",
16
18
  "@angular/core": "^15.2.9",
17
19
  "@angular/material": "^15.2.9",
20
+ "@juice-js/dict-builder": "1.0.6",
18
21
  "@ngx-translate/core": "^14.0.0",
19
- "ngx-mat-multi-sort": "^0.10.2",
20
- "@juice-js/dict-builder": "^1.0.3"
22
+ "ngx-mat-multi-sort": "^0.10.2"
21
23
  },
22
24
  "exports": {
23
25
  "./theming": {
24
26
  "sass": "./theming/_tenants.component-theme.scss"
27
+ },
28
+ "./package.json": {
29
+ "default": "./package.json"
30
+ },
31
+ ".": {
32
+ "types": "./index.d.ts",
33
+ "esm2020": "./esm2020/juice-js-tenants.mjs",
34
+ "es2020": "./fesm2020/juice-js-tenants.mjs",
35
+ "es2015": "./fesm2015/juice-js-tenants.mjs",
36
+ "node": "./fesm2015/juice-js-tenants.mjs",
37
+ "default": "./fesm2020/juice-js-tenants.mjs"
25
38
  }
26
39
  },
27
40
  "dependencies": {
28
41
  "tslib": "^2.3.0"
29
42
  },
30
- "sideEffects": false
43
+ "sideEffects": false,
44
+ "module": "fesm2015/juice-js-tenants.mjs",
45
+ "es2020": "fesm2020/juice-js-tenants.mjs",
46
+ "esm2020": "esm2020/juice-js-tenants.mjs",
47
+ "fesm2020": "fesm2020/juice-js-tenants.mjs",
48
+ "fesm2015": "fesm2015/juice-js-tenants.mjs",
49
+ "typings": "index.d.ts",
50
+ "readme": "ERROR: No README data found!",
51
+ "_id": "@juice-js/tenants@1.0.6"
31
52
  }
@@ -1,7 +1,3 @@
1
- /*
2
- * Public API Surface of tenants
3
- */
4
-
5
1
  export * from './lib/shared/services/tenant-admin.service';
6
2
  export * from './lib/tenants.component';
7
3
  export * from './lib/tenant-detail/tenant-detail.component';
package/.releaserc DELETED
@@ -1,7 +0,0 @@
1
- branches:
2
- - master
3
- - name: alpha
4
- prerelease: true
5
- debug: true
6
- ci: true
7
- dryRun: false
package/ng-package.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../../dist/juice-js/tenants",
4
- "assets": [
5
- { "input": "src", "glob":"*.scss", "output": "theming" }
6
- ],
7
- "lib": {
8
- "entryFile": "src/public-api.ts"
9
- }
10
- }
@@ -1,10 +0,0 @@
1
- <mat-card>
2
- <mat-card-header>
3
- <mat-card-title>{{ confirmTitle | translate }}</mat-card-title>
4
- <mat-card-subtitle [class]="confirmMessageClasses">{{ confirmMessage | translate }}</mat-card-subtitle>
5
- </mat-card-header>
6
- <mat-card-actions align="end">
7
- <button mat-button (click)="confirm()" [color]="confirmButtonColor">{{ confirmButtonText | translate }}</button>
8
- <button mat-button (click)="cancel()">{{ 'Cancel' | translate }}</button>
9
- </mat-card-actions>
10
- </mat-card>
@@ -1,9 +0,0 @@
1
- :host{
2
- mat-card{
3
- width: 350px;
4
- }
5
- mat-card-subtitle{
6
- padding-top: 12px !important;
7
- padding: 12px;
8
- }
9
- }
@@ -1,33 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ConfirmDialogComponent } from './confirm-dialog.component';
4
- import { TranslateModule } from '@ngx-translate/core';
5
- import { TenantsTestingModule } from '../shared/tenant-testing';
6
- import { MAT_DIALOG_DATA } from '@angular/material/dialog';
7
-
8
- describe('ConfirmDialogComponent', () => {
9
- let component: ConfirmDialogComponent;
10
- let fixture: ComponentFixture<ConfirmDialogComponent>;
11
-
12
- beforeEach(async () => {
13
- await TestBed.configureTestingModule({
14
- imports:[
15
- TranslateModule.forRoot(),
16
- TenantsTestingModule.forTest({}),
17
- ],
18
- declarations: [ ConfirmDialogComponent ],
19
- providers: [
20
- { provide: MAT_DIALOG_DATA, useValue: {} }
21
- ]
22
- })
23
- .compileComponents();
24
-
25
- fixture = TestBed.createComponent(ConfirmDialogComponent);
26
- component = fixture.componentInstance;
27
- fixture.detectChanges();
28
- });
29
-
30
- it('should create', () => {
31
- expect(component).toBeTruthy();
32
- });
33
- });
@@ -1,49 +0,0 @@
1
- import { Component, Output, EventEmitter, Inject } from '@angular/core';
2
- import {MAT_DIALOG_DATA} from '@angular/material/dialog';
3
-
4
- @Component({
5
- selector: 'juice-confirm-dialog',
6
- templateUrl: './confirm-dialog.component.html',
7
- styleUrls: ['./confirm-dialog.component.scss']
8
- })
9
- export class ConfirmDialogComponent {
10
-
11
- @Output() confirmed = new EventEmitter();
12
- @Output() cancelled = new EventEmitter();
13
-
14
- confirmMessage: string = "Are you sure?";
15
- confirmMessageClasses: string = "";
16
- confirmTitle: string = "Action required";
17
- confirmButtonText: string = "Confirm";
18
- confirmButtonColor: string = "primary";
19
-
20
- constructor(@Inject(MAT_DIALOG_DATA) public data: {
21
- title: string, message: string, buttonText: string, buttonColor: string,
22
- messageClasses: string
23
- }) {
24
-
25
- if(data.title){
26
- this.confirmTitle = data.title;
27
- }
28
- if(data.message){
29
- this.confirmMessage = data.message;
30
- }
31
- if(data.buttonText){
32
- this.confirmButtonText = data.buttonText;
33
- }
34
- if(data.buttonColor){
35
- this.confirmButtonColor = data.buttonColor;
36
- }
37
- if(data.messageClasses){
38
- this.confirmMessageClasses = data.messageClasses;
39
- }
40
- }
41
-
42
- confirm(){
43
- this.confirmed.emit();
44
- }
45
-
46
- cancel(){
47
- this.cancelled.emit();
48
- }
49
- }
@@ -1,15 +0,0 @@
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 +0,0 @@
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,13 +0,0 @@
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
- }
@@ -1,14 +0,0 @@
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
- }
@@ -1,32 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- export class TenantUpdate {
2
- public name: string = "";
3
- public identifier: string = "";
4
- public connectionString: string = "";
5
- }
@@ -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,10 +0,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
- }