feat: 修复构建.

This commit is contained in:
lijiahangmax
2024-01-09 23:53:45 +08:00
parent 0bb7b5bc62
commit d78d2a2053
38 changed files with 121 additions and 73 deletions

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -32,7 +32,7 @@
#end
</a-form-item>
#end
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -47,7 +47,7 @@
</template>
</a-button>
</a-tooltip>
<a-dropdown trigger="click" @select="changeLocale">
<a-dropdown trigger="click" @select="s => changeLocale(s as string)">
<div ref="localeRef" class="trigger-btn" />
<template #content>
<a-doption v-for="item in locales"

View File

@@ -10,7 +10,7 @@
<!-- 开关 -->
<a-switch v-else-if="type === 'switch'"
type="round"
:default-checked="defaultValue"
:default-checked="defaultValue as boolean"
size="small"
@change="handleChange" />
<!-- 单选按钮 -->

View File

@@ -1,6 +1,6 @@
import type { App } from 'vue';
import { use } from 'echarts/core';
import AQueryHeader from '@dangojs/a-query-header';
import QueryHeader from '@dangojs/a-query-header';
import { CanvasRenderer } from 'echarts/renderers';
import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts';
import {
@@ -33,7 +33,7 @@ export default {
install(Vue: App) {
Vue.component('chart', Chart);
Vue.component('breadcrumb', Breadcrumb);
Vue.component('a-query-header', AQueryHeader);
Vue.component('query-header', QueryHeader);
Vue.component('card-list', CardList);
Vue.component('editor', Editor);
Vue.component('tab-router', TabRouter);

View File

@@ -12,7 +12,7 @@
size="mini"
v-model:current="(pagination as PaginationProps).current"
v-model:page-size="(pagination as PaginationProps).pageSize"
v-bind="pagination"
v-bind="pagination as any"
:auto-adjust="false"
@change="page => bubblesEmitter(HeaderEmitter.PAGE_CHANGE, page, (pagination as PaginationProps).pageSize)"
@page-size-change="limit => bubblesEmitter(HeaderEmitter.PAGE_CHANGE, 1, limit)" />

View File

@@ -49,7 +49,7 @@
'field-value',
field.ellipsis ? 'field-value-ellipsis' : ''
]">
<slot :name="field.slotName" :record="item" :index="index" :key="item[key]">
<slot :name="field.slotName" :record="item" :index="index" :key="item[key as string]">
<a-tooltip v-if="field.tooltip" :content="item[field.dataIndex]">
<span v-if="field.render" v-html="field.render({ record: item, index })" />
<span v-else>{{ item[field.dataIndex] }}</span>

View File

@@ -98,6 +98,6 @@ self.MonacoEnvironment = {
if (label === 'json') {
return new JsonWorker();
}
return new EditorWorker();
return new EditorWorker(label);
},
};

View File

@@ -1,9 +1,9 @@
<template>
<div ref="editorContainer"
:class="{
'editor-wrapper': true,
[containerClass]: !!containerClass
}"
class="editor-wrapper"
:class="[
!!containerClass ? containerClass : ''
]"
:style="{
...containerStyle
}" />
@@ -22,6 +22,7 @@
import { createDefaultOptions } from './core';
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useAppStore } from '@/store';
import { language as shellLanguage } from 'monaco-editor/esm/vs/basic-languages/shell/shell.js';
const appStore = useAppStore();
@@ -82,6 +83,48 @@
emits('update:modelValue', value);
emits('change', value);
});
// FIXME test containerClass
// TODO
// 代码提示
monaco.languages.registerCompletionItemProvider('shell', {
provideCompletionItems() {
const suggestions: any = [];
// 这个keywords就是java.java文件中有的
shellLanguage.keywords?.forEach((item: any) => {
suggestions.push({
label: item,
kind: monaco.languages.CompletionItemKind.Keyword,
insertText: item,
});
});
shellLanguage.operators?.forEach((item: any) => {
suggestions.push({
label: item,
kind: monaco.languages.CompletionItemKind.Operator,
insertText: item,
});
});
shellLanguage.builtinFunctions?.forEach((item: any) => {
suggestions.push({
label: item,
kind: monaco.languages.CompletionItemKind.Function,
insertText: item,
});
});
shellLanguage.builtinVariables?.forEach((item: any) => {
suggestions.push({
label: item,
kind: monaco.languages.CompletionItemKind.Variable,
insertText: item,
});
});
return {
suggestions,
};
},
});
emits('editor-mounted', editor);
};

