|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { ABP } from '@abp/ng.core'; |
|
|
|
import { ConfirmationService, Toaster } from '@abp/ng.theme.shared'; |
|
|
|
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; |
|
|
|
import { Component, OnInit, TemplateRef, ViewChild, ChangeDetectorRef } from '@angular/core'; |
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
|
import { Observable } from 'rxjs'; |
|
|
|
@ -16,7 +16,7 @@ import { TenantManagementService } from '../../services/tenant-management.servic |
|
|
|
import { TenantManagementState } from '../../states/tenant-management.state'; |
|
|
|
|
|
|
|
interface SelectedModalContent { |
|
|
|
type: string; |
|
|
|
type: 'saveConnStr' | 'saveTenant'; |
|
|
|
title: string; |
|
|
|
template: TemplateRef<any>; |
|
|
|
} |
|
|
|
@ -74,6 +74,18 @@ export class TenantsComponent implements OnInit { |
|
|
|
@ViewChild('connectionStringModalTemplate', { static: false }) |
|
|
|
connectionStringModalTemplate: TemplateRef<any>; |
|
|
|
|
|
|
|
get isDisabledSaveButton(): boolean { |
|
|
|
if (!this.selectedModalContent) return false; |
|
|
|
|
|
|
|
if (this.selectedModalContent.type === 'saveConnStr' && this.defaultConnectionStringForm.invalid) { |
|
|
|
return true; |
|
|
|
} else if (this.selectedModalContent.type === 'saveTenant' && this.tenantForm.invalid) { |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
constructor( |
|
|
|
private confirmationService: ConfirmationService, |
|
|
|
private tenantService: TenantManagementService, |
|
|
|
@ -103,7 +115,7 @@ export class TenantsComponent implements OnInit { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
openModal(title: string, template: TemplateRef<any>, type: string) { |
|
|
|
openModal(title: string, template: TemplateRef<any>, type: 'saveConnStr' | 'saveTenant') { |
|
|
|
this.selectedModalContent = { |
|
|
|
title, |
|
|
|
template, |
|
|
|
@ -224,4 +236,15 @@ export class TenantsComponent implements OnInit { |
|
|
|
.pipe(finalize(() => (this.loading = false))) |
|
|
|
.subscribe(); |
|
|
|
} |
|
|
|
|
|
|
|
onSharedDatabaseChange(value: boolean) { |
|
|
|
if (!value) { |
|
|
|
setTimeout(() => { |
|
|
|
const defaultConnectionString = document.getElementById('defaultConnectionString') as HTMLInputElement; |
|
|
|
if (defaultConnectionString) { |
|
|
|
defaultConnectionString.focus(); |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|