Browse Source

Merge pull request #657 from colinin/upt-5.3.2

fix: fix PermissionModal
pull/712/head
yx lin 3 years ago
committed by GitHub
parent
commit
b080ea8219
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 130
      apps/vue/src/components/Permission/src/PermissionModal.vue
  2. 20
      gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayModule.cs
  3. 126
      gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayOptions.cs
  4. 9
      gateways/web/LY.MicroService.ApiGateway/Properties/launchSettings.json
  5. 6
      gateways/web/LY.MicroService.ApiGateway/yarp.json

130
apps/vue/src/components/Permission/src/PermissionModal.vue

@ -59,16 +59,18 @@
</BasicModal>
</template>
<script lang="ts">
import { computed, defineComponent, ref } from 'vue';
import { message } from 'ant-design-vue';
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { Card, Checkbox, Col, Divider, Row, Tabs } from 'ant-design-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTree } from '/@/components/Tree';
import { usePermissions } from './hooks/usePermissions';
import { PermissionProps } from './types/permission';
const TabPane = Tabs.TabPane;
const defaultProps: PermissionProps = {
providerName: 'G',
providerKey: '',
@ -76,84 +78,50 @@
identity: '',
};
export default defineComponent({
name: 'PermissionModal',
components: {
BasicModal,
BasicTree,
Card,
Checkbox,
Divider,
Col,
Row,
Tabs,
TabPane: Tabs.TabPane,
},
setup() {
const { L } = useLocalization('AbpPermissionManagement');
const activeKey = ref('');
const model = ref<PermissionProps>(defaultProps);
const {
title,
permissionTree,
permissionTab,
permissionGrantKeys,
permissionTabCheckState,
permissionTreeCheckState,
permissionTreeDisabled,
handlePermissionGranted,
handleSavePermission,
handleGrantAllPermission,
handleGrantPermissions,
} = usePermissions({
getPropsRef: model,
});
const [registerModal, { closeModal, changeOkLoading }] = useModalInner((val) => {
model.value = val;
});
const getIdentity = computed(() => {
if (model.value.identity) {
return `${L('Permissions')} - ${model.value.identity}`;
}
return title.value;
});
function handleVisibleChange(visible: boolean) {
if (!visible) {
model.value.providerKey = '';
}
}
const { createMessage } = useMessage();
const { L } = useLocalization('AbpPermissionManagement');
const activeKey = ref('');
const model = ref<PermissionProps>(defaultProps);
const {
title,
permissionTree,
permissionTab,
permissionGrantKeys,
permissionTabCheckState,
permissionTreeCheckState,
permissionTreeDisabled,
handlePermissionGranted,
handleSavePermission,
handleGrantAllPermission,
handleGrantPermissions,
} = usePermissions({
getPropsRef: model,
});
const [registerModal, { closeModal, changeOkLoading }] = useModalInner((val) => {
model.value = val;
});
const getIdentity = computed(() => {
if (model.value.identity) {
return `${L('Permissions')} - ${model.value.identity}`;
}
return title.value;
});
function handleSubmit() {
changeOkLoading(true);
handleSavePermission()
.then(() => {
message.success(L('Successful'));
closeModal();
})
.finally(() => {
changeOkLoading(false);
});
}
function handleVisibleChange(visible: boolean) {
if (!visible) {
model.value.providerKey = '';
}
}
return {
L,
activeKey,
title,
getIdentity,
permissionTab,
permissionTree,
permissionGrantKeys,
permissionTabCheckState,
permissionTreeCheckState,
permissionTreeDisabled,
handlePermissionGranted,
handleGrantAllPermission,
handleGrantPermissions,
registerModal,
handleSubmit,
handleVisibleChange,
};
},
});
function handleSubmit() {
changeOkLoading(true);
handleSavePermission()
.then(() => {
createMessage.success(L('Successful'));
closeModal();
})
.finally(() => {
changeOkLoading(false);
});
}
</script>

