Browse Source

👕 调整审计日志样式

main-auditlogging
王军 4 years ago
parent
commit
07be961632
  1. 2
      aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Users/Dtos/LoginInput.cs
  2. 4
      vben271/src/locales/lang/en/routes/admin.ts
  3. 5
      vben271/src/locales/lang/zh-CN/routes/admin.ts
  4. 2
      vben271/src/router/routes/modules/identityServer.ts
  5. 4
      vben271/src/store/modules/user.ts
  6. 71
      vben271/src/views/admin/auditLog/AuditLog.ts
  7. 20
      vben271/src/views/admin/auditLog/AuditLog.vue

2
aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Users/Dtos/LoginInput.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Auditing;
namespace Lion.AbpPro.Users.Dtos
{
@ -14,6 +15,7 @@ namespace Lion.AbpPro.Users.Dtos
/// </summary>
public string Name { get; set; }
[DisableAuditing]
/// <summary>
/// 密码
/// </summary>

4
vben271/src/locales/lang/en/routes/admin.ts

@ -46,7 +46,7 @@ export default {
identityServer: 'IdentityServer',
client: 'Client',
apiResource: 'ApiResource',
apiSocpe: 'ApiSocpe',
apiScope: 'ApiScope',
identityResource: 'IdentityResource',
logLevel: 'Level',
@ -66,4 +66,6 @@ export default {
newPassword: 'NewPassword',
confirmPassword: 'ConfirmPassword',
editPasswordMessage: 'The passwords entered twice are inconsistent. Procedure',
executionTime: 'ExecutionTime',
executionDuration: 'ExecutionDuration(Millisecond)',
};

5
vben271/src/locales/lang/zh-CN/routes/admin.ts

@ -44,7 +44,7 @@ export default {
identityServer: '身份认证中心',
client: '客户端',
apiResource: 'Api资源',
apiSocpe: 'ApiSocpe',
apiScope: 'ApiScope',
identityResource: 'Identity资源',
logLevel: '级别',
@ -65,4 +65,7 @@ export default {
newPassword: '新密码',
confirmPassword: '确认密码',
editPasswordMessage: '输入的2次密码不一致',
executionTime: '执行时间',
executionDuration: '响应时间(毫秒)',
};

2
vben271/src/router/routes/modules/identityServer.ts

@ -37,7 +37,7 @@ const identityServer: AppRouteModule = {
name: 'ApiScopes',
component: () => import('/@/views/identityServers/apiScopes/ApiScopes.vue'),
meta: {
title: t('routes.admin.apiSocpe'),
title: t('routes.admin.apiScope'),
icon: 'ant-design:compass-outlined',
policy: 'IdentityServerManagement.ApiScope',
},

4
vben271/src/store/modules/user.ts

@ -150,8 +150,8 @@ export const useUserStore = defineStore({
} catch (error) {
//console.log(error);
router.replace(PageEnum.BASE_LOGIN);
//return null;
throw new Error(error);
return null;
//throw new Error(error);
}
},
async getAbpApplicationConfigurationAsync() {

71
vben271/src/views/admin/auditLog/AuditLog.ts

@ -1,6 +1,7 @@
import { FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
import moment from 'moment';
import { AuditLogsServiceProxy, PagingAuditLogListInput } from '/@/services/ServiceProxies';
@ -27,28 +28,21 @@ export const tableColumns: BasicColumn[] = [
// dataIndex: 'tenantName',
// width: 100,
// },
{
title: 'Url',
dataIndex: 'url',
width: 300,
slots: {
customRender: 'url',
},
},
{
title: t('routes.admin.userManagement_userName'),
dataIndex: 'userName',
width: 100,
},
{
title: 'HttpMethod',
dataIndex: 'httpMethod',
width: 150,
},
{
title: 'HttpStatusCode',
dataIndex: 'httpStatusCode',
width: 150,
},
{
title: 'Url',
dataIndex: 'url',
width: 350,
},
{
title: 'ExecutionTime',
title: t('routes.admin.executionTime'),
dataIndex: 'executionTime',
width: 200,
customRender: ({ text }) => {
@ -56,12 +50,14 @@ export const tableColumns: BasicColumn[] = [
},
},
{
title: 'BrowserInfo',
dataIndex: 'browserInfo',
title: t('routes.admin.executionDuration'),
dataIndex: 'executionDuration',
width: 150,
},
{
title: 'Exceptions',
dataIndex: 'exceptions',
},
];
/**
@ -73,3 +69,42 @@ export async function getTableListAsync(params: PagingAuditLogListInput) {
const _auditLogsServiceProxy = new AuditLogsServiceProxy();
return _auditLogsServiceProxy.page(params);
}
export function httpStatusCodeColor(statusCode?: number) {
if (!statusCode) {
return '';
}
if (statusCode >= 200 && statusCode < 300) {
return '#87d068';
}
if (statusCode >= 300 && statusCode < 400) {
return '#108ee9';
}
if (statusCode >= 400 && statusCode < 500) {
return 'orange';
}
if (statusCode >= 500) {
return 'red';
}
return 'cyan';
}
export function httpMethodColor(method?: string) {
if (method == 'GET') {
return 'blue';
}
if (method == 'POST') {
return 'blue';
}
if (method == 'PUT') {
return 'orange';
}
if (method == 'DELETE') {
return 'red';
}
if (method == 'OPTIONS') {
return 'cyan';
}
if (method == 'PATCH') {
return 'pink';
}
return 'cyan';
}

20
vben271/src/views/admin/auditLog/AuditLog.vue

@ -1,20 +1,27 @@
<template>
<div>
<BasicTable @register="registerTable" size="small"> </BasicTable>
<BasicTable @register="registerTable" size="small">
<template #url="{ record }">
<Tag :color="httpStatusCodeColor(record.httpStatusCode)">{{ record.httpStatusCode }}</Tag>
<Tag style="margin-left: 5px" :color="httpMethodColor(record.httpMethod)">{{
record.httpMethod
}}</Tag>
<span style="margin-left: 5px">{{ record.url }}</span>
</template>
</BasicTable>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { tableColumns, searchFormSchema, getTableListAsync } from './AuditLog';
import { BasicTable, useTable } from '/@/components/Table';
import { tableColumns, searchFormSchema, getTableListAsync,httpStatusCodeColor,httpMethodColor } from './AuditLog';
import { Tag } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
export default defineComponent({
name: 'AuditLog',
components: {
BasicTable,
TableAction,
Tag,
},
setup() {
@ -35,12 +42,17 @@
bordered: true,
canResize: true,
showIndexColumn: true,
bordered: true,
immediate: true,
scroll: { x: true },
});
return {
registerTable,
reload,
t,
httpStatusCodeColor,
httpMethodColor,
};
},
});

Loading…
Cancel
Save