diff --git a/orion-visor-ui/src/api/asset/asset-authorized-data.ts b/orion-visor-ui/src/api/asset/asset-authorized-data.ts index 237340ad..112c15e3 100644 --- a/orion-visor-ui/src/api/asset/asset-authorized-data.ts +++ b/orion-visor-ui/src/api/asset/asset-authorized-data.ts @@ -1,5 +1,5 @@ import type { HostGroupQueryResponse } from '@/api/asset/host-group'; -import type { HostQueryResponse } from './host'; +import type { HostQueryResponse, HostType } from './host'; import type { HostKeyQueryResponse } from './host-key'; import type { HostIdentityQueryResponse } from './host-identity'; import axios from 'axios'; @@ -17,7 +17,7 @@ export interface AuthorizedHostQueryResponse { /** * 查询当前用户已授权的主机 */ -export function getCurrentAuthorizedHost(type: string) { +export function getCurrentAuthorizedHost(type: HostType) { return axios.get('/asset/authorized-data/current-host', { params: { type } }); } diff --git a/orion-visor-ui/src/api/asset/host-config.ts b/orion-visor-ui/src/api/asset/host-config.ts deleted file mode 100644 index 851b1cbf..00000000 --- a/orion-visor-ui/src/api/asset/host-config.ts +++ /dev/null @@ -1,52 +0,0 @@ -import axios from 'axios'; - -/** - * 主机配置请求 - */ -export interface HostConfigRequest { - hostId?: number; - type?: string; - version?: number; - status?: number; - config?: string; -} - -/** - * 主机配置查询响应 - */ -export interface HostConfigQueryResponse { - id: number; - hostId: number; - type: string; - version: number; - status: number; - config: Record; -} - -/** - * 查询主机配置 - */ -export function getHostConfig(params: HostConfigRequest) { - return axios.get('/asset/host-config/get', { params }); -} - -/** - * 查询全部主机配置 - */ -export function getHostConfigList(hostId: number) { - return axios.get>('/asset/host-config/list', { params: { hostId } }); -} - -/** - * 更新主机配置 - */ -export function updateHostConfig(request: HostConfigRequest) { - return axios.put('/asset/host-config/update', request); -} - -/** - * 更新主机配置状态 - */ -export function updateHostConfigStatus(request: HostConfigRequest) { - return axios.put('/asset/host-config/update-status', request); -} diff --git a/orion-visor-ui/src/api/asset/host.ts b/orion-visor-ui/src/api/asset/host.ts index ef60622d..7221dc06 100644 --- a/orion-visor-ui/src/api/asset/host.ts +++ b/orion-visor-ui/src/api/asset/host.ts @@ -3,13 +3,18 @@ import type { TableData } from '@arco-design/web-vue/es/table/interface'; import axios from 'axios'; import qs from 'query-string'; +// 主机类型 +export type HostType = 'SSH' | string | undefined; + /** * 主机创建请求 */ export interface HostCreateRequest { + type?: string; name?: string; code?: string; address?: string; + port?: number; tags?: Array; groupIdList?: Array; } @@ -21,15 +26,33 @@ export interface HostUpdateRequest extends HostCreateRequest { id?: number; } +/** + * 主机更新状态请求 + */ +export interface HostUpdateStatusRequest { + id: number; + status: string; +} + +/** + * 主机更新配置请求 + */ +export interface HostUpdateConfigRequest { + id: number; + config: string; +} + /** * 主机查询请求 */ export interface HostQueryRequest extends Pagination { searchValue?: string; id?: number; + type?: string; name?: string; code?: string; address?: string; + status?: string; tags?: Array; queryTag?: boolean; } @@ -39,9 +62,12 @@ export interface HostQueryRequest extends Pagination { */ export interface HostQueryResponse extends TableData, HostQueryResponseExtra { id: number; + type: string; name: string; code: string; address: string; + port: string; + status: string; createTime: number; updateTime: number; creator: string; @@ -62,6 +88,22 @@ export interface HostQueryResponseExtra { modCount: number; } +/** + * 主机 配置查询响应 + */ +export interface HostConfigQueryResponse extends HostConfigQueryResponseExtra { + id: number; + type: string; + config: Record; +} + +/** + * 主机配置拓展 + */ +export interface HostConfigQueryResponseExtra { + current: number; +} + /** * 创建主机 */ @@ -77,7 +119,21 @@ export function updateHost(request: HostUpdateRequest) { } /** - * 通过 id 查询主机 + * 通过 id 更新主机状态 + */ +export function updateHostStatus(request: HostUpdateStatusRequest) { + return axios.put('/asset/host/update-status', request); +} + +/** + * 通过 id 更新主机配置 + */ +export function updateHostConfig(request: HostUpdateConfigRequest) { + return axios.put('/asset/host/update-config', request); +} + +/** + * 查询主机 */ export function getHost(id: number) { return axios.get('/asset/host/get', { params: { id } }); @@ -86,8 +142,15 @@ export function getHost(id: number) { /** * 查询全部主机 */ -export function getHostList() { - return axios.get>('/asset/host/list'); +export function getHostList(type: HostType) { + return axios.get>('/asset/host/list', { params: { type } }); +} + +/** + * 通过 id 查询主机配置 + */ +export function getHostConfig(id: number) { + return axios.get('/asset/host/get-config', { params: { id } }); } /** diff --git a/orion-visor-ui/src/assets/style/arco-extends.less b/orion-visor-ui/src/assets/style/arco-extends.less index 57760b59..386470a9 100644 --- a/orion-visor-ui/src/assets/style/arco-extends.less +++ b/orion-visor-ui/src/assets/style/arco-extends.less @@ -30,12 +30,20 @@ border-radius: 50%; background-color: rgb(var(--blue-6)); + &.normal { + color: rgb(var(--arcoblue-6)); + } + &.pass { - background-color: rgb(var(--green-6)); + color: rgb(var(--green-6)); + } + + &.warn { + color: rgb(var(--orange-6)); } &.error { - background-color: rgb(var(--red-6)); + color: rgb(var(--red-6)); } } } diff --git a/orion-visor-ui/src/assets/style/layout.less b/orion-visor-ui/src/assets/style/layout.less index b6d8bb62..9f9128db 100644 --- a/orion-visor-ui/src/assets/style/layout.less +++ b/orion-visor-ui/src/assets/style/layout.less @@ -67,7 +67,7 @@ } // -- drawer -.drawer-form-small{ +.drawer-form-small { padding: 20px 20px 2px 20px; } @@ -185,3 +185,31 @@ background: var(--color-bg-2); border-radius: 4px; } + +// -- doption +.more-doption { + min-width: 42px; + padding: 0 4px; + font-size: 12px; + display: inline-block; + + svg { + margin-right: 2px; + } + + &.normal { + color: rgb(var(--arcoblue-6)); + } + + &.pass { + color: rgb(var(--green-6)); + } + + &.warn { + color: rgb(var(--orange-6)); + } + + &.error { + color: rgb(var(--red-6)); + } +} diff --git a/orion-visor-ui/src/components/asset/host/authorized-host-modal/components/host-group.vue b/orion-visor-ui/src/components/asset/host/authorized-host-modal/components/host-group.vue index 059d86f1..54757e97 100644 --- a/orion-visor-ui/src/components/asset/host/authorized-host-modal/components/host-group.vue +++ b/orion-visor-ui/src/components/asset/host/authorized-host-modal/components/host-group.vue @@ -18,7 +18,7 @@ + empty-message="当前分组内无授权主机!" /> diff --git a/orion-visor-ui/src/components/asset/host/authorized-host-modal/index.vue b/orion-visor-ui/src/components/asset/host/authorized-host-modal/index.vue index 952758d9..1775c142 100644 --- a/orion-visor-ui/src/components/asset/host/authorized-host-modal/index.vue +++ b/orion-visor-ui/src/components/asset/host/authorized-host-modal/index.vue @@ -79,6 +79,7 @@ import type { SelectOptionData } from '@arco-design/web-vue'; import type { AuthorizedHostQueryResponse } from '@/api/asset/asset-authorized-data'; import type { HostQueryResponse } from '@/api/asset/host'; + import type { HostType } from '@/api/asset/host'; import { onMounted, ref, watch, computed } from 'vue'; import { dataColor } from '@/utils'; import { dictKeys, NewConnectionType, newConnectionTypeKey } from './types/const'; @@ -92,6 +93,12 @@ import HostTable from './components/host-table.vue'; import HostGroup from './components/host-group.vue'; + const props = withDefaults(defineProps>(), { + type: undefined, + }); + const emits = defineEmits(['selected']); const { toRadioOptions, loadKeys } = useDictStore(); @@ -110,10 +117,10 @@ const emptyMessage = computed(() => { if (newConnectionType.value === NewConnectionType.LIST) { // 列表 - return '无授权主机/主机未启用 SSH 配置!'; + return '无授权主机!'; } else if (newConnectionType.value === NewConnectionType.FAVORITE) { // 收藏 - return '无收藏主机/主机未启用 SSH 配置!'; + return '无收藏主机!'; } else if (newConnectionType.value === NewConnectionType.LATEST) { // 最近连接 return '暂无连接记录!'; @@ -144,7 +151,7 @@ setLoading(true); try { // 加载主机列表 - const { data } = await getCurrentAuthorizedHost('ssh'); + const { data } = await getCurrentAuthorizedHost(props.type); hosts.value = data; // 禁用别名 data.hostList.forEach(s => s.alias = undefined as unknown as string); diff --git a/orion-visor-ui/src/components/asset/host/selector/index.vue b/orion-visor-ui/src/components/asset/host/selector/index.vue index 32f02271..adb46530 100644 --- a/orion-visor-ui/src/components/asset/host/selector/index.vue +++ b/orion-visor-ui/src/components/asset/host/selector/index.vue @@ -2,6 +2,7 @@ @@ -14,22 +15,30 @@ diff --git a/orion-visor-ui/src/views/asset-audit/connect-session/index.vue b/orion-visor-ui/src/views/asset-audit/connect-session/index.vue index 7014e8ed..2033d5a0 100644 --- a/orion-visor-ui/src/views/asset-audit/connect-session/index.vue +++ b/orion-visor-ui/src/views/asset-audit/connect-session/index.vue @@ -29,7 +29,7 @@ // 重置缓存 onUnmounted(() => { const cacheStore = useCacheStore(); - cacheStore.reset('users', 'hosts'); + cacheStore.reset('users'); }); diff --git a/orion-visor-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue b/orion-visor-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue index 7f7c8a93..1ba0b40c 100644 --- a/orion-visor-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue +++ b/orion-visor-ui/src/views/asset-audit/sftp-log/components/sftp-log-table.vue @@ -16,6 +16,7 @@ diff --git a/orion-visor-ui/src/views/asset-audit/sftp-log/index.vue b/orion-visor-ui/src/views/asset-audit/sftp-log/index.vue index 8f6d4b0c..76f540a0 100644 --- a/orion-visor-ui/src/views/asset-audit/sftp-log/index.vue +++ b/orion-visor-ui/src/views/asset-audit/sftp-log/index.vue @@ -29,7 +29,7 @@ // 重置缓存 onUnmounted(() => { const cacheStore = useCacheStore(); - cacheStore.reset('users', 'hosts'); + cacheStore.reset('users'); }); diff --git a/orion-visor-ui/src/views/asset/grant/components/host-list.vue b/orion-visor-ui/src/views/asset/grant/components/host-list.vue index ae0d2418..bb3eb349 100644 --- a/orion-visor-ui/src/views/asset/grant/components/host-list.vue +++ b/orion-visor-ui/src/views/asset/grant/components/host-list.vue @@ -58,7 +58,7 @@ try { setLoading(true); const { data } = await getHostGroupRelList(groupId as number); - const hosts = await cacheStore.loadHosts(); + const hosts = await cacheStore.loadHosts(undefined); selectedGroupHosts.value = data.map(s => hosts.find(h => h.id === s) as HostQueryResponse) .filter(Boolean); } catch (e) { diff --git a/orion-visor-ui/src/views/asset/grant/index.vue b/orion-visor-ui/src/views/asset/grant/index.vue index 1b7e0d87..ee9f0f01 100644 --- a/orion-visor-ui/src/views/asset/grant/index.vue +++ b/orion-visor-ui/src/views/asset/grant/index.vue @@ -51,7 +51,7 @@ // 卸载时清除 cache onUnmounted(() => { - cacheStore.reset('users', 'roles', 'hosts', 'hostGroups', 'hostKeys', 'hostIdentities'); + cacheStore.reset('users', 'roles', 'hostGroups', 'hostKeys', 'hostIdentities'); }); diff --git a/orion-visor-ui/src/views/asset/host-config/components/ssh-config-form.vue b/orion-visor-ui/src/views/asset/host-config/components/ssh-config-form.vue index 11af8acb..db9ab9e5 100644 --- a/orion-visor-ui/src/views/asset/host-config/components/ssh-config-form.vue +++ b/orion-visor-ui/src/views/asset/host-config/components/ssh-config-form.vue @@ -1,20 +1,25 @@ @@ -151,38 +126,26 @@ diff --git a/orion-visor-ui/src/views/asset/host-config/drawer/index.vue b/orion-visor-ui/src/views/asset/host-config/drawer/index.vue index 90bfc393..ff8fcf1b 100644 --- a/orion-visor-ui/src/views/asset/host-config/drawer/index.vue +++ b/orion-visor-ui/src/views/asset/host-config/drawer/index.vue @@ -11,15 +11,15 @@ + :host-config="hostConfig" + @save="save" + @reset="reset" /> @@ -31,14 +31,14 @@ diff --git a/orion-visor-ui/src/views/asset/host-config/types/const.ts b/orion-visor-ui/src/views/asset/host-config/types/const.ts index 02553a9d..c949d0c6 100644 --- a/orion-visor-ui/src/views/asset/host-config/types/const.ts +++ b/orion-visor-ui/src/views/asset/host-config/types/const.ts @@ -1,19 +1,11 @@ -// 主机所有配置 -export interface HostConfigWrapper { - ssh: HostSshConfig; - - [key: string]: unknown; -} - // 主机 SSH 配置 export interface HostSshConfig { osType?: string; - port?: number; username?: string; password?: string; authType?: string; - identityId?: number; keyId?: number; + identityId?: number; connectTimeout?: number; charset?: string; fileNameCharset?: string; @@ -32,17 +24,6 @@ export const SshAuthType = { IDENTITY: 'IDENTITY' }; -// 主机系统版本 -export const SshOsType = { - LINUX: 'LINUX', - WINDOWS: 'WINDOWS', -}; - -// 主机配置类型 -export const HostConfigType = { - SSH: 'ssh' -}; - // 主机验证方式 字典项 export const sshAuthTypeKey = 'hostSshAuthType'; diff --git a/orion-visor-ui/src/views/asset/host-config/types/ssh-form.rules.ts b/orion-visor-ui/src/views/asset/host-config/types/ssh-form.rules.ts index c7d7a215..772d9268 100644 --- a/orion-visor-ui/src/views/asset/host-config/types/ssh-form.rules.ts +++ b/orion-visor-ui/src/views/asset/host-config/types/ssh-form.rules.ts @@ -5,16 +5,6 @@ export const osType = [{ message: '请选择系统类型' }] as FieldRule[]; -export const port = [{ - required: true, - message: '请输入SSH端口' -}, { - type: 'number', - min: 1, - max: 65535, - message: '输入的端口不合法' -}] as FieldRule[]; - export const authType = [{ required: true, message: '请选择认证方式' @@ -66,7 +56,6 @@ export const fileContentCharset = [{ export default { osType, - port, authType, keyId, identityId, diff --git a/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue b/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue index 2aa73e8f..6bbcc899 100644 --- a/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue +++ b/orion-visor-ui/src/views/asset/host-group/components/host-transfer.vue @@ -112,7 +112,7 @@ }); onMounted(() => { - cacheStore.loadHosts().then(hosts => { + cacheStore.loadHosts(undefined).then(hosts => { data.value = hosts.map(s => { return { value: String(s.id), diff --git a/orion-visor-ui/src/views/asset/host-identity/components/host-identity-card-list.vue b/orion-visor-ui/src/views/asset/host-identity/components/host-identity-card-list.vue index 80e177b7..c78e711b 100644 --- a/orion-visor-ui/src/views/asset/host-identity/components/host-identity-card-list.vue +++ b/orion-visor-ui/src/views/asset/host-identity/components/host-identity-card-list.vue @@ -2,7 +2,7 @@ - - 修改 + + 修改 + - - 删除 + + 删除 + - - diff --git a/orion-visor-ui/src/views/asset/host-key/components/host-key-card-list.vue b/orion-visor-ui/src/views/asset/host-key/components/host-key-card-list.vue index 650c8b15..c871df2f 100644 --- a/orion-visor-ui/src/views/asset/host-key/components/host-key-card-list.vue +++ b/orion-visor-ui/src/views/asset/host-key/components/host-key-card-list.vue @@ -2,7 +2,7 @@ - - 详情 + + 详情 + - - 修改 + + 修改 + - - 删除 + + 删除 + - - diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue b/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue index 99bcfc34..644a488f 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-card-list.vue @@ -2,7 +2,7 @@ + + + + + + + + {{ record.code }} + + + + - - @@ -169,24 +198,25 @@ import type { HostQueryRequest, HostQueryResponse } from '@/api/asset/host'; import { usePagination, useColLayout } from '@/types/card'; import { computed, reactive, ref, onMounted } from 'vue'; - import useLoading from '@/hooks/loading'; import { dataColor, objectTruthKeyCount, resetObject } from '@/utils'; - import fieldConfig from '../types/card.fields'; - import { deleteHost, getHostPage } from '@/api/asset/host'; + import { deleteHost, getHostPage, updateHostStatus } from '@/api/asset/host'; import { Message, Modal } from '@arco-design/web-vue'; - import { tagColor } from '../types/const'; + import { hostStatusKey, hostTypeKey, tagColor } from '../types/const'; import { copy } from '@/hooks/copy'; + import { useDictStore } from '@/store'; import { GrantKey, GrantRouteName } from '@/views/asset/grant/types/const'; + import useLoading from '@/hooks/loading'; + import fieldConfig from '../types/card.fields'; import TagMultiSelector from '@/components/meta/tag/multi-selector/index.vue'; - const emits = defineEmits(['openAdd', 'openUpdate', 'openUpdateConfig', 'openHostGroup']); - - const list = ref([]); + const emits = defineEmits(['openAdd', 'openUpdate', 'openUpdateConfig', 'openHostGroup', 'openCopy']); const cardColLayout = useColLayout(); const pagination = usePagination(); const { loading, setLoading } = useLoading(); + const { toOptions, getDictValue, toggleDictValue, toggleDict } = useDictStore(); + const list = ref([]); const formRef = ref(); const formModel = reactive({ searchValue: undefined, @@ -194,6 +224,8 @@ name: undefined, code: undefined, address: undefined, + type: undefined, + status: undefined, tags: undefined, queryTag: true }); @@ -203,6 +235,33 @@ return objectTruthKeyCount(formModel, ['searchValue', 'queryTag']); }); + // 更新状态 + const updateStatus = async (record: HostQueryResponse) => { + const dict = toggleDict(hostStatusKey, record.status); + Modal.confirm({ + title: `${dict.label}确认`, + titleAlign: 'start', + content: `确定要${dict.label}该主机吗?`, + okText: '确定', + onOk: async () => { + try { + setLoading(true); + const newStatus = dict.value as string; + // 调用修改接口 + await updateHostStatus({ + id: record.id, + status: newStatus, + }); + record.status = newStatus; + Message.success(`已${dict.label}`); + } catch (e) { + } finally { + setLoading(false); + } + } + }); + }; + // 删除当前行 const deleteRow = (id: number) => { Modal.confirm({ @@ -273,4 +332,8 @@ diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-form-modal.vue b/orion-visor-ui/src/views/asset/host-list/components/host-form-modal.vue index 09ba1654..d45e2286 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-form-modal.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-form-modal.vue @@ -18,6 +18,15 @@ label-align="right" :auto-label-width="true" :rules="formRules"> + + + + @@ -30,6 +39,12 @@ + + + + { return { id: undefined, + type: hostType.SSH.type, name: undefined, code: undefined, address: undefined, + port: hostType.SSH.default.port, tags: undefined, groupIdList: undefined, }; @@ -108,13 +127,22 @@ await fetchHostRender(id); }; + // 打开复制 + const openCopy = async (id: number) => { + title.value = '复制主机'; + isAddHandle.value = true; + renderForm({ ...defaultForm() }); + setVisible(true); + await fetchHostRender(id); + }; + // 渲染主机 const fetchHostRender = async (id: number) => { try { setLoading(true); const { data } = await getHost(id); const detail = Object.assign({} as Record, - pick(data, 'id', 'name', 'code', 'address', 'groupIdList')); + pick(data, 'id', 'type', 'name', 'code', 'address', 'port', 'status', 'groupIdList')); // tag const tags = (data.tags || []).map(s => s.id); // 渲染 @@ -130,7 +158,7 @@ formModel.value = Object.assign({}, record); }; - defineExpose({ openAdd, openUpdate }); + defineExpose({ openAdd, openUpdate, openCopy }); // tag 超出所选限制 const onLimitedTag = (count: number, message: string) => { diff --git a/orion-visor-ui/src/views/asset/host-list/components/host-table.vue b/orion-visor-ui/src/views/asset/host-list/components/host-table.vue index 31370702..411239d3 100644 --- a/orion-visor-ui/src/views/asset/host-list/components/host-table.vue +++ b/orion-visor-ui/src/views/asset/host-list/components/host-table.vue @@ -25,6 +25,20 @@ + + + + + + + + - + + + + + @@ -183,43 +237,72 @@ diff --git a/orion-visor-ui/src/views/asset/host-list/types/card.fields.ts b/orion-visor-ui/src/views/asset/host-list/types/card.fields.ts index f0aa2346..236a070e 100644 --- a/orion-visor-ui/src/views/asset/host-list/types/card.fields.ts +++ b/orion-visor-ui/src/views/asset/host-list/types/card.fields.ts @@ -9,6 +9,10 @@ const fieldConfig = { label: 'id', dataIndex: 'id', slotName: 'id', + }, { + label: '主机类型', + dataIndex: 'type', + slotName: 'type', }, { label: '主机编码', dataIndex: 'code', @@ -18,6 +22,10 @@ const fieldConfig = { dataIndex: 'address', slotName: 'address', tooltip: true, + }, { + label: '主机状态', + dataIndex: 'status', + slotName: 'status', }, { label: '主机标签', dataIndex: 'tags', diff --git a/orion-visor-ui/src/views/asset/host-list/types/const.ts b/orion-visor-ui/src/views/asset/host-list/types/const.ts index c23e8139..f41859e0 100644 --- a/orion-visor-ui/src/views/asset/host-list/types/const.ts +++ b/orion-visor-ui/src/views/asset/host-list/types/const.ts @@ -6,3 +6,22 @@ export const tagColor = [ 'pinkpurple', 'magenta' ]; + +// 主机类型 +export const hostType = { + SSH: { + type: 'SSH', + default: { + port: 22, + } + } +}; + +// 主机类型 字典项 +export const hostTypeKey = 'hostType'; + +// 主机状态 字典项 +export const hostStatusKey = 'hostStatus'; + +// 加载的字典值 +export const dictKeys = [hostTypeKey, hostStatusKey]; diff --git a/orion-visor-ui/src/views/asset/host-list/types/form.rules.ts b/orion-visor-ui/src/views/asset/host-list/types/form.rules.ts index f45d9e53..91b1a0a1 100644 --- a/orion-visor-ui/src/views/asset/host-list/types/form.rules.ts +++ b/orion-visor-ui/src/views/asset/host-list/types/form.rules.ts @@ -1,5 +1,10 @@ import type { FieldRule } from '@arco-design/web-vue'; +export const type = [{ + required: true, + message: '请选择主机类型' +}] as FieldRule[]; + export const name = [{ required: true, message: '请输入主机名称' @@ -24,14 +29,26 @@ export const address = [{ message: '主机地址长度不能大于128位' }] as FieldRule[]; +export const port = [{ + required: true, + message: '请输入主机端口' +}, { + type: 'number', + min: 1, + max: 65535, + message: '输入的端口不合法' +}] as FieldRule[]; + export const tags = [{ maxLength: 5, message: '最多选择5个标签' }] as FieldRule[]; export default { + type, name, code, address, + port, tags, } as Record; diff --git a/orion-visor-ui/src/views/asset/host-list/types/table.columns.ts b/orion-visor-ui/src/views/asset/host-list/types/table.columns.ts index 9d54dabd..a718dafa 100644 --- a/orion-visor-ui/src/views/asset/host-list/types/table.columns.ts +++ b/orion-visor-ui/src/views/asset/host-list/types/table.columns.ts @@ -5,7 +5,7 @@ const columns = [ title: 'id', dataIndex: 'id', slotName: 'id', - width: 100, + width: 68, align: 'left', fixed: 'left', }, { @@ -13,20 +13,37 @@ const columns = [ dataIndex: 'name', slotName: 'name', ellipsis: true, - tooltip: true + tooltip: true, + minWidth: 238, }, { title: '主机编码', dataIndex: 'code', slotName: 'code', + minWidth: 120, + }, { + title: '主机类型', + dataIndex: 'type', + slotName: 'type', + align: 'center', + width: 88, }, { title: '主机地址', dataIndex: 'address', slotName: 'address', + minWidth: 238 }, { title: '主机标签', dataIndex: 'tags', slotName: 'tags', align: 'left', + minWidth: 148, + }, { + title: '主机状态', + dataIndex: 'status', + slotName: 'status', + width: 88, + align: 'center', + fixed: 'right', }, { title: '操作', slotName: 'handle', diff --git a/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue b/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue index 0e970ad2..542d90f5 100644 --- a/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue +++ b/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue @@ -38,6 +38,7 @@ diff --git a/orion-visor-ui/src/views/exec/exec-command/components/exec-command-panel.vue b/orion-visor-ui/src/views/exec/exec-command/components/exec-command-panel.vue index bb81b34d..eb436f59 100644 --- a/orion-visor-ui/src/views/exec/exec-command/components/exec-command-panel.vue +++ b/orion-visor-ui/src/views/exec/exec-command/components/exec-command-panel.vue @@ -107,6 +107,7 @@ @selected="setWithTemplate" /> diff --git a/orion-visor-ui/src/views/exec/exec-template/index.vue b/orion-visor-ui/src/views/exec/exec-template/index.vue index a755ce3d..11546c52 100644 --- a/orion-visor-ui/src/views/exec/exec-template/index.vue +++ b/orion-visor-ui/src/views/exec/exec-template/index.vue @@ -15,6 +15,7 @@ @open-host="(e) => openHostModal('exec', e)" /> diff --git a/orion-visor-ui/src/views/host/terminal/components/new-connection/host-group-view.vue b/orion-visor-ui/src/views/host/terminal/components/new-connection/host-group-view.vue index c15faa64..acfaa4e0 100644 --- a/orion-visor-ui/src/views/host/terminal/components/new-connection/host-group-view.vue +++ b/orion-visor-ui/src/views/host/terminal/components/new-connection/host-group-view.vue @@ -17,7 +17,7 @@ + empty-value="当前分组内无授权主机!" /> diff --git a/orion-visor-ui/src/views/host/terminal/components/new-connection/hosts-view.vue b/orion-visor-ui/src/views/host/terminal/components/new-connection/hosts-view.vue index 3b407291..63635539 100644 --- a/orion-visor-ui/src/views/host/terminal/components/new-connection/hosts-view.vue +++ b/orion-visor-ui/src/views/host/terminal/components/new-connection/hosts-view.vue @@ -49,7 +49,7 @@ const emptyMessage = computed(() => { if (props.newConnectionType === NewConnectionType.LIST) { // 列表 - return '无授权主机/主机未启用 SSH 配置!'; + return '无授权主机!'; } else if (props.newConnectionType === NewConnectionType.FAVORITE) { // 收藏 return '无收藏记录, 快去点击主机右侧的⭐进行收藏吧!'; diff --git a/orion-visor-ui/src/views/host/terminal/components/setting/extra/label-setting-form.vue b/orion-visor-ui/src/views/host/terminal/components/setting/extra/label-setting-form.vue index 6d239ae3..d98b761f 100644 --- a/orion-visor-ui/src/views/host/terminal/components/setting/extra/label-setting-form.vue +++ b/orion-visor-ui/src/views/host/terminal/components/setting/extra/label-setting-form.vue @@ -49,7 +49,7 @@ const { toOptions } = useDictStore(); const formModel = ref({ - color: '' + color: '', }); // 渲染表单 diff --git a/orion-visor-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue b/orion-visor-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue index 0e1a2abc..d62f243d 100644 --- a/orion-visor-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue +++ b/orion-visor-ui/src/views/host/terminal/components/sftp/sftp-table-header.vue @@ -216,7 +216,7 @@ selectedFiles: Array; }>(); - const emits = defineEmits(['update:selectedFiles', 'loadFile', 'download', 'setLoading']); + const emits = defineEmits(['loadFile', 'download', 'deleteFile', 'setLoading']); const showHiddenFile = ref(false); const analysisPaths = ref>([]); @@ -295,9 +295,12 @@ // 删除选中文件 const deleteSelectFiles = () => { - if (props.selectedFiles?.length) { - props.session?.remove(props.selectedFiles); - } + emits('deleteFile', [...props.selectedFiles]); + }; + + // 下载文件 + const downloadFile = () => { + emits('download', [...props.selectedFiles], true); }; // 重新连接 @@ -309,12 +312,6 @@ } }; - // 下载文件 - const downloadFile = () => { - emits('download', [...props.selectedFiles]); - emits('update:selectedFiles', []); - }; -