⚡ 修改终端提示.
This commit is contained in:
11
orion-visor-ui/src/store/modules/cache/index.ts
vendored
11
orion-visor-ui/src/store/modules/cache/index.ts
vendored
@@ -15,7 +15,7 @@ import { getHostKeyList } from '@/api/asset/host-key';
|
||||
import { getHostIdentityList } from '@/api/asset/host-identity';
|
||||
import { getHostGroupTree } from '@/api/asset/host-group';
|
||||
import { getMenuList } from '@/api/system/menu';
|
||||
import { getCurrentAuthorizedHostIdentity, getCurrentAuthorizedHostKey } from '@/api/asset/asset-authorized-data';
|
||||
import { getCurrentAuthorizedHost, getCurrentAuthorizedHostIdentity, getCurrentAuthorizedHostKey } from '@/api/asset/asset-authorized-data';
|
||||
import { getCommandSnippetGroupList } from '@/api/asset/command-snippet-group';
|
||||
import { getExecJobList } from '@/api/exec/exec-job';
|
||||
import { getPathBookmarkGroupList } from '@/api/asset/path-bookmark-group';
|
||||
@@ -99,8 +99,8 @@ export default defineStore('cache', {
|
||||
},
|
||||
|
||||
// 获取主机列表
|
||||
async loadHosts(type: HostType, force = false) {
|
||||
return await this.load(`host_${type}`, () => getHostList(type), ['asset:host:query'], force);
|
||||
async loadHosts(type: HostType = '', force = false) {
|
||||
return await this.load(`host_${type || 'ALL'}`, () => getHostList(type), ['asset:host:query'], force);
|
||||
},
|
||||
|
||||
// 获取主机密钥列表
|
||||
@@ -123,6 +123,11 @@ export default defineStore('cache', {
|
||||
return await this.load(`${type}_Tags`, () => getTagList(type), undefined, force);
|
||||
},
|
||||
|
||||
// 获取已授权的主机列表
|
||||
async loadAuthorizedHosts(type: HostType = '', force = false) {
|
||||
return await this.load(`authorizedHost_${type || 'ALL'}`, () => getCurrentAuthorizedHost(type), undefined, force);
|
||||
},
|
||||
|
||||
// 获取已授权的主机密钥列表
|
||||
async loadAuthorizedHostKeys(force = false) {
|
||||
return await this.load('authorizedHostKeys', getCurrentAuthorizedHostKey, undefined, force);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// 缓存类型
|
||||
export type CacheType = 'users' | 'menus' | 'roles'
|
||||
| 'hostGroups' | 'hostKeys' | 'hostIdentities' | 'host_*'
|
||||
| 'hostGroups' | 'host_*' | 'authorizedHost_*'
|
||||
| 'hostKeys' | 'hostIdentities'
|
||||
| 'dictKeys'
|
||||
| 'execJob'
|
||||
| 'authorizedHostKeys' | 'authorizedHostIdentities'
|
||||
|
||||
@@ -10,7 +10,6 @@ import type {
|
||||
} from './types';
|
||||
import type { ISshSession, ITerminalSession, PanelSessionTabType, TerminalPanelTabItem } from '@/views/host/terminal/types/define';
|
||||
import type { AuthorizedHostQueryResponse } from '@/api/asset/asset-authorized-data';
|
||||
import { getCurrentAuthorizedHost } from '@/api/asset/asset-authorized-data';
|
||||
import type { HostQueryResponse } from '@/api/asset/host';
|
||||
import type { TerminalTheme, TerminalThemeSchema } from '@/api/asset/terminal';
|
||||
import { getTerminalThemes } from '@/api/asset/terminal';
|
||||
@@ -21,6 +20,7 @@ import { getLatestConnectHostId } from '@/api/asset/terminal-connect-log';
|
||||
import { nextId } from '@/utils';
|
||||
import { isObject } from '@/utils/is';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { useCacheStore } from '@/store';
|
||||
import { PanelSessionType, TerminalTabs } from '@/views/host/terminal/types/const';
|
||||
import TerminalTabManager from '@/views/host/terminal/handler/terminal-tab-manager';
|
||||
import TerminalSessionManager from '@/views/host/terminal/handler/terminal-session-manager';
|
||||
@@ -131,18 +131,18 @@ export default defineStore('terminal', {
|
||||
},
|
||||
|
||||
// 加载主机列表
|
||||
async loadHosts() {
|
||||
async loadHostList() {
|
||||
if (this.hosts.hostList?.length) {
|
||||
return;
|
||||
}
|
||||
// 查询授权主机
|
||||
const { data } = await getCurrentAuthorizedHost('SSH');
|
||||
const data = await useCacheStore().loadAuthorizedHosts();
|
||||
Object.keys(data).forEach(k => {
|
||||
this.hosts[k as keyof AuthorizedHostQueryResponse] = data[k as keyof AuthorizedHostQueryResponse] as any;
|
||||
});
|
||||
this.hosts.latestHosts = [];
|
||||
// 查询最近连接的主机
|
||||
const { data: latestHosts } = await getLatestConnectHostId('SSH', 30);
|
||||
const { data: latestHosts } = await getLatestConnectHostId('', 30);
|
||||
this.hosts.latestHosts = latestHosts;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user