diff --git a/mayfly_go_web/src/common/rsa.ts b/mayfly_go_web/src/common/rsa.ts index ef5b2a51..fc41dd39 100644 --- a/mayfly_go_web/src/common/rsa.ts +++ b/mayfly_go_web/src/common/rsa.ts @@ -25,7 +25,7 @@ export async function RsaEncrypt(value: any) { if (!value) { return ''; } - if (encryptor != null) { + if (encryptor != null && sessionStorage.getItem('RsaPublicKey') != null) { return encryptor.encrypt(value); } encryptor = new JSEncrypt(); diff --git a/mayfly_go_web/src/views/ops/db/DbEdit.vue b/mayfly_go_web/src/views/ops/db/DbEdit.vue index ef33805b..fdc3e77a 100644 --- a/mayfly_go_web/src/views/ops/db/DbEdit.vue +++ b/mayfly_go_web/src/views/ops/db/DbEdit.vue @@ -1,14 +1,39 @@ @@ -234,21 +249,21 @@ - {{ infoDialog.data.tagPath }} - {{ infoDialog.data.name }} - {{ infoDialog.data.id }} - {{ infoDialog.data.database }} - {{ infoDialog.data.remark }} - {{ dateFormat(infoDialog.data.createTime) }} - {{ infoDialog.data.creator }} - {{ dateFormat(infoDialog.data.updateTime) }} - {{ infoDialog.data.modifier }} + {{ infoDialog.data?.tagPath }} + {{ infoDialog.data?.name }} + {{ infoDialog.data?.id }} + {{ infoDialog.data?.database }} + {{ infoDialog.data?.remark }} + {{ dateFormat(infoDialog.data?.createTime) }} + {{ infoDialog.data?.creator }} + {{ dateFormat(infoDialog.data?.updateTime) }} + {{ infoDialog.data?.modifier }} - {{ infoDialog.instance.name }} - {{ infoDialog.instance.host }} - {{ infoDialog.instance.port }} - {{ infoDialog.instance.username }} - {{ infoDialog.instance.type }} + {{ infoDialog.instance?.name }} + {{ infoDialog.instance?.host }} + {{ infoDialog.instance?.port }} + {{ infoDialog.instance?.username }} + {{ infoDialog.instance?.type }} @@ -291,10 +306,7 @@ const perms = { delDb: 'db:del', }; -const queryConfig = [ - TableQuery.slot('tagPath', '标签', 'tagPathSelect'), - TableQuery.slot('instanceId', '实例', 'instanceSelect'), -]; +const queryConfig = [TableQuery.slot('tagPath', '标签', 'tagPathSelect'), TableQuery.slot('instanceId', '实例', 'instanceSelect')]; const columns = ref([ TableColumn.new('tagPath', '标签路径').isSlot().setAddWidth(20), @@ -315,7 +327,7 @@ const state = reactive({ dbId: 0, db: '', tags: [], - instances: [], + instances: [] as any, /** * 选中的数据 */ @@ -337,7 +349,7 @@ const state = reactive({ instance: null as any, query: { instanceId: 0, - } + }, }, showDumpInfo: false, dumpInfo: { @@ -504,19 +516,23 @@ const showInfo = async (info: any) => { }; const onBeforeCloseInfoDialog = () => { - state.infoDialog.visible = false; - state.infoDialog.data = null; - state.infoDialog.instance = null; + state.infoDialog.visible = false; + state.infoDialog.data = null; + state.infoDialog.instance = null; }; const getTags = async () => { state.tags = await dbApi.dbTags.request(null); }; -const getInstances = async () => { - const data = await dbApi.instances.request(null); +const getInstances = async (instanceName = '') => { + if (!instanceName) { + state.instances = []; + return; + } + const data = await dbApi.instances.request({ name: instanceName }); if (data) { - state.instances = data.list; + state.instances = data.list; } }; diff --git a/mayfly_go_web/src/views/ops/db/InstanceEdit.vue b/mayfly_go_web/src/views/ops/db/InstanceEdit.vue index 24e92475..bb3f8ac6 100644 --- a/mayfly_go_web/src/views/ops/db/InstanceEdit.vue +++ b/mayfly_go_web/src/views/ops/db/InstanceEdit.vue @@ -26,13 +26,17 @@ - + + + @@ -79,7 +83,6 @@ import { dbApi } from './api'; import { ElMessage } from 'element-plus'; import { notBlank } from '@/common/assert'; import { RsaEncrypt } from '@/common/rsa'; -import TagSelect from '../component/TagSelect.vue'; import SshTunnelSelect from '../component/SshTunnelSelect.vue'; const props = defineProps({ @@ -161,11 +164,11 @@ watch(props, (newValue: any) => { } state.tabActiveName = 'basic'; if (newValue.data) { - state.form = { ...newValue.data}; - state.oldUserName = state.form.username + state.form = { ...newValue.data }; + state.oldUserName = state.form.username; } else { state.form = { port: 3306 } as any; - state.oldUserName = null + state.oldUserName = null; } }); @@ -177,7 +180,7 @@ const btnOk = async () => { if (!state.form.id) { notBlank(state.form.password, '新增操作,密码不可为空'); } else if (state.form.username != state.oldUserName) { - notBlank(state.form.password, '已修改用户名,请输入密码'); + notBlank(state.form.password, '已修改用户名,请输入密码'); } dbForm.value.validate(async (valid: boolean) => { diff --git a/mayfly_go_web/src/views/ops/db/InstanceList.vue b/mayfly_go_web/src/views/ops/db/InstanceList.vue index 03710b4d..74edec62 100644 --- a/mayfly_go_web/src/views/ops/db/InstanceList.vue +++ b/mayfly_go_web/src/views/ops/db/InstanceList.vue @@ -15,7 +15,9 @@ > diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue index 78f8b137..1c1bb68a 100644 --- a/mayfly_go_web/src/views/ops/db/SqlExec.vue +++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue @@ -44,8 +44,7 @@ @@ -633,12 +632,12 @@ const registerSqlCompletionItemProvider = () => { range, }); }); - - let replacedFunctions = [] as string[]; + + let replacedFunctions = [] as string[]; // 添加的函数 addSqlLanguage.replaceFunctions.forEach((item: any) => { - replacedFunctions.push(item.label) + replacedFunctions.push(item.label); suggestions.push({ label: { label: item.label, @@ -649,18 +648,19 @@ const registerSqlCompletionItemProvider = () => { range, }); }); - + // 内置函数 sqlCompletionBuiltinFunctions.forEach((item: any) => { - replacedFunctions.indexOf(item) < 0 && suggestions.push({ - label: { - label: item, - description: 'func', - }, - kind: monaco.languages.CompletionItemKind.Function, - insertText: item, - range, - }); + replacedFunctions.indexOf(item) < 0 && + suggestions.push({ + label: { + label: item, + description: 'func', + }, + kind: monaco.languages.CompletionItemKind.Function, + insertText: item, + range, + }); }); // 内置变量 sqlCompletionBuiltinVariables.forEach((item: string) => { diff --git a/mayfly_go_web/src/views/ops/machine/ScriptEdit.vue b/mayfly_go_web/src/views/ops/machine/ScriptEdit.vue index 9d9fead6..ba1aa566 100644 --- a/mayfly_go_web/src/views/ops/machine/ScriptEdit.vue +++ b/mayfly_go_web/src/views/ops/machine/ScriptEdit.vue @@ -9,16 +9,16 @@ :destroy-on-close="true" width="900px" > - - + + - + - + @@ -59,7 +59,11 @@ - + +
+ +
+