mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
899 lines
30 KiB
899 lines
30 KiB
import { RestService, DynamicLayoutComponent, AuthGuard, PermissionGuard, CoreModule } from '@abp/ng.core';
|
|
import { ConfirmationService, ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
import { Injectable, ɵɵdefineInjectable, ɵɵinject, Component, ViewChild, NgModule } from '@angular/core';
|
|
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
|
import { Action, Selector, State, Store, Select, NgxsModule } from '@ngxs/store';
|
|
import { TableModule } from 'primeng/table';
|
|
import { __decorate, __metadata } from 'tslib';
|
|
import { Validators, FormBuilder } from '@angular/forms';
|
|
import { Observable } from 'rxjs';
|
|
import { tap, switchMap, pluck, take, finalize } from 'rxjs/operators';
|
|
import { RouterModule } from '@angular/router';
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
class GetTenants {
|
|
/**
|
|
* @param {?=} payload
|
|
*/
|
|
constructor(payload) {
|
|
this.payload = payload;
|
|
}
|
|
}
|
|
GetTenants.type = '[TenantManagement] Get Tenant';
|
|
if (false) {
|
|
/** @type {?} */
|
|
GetTenants.type;
|
|
/** @type {?} */
|
|
GetTenants.prototype.payload;
|
|
}
|
|
class GetTenantById {
|
|
/**
|
|
* @param {?} payload
|
|
*/
|
|
constructor(payload) {
|
|
this.payload = payload;
|
|
}
|
|
}
|
|
GetTenantById.type = '[TenantManagement] Get Tenant By Id';
|
|
if (false) {
|
|
/** @type {?} */
|
|
GetTenantById.type;
|
|
/** @type {?} */
|
|
GetTenantById.prototype.payload;
|
|
}
|
|
class CreateTenant {
|
|
/**
|
|
* @param {?} payload
|
|
*/
|
|
constructor(payload) {
|
|
this.payload = payload;
|
|
}
|
|
}
|
|
CreateTenant.type = '[TenantManagement] Create Tenant';
|
|
if (false) {
|
|
/** @type {?} */
|
|
CreateTenant.type;
|
|
/** @type {?} */
|
|
CreateTenant.prototype.payload;
|
|
}
|
|
class UpdateTenant {
|
|
/**
|
|
* @param {?} payload
|
|
*/
|
|
constructor(payload) {
|
|
this.payload = payload;
|
|
}
|
|
}
|
|
UpdateTenant.type = '[TenantManagement] Update Tenant';
|
|
if (false) {
|
|
/** @type {?} */
|
|
UpdateTenant.type;
|
|
/** @type {?} */
|
|
UpdateTenant.prototype.payload;
|
|
}
|
|
class DeleteTenant {
|
|
/**
|
|
* @param {?} payload
|
|
*/
|
|
constructor(payload) {
|
|
this.payload = payload;
|
|
}
|
|
}
|
|
DeleteTenant.type = '[TenantManagement] Delete Tenant';
|
|
if (false) {
|
|
/** @type {?} */
|
|
DeleteTenant.type;
|
|
/** @type {?} */
|
|
DeleteTenant.prototype.payload;
|
|
}
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
class TenantManagementService {
|
|
/**
|
|
* @param {?} rest
|
|
*/
|
|
constructor(rest) {
|
|
this.rest = rest;
|
|
}
|
|
/**
|
|
* @param {?=} params
|
|
* @return {?}
|
|
*/
|
|
getTenant(params = (/** @type {?} */ ({}))) {
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'GET',
|
|
url: '/api/multi-tenancy/tenants',
|
|
params,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @return {?}
|
|
*/
|
|
getTenantById(id) {
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'GET',
|
|
url: `/api/multi-tenancy/tenants/${id}`,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @return {?}
|
|
*/
|
|
deleteTenant(id) {
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'DELETE',
|
|
url: `/api/multi-tenancy/tenants/${id}`,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} body
|
|
* @return {?}
|
|
*/
|
|
createTenant(body) {
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'POST',
|
|
url: `/api/multi-tenancy/tenants`,
|
|
body,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} body
|
|
* @return {?}
|
|
*/
|
|
updateTenant(body) {
|
|
/** @type {?} */
|
|
const url = `/api/multi-tenancy/tenants/${body.id}`;
|
|
delete body.id;
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'PUT',
|
|
url,
|
|
body,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @return {?}
|
|
*/
|
|
getDefaultConnectionString(id) {
|
|
/** @type {?} */
|
|
const url = `/api/multi-tenancy/tenants/${id}/default-connection-string`;
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'GET',
|
|
responseType: "text" /* Text */,
|
|
url,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} payload
|
|
* @return {?}
|
|
*/
|
|
updateDefaultConnectionString(payload) {
|
|
/** @type {?} */
|
|
const url = `/api/multi-tenancy/tenants/${payload.id}/default-connection-string`;
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'PUT',
|
|
url,
|
|
params: { defaultConnectionString: payload.defaultConnectionString },
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @return {?}
|
|
*/
|
|
deleteDefaultConnectionString(id) {
|
|
/** @type {?} */
|
|
const url = `/api/multi-tenancy/tenant/${id}/default-connection-string`;
|
|
/** @type {?} */
|
|
const request = {
|
|
method: 'DELETE',
|
|
url,
|
|
};
|
|
return this.rest.request(request);
|
|
}
|
|
}
|
|
TenantManagementService.decorators = [
|
|
{ type: Injectable, args: [{
|
|
providedIn: 'root',
|
|
},] }
|
|
];
|
|
/** @nocollapse */
|
|
TenantManagementService.ctorParameters = () => [
|
|
{ type: RestService }
|
|
];
|
|
/** @nocollapse */ TenantManagementService.ngInjectableDef = ɵɵdefineInjectable({ factory: function TenantManagementService_Factory() { return new TenantManagementService(ɵɵinject(RestService)); }, token: TenantManagementService, providedIn: "root" });
|
|
if (false) {
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantManagementService.prototype.rest;
|
|
}
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
let TenantManagementState = class TenantManagementState {
|
|
/**
|
|
* @param {?} tenantManagementService
|
|
*/
|
|
constructor(tenantManagementService) {
|
|
this.tenantManagementService = tenantManagementService;
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @return {?}
|
|
*/
|
|
static get({ result }) {
|
|
return result.items || [];
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @return {?}
|
|
*/
|
|
static getTenantsTotalCount({ result }) {
|
|
return result.totalCount;
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @param {?} __1
|
|
* @return {?}
|
|
*/
|
|
get({ patchState }, { payload }) {
|
|
return this.tenantManagementService.getTenant(payload).pipe(tap((/**
|
|
* @param {?} result
|
|
* @return {?}
|
|
*/
|
|
result => patchState({
|
|
result,
|
|
}))));
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @param {?} __1
|
|
* @return {?}
|
|
*/
|
|
getById({ patchState }, { payload }) {
|
|
return this.tenantManagementService.getTenantById(payload).pipe(tap((/**
|
|
* @param {?} selectedItem
|
|
* @return {?}
|
|
*/
|
|
selectedItem => patchState({
|
|
selectedItem,
|
|
}))));
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @param {?} __1
|
|
* @return {?}
|
|
*/
|
|
delete({ dispatch }, { payload }) {
|
|
return this.tenantManagementService.deleteTenant(payload).pipe(switchMap((/**
|
|
* @return {?}
|
|
*/
|
|
() => dispatch(new GetTenants()))));
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @param {?} __1
|
|
* @return {?}
|
|
*/
|
|
add({ dispatch }, { payload }) {
|
|
return this.tenantManagementService.createTenant(payload).pipe(switchMap((/**
|
|
* @return {?}
|
|
*/
|
|
() => dispatch(new GetTenants()))));
|
|
}
|
|
/**
|
|
* @param {?} __0
|
|
* @param {?} __1
|
|
* @return {?}
|
|
*/
|
|
update({ dispatch, getState }, { payload }) {
|
|
return dispatch(new GetTenantById(payload.id)).pipe(switchMap((/**
|
|
* @return {?}
|
|
*/
|
|
() => this.tenantManagementService.updateTenant(Object.assign({}, getState().selectedItem, payload)))), switchMap((/**
|
|
* @return {?}
|
|
*/
|
|
() => dispatch(new GetTenants()))));
|
|
}
|
|
};
|
|
__decorate([
|
|
Action(GetTenants),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, GetTenants]),
|
|
__metadata("design:returntype", void 0)
|
|
], TenantManagementState.prototype, "get", null);
|
|
__decorate([
|
|
Action(GetTenantById),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, GetTenantById]),
|
|
__metadata("design:returntype", void 0)
|
|
], TenantManagementState.prototype, "getById", null);
|
|
__decorate([
|
|
Action(DeleteTenant),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, DeleteTenant]),
|
|
__metadata("design:returntype", void 0)
|
|
], TenantManagementState.prototype, "delete", null);
|
|
__decorate([
|
|
Action(CreateTenant),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, CreateTenant]),
|
|
__metadata("design:returntype", void 0)
|
|
], TenantManagementState.prototype, "add", null);
|
|
__decorate([
|
|
Action(UpdateTenant),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object, UpdateTenant]),
|
|
__metadata("design:returntype", void 0)
|
|
], TenantManagementState.prototype, "update", null);
|
|
__decorate([
|
|
Selector(),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", Array)
|
|
], TenantManagementState, "get", null);
|
|
__decorate([
|
|
Selector(),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Object]),
|
|
__metadata("design:returntype", Number)
|
|
], TenantManagementState, "getTenantsTotalCount", null);
|
|
TenantManagementState = __decorate([
|
|
State({
|
|
name: 'TenantManagementState',
|
|
defaults: (/** @type {?} */ ({ result: {}, selectedItem: {} })),
|
|
}),
|
|
__metadata("design:paramtypes", [TenantManagementService])
|
|
], TenantManagementState);
|
|
if (false) {
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantManagementState.prototype.tenantManagementService;
|
|
}
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
class TenantsComponent {
|
|
/**
|
|
* @param {?} confirmationService
|
|
* @param {?} tenantService
|
|
* @param {?} fb
|
|
* @param {?} store
|
|
*/
|
|
constructor(confirmationService, tenantService, fb, store) {
|
|
this.confirmationService = confirmationService;
|
|
this.tenantService = tenantService;
|
|
this.fb = fb;
|
|
this.store = store;
|
|
this.selectedModalContent = (/** @type {?} */ ({}));
|
|
this.pageQuery = {
|
|
sorting: 'name',
|
|
};
|
|
this.loading = false;
|
|
this.modalBusy = false;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
get useSharedDatabase() {
|
|
return this.defaultConnectionStringForm.get('useSharedDatabase').value;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
get connectionString() {
|
|
return this.defaultConnectionStringForm.get('defaultConnectionString').value;
|
|
}
|
|
/**
|
|
* @param {?} value
|
|
* @return {?}
|
|
*/
|
|
onSearch(value) {
|
|
this.pageQuery.filter = value;
|
|
this.get();
|
|
}
|
|
/**
|
|
* @private
|
|
* @return {?}
|
|
*/
|
|
createTenantForm() {
|
|
this.tenantForm = this.fb.group({
|
|
name: [this.selected.name || '', [Validators.required, Validators.maxLength(256)]],
|
|
});
|
|
}
|
|
/**
|
|
* @private
|
|
* @return {?}
|
|
*/
|
|
createDefaultConnectionStringForm() {
|
|
this.defaultConnectionStringForm = this.fb.group({
|
|
useSharedDatabase: this._useSharedDatabase,
|
|
defaultConnectionString: this.defaultConnectionString || '',
|
|
});
|
|
}
|
|
/**
|
|
* @param {?} title
|
|
* @param {?} template
|
|
* @param {?} type
|
|
* @return {?}
|
|
*/
|
|
openModal(title, template, type) {
|
|
this.selectedModalContent = {
|
|
title,
|
|
template,
|
|
type,
|
|
};
|
|
this.isModalVisible = true;
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @return {?}
|
|
*/
|
|
onEditConnectionString(id) {
|
|
this.store
|
|
.dispatch(new GetTenantById(id))
|
|
.pipe(pluck('TenantManagementState', 'selectedItem'), switchMap((/**
|
|
* @param {?} selected
|
|
* @return {?}
|
|
*/
|
|
selected => {
|
|
this.selected = selected;
|
|
return this.tenantService.getDefaultConnectionString(id);
|
|
})))
|
|
.subscribe((/**
|
|
* @param {?} fetchedConnectionString
|
|
* @return {?}
|
|
*/
|
|
fetchedConnectionString => {
|
|
this._useSharedDatabase = fetchedConnectionString ? false : true;
|
|
this.defaultConnectionString = fetchedConnectionString ? fetchedConnectionString : '';
|
|
this.createDefaultConnectionStringForm();
|
|
this.openModal('AbpTenantManagement::ConnectionStrings', this.connectionStringModalTemplate, 'saveConnStr');
|
|
}));
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
onAddTenant() {
|
|
this.selected = (/** @type {?} */ ({}));
|
|
this.createTenantForm();
|
|
this.openModal('AbpTenantManagement::NewTenant', this.tenantModalTemplate, 'saveTenant');
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @return {?}
|
|
*/
|
|
onEditTenant(id) {
|
|
this.store
|
|
.dispatch(new GetTenantById(id))
|
|
.pipe(pluck('TenantManagementState', 'selectedItem'))
|
|
.subscribe((/**
|
|
* @param {?} selected
|
|
* @return {?}
|
|
*/
|
|
selected => {
|
|
this.selected = selected;
|
|
this.createTenantForm();
|
|
this.openModal('AbpTenantManagement::Edit', this.tenantModalTemplate, 'saveTenant');
|
|
}));
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
save() {
|
|
const { type } = this.selectedModalContent;
|
|
if (!type)
|
|
return;
|
|
if (type === 'saveTenant')
|
|
this.saveTenant();
|
|
else if (type === 'saveConnStr')
|
|
this.saveConnectionString();
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
saveConnectionString() {
|
|
this.modalBusy = true;
|
|
if (this.useSharedDatabase) {
|
|
this.tenantService
|
|
.deleteDefaultConnectionString(this.selected.id)
|
|
.pipe(take(1))
|
|
.subscribe((/**
|
|
* @return {?}
|
|
*/
|
|
() => {
|
|
this.modalBusy = false;
|
|
this.isModalVisible = false;
|
|
}));
|
|
}
|
|
else {
|
|
this.tenantService
|
|
.updateDefaultConnectionString({ id: this.selected.id, defaultConnectionString: this.connectionString })
|
|
.pipe(take(1))
|
|
.subscribe((/**
|
|
* @return {?}
|
|
*/
|
|
() => {
|
|
this.modalBusy = false;
|
|
this.isModalVisible = false;
|
|
}));
|
|
}
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
saveTenant() {
|
|
if (!this.tenantForm.valid)
|
|
return;
|
|
this.modalBusy = true;
|
|
this.store
|
|
.dispatch(this.selected.id
|
|
? new UpdateTenant(Object.assign({}, this.tenantForm.value, { id: this.selected.id }))
|
|
: new CreateTenant(this.tenantForm.value))
|
|
.subscribe((/**
|
|
* @return {?}
|
|
*/
|
|
() => {
|
|
this.modalBusy = false;
|
|
this.isModalVisible = false;
|
|
}));
|
|
}
|
|
/**
|
|
* @param {?} id
|
|
* @param {?} name
|
|
* @return {?}
|
|
*/
|
|
delete(id, name) {
|
|
this.confirmationService
|
|
.warn('AbpTenantManagement::TenantDeletionConfirmationMessage', 'AbpTenantManagement::AreYouSure', {
|
|
messageLocalizationParams: [name],
|
|
})
|
|
.subscribe((/**
|
|
* @param {?} status
|
|
* @return {?}
|
|
*/
|
|
(status) => {
|
|
if (status === "confirm" /* confirm */) {
|
|
this.store.dispatch(new DeleteTenant(id));
|
|
this.modalBusy = false;
|
|
}
|
|
}));
|
|
}
|
|
/**
|
|
* @param {?} data
|
|
* @return {?}
|
|
*/
|
|
onPageChange(data) {
|
|
this.pageQuery.skipCount = data.first;
|
|
this.pageQuery.maxResultCount = data.rows;
|
|
this.get();
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
get() {
|
|
this.loading = true;
|
|
this.store
|
|
.dispatch(new GetTenants(this.pageQuery))
|
|
.pipe(finalize((/**
|
|
* @return {?}
|
|
*/
|
|
() => (this.loading = false))))
|
|
.subscribe();
|
|
}
|
|
}
|
|
TenantsComponent.decorators = [
|
|
{ type: Component, args: [{
|
|
selector: 'abp-tenants',
|
|
template: "<div id=\"wrapper\" class=\"card\">\n <div class=\"card-header\">\n <div class=\"row\">\n <div class=\"col col-md-6\">\n <h5 class=\"card-title\">\n {{ 'AbpTenantManagement::Tenants' | abpLocalization }}\n </h5>\n </div>\n <div class=\"text-right col col-md-6\">\n <button\n [abpPermission]=\"'AbpTenantManagement.Tenants.Create'\"\n id=\"create-tenants\"\n class=\"btn btn-primary\"\n type=\"button\"\n (click)=\"onAddTenant()\"\n >\n <i class=\"fa fa-plus mr-1\"></i>\n <span>{{ 'AbpTenantManagement::NewTenant' | abpLocalization }}</span>\n </button>\n </div>\n </div>\n </div>\n <div class=\"card-body\">\n <div id=\"data-tables-table-filter\" class=\"data-tables-filter\">\n <label\n ><input\n type=\"search\"\n class=\"form-control form-control-sm\"\n [placeholder]=\"'AbpUi::PagerSearch' | abpLocalization\"\n (input.debounce)=\"onSearch($event.target.value)\"\n /></label>\n </div>\n <p-table\n [value]=\"data$ | async\"\n [lazy]=\"true\"\n [lazyLoadOnInit]=\"false\"\n [paginator]=\"true\"\n [rows]=\"10\"\n [totalRecords]=\"totalCount$ | async\"\n [loading]=\"loading\"\n (onLazyLoad)=\"onPageChange($event)\"\n >\n <ng-template pTemplate=\"header\">\n <tr>\n <th>{{ 'AbpTenantManagement::Actions' | abpLocalization }}</th>\n <th>{{ 'AbpTenantManagement::TenantName' | abpLocalization }}</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-data>\n <tr>\n <td>\n <div ngbDropdown class=\"d-inline-block\">\n <button\n class=\"btn btn-primary btn-sm dropdown-toggle\"\n data-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n ngbDropdownToggle\n >\n <i class=\"fa fa-cog mr-1\"></i>{{ 'AbpTenantManagement::Actions' | abpLocalization }}\n </button>\n <div ngbDropdownMenu>\n <button\n [abpPermission]=\"'AbpTenantManagement.Tenants.Update'\"\n ngbDropdownItem\n (click)=\"onEditTenant(data.id)\"\n >\n {{ 'AbpTenantManagement::Edit' | abpLocalization }}\n </button>\n <button\n [abpPermission]=\"'AbpTenantManagement.Tenants.ManageConnectionStrings'\"\n ngbDropdownItem\n (click)=\"onEditConnectionString(data.id)\"\n >\n {{ 'AbpTenantManagement::ConnectionStrings' | abpLocalization }}\n </button>\n <button\n [abpPermission]=\"'AbpTenantManagement.Tenants.Delete'\"\n ngbDropdownItem\n (click)=\"delete(data.id, data.name)\"\n >\n {{ 'AbpTenantManagement::Delete' | abpLocalization }}\n </button>\n </div>\n </div>\n </td>\n <td>{{ data.name }}</td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n</div>\n\n<abp-modal [(visible)]=\"isModalVisible\" [busy]=\"modalBusy\">\n <ng-template #abpHeader>\n <h3>{{ selectedModalContent.title | abpLocalization }}</h3>\n </ng-template>\n\n <ng-template #abpBody>\n <ng-container *ngTemplateOutlet=\"selectedModalContent?.template\"></ng-container>\n </ng-template>\n\n <ng-template #abpFooter>\n <button #abpClose type=\"button\" class=\"btn btn-secondary\">\n {{ 'AbpTenantManagement::Cancel' | abpLocalization }}\n </button>\n <abp-button iconClass=\"fa fa-check\" (click)=\"save()\">{{ 'AbpIdentity::Save' | abpLocalization }}</abp-button>\n </ng-template>\n</abp-modal>\n\n<ng-template #tenantModalTemplate>\n <form [formGroup]=\"tenantForm\" (ngSubmit)=\"save()\">\n <div class=\"mt-2\">\n <div class=\"form-group\">\n <label for=\"name\">{{ 'AbpTenantManagement::TenantName' | abpLocalization }}</label>\n <input type=\"text\" id=\"name\" class=\"form-control\" formControlName=\"name\" autofocus />\n </div>\n </div>\n </form>\n</ng-template>\n\n<ng-template #connectionStringModalTemplate>\n <form [formGroup]=\"defaultConnectionStringForm\" (ngSubmit)=\"save()\">\n <div class=\"mt-2\">\n <div class=\"form-group\">\n <div class=\"form-check\">\n <input\n id=\"useSharedDatabase\"\n type=\"checkbox\"\n class=\"form-check-input\"\n formControlName=\"useSharedDatabase\"\n autofocus\n />\n <label for=\"useSharedDatabase\" class=\"font-check-label\">{{\n 'AbpTenantManagement::DisplayName:UseSharedDatabase' | abpLocalization\n }}</label>\n </div>\n </div>\n <div class=\"form-group\" *ngIf=\"!useSharedDatabase\">\n <label for=\"defaultConnectionString\">{{\n 'AbpTenantManagement::DisplayName:DefaultConnectionString' | abpLocalization\n }}</label>\n <input\n type=\"text\"\n id=\"defaultConnectionString\"\n class=\"form-control\"\n formControlName=\"defaultConnectionString\"\n />\n </div>\n </div>\n </form>\n</ng-template>\n"
|
|
}] }
|
|
];
|
|
/** @nocollapse */
|
|
TenantsComponent.ctorParameters = () => [
|
|
{ type: ConfirmationService },
|
|
{ type: TenantManagementService },
|
|
{ type: FormBuilder },
|
|
{ type: Store }
|
|
];
|
|
TenantsComponent.propDecorators = {
|
|
tenantModalTemplate: [{ type: ViewChild, args: ['tenantModalTemplate', { static: false },] }],
|
|
connectionStringModalTemplate: [{ type: ViewChild, args: ['connectionStringModalTemplate', { static: false },] }]
|
|
};
|
|
__decorate([
|
|
Select(TenantManagementState.get),
|
|
__metadata("design:type", Observable)
|
|
], TenantsComponent.prototype, "data$", void 0);
|
|
__decorate([
|
|
Select(TenantManagementState.getTenantsTotalCount),
|
|
__metadata("design:type", Observable)
|
|
], TenantsComponent.prototype, "totalCount$", void 0);
|
|
if (false) {
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.data$;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.totalCount$;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.selected;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.tenantForm;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.defaultConnectionStringForm;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.defaultConnectionString;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.isModalVisible;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.selectedModalContent;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype._useSharedDatabase;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.pageQuery;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.loading;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.modalBusy;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.tenantModalTemplate;
|
|
/** @type {?} */
|
|
TenantsComponent.prototype.connectionStringModalTemplate;
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantsComponent.prototype.confirmationService;
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantsComponent.prototype.tenantService;
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantsComponent.prototype.fb;
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantsComponent.prototype.store;
|
|
}
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
class TenantsResolver {
|
|
/**
|
|
* @param {?} store
|
|
*/
|
|
constructor(store) {
|
|
this.store = store;
|
|
}
|
|
/**
|
|
* @return {?}
|
|
*/
|
|
resolve() {
|
|
/** @type {?} */
|
|
const data = this.store.selectSnapshot(TenantManagementState.get);
|
|
return data && data.length ? null : this.store.dispatch(new GetTenants());
|
|
}
|
|
}
|
|
TenantsResolver.decorators = [
|
|
{ type: Injectable }
|
|
];
|
|
/** @nocollapse */
|
|
TenantsResolver.ctorParameters = () => [
|
|
{ type: Store }
|
|
];
|
|
if (false) {
|
|
/**
|
|
* @type {?}
|
|
* @private
|
|
*/
|
|
TenantsResolver.prototype.store;
|
|
}
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
const ɵ0 = { requiredPolicy: 'AbpTenantManagement.Tenants' };
|
|
/** @type {?} */
|
|
const routes = [
|
|
{ path: '', redirectTo: 'tenants', pathMatch: 'full' },
|
|
{
|
|
path: 'tenants',
|
|
component: DynamicLayoutComponent,
|
|
canActivate: [AuthGuard, PermissionGuard],
|
|
data: ɵ0,
|
|
children: [{ path: '', component: TenantsComponent, resolve: [TenantsResolver] }],
|
|
},
|
|
];
|
|
class TenantManagementRoutingModule {
|
|
}
|
|
TenantManagementRoutingModule.decorators = [
|
|
{ type: NgModule, args: [{
|
|
imports: [RouterModule.forChild(routes)],
|
|
exports: [RouterModule],
|
|
providers: [TenantsResolver],
|
|
},] }
|
|
];
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
class TenantManagementModule {
|
|
}
|
|
TenantManagementModule.decorators = [
|
|
{ type: NgModule, args: [{
|
|
declarations: [TenantsComponent],
|
|
imports: [
|
|
TenantManagementRoutingModule,
|
|
NgxsModule.forFeature([TenantManagementState]),
|
|
CoreModule,
|
|
TableModule,
|
|
ThemeSharedModule,
|
|
NgbDropdownModule,
|
|
],
|
|
},] }
|
|
];
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
/** @type {?} */
|
|
const TENANT_MANAGEMENT_ROUTES = (/** @type {?} */ ([
|
|
{
|
|
name: 'AbpTenantManagement::Menu:TenantManagement',
|
|
path: 'tenant-management',
|
|
parentName: 'AbpUiNavigation::Menu:Administration',
|
|
layout: "application" /* application */,
|
|
iconClass: 'fa fa-users',
|
|
children: [
|
|
{
|
|
path: 'tenants',
|
|
name: 'AbpTenantManagement::Tenants',
|
|
order: 1,
|
|
requiredPolicy: 'AbpTenantManagement.Tenants',
|
|
},
|
|
],
|
|
},
|
|
]));
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
var TenantManagement;
|
|
(function (TenantManagement) {
|
|
/**
|
|
* @record
|
|
*/
|
|
function State() { }
|
|
TenantManagement.State = State;
|
|
if (false) {
|
|
/** @type {?} */
|
|
State.prototype.result;
|
|
/** @type {?} */
|
|
State.prototype.selectedItem;
|
|
}
|
|
/**
|
|
* @record
|
|
*/
|
|
function Item() { }
|
|
TenantManagement.Item = Item;
|
|
if (false) {
|
|
/** @type {?} */
|
|
Item.prototype.id;
|
|
/** @type {?} */
|
|
Item.prototype.name;
|
|
}
|
|
/**
|
|
* @record
|
|
*/
|
|
function AddRequest() { }
|
|
TenantManagement.AddRequest = AddRequest;
|
|
if (false) {
|
|
/** @type {?} */
|
|
AddRequest.prototype.name;
|
|
}
|
|
/**
|
|
* @record
|
|
*/
|
|
function UpdateRequest() { }
|
|
TenantManagement.UpdateRequest = UpdateRequest;
|
|
if (false) {
|
|
/** @type {?} */
|
|
UpdateRequest.prototype.id;
|
|
}
|
|
/**
|
|
* @record
|
|
*/
|
|
function DefaultConnectionStringRequest() { }
|
|
TenantManagement.DefaultConnectionStringRequest = DefaultConnectionStringRequest;
|
|
if (false) {
|
|
/** @type {?} */
|
|
DefaultConnectionStringRequest.prototype.id;
|
|
/** @type {?} */
|
|
DefaultConnectionStringRequest.prototype.defaultConnectionString;
|
|
}
|
|
})(TenantManagement || (TenantManagement = {}));
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview added by tsickle
|
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
*/
|
|
|
|
export { CreateTenant, DeleteTenant, GetTenantById, GetTenants, TENANT_MANAGEMENT_ROUTES, TenantManagementModule, TenantManagementService, TenantManagementState, TenantsComponent, TenantsResolver, UpdateTenant, TenantsComponent as ɵa, TenantManagementState as ɵb, TenantManagementService as ɵc, GetTenants as ɵd, GetTenantById as ɵe, CreateTenant as ɵf, UpdateTenant as ɵg, DeleteTenant as ɵh, TenantManagementRoutingModule as ɵj, TenantsResolver as ɵk };
|
|
//# sourceMappingURL=abp-ng.tenant-management.js.map
|