Browse Source

fix(saas): Redirects the correct tenant management path

pull/523/head
cKey 4 years ago
parent
commit
b6d912e6b4
  1. 13
      apps/vue/src/api/saas/model/tenantModel.ts
  2. 16
      apps/vue/src/api/saas/tenant.ts
  3. 6
      apps/vue/src/views/saas/tenant/components/TenantConnectionModal.vue
  4. 6
      apps/vue/src/views/saas/tenant/components/TenantModal.vue
  5. 12
      apps/vue/src/views/saas/tenant/components/TenantTable.vue
  6. 33
      apps/vue/src/views/saas/tenant/datas/ModalData.ts
  7. 9
      apps/vue/src/views/saas/tenant/datas/TableData.ts
  8. 2
      apps/vue/src/views/saas/tenant/hooks/useTenantTable.ts
  9. 1
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json
  10. 1
      aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json
  11. 1
      aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.Application/LINGYUN.Abp.TenantManagement.Application.csproj
  12. 4
      aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.HttpApi/LINGYUN.Abp.TenantManagement.HttpApi.csproj
  13. 12
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs
  14. 1
      aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs
  15. 4
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.Development.json
  16. 34
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.backendadmin.json

13
apps/vue/src/api/saas/model/tenantModel.ts

@ -9,6 +9,11 @@ import {
export interface Tenant extends AuditedEntityDto {
id: string;
name: string;
editionId?: string;
editionName?: string;
isActive: boolean;
enableTime?: Date;
disableTime?: Date;
}
export interface TenantConnectionString {
@ -20,10 +25,18 @@ export interface CreateTenant {
name: string;
adminEmailAddress: string;
adminPassword: string;
editionId?: string;
isActive: boolean;
enableTime?: Date;
disableTime?: Date;
}
export interface UpdateTenant {
name: string;
editionId?: string;
isActive: boolean;
enableTime?: Date;
disableTime?: Date;
}
export interface GetTenantPagedRequest extends PagedAndSortedResultRequestDto {

16
apps/vue/src/api/saas/tenant.ts

@ -12,14 +12,14 @@ import { format } from '/@/utils/strings';
/** 与 multi-tenancy中不同,此为管理tenant api */
enum Api {
Create = '/api/tenant-management/tenants',
DeleteById = '/api/tenant-management/tenants/{id}',
GetById = '/api/tenant-management/tenants/{id}',
GetList = '/api/tenant-management/tenants',
Update = '/api/tenant-management/tenants/{id}',
GetConnectionStrings = '/api/tenant-management/tenants/{id}/connection-string',
SetConnectionString = '/api/tenant-management/tenants/{id}/connection-string',
DeleteConnectionString = '/api/tenant-management/tenants/{id}/connection-string/{name}',
Create = '/api/saas/tenants',
DeleteById = '/api/saas/tenants/{id}',
GetById = '/api/saas/tenants/{id}',
GetList = '/api/saas/tenants',
Update = '/api/saas/tenants/{id}',
GetConnectionStrings = '/api/saas/tenants/{id}/connection-string',
SetConnectionString = '/api/saas/tenants/{id}/connection-string',
DeleteConnectionString = '/api/saas/tenants/{id}/connection-string/{name}',
}
export const getById = (id: string) => {

6
apps/vue/src/views/saas/tenant/components/TenantConnectionModal.vue

@ -10,7 +10,7 @@
<BasicTable @register="registerTable">
<template #toolbar>
<a-button
v-if="hasPermission('AbpTenantManagement.Tenants.Create')"
v-if="hasPermission('AbpSaas.Tenants.ManageConnectionStrings')"
type="primary"
@click="handleAddNew"
>{{ L('ConnectionStrings:AddNew') }}</a-button
@ -20,7 +20,7 @@
<TableAction
:actions="[
{
auth: 'AbpTenantManagement.Tenants.ManageConnectionStrings',
auth: 'AbpSaas.Tenants.ManageConnectionStrings',
color: 'error',
label: L('Delete'),
icon: 'ant-design:delete-outlined',
@ -55,7 +55,7 @@
export default defineComponent({
components: { BasicForm, BasicModal, BasicTable, TableAction },
setup() {
const { L } = useLocalization('AbpTenantManagement');
const { L } = useLocalization('AbpSaas');
const tenantIdRef = ref('');
const connectionsRef = ref<any[]>([]);
const { hasPermission } = usePermission();

6
apps/vue/src/views/saas/tenant/components/TenantModal.vue

@ -27,7 +27,7 @@
components: { BasicForm, BasicModal },
emits: ['change', 'register'],
setup(_props, { emit }) {
const { L } = useLocalization('AbpTenantManagement');
const { L } = useLocalization('AbpSaas');
const loading = ref(false);
const tenantIdRef = ref('');
const [registerModal, { closeModal }] = useModalInner((data) => {
@ -46,9 +46,7 @@
loading.value = true;
const api = input.id
? update(input.id, {
name: input.name,
})
? update(input.id, input)
: create(input);
api

12
apps/vue/src/views/saas/tenant/components/TenantTable.vue

@ -3,7 +3,7 @@
<BasicTable ref="tableElRef" @register="registerTable">
<template #toolbar>
<a-button
v-if="hasPermission('AbpTenantManagement.Tenants.Create')"
v-if="hasPermission('AbpSaas.Tenants.Create')"
type="primary"
@click="handleAddNew"
>{{ L('NewTenant') }}</a-button
@ -19,13 +19,13 @@
<TableAction
:actions="[
{
auth: 'AbpTenantManagement.Tenants.Update',
auth: 'AbpSaas.Tenants.Update',
label: L('Edit'),
icon: 'ant-design:edit-outlined',
onClick: handleEdit.bind(null, record),
},
{
auth: 'AbpTenantManagement.Tenants.Delete',
auth: 'AbpSaas.Tenants.Delete',
color: 'error',
label: L('Delete'),
icon: 'ant-design:delete-outlined',
@ -34,12 +34,12 @@
]"
:dropDownActions="[
{
auth: 'FeatureManagement.ManageHostFeatures',
auth: 'AbpSaas.Tenants.ManageFeatures',
label: L('ManageFeatures'),
onClick: handleManageTenantFeature.bind(null, record),
},
{
auth: 'AbpTenantManagement.Tenants.ManageConnectionStrings',
auth: 'AbpSaas.Tenants.ManageConnectionStrings',
label: L('ConnectionStrings'),
onClick: openConnectModal.bind(null, true, record),
},
@ -70,7 +70,7 @@
name: 'TenantTable',
components: { BasicTable, FeatureModal, TableAction, TenantModal, TenantConnectionModal },
setup() {
const { L } = useLocalization('AbpTenantManagement', 'AbpFeatureManagement');
const { L } = useLocalization('AbpSaas', 'AbpFeatureManagement');
const { hasPermission } = usePermission();
const tableElRef = ref<Nullable<TableActionType>>(null);
const [registerConnectModal, { openModal: openConnectModal }] = useModal();

33
apps/vue/src/views/saas/tenant/datas/ModalData.ts

@ -1,7 +1,7 @@
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { FormProps, FormSchema } from '/@/components/Form';
const { L } = useLocalization('AbpTenantManagement');
const { L } = useLocalization('AbpSaas');
export function getSearchFormSchemas(): Partial<FormProps> {
return {
@ -25,6 +25,14 @@ export function getModalFormSchemas(): FormSchema[] {
label: 'id',
show: false,
},
{
field: 'isActive',
component: 'Checkbox',
label: L('DisplayName:IsActive'),
labelWidth: 50,
colProps: { span: 24 },
defaultValue: true,
},
{
field: 'name',
component: 'Input',
@ -32,6 +40,29 @@ export function getModalFormSchemas(): FormSchema[] {
colProps: { span: 24 },
required: true,
},
{
field: 'enableTime',
component: 'DatePicker',
label: L('DisplayName:EnableTime'),
colProps: { span: 24 },
defaultValue: new Date(),
componentProps: {
style: {
width: '100%',
},
},
},
{
field: 'disableTime',
component: 'DatePicker',
label: L('DisplayName:DisableTime'),
colProps: { span: 24 },
componentProps: {
style: {
width: '100%',
},
},
},
{
field: 'adminEmailAddress',
component: 'Input',

9
apps/vue/src/views/saas/tenant/datas/TableData.ts

@ -1,7 +1,7 @@
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { BasicColumn } from '/@/components/Table';
const { L } = useLocalization('AbpTenantManagement');
const { L } = useLocalization('AbpSaas');
export function getDataColumns(): BasicColumn[] {
return [
@ -15,6 +15,13 @@ export function getDataColumns(): BasicColumn[] {
title: L('DisplayName:TenantName'),
dataIndex: 'name',
align: 'left',
width: 200,
sorter: true,
},
{
title: L('DisplayName:EditionName'),
dataIndex: 'editionName',
align: 'left',
width: 'auto',
sorter: true,
},

2
apps/vue/src/views/saas/tenant/hooks/useTenantTable.ts

@ -14,7 +14,7 @@ interface UseTenantTable {
}
export function useTenantTable({ tableElRef }: UseTenantTable) {
const { L } = useLocalization('AbpTenantManagement');
const { L } = useLocalization('AbpSaas');
const [registerTable, {}] = useTable({
rowKey: 'id',
title: L('Tenants'),

1
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/en.json

@ -19,6 +19,7 @@
"DisplayName:TenantName": "Tenant name",
"TenantDeletionConfirmationMessage": "Tenant '{0}' will be deleted. Do you confirm that?",
"ConnectionStrings": "Connection Strings",
"ConnectionStrings:AddNew": "New Connection",
"DisplayName:DefaultConnectionString": "Default Connection String",
"DisplayName:UseSharedDatabase": "Use the Shared Database",
"DisplayName:Name": "Name",

1
aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain.Shared/LINGYUN/Abp/Saas/Localization/Resources/zh-Hans.json

@ -19,6 +19,7 @@
"DisplayName:TenantName": "租户名称",
"TenantDeletionConfirmationMessage": "租户 '{0}' 将被删除. 你确定吗?",
"ConnectionStrings": "连接字符串",
"ConnectionStrings:AddNew": "添加新连接",
"DisplayName:DefaultConnectionString": "默认连接字符串",
"DisplayName:UseSharedDatabase": "使用共享数据库",
"DisplayName:Name": "名称",

1
aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.Application/LINGYUN.Abp.TenantManagement.Application.csproj

@ -14,7 +14,6 @@
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.MultiTenancy\LINGYUN.Abp.MultiTenancy.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.TenantManagement.Application.Contracts\LINGYUN.Abp.TenantManagement.Application.Contracts.csproj" />
</ItemGroup>
</Project>

4
aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.HttpApi/LINGYUN.Abp.TenantManagement.HttpApi.csproj

@ -12,8 +12,4 @@
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TenantManagement.Application.Contracts\LINGYUN.Abp.TenantManagement.Application.Contracts.csproj" />
</ItemGroup>
</Project>

12
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.Configure.cs

@ -2,6 +2,7 @@
using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.Saas;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.Abp.Serilog.Enrichers.UniqueId;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@ -22,6 +23,8 @@ using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.FeatureManagement;
using Volo.Abp.Features;
using Volo.Abp.GlobalFeatures;
using Volo.Abp.Identity.Localization;
using Volo.Abp.Json;
@ -87,6 +90,15 @@ public partial class BackendAdminHttpApiHostModule
});
}
private void ConfigureFeatureManagement()
{
Configure<FeatureManagementOptions>(options =>
{
options.ProviderPolicies[EditionFeatureValueProvider.ProviderName] = AbpSaasPermissions.Editions.ManageFeatures;
options.ProviderPolicies[TenantFeatureValueProvider.ProviderName] = AbpSaasPermissions.Tenants.ManageFeatures;
});
}
private void ConfigureJsonSerializer()
{
// 统一时间日期格式

1
aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs

@ -99,6 +99,7 @@ public partial class BackendAdminHttpApiHostModule : AbpModule
ConfigureJsonSerializer();
ConfigureExceptionHandling();
ConfigureVirtualFileSystem();
ConfigureFeatureManagement();
ConfigurePermissionManagement();
ConfigureCaching(configuration);
ConfigureAuditing(configuration);

4
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.Development.json

@ -103,7 +103,7 @@
}
},
{
"DownstreamPathTemplate": "/api/tenant-management/{everything}",
"DownstreamPathTemplate": "/api/saas/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
@ -111,7 +111,7 @@
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/tenant-management/{everything}",
"UpstreamPathTemplate": "/api/saas/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",

34
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.backendadmin.json

@ -1,6 +1,6 @@
{
"Routes": [
//
// ܶ˵
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
@ -26,7 +26,7 @@
},
"Key": "backend-admin-configuration"
},
// API
// ̬ܶAPI˵
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
@ -52,7 +52,7 @@
},
"Key": "backend-admin-api-definition"
},
//
//
{
"DownstreamPathTemplate": "/api/abp/multi-tenancy/{everything}",
"DownstreamScheme": "http",
@ -77,9 +77,9 @@
"UseTracing": true
}
},
//
//
{
"DownstreamPathTemplate": "/api/tenant-management/{everything}",
"DownstreamPathTemplate": "/api/saas/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
@ -87,7 +87,7 @@
"Port": 30010
}
],
"UpstreamPathTemplate": "/api/tenant-management/{everything}",
"UpstreamPathTemplate": "/api/saas/{everything}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE" ],
"LoadBalancerOptions": {
"Type": "RoundRobin"
@ -108,7 +108,7 @@
"UseTracing": true
}
},
//
// Ȩ޹
{
"DownstreamPathTemplate": "/api/permission-management/{everything}",
"DownstreamScheme": "http",
@ -139,7 +139,7 @@
"UseTracing": true
}
},
//
//
{
"DownstreamPathTemplate": "/api/setting-management/settings/by-current-tenant",
"DownstreamScheme": "http",
@ -171,7 +171,7 @@
},
"Key": "setting-current-tenant"
},
//
// ȫ
{
"DownstreamPathTemplate": "/api/setting-management/settings/by-global",
"DownstreamScheme": "http",
@ -203,7 +203,7 @@
},
"Key": "setting-global"
},
//
// ΢
{
"DownstreamPathTemplate": "/api/setting-management/wechat/by-current-tenant",
"DownstreamScheme": "http",
@ -235,7 +235,7 @@
},
"Key": "wechat-setting-current-tenant"
},
//
// ΢ȫ
{
"DownstreamPathTemplate": "/api/setting-management/wechat/by-global",
"DownstreamScheme": "http",
@ -267,7 +267,7 @@
},
"Key": "wechat-setting-global"
},
//
//
{
"DownstreamPathTemplate": "/api/setting-management/aliyun/by-current-tenant",
"DownstreamScheme": "http",
@ -299,7 +299,7 @@
},
"Key": "aliyun-setting-current-tenant"
},
//
// ȫ
{
"DownstreamPathTemplate": "/api/setting-management/aliyun/by-global",
"DownstreamScheme": "http",
@ -331,7 +331,7 @@
},
"Key": "aliyun-setting-global"
},
//
// ù
{
"DownstreamPathTemplate": "/api/setting-management/{everything}",
"DownstreamScheme": "http",
@ -362,7 +362,7 @@
"UseTracing": true
}
},
//
// Թ
{
"DownstreamPathTemplate": "/api/feature-management/{everything}",
"DownstreamScheme": "http",
@ -393,7 +393,7 @@
"UseTracing": true
}
},
//
// ־
{
"DownstreamPathTemplate": "/api/auditing/{everything}",
"DownstreamScheme": "http",
@ -424,7 +424,7 @@
"UseTracing": true
}
},
// API
// API ĵ
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",

Loading…
Cancel
Save