20
gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayModule.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Builder;
using LINGYUN.Abp.AspNetCore.Mvc.Wrapper;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.Configuration;
@ -23,7 +24,8 @@ namespace LY.MicroService.ApiGateway;
typeof(AbpAutofacModule),
typeof(AbpDataModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule)
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAspNetCoreMvcWrapperModule)
)]
public class InternalApiGatewayModule : AbpModule
{
@ -32,6 +34,18 @@ public class InternalApiGatewayModule : AbpModule
var configuration = context.Services.GetConfiguration();
var hostingEnvironment = context.Services.GetHostingEnvironment();
Configure<InternalApiGatewayOptions>(options =>
{
options.Aggregator.ConfigurationUrl.ClientName = "_Abp_Application_Configuration";
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30010"));
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30015"));
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30020"));
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30025"));
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30030"));
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30035"));
options.Aggregator.ConfigurationUrl.GetUrls.AddIfNotContains(new RequestUrl("http://10.21.15.28:30040"));
});
context.Services.AddAbpSwaggerGenWithOAuth(
authority: configuration["AuthServer:Authority"],
scopes: new Dictionary<string, string>
@ -128,7 +142,7 @@ public class InternalApiGatewayModule : AbpModule
app.UseRewriter(new RewriteOptions().AddRedirect("^(|\\|\\s+)$", "/swagger"));
app.UseRouting();
app.UseEndpoints(endpoints =>
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapReverseProxy(options =>
options.UseLoadBalancing());

126
gateways/web/LY.MicroService.ApiGateway/InternalApiGatewayOptions.cs

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
namespace LY.MicroService.ApiGateway
{
public class InternalApiGatewayOptions
{
public Aggregator Aggregator { get; set; }
public InternalApiGatewayOptions()
{
Aggregator = new Aggregator();
}
}
public class Aggregator
{
/// <summary>
/// 设置聚合路由
/// </summary>
/// <remarks>
/// 聚合路由:
/// /api/setting-management/settings
/// </remarks>
/// <example>
/// 宿主端路由:
/// Get: /api/setting-management/settings/by-global
/// Set: /api/setting-management/settings/change-global
/// </example>
/// <example>
/// 租户端路由:
/// Get: /api/setting-management/settings/by-current-tenant
/// Set: /api/setting-management/settings/change-current-tenant
/// </example>
/// <example>
/// 用户端路由:
/// Get: /api/setting-management/settings/by-current-user
/// Set: /api/setting-management/settings/change-current-user
/// </example>
public AggregatorUrl SettingUrl { get; set; }
/// <summary>
/// 应用配置聚合路由
/// </summary>
/// <remarks>
/// 聚合路由:
/// /api/abp/application-configuration
/// </remarks>
public AggregatorUrl ConfigurationUrl { get; set; }
/// <summary>
/// Api接口定义配置聚合路由
/// </summary>
/// <remarks>
/// 聚合路由:
/// /api/abp/api-definition
/// </remarks>
public AggregatorUrl ApiDefinitionUrl { get; set; }
public Aggregator()
{
SettingUrl = new AggregatorUrl();
ConfigurationUrl = new AggregatorUrl();
ApiDefinitionUrl = new AggregatorUrl();
}
}
public class AggregatorUrl
{
public string ClientName { get; set; }
public HttpHandlerOptions HttpHandler { get; set; }
/// <summary>
/// 查询聚合路由列表
/// </summary>
public List<RequestUrl> GetUrls { get; set; }
/// <summary>
/// 变更路由
/// </summary>
public RequestUrl SetUrl { get; set; }
/// <summary>
/// 默认超时时间
/// </summary>
/// <remarks>
/// default: 30s
/// </remarks>
public TimeSpan? DefaultTimeout { get; set; }
public AggregatorUrl()
{
HttpHandler = new HttpHandlerOptions();
GetUrls = new List<RequestUrl>();
DefaultTimeout = TimeSpan.FromSeconds(30);
}
}
public class RequestUrl
{
public HttpMethod Method { get; set; }
public string Url { get; set; }
public RequestUrl()
{
Method = HttpMethod.Get;
}
public RequestUrl(string url)
: this(HttpMethod.Get, url)
{
}
public RequestUrl(
HttpMethod method,
string url)
{
Method = method;
Url = url;
}
}
public class HttpHandlerOptions
{
public bool AllowAutoRedirect { get; set; }
public bool UseCookieContainer { get; set; }
public bool UseTracing { get; set; }
public bool UseProxy { get; set; }
public int MaxConnectionsPerServer { get; set; }
}
}

9
gateways/web/LY.MicroService.ApiGateway/Properties/launchSettings.json

@ -8,7 +8,7 @@
}
},
"profiles": {
"PackageName.CompanyName.ProjectName.HttpApi.Host": {
"LY.MicroService.ApiGateway": {
"commandName": "Project",
"launchBrowser": false,
"environmentVariables": {
@ -16,13 +16,6 @@
},
"applicationUrl": "http://localhost:5000",
"dotnetRunMessages": "true"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

6
gateways/web/LY.MicroService.ApiGateway/yarp.json

@ -19,12 +19,6 @@
"Path": "/api/identity-server/{**everything}"
}
},
"BackendAdmin": {
"ClusterId": "backendAdminCluster",
"Match": {
"Path": "/api/abp/{**everything}"
}
},
"feature-management-route": {
"ClusterId": "feature-management-cluster",
"Match": {

Loading…
Cancel
Save