⚡ 修改类型定义.
This commit is contained in:
@@ -76,7 +76,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession } from '../../types/terminal.type';
|
||||
import type { ISshSession } from '../../types/define';
|
||||
import type { CommandSnippetWrapperResponse, CommandSnippetQueryResponse } from '@/api/asset/command-snippet';
|
||||
import { ref, watch, provide } from 'vue';
|
||||
import useVisible from '@/hooks/visible';
|
||||
@@ -84,7 +84,7 @@
|
||||
import { deleteCommandSnippet, getCommandSnippetList } from '@/api/asset/command-snippet';
|
||||
import { useCacheStore, useTerminalStore } from '@/store';
|
||||
import { openUpdateSnippetKey, removeSnippetKey } from './types/const';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
import CommandSnippetListItem from './command-snippet-list-item.vue';
|
||||
import CommandSnippetListGroup from './command-snippet-list-group.vue';
|
||||
import CommandSnippetFormDrawer from './command-snippet-form-drawer.vue';
|
||||
|
||||
@@ -113,14 +113,14 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession } from '../../types/terminal.type';
|
||||
import type { ISshSession } from '../../types/define';
|
||||
import type { CommandSnippetQueryResponse } from '@/api/asset/command-snippet';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { inject } from 'vue';
|
||||
import { openUpdateSnippetKey, removeSnippetKey } from './types/const';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
|
||||
const props = defineProps<{
|
||||
item: CommandSnippetQueryResponse;
|
||||
|
||||
@@ -71,11 +71,11 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalTabItem, CombinedHandlerItem } from '../../types/terminal.type';
|
||||
import type { TerminalTabItem, CombinedHandlerItem } from '../../types/define';
|
||||
import type { HostQueryResponse } from '@/api/asset/host';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { PanelSessionType, TerminalTabs } from '../../types/terminal.const';
|
||||
import { PanelSessionType, TerminalTabs } from '../../types/const';
|
||||
|
||||
const totalCount = 7;
|
||||
const { tabManager, hosts, openSession } = useTerminalStore();
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SidebarAction } from '../../types/terminal.type';
|
||||
import type { SidebarAction } from '../../types/define';
|
||||
|
||||
defineProps<Partial<{
|
||||
actions: Array<SidebarAction>;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SidebarAction } from '../../types/terminal.type';
|
||||
import type { SidebarAction } from '../../types/define';
|
||||
import { useFullscreen } from '@vueuse/core';
|
||||
import { computed } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SidebarAction } from '../../types/terminal.type';
|
||||
import { TerminalTabs } from '../../types/terminal.const';
|
||||
import type { SidebarAction } from '../../types/define';
|
||||
import { TerminalTabs } from '../../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import IconActions from './icon-actions.vue';
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession } from '../../types/terminal.type';
|
||||
import { TerminalTabs, TerminalShortcutKeys, PanelSessionType } from '../../types/terminal.const';
|
||||
import type { ISshSession } from '../../types/define';
|
||||
import { TerminalTabs, TerminalShortcutKeys, PanelSessionType } from '../../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { onMounted, onUnmounted, watch } from 'vue';
|
||||
import { addEventListen, removeEventListen } from '@/utils/event';
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SidebarAction } from '../../types/terminal.type';
|
||||
import type { SidebarAction } from '../../types/define';
|
||||
import IconActions from './icon-actions.vue';
|
||||
|
||||
const emits = defineEmits(['openCommandSnippet', 'openPathBookmark', 'openTransferList', 'screenshot']);
|
||||
|
||||
@@ -45,10 +45,10 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession, ITerminalTabManager, TerminalPanelTabItem } from '../../types/terminal.type';
|
||||
import type { ISshSession, ITerminalTabManager, TerminalPanelTabItem } from '../../types/define';
|
||||
import { watch } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
import SshView from '../ssh/ssh-view.vue';
|
||||
import SftpView from '../sftp/sftp-view.vue';
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { TerminalShortcutKeys, TerminalTabs } from '../../types/terminal.const';
|
||||
import { TerminalShortcutKeys, TerminalTabs } from '../../types/const';
|
||||
import { addEventListen, removeEventListen } from '@/utils/event';
|
||||
import TerminalPanel from './terminal-panel.vue';
|
||||
import HostListModal from '../new-connection/host-list-modal.vue';
|
||||
|
||||
@@ -80,11 +80,11 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { PanelSessionTabType } from '../../types/terminal.type';
|
||||
import type { PanelSessionTabType } from '../../types/define';
|
||||
import type { HostQueryResponse } from '@/api/asset/host';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
import useVisible from '@/hooks/visible';
|
||||
|
||||
const { hosts, openSession } = useTerminalStore();
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
import { dataColor } from '@/utils';
|
||||
import { tagColor } from '@/views/asset/host-list/types/const';
|
||||
import { updateHostExtra } from '@/api/asset/host-extra';
|
||||
import { openSettingModalKey, PanelSessionType, ExtraSettingItems } from '../../types/terminal.const';
|
||||
import { openSettingModalKey, PanelSessionType, ExtraSettingItems } from '../../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
import type { AuthorizedHostQueryResponse } from '@/api/asset/asset-authorized-data';
|
||||
import type { HostQueryResponse } from '@/api/asset/host';
|
||||
import { computed, onMounted, provide, ref, watch } from 'vue';
|
||||
import { NewConnectionType, openSettingModalKey } from '../../types/terminal.const';
|
||||
import { NewConnectionType, openSettingModalKey } from '../../types/const';
|
||||
import HostGroupView from './host-group-view.vue';
|
||||
import HostListView from './host-list-view.vue';
|
||||
import HostSettingModal from '../setting/extra/host-setting-modal.vue';
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<script lang="ts" setup>
|
||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||
import { onBeforeMount, ref } from 'vue';
|
||||
import { NewConnectionType, newConnectionTypeKey } from '../../types/terminal.const';
|
||||
import { NewConnectionType, newConnectionTypeKey } from '../../types/const';
|
||||
import { useDictStore, useTerminalStore } from '@/store';
|
||||
import { TerminalPreferenceItem } from '@/store/modules/terminal';
|
||||
import { dataColor } from '@/utils';
|
||||
|
||||
@@ -76,14 +76,14 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession } from '../../types/terminal.type';
|
||||
import type { ISshSession } from '../../types/define';
|
||||
import type { PathBookmarkWrapperResponse, PathBookmarkQueryResponse } from '@/api/asset/path-bookmark';
|
||||
import { ref, provide, watch } from 'vue';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { deletePathBookmark, getPathBookmarkList } from '@/api/asset/path-bookmark';
|
||||
import { useCacheStore, useTerminalStore } from '@/store';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
import { openUpdatePathKey, removePathKey } from './types/const';
|
||||
import PathBookmarkListItem from './path-bookmark-list-item.vue';
|
||||
import PathBookmarkListGroup from './path-bookmark-list-group.vue';
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
import { createPathBookmark, updatePathBookmark } from '@/api/asset/path-bookmark';
|
||||
import formRules from './types/form.rules';
|
||||
import { PathBookmarkType } from './types/const';
|
||||
import { pathBookmarkTypeKey } from '../../types/terminal.const';
|
||||
import { pathBookmarkTypeKey } from '../../types/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import PathBookmarkGroupSelect from './path-bookmark-group-select.vue';
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISftpSession, ISshSession } from '../../types/terminal.type';
|
||||
import type { ISftpSession, ISshSession } from '../../types/define';
|
||||
import type { PathBookmarkQueryResponse } from '@/api/asset/path-bookmark';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
@@ -120,7 +120,7 @@
|
||||
import { inject } from 'vue';
|
||||
import { getParentPath } from '@/utils/file';
|
||||
import { openUpdatePathKey, PathBookmarkType, removePathKey } from './types/const';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
|
||||
const props = defineProps<{
|
||||
item: PathBookmarkQueryResponse;
|
||||
|
||||
@@ -53,11 +53,11 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TerminalActionBarSetting } from '@/store/modules/terminal/types';
|
||||
import type { SidebarAction } from '../../../types/terminal.type';
|
||||
import type { SidebarAction } from '../../../types/define';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { TerminalPreferenceItem } from '@/store/modules/terminal';
|
||||
import { ActionBarItems } from '../../../types/terminal.const';
|
||||
import { ActionBarItems } from '../../../types/const';
|
||||
import { isSecureEnvironment } from '@/utils/env';
|
||||
import IconActions from '../../layout/icon-actions.vue';
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
import type { TerminalDisplaySetting } from '@/store/modules/terminal/types';
|
||||
import { ref, watch, onMounted } from 'vue';
|
||||
import { useDictStore, useTerminalStore } from '@/store';
|
||||
import { fontFamilyKey, fontSizeKey, fontWeightKey, cursorStyleKey } from '../../../types/terminal.const';
|
||||
import { fontFamilyKey, fontSizeKey, fontWeightKey, cursorStyleKey } from '../../../types/const';
|
||||
import { labelFilter } from '@/types/form';
|
||||
import { TerminalPreferenceItem } from '@/store/modules/terminal';
|
||||
import { defaultFontFamily } from '@/types/xterm';
|
||||
|
||||
@@ -85,11 +85,11 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ContextMenuItem } from '../../../types/terminal.type';
|
||||
import type { ContextMenuItem } from '../../../types/define';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { TerminalPreferenceItem } from '@/store/modules/terminal';
|
||||
import { ActionBarItems } from '../../../types/terminal.const';
|
||||
import { ActionBarItems } from '../../../types/const';
|
||||
import { isSecureEnvironment } from '@/utils/env';
|
||||
|
||||
const { preference, updateTerminalPreference } = useTerminalStore();
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { ExtraSettingItems } from '../../../types/terminal.const';
|
||||
import { ExtraSettingItems } from '../../../types/const';
|
||||
import { updateHostExtra } from '@/api/asset/host-extra';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import SshSettingForm from './ssh-setting-form.vue';
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { LabelExtraSettingModel } from '../../../types/terminal.type';
|
||||
import type { LabelExtraSettingModel } from '../../../types/define';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { tabColorKey } from '../../../types/terminal.const';
|
||||
import { tabColorKey } from '../../../types/const';
|
||||
import { getHostExtraItem } from '@/api/asset/host-extra';
|
||||
import { useDictStore } from '@/store';
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SshExtraSettingModel } from '../../../types/terminal.type';
|
||||
import type { SshExtraSettingModel } from '../../../types/define';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { getHostExtraItem } from '@/api/asset/host-extra';
|
||||
import { ExtraSshAuthType, extraSshAuthTypeKey } from '../../../types/terminal.const';
|
||||
import { ExtraSshAuthType, extraSshAuthTypeKey } from '../../../types/const';
|
||||
import { useDictStore } from '@/store';
|
||||
import HostKeySelector from '@/components/asset/host-key/selector/index.vue';
|
||||
import HostIdentitySelector from '@/components/asset/host-identity/selector/index.vue';
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
import { ref, watch } from 'vue';
|
||||
import { useDictStore, useTerminalStore } from '@/store';
|
||||
import { TerminalPreferenceItem } from '@/store/modules/terminal';
|
||||
import { emulationTypeKey } from '../../../types/terminal.const';
|
||||
import { emulationTypeKey } from '../../../types/const';
|
||||
import BlockSettingItem from '../block-setting-item.vue';
|
||||
|
||||
const { toOptions } = useDictStore();
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
import type { TerminalShortcutKeyEditable } from '@/store/modules/terminal/types';
|
||||
import type { VNodeRef } from 'vue';
|
||||
import { setAutoFocus } from '@/utils/dom';
|
||||
import { TerminalShortcutKeys } from '../../../types/terminal.const';
|
||||
import { TerminalShortcutKeys } from '../../../types/const';
|
||||
|
||||
defineProps<{
|
||||
title: string;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { getDefaultPreference, getPreference } from '@/api/user/preference';
|
||||
import { TerminalPreferenceItem } from '@/store/modules/terminal';
|
||||
import { TerminalShortcutItems, TerminalShortcutType } from '../../../types/terminal.const';
|
||||
import { TerminalShortcutItems, TerminalShortcutType } from '../../../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
|
||||
@@ -45,12 +45,12 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISftpSession } from '../../types/terminal.type';
|
||||
import type { ISftpSession } from '../../types/define';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { nextTick, ref } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { permission10toString } from '@/utils/file';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
const { sessionManager } = useTerminalStore();
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISftpSession } from '../../types/terminal.type';
|
||||
import type { ISftpSession } from '../../types/define';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { nextTick, ref } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
const { sessionManager } = useTerminalStore();
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISftpSession } from '../../types/terminal.type';
|
||||
import type { ISftpSession } from '../../types/define';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { nextTick, ref } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { PanelSessionType } from '../../types/terminal.const';
|
||||
import { PanelSessionType } from '../../types/const';
|
||||
|
||||
const { visible, setVisible } = useVisible();
|
||||
const { sessionManager } = useTerminalStore();
|
||||
|
||||
@@ -203,10 +203,10 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { PathAnalysis } from '@/utils/file';
|
||||
import type { ISftpSession } from '../../types/terminal.type';
|
||||
import type { ISftpSession } from '../../types/define';
|
||||
import { inject, nextTick, ref, watch } from 'vue';
|
||||
import { getParentPath, getPathAnalysis } from '@/utils/file';
|
||||
import { openSftpCreateModalKey, openSftpUploadModalKey } from '../../types/terminal.const';
|
||||
import { openSftpCreateModalKey, openSftpUploadModalKey } from '../../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { SftpFile, ISftpSession } from '../../types/terminal.type';
|
||||
import type { SftpFile, ISftpSession } from '../../types/define';
|
||||
import type { VNodeRef } from 'vue';
|
||||
import { ref, computed, watch, inject } from 'vue';
|
||||
import { useRowSelection } from '@/types/table';
|
||||
@@ -150,7 +150,7 @@
|
||||
import { setAutoFocus } from '@/utils/dom';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import columns from './types/table.columns';
|
||||
import { FILE_TYPE, openSftpChmodModalKey, openSftpMoveModalKey } from '../../types/terminal.const';
|
||||
import { FILE_TYPE, openSftpChmodModalKey, openSftpMoveModalKey } from '../../types/const';
|
||||
|
||||
const previewSize = Number.parseInt(import.meta.env.VITE_SFTP_PREVIEW_MB);
|
||||
|
||||
|
||||
@@ -64,12 +64,12 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISftpSession, SftpFile, TerminalPanelTabItem } from '../../types/terminal.type';
|
||||
import type { ISftpSession, SftpFile, TerminalPanelTabItem } from '../../types/define';
|
||||
import { onMounted, onUnmounted, provide, ref } from 'vue';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { openSftpCreateModalKey, openSftpMoveModalKey, openSftpChmodModalKey, openSftpUploadModalKey } from '../../types/terminal.const';
|
||||
import { openSftpCreateModalKey, openSftpMoveModalKey, openSftpChmodModalKey, openSftpUploadModalKey } from '../../types/const';
|
||||
import SftpTableHeader from './sftp-table-header.vue';
|
||||
import SftpTable from './sftp-table.vue';
|
||||
import SftpEditorHeader from './sftp-editor-header.vue';
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ContextMenuItem, ISshSession } from '../../types/terminal.type';
|
||||
import { ActionBarItems } from '../../types/terminal.const';
|
||||
import type { ContextMenuItem, ISshSession } from '../../types/define';
|
||||
import { ActionBarItems } from '../../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
|
||||
defineProps<{
|
||||
|
||||
@@ -68,11 +68,11 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession, TerminalPanelTabItem, SidebarAction } from '../../types/terminal.type';
|
||||
import type { ISshSession, TerminalPanelTabItem, SidebarAction } from '../../types/define';
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useDictStore, useTerminalStore } from '@/store';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { ActionBarItems, connectStatusKey } from '../../types/terminal.const';
|
||||
import { ActionBarItems, connectStatusKey } from '../../types/const';
|
||||
import ShellEditorModal from '@/components/view/shell-editor/modal/index.vue';
|
||||
import IconActions from '../layout/icon-actions.vue';
|
||||
import SshContextMenu from './ssh-context-menu.vue';
|
||||
|
||||
@@ -68,12 +68,12 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SftpTransferItem } from '../../types/terminal.type';
|
||||
import type { SftpTransferItem } from '../../types/define';
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { useDictStore, useTerminalStore } from '@/store';
|
||||
import { transferStatusKey } from '../../types/terminal.const';
|
||||
import { transferStatusKey } from '../../types/const';
|
||||
import TransferItem from './transfer-item.vue';
|
||||
|
||||
const { transferManager } = useTerminalStore();
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SftpTransferItem } from '../../types/terminal.type';
|
||||
import type { SftpTransferItem } from '../../types/define';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import useVisible from '@/hooks/visible';
|
||||
import { useDictStore, useTerminalStore } from '@/store';
|
||||
import { copy } from '@/hooks/copy';
|
||||
import { getFileSize } from '@/utils/file';
|
||||
import { TransferStatus, TransferType, transferStatusKey } from '../../types/terminal.const';
|
||||
import { TransferStatus, TransferType, transferStatusKey } from '../../types/const';
|
||||
|
||||
const props = defineProps<{
|
||||
item: SftpTransferItem;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ITerminalSession, TerminalPanelTabItem } from '../types/terminal.type';
|
||||
import type { ITerminalSession, TerminalPanelTabItem } from '../types/define';
|
||||
|
||||
// 会话基类
|
||||
export default abstract class BaseSession implements ITerminalSession {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ISftpSession, ISftpSessionResolver, ITerminalChannel, TerminalPanelTabItem } from '../types/terminal.type';
|
||||
import type { ISftpSession, ISftpSessionResolver, ITerminalChannel, TerminalPanelTabItem } from '../types/define';
|
||||
import { InputProtocol } from '@/types/protocol/terminal.protocol';
|
||||
import { PanelSessionType } from '../types/terminal.const';
|
||||
import { PanelSessionType } from '../types/const';
|
||||
import { Modal } from '@arco-design/web-vue';
|
||||
import BaseSession from './base-session';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { SftpTransferItem } from '../types/terminal.type';
|
||||
import { TransferStatus } from '../types/terminal.const';
|
||||
import type { SftpTransferItem } from '../types/define';
|
||||
import { TransferStatus } from '../types/const';
|
||||
import { getFileName, openDownloadFile } from '@/utils/file';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { getDownloadTransferUrl } from '@/api/asset/host-sftp';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ISftpTransferHandler, SftpTransferItem } from '../types/terminal.type';
|
||||
import { TransferOperator, TransferStatus } from '../types/terminal.const';
|
||||
import type { ISftpTransferHandler, SftpTransferItem } from '../types/define';
|
||||
import { TransferOperator, TransferStatus } from '../types/const';
|
||||
import { getPath } from '@/utils/file';
|
||||
|
||||
// sftp 传输处理器定义
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ISftpTransferHandler, ISftpTransferManager, SftpFile, SftpTransferItem, TransferOperatorResponse } from '../types/terminal.type';
|
||||
import { sessionCloseMsg, TransferReceiver, TransferStatus, TransferType } from '../types/terminal.const';
|
||||
import type { ISftpTransferHandler, ISftpTransferManager, SftpFile, SftpTransferItem, TransferOperatorResponse } from '../types/define';
|
||||
import { sessionCloseMsg, TransferReceiver, TransferStatus, TransferType } from '../types/const';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { getTerminalAccessToken, openHostTransferChannel } from '@/api/asset/host-terminal';
|
||||
import { nextId } from '@/utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SftpTransferItem } from '../types/terminal.type';
|
||||
import type { SftpTransferItem } from '../types/define';
|
||||
import SftpTransferHandler from './sftp-transfer-handler';
|
||||
|
||||
// 512 KB
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { ShortcutKey, TerminalInteractSetting, TerminalShortcutKey } from '@/store/modules/terminal/types';
|
||||
import type { ISshSession, ISshSessionHandler, XtermDomRef } from '../types/terminal.type';
|
||||
import type { ISshSession, ISshSessionHandler, XtermDomRef } from '../types/define';
|
||||
import type { Terminal } from '@xterm/xterm';
|
||||
import useCopy from '@/hooks/copy';
|
||||
import html2canvas from 'html2canvas';
|
||||
import { useTerminalStore, useUserStore } from '@/store';
|
||||
import { PanelSessionType, TerminalShortcutItems } from '../types/terminal.const';
|
||||
import { PanelSessionType, TerminalShortcutItems } from '../types/const';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import { dateFormat } from '@/utils';
|
||||
|
||||
@@ -2,12 +2,12 @@ import type { UnwrapRef } from 'vue';
|
||||
import type { ISearchOptions } from '@xterm/addon-search';
|
||||
import { SearchAddon } from '@xterm/addon-search';
|
||||
import type { TerminalPreference } from '@/store/modules/terminal/types';
|
||||
import type { ISshSession, ISshSessionHandler, ITerminalChannel, TerminalPanelTabItem, XtermDomRef } from '../types/terminal.type';
|
||||
import type { ISshSession, ISshSessionHandler, ITerminalChannel, TerminalPanelTabItem, XtermDomRef } from '../types/define';
|
||||
import type { XtermAddons } from '@/types/xterm';
|
||||
import { defaultFontFamily } from '@/types/xterm';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { InputProtocol } from '@/types/protocol/terminal.protocol';
|
||||
import { PanelSessionType, TerminalShortcutType, TerminalStatus } from '../types/terminal.const';
|
||||
import { PanelSessionType, TerminalShortcutType, TerminalStatus } from '../types/const';
|
||||
import { Terminal } from '@xterm/xterm';
|
||||
import { FitAddon } from '@xterm/addon-fit';
|
||||
import { WebLinksAddon } from '@xterm/addon-web-links';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ITerminalChannel, ITerminalOutputProcessor, ITerminalSessionManager } from '../types/terminal.type';
|
||||
import type { ITerminalChannel, ITerminalOutputProcessor, ITerminalSessionManager } from '../types/define';
|
||||
import type { InputPayload, Protocol } from '@/types/protocol/terminal.protocol';
|
||||
import { format, OutputProtocol, parse } from '@/types/protocol/terminal.protocol';
|
||||
import { sessionCloseMsg } from '../types/terminal.const';
|
||||
import { sessionCloseMsg } from '../types/const';
|
||||
import { getTerminalAccessToken, openHostTerminalChannel } from '@/api/asset/host-terminal';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
import TerminalOutputProcessor from './terminal-output-processor';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ISftpSession, ISshSession, ITerminalChannel, ITerminalOutputProcessor, ITerminalSession, ITerminalSessionManager } from '../types/terminal.type';
|
||||
import type { ISftpSession, ISshSession, ITerminalChannel, ITerminalOutputProcessor, ITerminalSession, ITerminalSessionManager } from '../types/define';
|
||||
import type { OutputPayload } from '@/types/protocol/terminal.protocol';
|
||||
import { InputProtocol } from '@/types/protocol/terminal.protocol';
|
||||
import { PanelSessionType, TerminalStatus } from '../types/terminal.const';
|
||||
import { PanelSessionType, TerminalStatus } from '../types/const';
|
||||
import { useTerminalStore } from '@/store';
|
||||
import { Message } from '@arco-design/web-vue';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ITerminalPanelManager, TerminalPanelTabItem } from '../types/terminal.type';
|
||||
import type { ITerminalPanelManager, TerminalPanelTabItem } from '../types/define';
|
||||
import TerminalTabManager from '../handler/terminal-tab-manager';
|
||||
|
||||
// 终端面板管理器实现
|
||||
|
||||
@@ -6,10 +6,10 @@ import type {
|
||||
ITerminalSessionManager,
|
||||
TerminalPanelTabItem,
|
||||
XtermDomRef
|
||||
} from '../types/terminal.type';
|
||||
} from '../types/define';
|
||||
import { sleep } from '@/utils';
|
||||
import { InputProtocol } from '@/types/protocol/terminal.protocol';
|
||||
import { PanelSessionType } from '../types/terminal.const';
|
||||
import { PanelSessionType } from '../types/const';
|
||||
import { useDebounceFn } from '@vueuse/core';
|
||||
import { addEventListen, removeEventListen } from '@/utils/event';
|
||||
import TerminalChannel from './terminal-channel';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ITerminalTabManager, TerminalTabItem } from '../types/terminal.type';
|
||||
import type { ITerminalTabManager, TerminalTabItem } from '../types/define';
|
||||
|
||||
// 终端 tab 管理器实现
|
||||
export default class TerminalTabManager<T extends TerminalTabItem = TerminalTabItem> implements ITerminalTabManager<T> {
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { ISshSession } from './types/terminal.type';
|
||||
import type { ISshSession } from './types/define';
|
||||
import { ref, onBeforeMount, onUnmounted, onMounted } from 'vue';
|
||||
import { dictKeys, PanelSessionType, TerminalTabs } from './types/terminal.const';
|
||||
import { dictKeys, PanelSessionType, TerminalTabs } from './types/const';
|
||||
import { useCacheStore, useDictStore, useTerminalStore } from '@/store';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import debug from '@/utils/env';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ShortcutKeyItem } from './terminal.type';
|
||||
import type { ShortcutKeyItem } from './define';
|
||||
|
||||
// 终端 tab
|
||||
export const TerminalTabs = {
|
||||
@@ -1,220 +0,0 @@
|
||||
import type { InputPayload, OutputPayload, Protocol } from './terminal.type';
|
||||
|
||||
// 分隔符
|
||||
export const SEPARATOR = '|';
|
||||
|
||||
// 输入协议
|
||||
export const InputProtocol = {
|
||||
// 主机连接检查
|
||||
CHECK: {
|
||||
type: 'ck',
|
||||
template: ['type', 'sessionId', 'hostId', 'connectType']
|
||||
},
|
||||
// 连接主机
|
||||
CONNECT: {
|
||||
type: 'co',
|
||||
template: ['type', 'sessionId', 'terminalType', 'cols', 'rows']
|
||||
},
|
||||
// 关闭连接
|
||||
CLOSE: {
|
||||
type: 'cl',
|
||||
template: ['type', 'sessionId']
|
||||
},
|
||||
// ping
|
||||
PING: {
|
||||
type: 'p',
|
||||
template: ['type']
|
||||
},
|
||||
// SSH 修改大小
|
||||
SSH_RESIZE: {
|
||||
type: 'rs',
|
||||
template: ['type', 'sessionId', 'cols', 'rows']
|
||||
},
|
||||
// SSH 输入
|
||||
SSH_INPUT: {
|
||||
type: 'i',
|
||||
template: ['type', 'sessionId', 'command']
|
||||
},
|
||||
// SFTP 文件列表
|
||||
SFTP_LIST: {
|
||||
type: 'ls',
|
||||
template: ['type', 'sessionId', 'showHiddenFile', 'path']
|
||||
},
|
||||
// SFTP 创建文件夹
|
||||
SFTP_MKDIR: {
|
||||
type: 'mk',
|
||||
template: ['type', 'sessionId', 'path']
|
||||
},
|
||||
// SFTP 创建文件
|
||||
SFTP_TOUCH: {
|
||||
type: 'to',
|
||||
template: ['type', 'sessionId', 'path']
|
||||
},
|
||||
// SFTP 移动文件
|
||||
SFTP_MOVE: {
|
||||
type: 'mv',
|
||||
template: ['type', 'sessionId', 'path', 'target']
|
||||
},
|
||||
// SFTP 删除文件
|
||||
SFTP_REMOVE: {
|
||||
type: 'rm',
|
||||
template: ['type', 'sessionId', 'path']
|
||||
},
|
||||
// SFTP 修改文件权限
|
||||
SFTP_CHMOD: {
|
||||
type: 'cm',
|
||||
template: ['type', 'sessionId', 'path', 'mod']
|
||||
},
|
||||
// SFTP 修改文件权限
|
||||
SFTP_DOWNLOAD_FLAT_DIRECTORY: {
|
||||
type: 'df',
|
||||
template: ['type', 'sessionId', 'currentPath', 'path']
|
||||
},
|
||||
// SFTP 获取内容
|
||||
SFTP_GET_CONTENT: {
|
||||
type: 'gc',
|
||||
template: ['type', 'sessionId', 'path']
|
||||
},
|
||||
// SFTP 修改内容
|
||||
SFTP_SET_CONTENT: {
|
||||
type: 'sc',
|
||||
template: ['type', 'sessionId', 'path', 'content']
|
||||
},
|
||||
};
|
||||
|
||||
// 输出协议
|
||||
export const OutputProtocol = {
|
||||
// 主机连接检查
|
||||
CHECK: {
|
||||
type: 'ck',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processCheck'
|
||||
},
|
||||
// 主机连接
|
||||
CONNECT: {
|
||||
type: 'co',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processConnect'
|
||||
},
|
||||
// 主机连接关闭
|
||||
CLOSE: {
|
||||
type: 'cl',
|
||||
template: ['type', 'sessionId', 'forceClose', 'msg'],
|
||||
processMethod: 'processClose'
|
||||
},
|
||||
// pong
|
||||
PONG: {
|
||||
type: 'p',
|
||||
template: ['type'],
|
||||
processMethod: 'processPong'
|
||||
},
|
||||
// SSH 输出
|
||||
SSH_OUTPUT: {
|
||||
type: 'o',
|
||||
template: ['type', 'sessionId', 'body'],
|
||||
processMethod: 'processSshOutput'
|
||||
},
|
||||
// SFTP 文件列表
|
||||
SFTP_LIST: {
|
||||
type: 'ls',
|
||||
template: ['type', 'sessionId', 'path', 'result', 'body'],
|
||||
processMethod: 'processSftpList'
|
||||
},
|
||||
// SFTP 创建文件夹
|
||||
SFTP_MKDIR: {
|
||||
type: 'mk',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processSftpMkdir'
|
||||
},
|
||||
// SFTP 创建文件
|
||||
SFTP_TOUCH: {
|
||||
type: 'to',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processSftpTouch'
|
||||
},
|
||||
// SFTP 移动文件
|
||||
SFTP_MOVE: {
|
||||
type: 'mv',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processSftpMove'
|
||||
},
|
||||
// SFTP 删除文件
|
||||
SFTP_REMOVE: {
|
||||
type: 'rm',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processSftpRemove'
|
||||
},
|
||||
// SFTP 修改文件权限
|
||||
SFTP_CHMOD: {
|
||||
type: 'cm',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processSftpChmod'
|
||||
},
|
||||
// SFTP 修改文件权限
|
||||
SFTP_DOWNLOAD_FLAT_DIRECTORY: {
|
||||
type: 'df',
|
||||
template: ['type', 'sessionId', 'currentPath', 'body'],
|
||||
processMethod: 'processDownloadFlatDirectory'
|
||||
},
|
||||
// SFTP 获取文件内容
|
||||
SFTP_GET_CONTENT: {
|
||||
type: 'gc',
|
||||
template: ['type', 'sessionId', 'path', 'result', 'content'],
|
||||
processMethod: 'processSftpGetContent'
|
||||
},
|
||||
// SFTP 修改文件内容
|
||||
SFTP_SET_CONTENT: {
|
||||
type: 'sc',
|
||||
template: ['type', 'sessionId', 'result', 'msg'],
|
||||
processMethod: 'processSftpSetContent'
|
||||
},
|
||||
};
|
||||
|
||||
// 解析参数
|
||||
export const parse = (payload: string) => {
|
||||
const protocols = Object.values(OutputProtocol);
|
||||
const useProtocol = protocols.find(p => payload.startsWith(p.type + SEPARATOR) || p.type === payload);
|
||||
if (!useProtocol) {
|
||||
return undefined;
|
||||
}
|
||||
const template = useProtocol.template;
|
||||
const res = {} as OutputPayload;
|
||||
let curr = 0;
|
||||
let len = payload.length;
|
||||
for (let i = 0, pl = template.length; i < pl; i++) {
|
||||
if (i == pl - 1) {
|
||||
// 最后一次
|
||||
res[template[i]] = payload.substring(curr, len);
|
||||
} else {
|
||||
// 非最后一次
|
||||
let tmp = '';
|
||||
for (; curr < len; curr++) {
|
||||
const c = payload.charAt(curr);
|
||||
if (c == SEPARATOR) {
|
||||
res[template[i]] = tmp;
|
||||
curr++;
|
||||
break;
|
||||
} else {
|
||||
tmp += c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
// 格式化参数
|
||||
export const format = (protocol: Protocol, payload: InputPayload | OutputPayload) => {
|
||||
payload.type = protocol.type;
|
||||
return protocol.template
|
||||
.map(i => getPayloadValueString(payload[i]))
|
||||
.join(SEPARATOR);
|
||||
};
|
||||
|
||||
// 获取默认值
|
||||
export const getPayloadValueString = (value: unknown): any => {
|
||||
if (value === undefined || value === null) {
|
||||
return '';
|
||||
}
|
||||
return value;
|
||||
};
|
||||
Reference in New Issue
Block a user