View File

@@ -11,7 +11,7 @@
:unmount-on-close="true"
:footer="false"
@close="handleClose">
<div :style="{width: '100%', 'height': height}">
<div :style="{ width: '100%', 'height': height }">
<editor v-model="value" readonly />
</div>
</a-modal>
@@ -19,7 +19,7 @@
<script lang="ts">
export default {
name: 'jsonViewModal'
name: 'jsonEditorModal'
};
</script>
@@ -44,7 +44,6 @@
const title = ref<string>();
const value = ref<string | any>();
//
const open = (editorValue: string | any, editorTitle = 'json') => {
title.value = editorTitle;
@@ -62,6 +61,7 @@
const handleClose = () => {
setVisible(false);
};
</script>
<style lang="less" scoped>

View File

@@ -1,9 +1,11 @@
import type { TreeNodeData } from '@arco-design/web-vue';
// 通过 label 进行过滤
export const labelFilter = (searchValue: string, option: { label: string; }) => {
export const labelFilter = (searchValue: string, option: { label: string }) => {
return option.label.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
};
// 通过 title 进行过滤
export const titleFilter = (searchValue: string, option: { title: string; }) => {
return option.title.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
export const titleFilter = (searchValue: string, option: TreeNodeData) => {
return (option.title as string).toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
};

View File

@@ -6,7 +6,7 @@
class="role-router"
v-model="value"
:items="rolesRouter"
@change="(key, item) => emits('change', key, item)" />
@change="(key: number, item: any) => emits('change', key, item)" />
<!-- 加载中 -->
<a-skeleton v-else-if="loading"
class="skeleton-wrapper"

View File

@@ -6,7 +6,7 @@
class="user-router"
v-model="value"
:items="usersRouter"
@change="(key, item) => emits('change', key, item)" />
@change="(key: number, item: any) => emits('change', key, item)" />
<!-- 加载中 -->
<a-skeleton v-else-if="loading"
class="skeleton-wrapper"

View File

@@ -41,7 +41,6 @@
v-if="!isAddHandle"
class="password-switch"
type="round"
size="large"
checked-text="使用新密码"
unchecked-text="使用原密码" />
</a-form-item>

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -25,7 +25,7 @@
<a-form-item field="keyId" label="主机秘钥" label-col-flex="50px">
<host-key-selector v-model="formModel.keyId" allow-clear />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -72,7 +72,6 @@
v-if="!isAddHandle"
class="password-switch"
type="round"
size="large"
checked-text="使用新密码"
unchecked-text="使用原密码" />
</a-form-item>

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -17,7 +17,7 @@
<a-form-item field="name" label="名称" label-col-flex="30px">
<a-input v-model="formModel.name" placeholder="请输入名称" allow-clear />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -18,7 +18,7 @@
<!-- SSH 配置 -->
<ssh-config-form :host-id="record.id"
:content="config.ssh"
@submitted="(e) => config.ssh.config = e" />
@submitted="(e) => config.ssh = e" />
</a-spin>
</a-drawer>
</template>
@@ -31,6 +31,7 @@
<script lang="ts" setup>
import type { HostConfigWrapper } from '../../types/const';
import { HostSshConfig } from './ssh/types/const';
import { ref } from 'vue';
import useVisible from '@/hooks/visible';
import useLoading from '@/hooks/loading';
@@ -46,7 +47,7 @@
const record = ref({} as any);
const config = ref<HostConfigWrapper>({
ssh: undefined
ssh: {} as HostSshConfig
});
// 打开

View File

@@ -10,7 +10,7 @@
type="round"
:checked-value="1"
:unchecked-value="0"
:beforeChange="updateStatus" />
:beforeChange="s => updateStatus(s as number)" />
</div>
</template>
<a-spin v-show="config.status" :loading="loading" class="config-form-wrapper">
@@ -48,7 +48,7 @@
<a-radio-group type="button"
class="auth-type-group usn"
v-model="formModel.authType"
:options="toOptions(sshAuthTypeKey)" />
:options="toOptions(sshAuthTypeKey) as RadioOption[]" />
</a-form-item>
<!-- 主机密码 -->
<a-form-item v-if="SshAuthType.PASSWORD === formModel.authType"
@@ -63,7 +63,6 @@
v-model="formModel.useNewPassword"
class="password-switch"
type="round"
size="large"
checked-text="使用新密码"
unchecked-text="使用原密码" />
</a-form-item>
@@ -136,6 +135,7 @@
</script>
<script lang="ts" setup>
import type { RadioOption } from '@arco-design/web-vue/es/radio/interface';
import type { FieldRule } from '@arco-design/web-vue';
import type { HostSshConfig } from './types/const';
import { reactive, ref, watch } from 'vue';
@@ -145,10 +145,10 @@
import { Message } from '@arco-design/web-vue';
import useLoading from '@/hooks/loading';
import { useDictStore } from '@/store';
import HostKeySelector from '@/components/asset/host-key/host-key-selector.vue';
import HostIdentitySelector from '@/components/asset/host-identity/host-identity-selector.vue';
import { EnabledStatus } from '@/types/const';
import { HostConfigType } from '../../../types/const';
import HostKeySelector from '@/components/asset/host-key/host-key-selector.vue';
import HostIdentitySelector from '@/components/asset/host-identity/host-identity-selector.vue';
const { loading, setLoading } = useLoading();
const { toOptions } = useDictStore();

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -35,7 +35,7 @@
:tagColor="tagColor"
placeholder="请选择主机标签" />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -2,7 +2,7 @@ import type { HostSshConfig } from '../components/config/ssh/types/const';
// 主机所有配置
export interface HostConfigWrapper {
ssh: HostSshConfig | unknown;
ssh: HostSshConfig;
[key: string]: unknown;
}

View File

@@ -15,7 +15,7 @@
<a-radio-group
v-model:model-value="type"
type="button"
@change="typeChange"
@change="s => typeChange(s as string)"
>
<a-radio value="text">
{{ $t('workplace.popularContent.text') }}

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
:itemOptions="{ 5: { span: 2 } }"
@submit="fetchTableData"
@@ -42,7 +42,7 @@
show-time
format="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -235,7 +235,7 @@
};
// 打开配置
const openSetting = inject<(record: HostQueryResponse) => void>(openSshModalKey);
const openSetting = inject<(record: HostQueryResponse) => void>(openSshModalKey) as any;
// 设置收藏
const setFavorite = async (item: HostQueryResponse) => {

View File

@@ -9,8 +9,8 @@
<a-radio-group v-model="newConnectionType"
type="button"
class="usn"
:options="toOptions(newConnectionTypeKey)"
@change="changeNewConnectionType" />
:options="toOptions(newConnectionTypeKey) as RadioOption[]"
@change="s => changeNewConnectionType(s as string)" />
<!-- 过滤 -->
<a-auto-complete v-model="filterValue"
class="host-filter"
@@ -75,6 +75,7 @@
</script>
<script lang="ts" setup>
import type { RadioOption } from '@arco-design/web-vue/es/radio/interface';
import type { SelectOptionData } from '@arco-design/web-vue';
import type { AuthorizedHostQueryResponse } from '@/api/asset/asset-authorized-data';
import { getCurrentAuthorizedHost } from '@/api/asset/asset-authorized-data';
@@ -84,8 +85,8 @@
import { useAppStore, useDictStore, useTerminalStore } from '@/store';
import { dataColor } from '@/utils';
import { tagColor } from '@/views/asset/host-list/types/const';
import HostsView from './hosts-view.vue';
import { getLatestConnectHostId } from '@/api/asset/host-connect-log';
import HostsView from './hosts-view.vue';
const { loading, setLoading } = useLoading();
const { toOptions } = useDictStore();

View File

@@ -25,7 +25,7 @@
<a-form-item field="authType" label="验证方式">
<a-radio-group type="button"
v-model="formModel.authType"
:options="toOptions(extraSshAuthTypeKey)" />
:options="toOptions(extraSshAuthTypeKey) as RadioOption[]" />
</a-form-item>
<!-- 用户名 -->
<a-form-item v-if="formModel.authType === ExtraSshAuthType.CUSTOM_KEY"
@@ -61,6 +61,7 @@
</script>
<script lang="ts" setup>
import type { RadioOption } from '@arco-design/web-vue/es/radio/interface';
import type { HostQueryResponse } from '@/api/asset/host';
import type { SshExtraModel } from '../../types/terminal.const';
import { ref } from 'vue';

View File

@@ -64,7 +64,7 @@
<a-radio-group type="button"
v-model="formModel.cursorStyle"
class="form-item form-item-cursor-style usn"
:options="toOptions(cursorStyleKey)" />
:options="toOptions(cursorStyleKey) as RadioOption[]" />
</a-form-item>
<!-- 光标闪烁 -->
<a-form-item field="cursorBlink" label="光标是否闪烁">
@@ -95,6 +95,7 @@
</script>
<script lang="ts" setup>
import type { RadioOption } from '@arco-design/web-vue/es/radio/interface';
import type { TerminalDisplaySetting } from '@/store/modules/terminal/types';
import { ref, watch } from 'vue';
import { useDictStore, useTerminalStore } from '@/store';

View File

@@ -10,16 +10,16 @@
class="usn"
size="mini"
type="button"
:options="toOptions(darkThemeKey)"
@change="changeDarkTheme">
:options="toOptions(darkThemeKey) as RadioOption[]"
@change="s => changeDarkTheme(s as string)">
</a-radio-group>
</div>
<!-- 内容区域 -->
<div class="terminal-setting-body terminal-theme-container">
<div class="theme-row"
v-for="index in ThemeSchema.length / 2"
:key="index">
<a-card v-for="(theme, index) in [ThemeSchema[(index - 1) * 2], ThemeSchema[(index - 1) * 2 + 1]]"
v-for="rowIndex in ThemeSchema.length / 2"
:key="rowIndex">
<a-card v-for="(theme, colIndex) in [ThemeSchema[(rowIndex - 1) * 2], ThemeSchema[(rowIndex - 1) * 2 + 1]]"
:key="theme.name"
class="terminal-theme-card simple-card"
:class="{
@@ -28,7 +28,7 @@
:title="theme.name"
:style="{
background: theme.background,
marginRight: index === 0 ? '16px' : 0
marginRight: colIndex === 0 ? '16px' : 0
}"
:header-style="{
color: theme.dark ? 'rgba(255, 255, 255, .8)' : 'rgba(0, 0, 0, .8)',
@@ -53,6 +53,7 @@
</script>
<script lang="ts" setup>
import type { RadioOption } from '@arco-design/web-vue/es/radio/interface';
import { darkThemeKey } from '../../types/terminal.const';
import ThemeSchema from '../../types/terminal.theme';
import { useDictStore, useTerminalStore } from '@/store';

View File

@@ -161,7 +161,7 @@
return;
}
extraSchemaArr.value.push({
name: name,
name: name as string,
type: type || ValueType.STRING
});
};

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -14,7 +14,7 @@
<a-form-item field="description" label="配置描述" label-col-flex="50px">
<a-input v-model="formModel.description" placeholder="请输入配置描述" allow-clear />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -10,7 +10,7 @@
@added="modalAddCallback"
@updated="modalUpdateCallback" />
<!-- json 查看器模态框 -->
<json-view-modal ref="view" />
<json-editor-modal ref="view" />
</div>
</template>
@@ -24,7 +24,7 @@
import { ref, onBeforeMount } from 'vue';
import DictKeyTable from './components/dict-key-table.vue';
import DictKeyFormModal from './components/dict-key-form-modal.vue';
import JsonViewModal from '@/components/view/json/json-view-modal.vue';
import JsonEditorModal from '@/components/view/json-editor/json-editor-modal.vue';
import { useDictStore } from '@/store';
import { dictKeys } from './types/const';

