Browse Source

fix(tenant): add validation to connection string #resolves 1641

pull/1672/head
mehmet-erim 7 years ago
parent
commit
96386ef0e6
  1. 14
      npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts
  2. 3
      npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts

14
npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts

@ -93,7 +93,7 @@ export class TenantsComponent {
private createDefaultConnectionStringForm() { private createDefaultConnectionStringForm() {
this.defaultConnectionStringForm = this.fb.group({ this.defaultConnectionStringForm = this.fb.group({
useSharedDatabase: this._useSharedDatabase, useSharedDatabase: this._useSharedDatabase,
defaultConnectionString: this.defaultConnectionString || '', defaultConnectionString: [this.defaultConnectionString || '', Validators.required],
}); });
} }
@ -150,13 +150,21 @@ export class TenantsComponent {
} }
saveConnectionString() { saveConnectionString() {
if (this.defaultConnectionStringForm.invalid) {
this.defaultConnectionStringForm.get('defaultConnectionString').markAsDirty();
this.defaultConnectionStringForm.get('defaultConnectionString').updateValueAndValidity();
return;
}
this.modalBusy = true; this.modalBusy = true;
if (this.useSharedDatabase) { if (this.useSharedDatabase) {
this.tenantService this.tenantService
.deleteDefaultConnectionString(this.selected.id) .deleteDefaultConnectionString(this.selected.id)
.pipe(take(1)) .pipe(
take(1),
finalize(() => (this.modalBusy = false)),
)
.subscribe(() => { .subscribe(() => {
this.modalBusy = false;
this.isModalVisible = false; this.isModalVisible = false;
}); });
} else { } else {

3
npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts

@ -1,6 +1,5 @@
import { CoreModule, LazyLoadService } from '@abp/ng.core'; import { CoreModule, LazyLoadService } from '@abp/ng.core';
import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core'; import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { NgxValidateCoreModule } from '@ngx-validate/core'; import { NgxValidateCoreModule } from '@ngx-validate/core';
import { MessageService } from 'primeng/components/common/messageservice'; import { MessageService } from 'primeng/components/common/messageservice';
import { ToastModule } from 'primeng/toast'; import { ToastModule } from 'primeng/toast';
@ -40,7 +39,6 @@ export function appendScript(injector: Injector) {
imports: [ imports: [
CoreModule, CoreModule,
ToastModule, ToastModule,
NgbModalModule,
NgxValidateCoreModule.forRoot({ NgxValidateCoreModule.forRoot({
targetSelector: '.form-group', targetSelector: '.form-group',
blueprints: { blueprints: {
@ -67,7 +65,6 @@ export function appendScript(injector: Injector) {
ProfileComponent, ProfileComponent,
], ],
exports: [ exports: [
NgbModalModule,
ButtonComponent, ButtonComponent,
ConfirmationComponent, ConfirmationComponent,
ToastComponent, ToastComponent,

Loading…
Cancel
Save