🎨 修改代码规范.

This commit is contained in:
lijiahang
2024-12-26 13:51:41 +08:00
parent 9017ada3aa
commit 00ea709f9e
19 changed files with 115 additions and 89 deletions

View File

@@ -51,7 +51,7 @@ public class OrionDataSourceAutoConfiguration {
* @return druid 广告过滤器
*/
@Bean
@ConditionalOnProperty(name = "spring.datasource.druid.web-stat-filter.enabled", havingValue = "true")
@ConditionalOnProperty(value = "spring.datasource.druid.web-stat-filter.enabled", havingValue = "true")
public FilterRegistrationBean<DruidAdRemoveFilter> druidAdRemoveFilterFilter(DruidStatProperties properties) {
// 获取 druid web 监控页面的参数
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();

View File

@@ -61,7 +61,7 @@ import java.util.Optional;
*/
@ConditionalOnClass({OpenAPI.class})
@EnableConfigurationProperties(SwaggerConfig.class)
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true")
@ConditionalOnProperty(value = "springdoc.api-docs.enabled", havingValue = "true")
@AutoConfiguration
@AutoConfigureOrder(AutoConfigureOrderConst.FRAMEWORK_SWAGGER)
public class OrionSwaggerAutoConfiguration {

View File

@@ -9,7 +9,8 @@
<a-link target="_blank" :href="`https://github.com/dromara/orion-visor/releases/tag/v${version}`">v{{ version }}</a-link>
</a-space>
<span class="copyright">
Copyright<icon-copyright /> 2023 - {{ new Date().getFullYear() }} Jiahang Li, All rights reserved.
Copyright<icon-copyright /> 2023 - {{ new Date().getFullYear() }} <a href="https://dromara.org">Dromara</a>, All rights reserved. Designed by
<a href="https://orionsec.cn" target="_blank">Jiahang Li.</a>
</span>
</a-space>
</a-layout-footer>

View File

@@ -22,7 +22,13 @@
</td>
<!-- 子菜单 -->
<td>
<a-checkbox :value="childrenMenu.id">
<!-- 默认路由 -->
<a-checkbox v-if="childrenMenu.component === DEFAULT_ROUTE_NAME"
:value="childrenMenu.id">
{{ childrenMenu.name }} <span class="span-red">(必选)</span>
</a-checkbox>
<!-- 普通子菜单 -->
<a-checkbox v-else :value="childrenMenu.id">
{{ childrenMenu.name }}
</a-checkbox>
</td>
@@ -73,6 +79,7 @@
import type { MenuQueryResponse } from '@/api/system/menu';
import { useCacheStore } from '@/store';
import { ref, watch } from 'vue';
import { DEFAULT_ROUTE_NAME } from '@/router/constants';
import { findNode, flatNodeKeys, flatNodes } from '@/utils/tree';
const cacheStore = useCacheStore();

View File

@@ -39,7 +39,11 @@
return props.modelValue;
},
set(e) {
emits('update:modelValue', e);
if (e) {
emits('update:modelValue', e);
} else {
emits('update:modelValue', null);
}
}
});

View File

@@ -40,7 +40,15 @@
return props.modelValue;
},
set(e) {
emits('update:modelValue', e);
if (e) {
emits('update:modelValue', e);
} else {
if (props.multiple) {
emits('update:modelValue', []);
} else {
emits('update:modelValue', null);
}
}
}
});
const optionData = ref<Array<SelectOptionData>>([]);

View File

@@ -39,7 +39,15 @@
return props.modelValue;
},
set(e) {
emits('update:modelValue', e);
if (e) {
emits('update:modelValue', e);
} else {
if (props.multiple) {
emits('update:modelValue', []);
} else {
emits('update:modelValue', null);
}
}
}
});
const optionData = ref<Array<SelectOptionData>>([]);

View File

