🎉 重构组件代码.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
alt="logo"
|
alt="logo"
|
||||||
draggable="false"
|
draggable="false"
|
||||||
src="@/assets/logo.svg?url" />
|
src="@/assets/logo.svg?url" />
|
||||||
<!-- 标头 -->
|
<!-- 名称 -->
|
||||||
<a-typography-title :heading="5"
|
<a-typography-title :heading="5"
|
||||||
:style="{ margin: 0, fontSize: '18px', height: '1.4em', overflow: 'hidden' }">
|
:style="{ margin: 0, fontSize: '18px', height: '1.4em', overflow: 'hidden' }">
|
||||||
Orion Visor
|
Orion Visor
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<!-- 右侧操作 -->
|
<!-- 右侧操作 -->
|
||||||
<ul class="right-side">
|
<ul class="right-side">
|
||||||
<!-- 主机终端 -->
|
<!-- 主机终端 -->
|
||||||
<li v-permission="['asset:terminal:access']">
|
<li v-permission="['terminal:terminal:access']">
|
||||||
<a-tooltip content="主机终端">
|
<a-tooltip content="主机终端">
|
||||||
<a-button class="nav-btn"
|
<a-button class="nav-btn"
|
||||||
type="outline"
|
type="outline"
|
||||||
|
|||||||
@@ -42,6 +42,8 @@
|
|||||||
import { isStandaloneMode } from '@/utils/env';
|
import { isStandaloneMode } from '@/utils/env';
|
||||||
import Block from './block.vue';
|
import Block from './block.vue';
|
||||||
|
|
||||||
|
const cardOptions = [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }];
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const { visible, setVisible } = useVisible();
|
const { visible, setVisible } = useVisible();
|
||||||
|
|
||||||
@@ -130,7 +132,7 @@
|
|||||||
margin: '0 0 4px 0',
|
margin: '0 0 4px 0',
|
||||||
permission: ['asset:host:query'],
|
permission: ['asset:host:query'],
|
||||||
defaultVal: appStore.hostView,
|
defaultVal: appStore.hostView,
|
||||||
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
options: cardOptions,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '主机密钥',
|
name: '主机密钥',
|
||||||
@@ -139,7 +141,7 @@
|
|||||||
margin: '0 0 4px 0',
|
margin: '0 0 4px 0',
|
||||||
permission: ['asset:host-key:query'],
|
permission: ['asset:host-key:query'],
|
||||||
defaultVal: appStore.hostKeyView,
|
defaultVal: appStore.hostKeyView,
|
||||||
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
options: cardOptions,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '主机身份',
|
name: '主机身份',
|
||||||
@@ -148,7 +150,7 @@
|
|||||||
margin: '0 0 4px 0',
|
margin: '0 0 4px 0',
|
||||||
permission: ['asset:host-identity:query'],
|
permission: ['asset:host-identity:query'],
|
||||||
defaultVal: appStore.hostIdentityView,
|
defaultVal: appStore.hostIdentityView,
|
||||||
options: [{ value: 'table', label: '表格' }, { value: 'card', label: '卡片' }]
|
options: cardOptions,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import useVisible from '@/hooks/visible';
|
import useVisible from '@/hooks/visible';
|
||||||
import { getAuthorizedHostOptions } from '@/types/options';
|
import { getAuthorizedHostOptions } from '@/types/options';
|
||||||
import { getLatestConnectHostId } from '@/api/asset/terminal-connect-log';
|
import { getLatestConnectHostId } from '@/api/terminal/terminal-connect-log';
|
||||||
import HostTable from './components/host-table.vue';
|
import HostTable from './components/host-table.vue';
|
||||||
import HostGroup from './components/host-group.vue';
|
import HostGroup from './components/host-group.vue';
|
||||||
|
|
||||||
|
|||||||
@@ -129,9 +129,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { CronPropType } from './const';
|
import type { CronPropType } from './types';
|
||||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||||
import { cronEmits, cronDefaultProps, convertWeekToQuartz } from './const';
|
import { cronEmits, cronDefaultProps, convertWeekToQuartz } from './types';
|
||||||
import { useDebounceFn } from '@vueuse/core';
|
import { useDebounceFn } from '@vueuse/core';
|
||||||
import { dateFormat } from '@/utils';
|
import { dateFormat } from '@/utils';
|
||||||
import { copy } from '@/hooks/copy';
|
import { copy } from '@/hooks/copy';
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import type { PathBookmarkGroupQueryResponse } from '@/api/asset/path-bookmark-group';
|
import type { PathBookmarkGroupQueryResponse } from '@/api/terminal/path-bookmark-group';
|
||||||
import { ref, computed, onBeforeMount } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { createPathBookmarkGroup } from '@/api/asset/path-bookmark-group';
|
import { createPathBookmarkGroup } from '@/api/terminal/path-bookmark-group';
|
||||||
|
|
||||||
const props = defineProps<Partial<{
|
const props = defineProps<Partial<{
|
||||||
modelValue: number;
|
modelValue: number;
|
||||||
@@ -15,11 +15,11 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { SelectOptionData } from '@arco-design/web-vue';
|
import type { SelectOptionData } from '@arco-design/web-vue';
|
||||||
import type { CommandSnippetGroupQueryResponse } from '@/api/asset/command-snippet-group';
|
import type { CommandSnippetGroupQueryResponse } from '@/api/terminal/command-snippet-group';
|
||||||
import { ref, computed, onBeforeMount } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useCacheStore } from '@/store';
|
import { useCacheStore } from '@/store';
|
||||||
import useLoading from '@/hooks/loading';
|
import useLoading from '@/hooks/loading';
|
||||||
import { createCommandSnippetGroup } from '@/api/asset/command-snippet-group';
|
import { createCommandSnippetGroup } from '@/api/terminal/command-snippet-group';
|
||||||
|
|
||||||
const props = defineProps<Partial<{
|
const props = defineProps<Partial<{
|
||||||
modelValue: number;
|
modelValue: number;
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// 代码提示
|
|
||||||
monaco.languages.registerCompletionItemProvider('java', {
|
|
||||||
provideCompletionItems() {
|
|
||||||
const suggestions: any = [];
|
|
||||||
// 这个keywords就是java.java文件中有的
|
|
||||||
javaLanguage.keywords?.forEach((item: any) => {
|
|
||||||
suggestions.push({
|
|
||||||
label: item,
|
|
||||||
kind: monaco.languages.CompletionItemKind.Keyword,
|
|
||||||
insertText: item,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
javaLanguage.operators?.forEach((item: any) => {
|
|
||||||
suggestions.push({
|
|
||||||
label: item,
|
|
||||||
kind: monaco.languages.CompletionItemKind.Operator,
|
|
||||||
insertText: item,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
javaLanguage.builtinFunctions?.forEach((item: any) => {
|
|
||||||
suggestions.push({
|
|
||||||
label: item,
|
|
||||||
kind: monaco.languages.CompletionItemKind.Function,
|
|
||||||
insertText: item,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
javaLanguage.builtinVariables?.forEach((item: any) => {
|
|
||||||
suggestions.push({
|
|
||||||
label: item,
|
|
||||||
kind: monaco.languages.CompletionItemKind.Variable,
|
|
||||||
insertText: item,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
suggestions,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<template>
|
||||||
|
<a-drawer v-model:visible="visible"
|
||||||
|
:title="title"
|
||||||
|
:esc-to-close="false"
|
||||||
|
:mask-closable="false"
|
||||||
|
:unmount-on-close="true"
|
||||||
|
@ok="handleOk"
|
||||||
|
@cancel="handleCancel">
|
||||||
|
<div class="full">
|
||||||
|
<editor v-model="value"
|
||||||
|
language="shell"
|
||||||
|
:suggestions="true"
|
||||||
|
:auto-focus="true"
|
||||||
|
:theme="dark ? 'vs-dark' : 'vs'"
|
||||||
|
:readonly="readonly" />
|
||||||
|
</div>
|
||||||
|
</a-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'shellEditorDrawer'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import useVisible from '@/hooks/visible';
|
||||||
|
|
||||||
|
const emits = defineEmits(['ok', 'cancel']);
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Partial<{
|
||||||
|
dark: boolean;
|
||||||
|
readonly: boolean;
|
||||||
|
}>>(), {
|
||||||
|
dark: true,
|
||||||
|
readonly: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { visible, setVisible } = useVisible();
|
||||||
|
|
||||||
|
const title = ref<string>();
|
||||||
|
const value = ref<string | any>();
|
||||||
|
|
||||||
|
// 打开
|
||||||
|
const open = (editorValue: string | any, editorTitle: string) => {
|
||||||
|
title.value = editorTitle;
|
||||||
|
value.value = editorValue;
|
||||||
|
setVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取值
|
||||||
|
const getValue = () => {
|
||||||
|
return value.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ open, getValue });
|
||||||
|
|
||||||
|
// 确定
|
||||||
|
const handleOk = () => {
|
||||||
|
setVisible(false);
|
||||||
|
emits('ok', value.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 取消
|
||||||
|
const handleCancel = () => {
|
||||||
|
setVisible(false);
|
||||||
|
emits('cancel', value.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
</style>
|
||||||
@@ -32,6 +32,8 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import useVisible from '@/hooks/visible';
|
import useVisible from '@/hooks/visible';
|
||||||
|
|
||||||
|
const emits = defineEmits(['close']);
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Partial<{
|
const props = withDefaults(defineProps<Partial<{
|
||||||
width: string | number;
|
width: string | number;
|
||||||
height: string;
|
height: string;
|
||||||
@@ -66,6 +68,7 @@
|
|||||||
// 关闭
|
// 关闭
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
emits('close', value.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user