🔨 执行日志.
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<!-- table -->
|
||||
<a-table row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
:data="row.hosts"
|
||||
:expandable="expandable"
|
||||
:scroll="{ y: '100%' }"
|
||||
:pagination="false"
|
||||
:bordered="false">
|
||||
<!-- 执行状态 -->
|
||||
<template #status="{ record }">
|
||||
{{ getDictValue(execHostStatusKey, record.status) }}
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 删除 -->
|
||||
<a-popconfirm content="确认删除这条记录吗?"
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-host-log:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
删除
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'execHostLogTable'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ExecLogQueryResponse } from '@/api/exec/exec-log';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { deleteExecHostLog } from '@/api/exec/exec-host-log';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { execHostStatusKey } from '../types/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import { useExpandable } from '@/types/table';
|
||||
|
||||
const props = defineProps<{
|
||||
row: ExecLogQueryResponse;
|
||||
}>();
|
||||
|
||||
const expandable = useExpandable();
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
|
||||
// 删除当前行
|
||||
const deleteRow = async ({ id }: {
|
||||
id: number
|
||||
}) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await deleteExecHostLog(id);
|
||||
Message.success('删除成功');
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,199 @@
|
||||
<!--<template>-->
|
||||
<!-- <a-modal v-model:visible="visible"-->
|
||||
<!-- body-class="modal-form"-->
|
||||
<!-- title-align="start"-->
|
||||
<!-- :title="title"-->
|
||||
<!-- :top="80"-->
|
||||
<!-- :align-center="false"-->
|
||||
<!-- :draggable="true"-->
|
||||
<!-- :mask-closable="false"-->
|
||||
<!-- :unmount-on-close="true"-->
|
||||
<!-- :ok-button-props="{ disabled: loading }"-->
|
||||
<!-- :cancel-button-props="{ disabled: loading }"-->
|
||||
<!-- :on-before-ok="handlerOk"-->
|
||||
<!-- @close="handleClose">-->
|
||||
<!-- <a-spin class="full" :loading="loading">-->
|
||||
<!-- <a-form :model="formModel"-->
|
||||
<!-- ref="formRef"-->
|
||||
<!-- label-align="right"-->
|
||||
<!-- :label-col-props="{ span: 5 }"-->
|
||||
<!-- :wrapper-col-props="{ span: 18 }"-->
|
||||
<!-- :rules="formRules">-->
|
||||
<!-- <!– 任务id –>-->
|
||||
<!-- <a-form-item field="userId" label="任务id">-->
|
||||
<!-- <a-input-number v-model="formModel.userId"-->
|
||||
<!-- placeholder="请输入任务id"-->
|
||||
<!-- hide-button />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行用户名 –>-->
|
||||
<!-- <a-form-item field="username" label="执行用户名">-->
|
||||
<!-- <a-input v-model="formModel.username"-->
|
||||
<!-- placeholder="请输入执行用户名"-->
|
||||
<!-- allow-clear />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行来源 –>-->
|
||||
<!-- <a-form-item field="source" label="执行来源">-->
|
||||
<!-- <a-input v-model="formModel.source"-->
|
||||
<!-- placeholder="请输入执行来源"-->
|
||||
<!-- allow-clear />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行来源id –>-->
|
||||
<!-- <a-form-item field="sourceId" label="执行来源id">-->
|
||||
<!-- <a-input-number v-model="formModel.sourceId"-->
|
||||
<!-- placeholder="请输入执行来源id"-->
|
||||
<!-- hide-button />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行描述 –>-->
|
||||
<!-- <a-form-item field="description" label="执行描述">-->
|
||||
<!-- <a-input v-model="formModel.description"-->
|
||||
<!-- placeholder="请输入执行描述"-->
|
||||
<!-- allow-clear />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行命令 –>-->
|
||||
<!-- <a-form-item field="command" label="执行命令">-->
|
||||
<!-- <a-input v-model="formModel.command"-->
|
||||
<!-- placeholder="请输入执行命令"-->
|
||||
<!-- allow-clear />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 超时时间 –>-->
|
||||
<!-- <a-form-item field="timeout" label="超时时间">-->
|
||||
<!-- <a-input-number v-model="formModel.timeout"-->
|
||||
<!-- placeholder="请输入超时时间"-->
|
||||
<!-- hide-button />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行状态 –>-->
|
||||
<!-- <a-form-item field="status" label="执行状态">-->
|
||||
<!-- <a-select v-model="formModel.status"-->
|
||||
<!-- :options="toOptions(execStatusKey)"-->
|
||||
<!-- placeholder="请选择执行状态" />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行开始时间 –>-->
|
||||
<!-- <a-form-item field="startTime" label="执行开始时间">-->
|
||||
<!-- <a-date-picker v-model="formModel.startTime"-->
|
||||
<!-- style="width: 100%"-->
|
||||
<!-- placeholder="请选择执行开始时间"-->
|
||||
<!-- show-time />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- <!– 执行完成时间 –>-->
|
||||
<!-- <a-form-item field="finishTime" label="执行完成时间">-->
|
||||
<!-- <a-date-picker v-model="formModel.finishTime"-->
|
||||
<!-- style="width: 100%"-->
|
||||
<!-- placeholder="请选择执行完成时间"-->
|
||||
<!-- show-time />-->
|
||||
<!-- </a-form-item>-->
|
||||
<!-- </a-form>-->
|
||||
<!-- </a-spin>-->
|
||||
<!-- </a-modal>-->
|
||||
<!--</template>-->
|
||||
|
||||
<!--<script lang="ts">-->
|
||||
<!-- export default {-->
|
||||
<!-- name: 'execLogFormModal'-->
|
||||
<!-- };-->
|
||||
<!--</script>-->
|
||||
|
||||
<!--<script lang="ts" setup>-->
|
||||
<!-- import type { ExecLogUpdateRequest } from '@/api/exec/exec-log';-->
|
||||
<!-- import { ref } from 'vue';-->
|
||||
<!-- import useLoading from '@/hooks/loading';-->
|
||||
<!-- import useVisible from '@/hooks/visible';-->
|
||||
<!-- import formRules from '../types/form.rules';-->
|
||||
<!-- import { execStatusKey } from '../types/const';-->
|
||||
<!-- import { createExecLog, updateExecLog } from '@/api/exec/exec-log';-->
|
||||
<!-- import { Message } from '@arco-design/web-vue';-->
|
||||
<!-- import { useDictStore } from '@/store';-->
|
||||
|
||||
<!-- const emits = defineEmits(['added', 'updated']);-->
|
||||
|
||||
<!-- const { visible, setVisible } = useVisible();-->
|
||||
<!-- const { loading, setLoading } = useLoading();-->
|
||||
<!-- const { toOptions } = useDictStore();-->
|
||||
|
||||
<!-- const title = ref<string>();-->
|
||||
<!-- const isAddHandle = ref<boolean>(true);-->
|
||||
<!-- const formRef = ref<any>();-->
|
||||
<!-- const formModel = ref<ExecLogUpdateRequest>({});-->
|
||||
|
||||
<!-- const defaultForm = (): ExecLogUpdateRequest => {-->
|
||||
<!-- return {-->
|
||||
<!-- id: undefined,-->
|
||||
<!-- userId: undefined,-->
|
||||
<!-- username: undefined,-->
|
||||
<!-- source: undefined,-->
|
||||
<!-- sourceId: undefined,-->
|
||||
<!-- description: undefined,-->
|
||||
<!-- command: undefined,-->
|
||||
<!-- timeout: undefined,-->
|
||||
<!-- status: undefined,-->
|
||||
<!-- startTime: undefined,-->
|
||||
<!-- finishTime: undefined,-->
|
||||
<!-- };-->
|
||||
<!-- };-->
|
||||
|
||||
<!-- // 打开新增-->
|
||||
<!-- const openAdd = () => {-->
|
||||
<!-- title.value = '添加执行记录';-->
|
||||
<!-- isAddHandle.value = true;-->
|
||||
<!-- renderForm({ ...defaultForm() });-->
|
||||
<!-- setVisible(true);-->
|
||||
<!-- };-->
|
||||
|
||||
<!-- // 打开修改-->
|
||||
<!-- const openUpdate = (record: any) => {-->
|
||||
<!-- title.value = '修改执行记录';-->
|
||||
<!-- isAddHandle.value = false;-->
|
||||
<!-- renderForm({ ...defaultForm(), ...record });-->
|
||||
<!-- setVisible(true);-->
|
||||
<!-- };-->
|
||||
|
||||
<!-- // 渲染表单-->
|
||||
<!-- const renderForm = (record: any) => {-->
|
||||
<!-- formModel.value = Object.assign({}, record);-->
|
||||
<!-- };-->
|
||||
|
||||
<!-- defineExpose({ openAdd, openUpdate });-->
|
||||
|
||||
<!-- // 确定-->
|
||||
<!-- const handlerOk = async () => {-->
|
||||
<!-- setLoading(true);-->
|
||||
<!-- try {-->
|
||||
<!-- // 验证参数-->
|
||||
<!-- const error = await formRef.value.validate();-->
|
||||
<!-- if (error) {-->
|
||||
<!-- return false;-->
|
||||
<!-- }-->
|
||||
<!-- if (isAddHandle.value) {-->
|
||||
<!-- // 新增-->
|
||||
<!-- await createExecLog(formModel.value);-->
|
||||
<!-- Message.success('创建成功');-->
|
||||
<!-- emits('added');-->
|
||||
<!-- } else {-->
|
||||
<!-- // 修改-->
|
||||
<!-- await updateExecLog(formModel.value);-->
|
||||
<!-- Message.success('修改成功');-->
|
||||
<!-- emits('updated');-->
|
||||
<!-- }-->
|
||||
<!-- // 清空-->
|
||||
<!-- handlerClear();-->
|
||||
<!-- } catch (e) {-->
|
||||
<!-- return false;-->
|
||||
<!-- } finally {-->
|
||||
<!-- setLoading(false);-->
|
||||
<!-- }-->
|
||||
<!-- };-->
|
||||
|
||||
<!-- // 关闭-->
|
||||
<!-- const handleClose = () => {-->
|
||||
<!-- handlerClear();-->
|
||||
<!-- };-->
|
||||
|
||||
<!-- // 清空-->
|
||||
<!-- const handlerClear = () => {-->
|
||||
<!-- setLoading(false);-->
|
||||
<!-- };-->
|
||||
|
||||
<!--</script>-->
|
||||
|
||||
<!--<style lang="less" scoped>-->
|
||||
|
||||
<!--</style>-->
|
||||
@@ -0,0 +1,259 @@
|
||||
<template>
|
||||
<!-- 搜索 -->
|
||||
<a-card class="general-card table-search-card">
|
||||
<query-header :model="formModel"
|
||||
label-align="left"
|
||||
:itemOptions="{ 5: { span: 2 } }"
|
||||
@submit="fetchTableData"
|
||||
@reset="fetchTableData"
|
||||
@keyup.enter="() => fetchTableData()">
|
||||
<!-- id -->
|
||||
<a-form-item field="id" label="id">
|
||||
<a-input-number v-model="formModel.id"
|
||||
placeholder="请输入id"
|
||||
allow-clear
|
||||
hide-button />
|
||||
</a-form-item>
|
||||
<!-- 执行用户 -->
|
||||
<a-form-item field="userId" label="执行用户">
|
||||
<user-selector v-model="formModel.userId"
|
||||
placeholder="请选择执行用户"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 执行描述 -->
|
||||
<a-form-item field="description" label="执行描述">
|
||||
<a-input v-model="formModel.description"
|
||||
placeholder="请输入执行描述"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 执行命令 -->
|
||||
<a-form-item field="command" label="执行命令">
|
||||
<a-input v-model="formModel.command"
|
||||
placeholder="请输入执行命令"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 执行状态 -->
|
||||
<a-form-item field="status" label="执行状态">
|
||||
<a-select v-model="formModel.status"
|
||||
:options="toOptions(execStatusKey)"
|
||||
placeholder="请选择执行状态"
|
||||
allow-clear />
|
||||
</a-form-item>
|
||||
<!-- 执行时间 -->
|
||||
<a-form-item field="startTimeRange" label="执行时间">
|
||||
<a-range-picker v-model="formModel.startTimeRange"
|
||||
:time-picker-props="{ defaultValue: ['00:00:00', '23:59:59'] }"
|
||||
show-time
|
||||
format="YYYY-MM-DD HH:mm:ss" />
|
||||
</a-form-item>
|
||||
</query-header>
|
||||
</a-card>
|
||||
<!-- 表格 -->
|
||||
<a-card class="general-card table-card">
|
||||
<template #title>
|
||||
<!-- 左侧操作 -->
|
||||
<div class="table-left-bar-handle">
|
||||
<!-- 标题 -->
|
||||
<div class="table-title">
|
||||
执行记录列表
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧操作 -->
|
||||
<div class="table-right-bar-handle">
|
||||
<a-space>
|
||||
<!-- 删除 -->
|
||||
<a-popconfirm :content="`确认删除选中的 ${selectedKeys.length} 条记录吗?`"
|
||||
position="br"
|
||||
type="warning"
|
||||
@ok="deleteSelectRows">
|
||||
<a-button v-permission="['asset:exec-log:delete']"
|
||||
type="secondary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
删除
|
||||
<template #icon>
|
||||
<icon-delete />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</div>
|
||||
</template>
|
||||
<!-- table -->
|
||||
<a-table row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:row-selection="rowSelection"
|
||||
:expandable="expandable"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)"
|
||||
@expand="loadHostExecData">
|
||||
<!-- 展开表格 -->
|
||||
<template #expand-row="{ record }">
|
||||
<exec-host-log-table :row="record" />
|
||||
</template>
|
||||
<!-- 执行状态 -->
|
||||
<template #status="{ record }">
|
||||
<a-tag :color="getDictValue(execStatusKey, record.status, 'color')">
|
||||
{{ getDictValue(execStatusKey, record.status) }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<!-- 执行时间 -->
|
||||
<template #startTime="{ record }">
|
||||
<span class="start-time">
|
||||
{{ (record.startTime && dateFormat(new Date(record.startTime))) || '-' }}
|
||||
</span>
|
||||
<br>
|
||||
<span class="exec-duration usn">
|
||||
持续时间: {{ formatDuration(record.startTime, record.finishTime) || '-' }}
|
||||
</span>
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #handle="{ record }">
|
||||
<div class="table-handle-wrapper">
|
||||
<!-- 删除 -->
|
||||
<a-popconfirm content="确认删除这条记录吗?"
|
||||
position="left"
|
||||
type="warning"
|
||||
@ok="deleteRow(record)">
|
||||
<a-button v-permission="['asset:exec-log:delete']"
|
||||
type="text"
|
||||
size="mini"
|
||||
status="danger">
|
||||
删除
|
||||
</a-button>
|
||||
</a-popconfirm>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'execLogTable'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ExecLogQueryRequest, ExecLogQueryResponse } from '@/api/exec/exec-log';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { batchDeleteExecLog, deleteExecLog, getExecHostLogList, getExecLogPage } from '@/api/exec/exec-log';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import columns from '../types/table.columns';
|
||||
import { execStatusKey } from '../types/const';
|
||||
import { useExpandable, usePagination, useRowSelection } from '@/types/table';
|
||||
import { useDictStore } from '@/store';
|
||||
import { dateFormat, formatDuration } from '@/utils';
|
||||
import UserSelector from '@/components/user/user/selector/index.vue';
|
||||
import ExecHostLogTable from './exec-host-log-table.vue';
|
||||
|
||||
const pagination = usePagination();
|
||||
const rowSelection = useRowSelection();
|
||||
const expandable = useExpandable();
|
||||
const { loading, setLoading } = useLoading();
|
||||
const { toOptions, getDictValue } = useDictStore();
|
||||
|
||||
const selectedKeys = ref<number[]>([]);
|
||||
const tableRenderData = ref<ExecLogQueryResponse[]>([]);
|
||||
const formModel = reactive<ExecLogQueryRequest>({
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
description: undefined,
|
||||
command: undefined,
|
||||
status: undefined,
|
||||
startTimeRange: undefined,
|
||||
});
|
||||
|
||||
// 删除选中行
|
||||
const deleteSelectRows = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await batchDeleteExecLog(selectedKeys.value);
|
||||
Message.success(`成功删除 ${selectedKeys.value.length} 条数据`);
|
||||
selectedKeys.value = [];
|
||||
// 重新加载数据
|
||||
fetchTableData();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 删除当前行
|
||||
const deleteRow = async ({ id }: {
|
||||
id: number
|
||||
}) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
// 调用删除接口
|
||||
await deleteExecLog(id);
|
||||
Message.success('删除成功');
|
||||
// 重新加载数据
|
||||
fetchTableData();
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 加载主机数据
|
||||
const loadHostExecData = async (key: number, record: ExecLogQueryResponse) => {
|
||||
if (record.hosts) {
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const { data } = await getExecHostLogList(record.id);
|
||||
record.hosts = data;
|
||||
};
|
||||
|
||||
// 加载数据
|
||||
const doFetchTableData = async (request: ExecLogQueryRequest) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await getExecLogPage(request);
|
||||
tableRenderData.value = data.rows;
|
||||
pagination.total = data.total;
|
||||
pagination.current = request.page;
|
||||
pagination.pageSize = request.limit;
|
||||
selectedKeys.value = [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// 切换页码
|
||||
const fetchTableData = (page = 1, limit = pagination.pageSize, form = formModel) => {
|
||||
doFetchTableData({ page, limit, ...form });
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
fetchTableData();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.start-time {
|
||||
color: var(--color-text-2);
|
||||
}
|
||||
|
||||
.exec-duration {
|
||||
display: flex;
|
||||
margin-top: 4px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
:deep(.arco-table-cell-fixed-expand) {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
48
orion-ops-ui/src/views/exec/exec-log/index.vue
Normal file
48
orion-ops-ui/src/views/exec/exec-log/index.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div class="layout-container" v-if="render">
|
||||
<!-- 列表-表格 -->
|
||||
<exec-log-table />
|
||||
<!-- 添加修改模态框 -->
|
||||
<!-- <exec-log-form-modal ref="modal"-->
|
||||
<!-- @added="modalAddCallback"-->
|
||||
<!-- @updated="modalUpdateCallback" />-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'execLog'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { useDictStore } from '@/store';
|
||||
import { dictKeys } from './types/const';
|
||||
import ExecLogTable from './components/exec-log-table.vue';
|
||||
|
||||
const render = ref(false);
|
||||
const table = ref();
|
||||
const modal = ref();
|
||||
|
||||
// 添加回调
|
||||
const modalAddCallback = () => {
|
||||
table.value.addedCallback();
|
||||
};
|
||||
|
||||
// 修改回调
|
||||
const modalUpdateCallback = () => {
|
||||
table.value.updatedCallback();
|
||||
};
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const dictStore = useDictStore();
|
||||
await dictStore.loadKeys(dictKeys);
|
||||
render.value = true;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
38
orion-ops-ui/src/views/exec/exec-log/types/const.ts
Normal file
38
orion-ops-ui/src/views/exec/exec-log/types/const.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 批量执行状态
|
||||
*/
|
||||
export const execStatus = {
|
||||
// 等待中
|
||||
WAITING: 'WAITING',
|
||||
// 运行中
|
||||
RUNNING: 'RUNNING',
|
||||
// 执行完成
|
||||
COMPLETED: 'COMPLETED',
|
||||
// 执行失败
|
||||
FAILED: 'FAILED',
|
||||
};
|
||||
|
||||
/**
|
||||
* 主机执行状态
|
||||
*/
|
||||
export const execHostStatus = {
|
||||
// 等待中
|
||||
WAITING: 'WAITING',
|
||||
// 运行中
|
||||
RUNNING: 'RUNNING',
|
||||
// 执行完成
|
||||
COMPLETED: 'COMPLETED',
|
||||
// 执行失败
|
||||
FAILED: 'FAILED',
|
||||
// 已中断
|
||||
INTERRUPTED: 'INTERRUPTED',
|
||||
};
|
||||
|
||||
// 执行状态 字典项
|
||||
export const execStatusKey = 'execStatus';
|
||||
|
||||
// 执行状态 字典项
|
||||
export const execHostStatusKey = 'execHostStatus';
|
||||
|
||||
// 加载的字典值
|
||||
export const dictKeys = [execStatusKey, execHostStatusKey];
|
||||
76
orion-ops-ui/src/views/exec/exec-log/types/form.rules.ts
Normal file
76
orion-ops-ui/src/views/exec/exec-log/types/form.rules.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import type { FieldRule } from '@arco-design/web-vue';
|
||||
|
||||
export const userId = [{
|
||||
required: true,
|
||||
message: '请输入执行用户id'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const username = [{
|
||||
required: true,
|
||||
message: '请输入执行用户名'
|
||||
}, {
|
||||
maxLength: 32,
|
||||
message: '执行用户名长度不能大于32位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const source = [{
|
||||
required: true,
|
||||
message: '请输入执行来源'
|
||||
}, {
|
||||
maxLength: 12,
|
||||
message: '执行来源长度不能大于12位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const sourceId = [{
|
||||
required: true,
|
||||
message: '请输入执行来源id'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const description = [{
|
||||
required: true,
|
||||
message: '请输入执行描述'
|
||||
}, {
|
||||
maxLength: 128,
|
||||
message: '执行描述长度不能大于128位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const command = [{
|
||||
required: true,
|
||||
message: '请输入执行命令'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const timeout = [{
|
||||
required: true,
|
||||
message: '请输入超时时间'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const status = [{
|
||||
required: true,
|
||||
message: '请输入执行状态'
|
||||
}, {
|
||||
maxLength: 12,
|
||||
message: '执行状态长度不能大于12位'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const startTime = [{
|
||||
required: true,
|
||||
message: '请输入执行开始时间'
|
||||
}] as FieldRule[];
|
||||
|
||||
export const finishTime = [{
|
||||
required: true,
|
||||
message: '请输入执行完成时间'
|
||||
}] as FieldRule[];
|
||||
|
||||
export default {
|
||||
userId,
|
||||
username,
|
||||
source,
|
||||
sourceId,
|
||||
description,
|
||||
command,
|
||||
timeout,
|
||||
status,
|
||||
startTime,
|
||||
finishTime,
|
||||
} as Record<string, FieldRule | FieldRule[]>;
|
||||
122
orion-ops-ui/src/views/exec/exec-log/types/host-table.columns.ts
Normal file
122
orion-ops-ui/src/views/exec/exec-log/types/host-table.columns.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
import { dateFormat } from '@/utils';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 70,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
title: '执行日志id',
|
||||
dataIndex: 'logId',
|
||||
slotName: 'logId',
|
||||
align: 'left',
|
||||
}, {
|
||||
title: '主机id',
|
||||
dataIndex: 'hostId',
|
||||
slotName: 'hostId',
|
||||
align: 'left',
|
||||
}, {
|
||||
title: '主机名称',
|
||||
dataIndex: 'hostName',
|
||||
slotName: 'hostName',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行命令',
|
||||
dataIndex: 'command',
|
||||
slotName: 'command',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行参数',
|
||||
dataIndex: 'parameter',
|
||||
slotName: 'parameter',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '退出码',
|
||||
dataIndex: 'exitStatus',
|
||||
slotName: 'exitStatus',
|
||||
align: 'left',
|
||||
}, {
|
||||
title: '日志路径',
|
||||
dataIndex: 'logPath',
|
||||
slotName: 'logPath',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '错误信息',
|
||||
dataIndex: 'errorMessage',
|
||||
slotName: 'errorMessage',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行开始时间',
|
||||
dataIndex: 'startTime',
|
||||
slotName: 'startTime',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return record.startTime && dateFormat(new Date(record.startTime));
|
||||
},
|
||||
}, {
|
||||
title: '执行结束时间',
|
||||
dataIndex: 'finishTime',
|
||||
slotName: 'finishTime',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return record.finishTime && dateFormat(new Date(record.finishTime));
|
||||
},
|
||||
}, {
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
slotName: 'createTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.createTime));
|
||||
},
|
||||
}, {
|
||||
title: '修改时间',
|
||||
dataIndex: 'updateTime',
|
||||
slotName: 'updateTime',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
render: ({ record }) => {
|
||||
return dateFormat(new Date(record.updateTime));
|
||||
},
|
||||
}, {
|
||||
title: '创建人',
|
||||
dataIndex: 'creator',
|
||||
slotName: 'creator',
|
||||
}, {
|
||||
title: '修改人',
|
||||
dataIndex: 'updater',
|
||||
slotName: 'updater',
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
export default columns;
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '执行主机',
|
||||
dataIndex: 'hostName',
|
||||
slotName: 'hostName',
|
||||
align: 'left',
|
||||
width: 168,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行命令',
|
||||
dataIndex: 'command',
|
||||
slotName: 'command',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行状态1',
|
||||
dataIndex: 'status1',
|
||||
slotName: 'status1',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
}, {
|
||||
title: '执行时间',
|
||||
dataIndex: 'startTime',
|
||||
slotName: 'startTime',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
export default columns;
|
||||
54
orion-ops-ui/src/views/exec/exec-log/types/table.columns.ts
Normal file
54
orion-ops-ui/src/views/exec/exec-log/types/table.columns.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 70,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
title: '描述',
|
||||
dataIndex: 'description',
|
||||
slotName: 'description',
|
||||
align: 'left',
|
||||
width: 168,
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行命令',
|
||||
dataIndex: 'command',
|
||||
slotName: 'command',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
}, {
|
||||
title: '执行用户',
|
||||
dataIndex: 'username',
|
||||
slotName: 'username',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
ellipsis: true,
|
||||
}, {
|
||||
title: '执行状态',
|
||||
dataIndex: 'status',
|
||||
slotName: 'status',
|
||||
align: 'left',
|
||||
width: 118,
|
||||
}, {
|
||||
title: '执行时间',
|
||||
dataIndex: 'startTime',
|
||||
slotName: 'startTime',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
}, {
|
||||
title: '操作',
|
||||
slotName: 'handle',
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
},
|
||||
] as TableColumnData[];
|
||||
|
||||
export default columns;
|
||||
Reference in New Issue
Block a user