@@ -43,7 +43,7 @@
// 跳转到指定页
onBeforeMount(() => {
const key = route.query.key;
const key = route.query.key as string;
if (key) {
activeKey.value = Number(key);
}

View File

@@ -30,12 +30,12 @@
// 跳转日志
onMounted(async () => {
const idParam = route.query.id;
const keyParam = route.query.key;
const idParam = route.query.id as string;
const keyParam = route.query.key as string;
if (idParam) {
await panel.value?.openLog(Number.parseInt(idParam as string));
await panel.value?.openLog(Number.parseInt(idParam));
} else if (keyParam) {
await panel.value?.openLog(Number.parseInt(keyParam as string));
await panel.value?.openLog(Number.parseInt(keyParam));
}
});

View File

@@ -3,7 +3,7 @@
<a-table row-key="id"
ref="tableRef"
:loading="loading"
:columns="columns"
:columns="hostColumns"
:data="row.hosts"
:expandable="expandable"
:scroll="{ y: '100%' }"
@@ -105,7 +105,7 @@
import { deleteExecCommandHostLog } from '@/api/exec/exec-command-log';
import { Message } from '@arco-design/web-vue';
import useLoading from '@/hooks/loading';
import columns from '../types/host-table.columns';
import { hostColumns } from '../types/table.columns';
import { execHostStatusKey, ExecHostStatus } from '@/components/exec/log/const';
import { useDictStore } from '@/store';
import { useExpandable } from '@/hooks/table';

View File

@@ -102,7 +102,7 @@
row-key="id"
ref="tableRef"
:loading="loading"
:columns="columns"
:columns="tableColumns"
:row-selection="rowSelection"
:expandable="expandable"
:data="tableRenderData"
@@ -218,7 +218,7 @@
} from '@/api/exec/exec-command-log';
import { Message } from '@arco-design/web-vue';
import useLoading from '@/hooks/loading';
import columns from '../types/table.columns';
import { tableColumns } from '../types/table.columns';
import { ExecStatus, execStatusKey } from '@/components/exec/log/const';
import { useExpandable, useTablePagination, useRowSelection } from '@/hooks/table';
import { useDictStore } from '@/store';

View File

@@ -1,57 +0,0 @@
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
import { isNumber } from '@/utils/is';
const columns = [
{
title: 'id',
dataIndex: 'id',
slotName: 'id',
width: 100,
align: 'left',
fixed: 'left',
}, {
title: '执行主机',
dataIndex: 'hostName',
slotName: 'hostName',
align: 'left',
ellipsis: true,
tooltip: true,
}, {
title: '退出码',
dataIndex: 'exitCode',
slotName: 'exitCode',
align: 'left',
width: 118,
render: ({ record }) => {
return isNumber(record.exitCode) ? record.exitCode : '-';
},
}, {
title: '执行状态',
dataIndex: 'status',
slotName: 'status',
align: 'left',
width: 118,
}, {
title: '错误信息',
dataIndex: 'errorMessage',
slotName: 'errorMessage',
align: 'left',
ellipsis: true,
tooltip: true,
width: 168,
}, {
title: '执行时间',
dataIndex: 'startTime',
slotName: 'startTime',
align: 'left',
width: 190,
}, {
title: '操作',
slotName: 'handle',
width: 258,
align: 'center',
fixed: 'right',
},
] as TableColumnData[];
export default columns;

View File

@@ -1,6 +1,8 @@
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
import { isNumber } from '@/utils/is';
const columns = [
// 表格列
export const tableColumns = [
{
title: 'id',
dataIndex: 'id',
@@ -51,4 +53,56 @@ const columns = [
},
] as TableColumnData[];
export default columns;
// 主机列
export const hostColumns = [
{
title: 'id',
dataIndex: 'id',
slotName: 'id',
width: 100,
align: 'left',
fixed: 'left',
}, {
title: '执行主机',
dataIndex: 'hostName',
slotName: 'hostName',
align: 'left',
ellipsis: true,
tooltip: true,
}, {
title: '退出码',
dataIndex: 'exitCode',
slotName: 'exitCode',
align: 'left',
width: 118,
render: ({ record }) => {
return isNumber(record.exitCode) ? record.exitCode : '-';
},
}, {
title: '执行状态',
dataIndex: 'status',
slotName: 'status',
align: 'left',
width: 118,
}, {
title: '错误信息',
dataIndex: 'errorMessage',
slotName: 'errorMessage',
align: 'left',
ellipsis: true,
tooltip: true,
width: 168,
}, {
title: '执行时间',
dataIndex: 'startTime',
slotName: 'startTime',
align: 'left',
width: 190,
}, {
title: '操作',
slotName: 'handle',
width: 258,
align: 'center',
fixed: 'right',
},
] as TableColumnData[];

View File

@@ -60,12 +60,12 @@
// 跳转日志
onMounted(async () => {
const idParam = route.query.id;
const keyParam = route.query.key;
const idParam = route.query.id as string;
const keyParam = route.query.key as string;
if (idParam) {
await openLogWithId(Number.parseInt(idParam as string));
await openLogWithId(Number.parseInt(idParam));
} else if (keyParam) {
await openLogWithId(Number.parseInt(keyParam as string));
await openLogWithId(Number.parseInt(keyParam));
}
});

View File

@@ -36,9 +36,9 @@
};
onMounted(() => {
const idParam = route.query.id;
const idParam = route.query.id as string;
if (idParam) {
init(Number.parseInt(idParam as string));
init(Number.parseInt(idParam));
}
});

View File

@@ -3,7 +3,7 @@
<a-table row-key="id"
ref="tableRef"
:loading="loading"
:columns="columns"
:columns="hostColumns"
:data="row.hosts"
:expandable="expandable"
:scroll="{ y: '100%' }"
@@ -106,7 +106,7 @@
import { execHostStatusKey, ExecHostStatus } from '@/components/exec/log/const';
import { useDictStore } from '@/store';
import useLoading from '@/hooks/loading';
import columns from '@/views/exec/exec-command-log/types/host-table.columns';
import { hostColumns } from '@/views/exec/exec-command-log/types/table.columns';
import { useExpandable } from '@/hooks/table';
import { dateFormat, formatDuration } from '@/utils';
import { downloadExecJobLogFile } from '@/api/exec/exec-job-log';

View File

@@ -138,7 +138,7 @@
onBeforeMount(() => {
// 打开默认 tab
let openTab;
const tab = route.query.tab;
const tab = route.query.tab as string;
if (tab) {
openTab = Object.values(TerminalTabs).find(s => s.key === tab);
}
@@ -167,9 +167,9 @@
// 加载主机
await loadHosts();
// 默认连接主机
const connect = route.query.connect;
const connect = route.query.connect as string;
if (connect) {
const connectHostId = Number.parseInt(connect as string);
const connectHostId = Number.parseInt(connect);
const connectHost = hosts.hostList.find(s => s.id === connectHostId);
// 打开连接
if (connectHost) {

View File

@@ -35,9 +35,9 @@
// 跳转到指定页
onBeforeMount(() => {
const key = route.query.key;
const key = route.query.key as string;
if (key) {
activeKey.value = key as string;
activeKey.value = key;
}
});

View File

@@ -324,7 +324,8 @@ INSERT INTO `dict_value` VALUES (431, 61, 'updatePasswordReason', 'NEW', '为了
INSERT INTO `dict_value` VALUES (432, 2, 'operatorLogType', 'exec-job:update-exec-user', '修改计划执行用户', '{}', 45, '2024-12-13 00:17:03', '2024-12-13 00:17:03', '1', '1', 0);
-- 菜单配置
INSERT INTO `system_menu` VALUES (1, 0, '工作台', NULL, 1, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'workplace', '2023-07-28 10:51:50', '2024-08-11 00:05:44', '1', '1', 0);
INSERT INTO `system_menu` VALUES (1, 0, '仪表盘', NULL, 1, 10, 1, 1, 1, 0, 'IconDashboard', NULL, 'dashboard', '2023-07-28 10:51:50', '2024-08-11 00:05:44', '1', '1', 0);
INSERT INTO `system_menu` VALUES (2, 1, '工作台', NULL, 2, 10, 1, 1, 1, 0, 'IconComputer', NULL, 'workplace', '2023-07-28 10:51:50', '2024-08-11 00:05:44', '1', '1', 0);
INSERT INTO `system_menu` VALUES (5, 0, '用户管理', NULL, 1, 700, 1, 1, 1, 0, 'icon-user', NULL, 'userModule', '2023-07-28 10:55:38', '2024-06-17 20:45:29', '1', '1', 0);
INSERT INTO `system_menu` VALUES (8, 0, '项目地址', NULL, 1, 1000, 1, 1, 1, 0, 'icon-link', 'https://visor.dromara.org', '', '2023-07-28 11:04:59', '2024-08-29 18:10:57', '1', '1', 0);
INSERT INTO `system_menu` VALUES (10, 5, '角色管理', NULL, 2, 10, 1, 1, 1, 0, 'IconUserGroup', '', 'role', '2023-07-28 10:55:52', '2024-03-07 19:10:13', '1', '1', 0);