Browse Source
Merge pull request #1673 from abpframework/fix/connection-string-validation
fix(tenant): add validation to connection string #resolves 1641
pull/1691/head
Mehmet Erim
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
18 additions and
17 deletions
-
npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html
-
npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts
-
npm/ng-packs/packages/tenant-management/src/lib/services/tenant-management.service.ts
-
npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts
|
|
|
@ -127,22 +127,22 @@ |
|
|
|
|
|
|
|
<ng-template #connectionStringModalTemplate> |
|
|
|
<form [formGroup]="defaultConnectionStringForm" (ngSubmit)="save()"> |
|
|
|
<div class="mt-2"> |
|
|
|
<label class="mt-2"> |
|
|
|
<div class="form-group"> |
|
|
|
<div class="form-check"> |
|
|
|
<div class="custom-checkbox custom-control mb-2"> |
|
|
|
<input |
|
|
|
id="useSharedDatabase" |
|
|
|
type="checkbox" |
|
|
|
class="form-check-input" |
|
|
|
class="custom-control-input" |
|
|
|
formControlName="useSharedDatabase" |
|
|
|
autofocus |
|
|
|
/> |
|
|
|
<label for="useSharedDatabase" class="font-check-label">{{ |
|
|
|
<label for="useSharedDatabase" class="custom-control-label">{{ |
|
|
|
'AbpTenantManagement::DisplayName:UseSharedDatabase' | abpLocalization |
|
|
|
}}</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group" *ngIf="!useSharedDatabase"> |
|
|
|
<label class="form-group" *ngIf="!useSharedDatabase"> |
|
|
|
<label for="defaultConnectionString">{{ |
|
|
|
'AbpTenantManagement::DisplayName:DefaultConnectionString' | abpLocalization |
|
|
|
}}</label> |
|
|
|
@ -152,8 +152,8 @@ |
|
|
|
class="form-control" |
|
|
|
formControlName="defaultConnectionString" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
</form> |
|
|
|
</ng-template> |
|
|
|
|
|
|
|
|
|
|
|
@ -93,7 +93,7 @@ export class TenantsComponent { |
|
|
|
private createDefaultConnectionStringForm() { |
|
|
|
this.defaultConnectionStringForm = this.fb.group({ |
|
|
|
useSharedDatabase: this._useSharedDatabase, |
|
|
|
defaultConnectionString: this.defaultConnectionString || '', |
|
|
|
defaultConnectionString: [this.defaultConnectionString || ''], |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -151,20 +151,24 @@ export class TenantsComponent { |
|
|
|
|
|
|
|
saveConnectionString() { |
|
|
|
this.modalBusy = true; |
|
|
|
if (this.useSharedDatabase) { |
|
|
|
if (this.useSharedDatabase || (!this.useSharedDatabase && !this.connectionString)) { |
|
|
|
this.tenantService |
|
|
|
.deleteDefaultConnectionString(this.selected.id) |
|
|
|
.pipe(take(1)) |
|
|
|
.pipe( |
|
|
|
take(1), |
|
|
|
finalize(() => (this.modalBusy = false)), |
|
|
|
) |
|
|
|
.subscribe(() => { |
|
|
|
this.modalBusy = false; |
|
|
|
this.isModalVisible = false; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.tenantService |
|
|
|
.updateDefaultConnectionString({ id: this.selected.id, defaultConnectionString: this.connectionString }) |
|
|
|
.pipe(take(1)) |
|
|
|
.pipe( |
|
|
|
take(1), |
|
|
|
finalize(() => (this.modalBusy = false)), |
|
|
|
) |
|
|
|
.subscribe(() => { |
|
|
|
this.modalBusy = false; |
|
|
|
this.isModalVisible = false; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ export class TenantManagementService { |
|
|
|
} |
|
|
|
|
|
|
|
deleteDefaultConnectionString(id: string): Observable<string> { |
|
|
|
const url = `/api/multi-tenancy/tenant/${id}/default-connection-string`; |
|
|
|
const url = `/api/multi-tenancy/tenants/${id}/default-connection-string`; |
|
|
|
|
|
|
|
const request: Rest.Request<TenantManagement.DefaultConnectionStringRequest> = { |
|
|
|
method: 'DELETE', |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
import { CoreModule, LazyLoadService } from '@abp/ng.core'; |
|
|
|
import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core'; |
|
|
|
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; |
|
|
|
import { NgxValidateCoreModule } from '@ngx-validate/core'; |
|
|
|
import { MessageService } from 'primeng/components/common/messageservice'; |
|
|
|
import { ToastModule } from 'primeng/toast'; |
|
|
|
@ -40,7 +39,6 @@ export function appendScript(injector: Injector) { |
|
|
|
imports: [ |
|
|
|
CoreModule, |
|
|
|
ToastModule, |
|
|
|
NgbModalModule, |
|
|
|
NgxValidateCoreModule.forRoot({ |
|
|
|
targetSelector: '.form-group', |
|
|
|
blueprints: { |
|
|
|
@ -67,7 +65,6 @@ export function appendScript(injector: Injector) { |
|
|
|
ProfileComponent, |
|
|
|
], |
|
|
|
exports: [ |
|
|
|
NgbModalModule, |
|
|
|
ButtonComponent, |
|
|
|
ConfirmationComponent, |
|
|
|
ToastComponent, |
|
|
|
|