View File

@@ -45,6 +45,6 @@ export const dictKeys = [dictValueTypeKey];
* 额外参数类型
*/
export interface ExtraParamType {
name?: string;
type?: string;
name: string;
type: string;
}

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="resetForm"
@@ -21,7 +21,7 @@
<a-form-item field="label" label="配置描述" label-col-flex="50px">
<a-input v-model="formModel.label" placeholder="请输入配置描述" allow-clear />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -25,7 +25,7 @@
@viewDetail="(e) => view.open(e)" />
</a-card>
<!-- json 查看器模态框 -->
<json-view-modal ref="view" />
<json-editor-modal ref="view" />
</div>
</template>
@@ -43,7 +43,7 @@
import { dictKeys } from '../../operator-log/types/const';
import OperatorLogQueryHeader from '../../operator-log/components/operator-log-query-header.vue';
import OperatorLogTable from '../../operator-log/components/operator-log-table.vue';
import JsonViewModal from '@/components/view/json/json-view-modal.vue';
import JsonEditorModal from '@/components/view/json-editor/json-editor-modal.vue';
const props = defineProps({
user: Object as PropType<UserQueryResponse>,

View File

@@ -5,7 +5,7 @@
position="left"
:lazy-load="true"
:destroy-on-hide="true"
@tab-click="clickTab">
@tab-click="k => clickTab(k as string)">
<!-- 个人信息 -->
<a-tab-pane key="mineInfo"
v-if="!user || hasPermission('infra:system-user:update')"

View File

@@ -1,5 +1,5 @@
<template>
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
:itemOptions="{ [visibleUser ? 5 : 4]: { span: 2 } }"
@submit="submit"
@@ -21,7 +21,7 @@
:allow-search="true"
:filter-option="labelFilter"
placeholder="请选择操作模块"
@change="selectedModule"
@change="m => selectedModule(m as string)"
allow-clear />
</a-form-item>
<!-- 操作类型 -->
@@ -55,7 +55,7 @@
show-time
format="YYYY-MM-DD HH:mm:ss" />
</a-form-item>
</a-query-header>
</query-header>
</template>
<script lang="ts">

View File

@@ -20,7 +20,7 @@
<operator-log-table ref="table" @viewDetail="(e) => view.open(e)" />
</a-card>
<!-- json 查看器模态框 -->
<json-view-modal ref="view" />
<json-editor-modal ref="view" />
</div>
</template>
@@ -36,7 +36,7 @@
import { dictKeys } from './types/const';
import OperatorLogQueryHeader from './components/operator-log-query-header.vue';
import OperatorLogTable from './components/operator-log-table.vue';
import JsonViewModal from '@/components/view/json/json-view-modal.vue';
import JsonEditorModal from '@/components/view/json-editor/json-editor-modal.vue';
const cacheStore = useCacheStore();

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -21,7 +21,7 @@
:options="toOptions(roleStatusKey)"
allow-clear />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">

View File

@@ -1,7 +1,7 @@
<template>
<!-- 搜索 -->
<a-card class="general-card table-search-card">
<a-query-header :model="formModel"
<query-header :model="formModel"
label-align="left"
@submit="fetchTableData"
@reset="fetchTableData"
@@ -36,7 +36,7 @@
<a-form-item field="email" label="邮箱" label-col-flex="50px">
<a-input v-model="formModel.email" placeholder="请输入邮箱" allow-clear />
</a-form-item>
</a-query-header>
</query-header>
</a-card>
<!-- 表格 -->
<a-card class="general-card table-card">