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

pull/1672/head
mehmet-erim 6 years ago
parent f901f90919
commit 96386ef0e6

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

@ -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,

Loading…
Cancel
Save