fix(接口测试): 修复后置sql打开数据源数据没刷新的缺陷
This commit is contained in:
parent
17cb9cc57b
commit
4afdfcf3f4
|
@ -38,6 +38,7 @@
|
||||||
import type { MsTableColumn } from '@/components/pure/ms-table/type';
|
import type { MsTableColumn } from '@/components/pure/ms-table/type';
|
||||||
import useTable from '@/components/pure/ms-table/useTable';
|
import useTable from '@/components/pure/ms-table/useTable';
|
||||||
|
|
||||||
|
import { getEnvironment } from '@/api/modules/api-test/common';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
|
||||||
import { EnvConfig } from '@/models/projectManagement/environmental';
|
import { EnvConfig } from '@/models/projectManagement/environmental';
|
||||||
|
@ -109,14 +110,24 @@
|
||||||
watch(
|
watch(
|
||||||
() => currentEnvConfig?.value,
|
() => currentEnvConfig?.value,
|
||||||
(config) => {
|
(config) => {
|
||||||
if (config) {
|
if (config && config.id) {
|
||||||
propsRes.value.data = cloneDeep(config.dataSources) as any[];
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
initEnvironment(config.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
async function initEnvironment(envId: string) {
|
||||||
|
try {
|
||||||
|
const res = await getEnvironment(envId);
|
||||||
|
propsRes.value.data = cloneDeep(res.dataSources) as any[];
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function searchDataSource() {
|
function searchDataSource() {
|
||||||
if (keyword.value.trim() !== '') {
|
if (keyword.value.trim() !== '') {
|
||||||
|
|
|
@ -33,7 +33,13 @@
|
||||||
:placeholder="t('project.environmental.database.namePlaceholder')"
|
:placeholder="t('project.environmental.database.namePlaceholder')"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="driver" asterisk-position="end" :label="t('project.environmental.database.driver')">
|
<a-form-item
|
||||||
|
field="driver"
|
||||||
|
required
|
||||||
|
asterisk-position="end"
|
||||||
|
:label="t('project.environmental.database.driver')"
|
||||||
|
:rules="[{ required: true, message: t('project.environmental.database.urlIsRequire') }]"
|
||||||
|
>
|
||||||
<a-select v-model="form.driverId" :options="driverOption" />
|
<a-select v-model="form.driverId" :options="driverOption" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
|
|
|
@ -87,6 +87,7 @@ export default {
|
||||||
'project.environmental.host.ipNotRepeat': 'IP address cannot be repeated',
|
'project.environmental.host.ipNotRepeat': 'IP address cannot be repeated',
|
||||||
'project.environmental.host.hostName': 'Host Name',
|
'project.environmental.host.hostName': 'Host Name',
|
||||||
'project.environmental.host.hostNameIsRequire': 'Host name cannot be empty',
|
'project.environmental.host.hostNameIsRequire': 'Host name cannot be empty',
|
||||||
|
'project.environmental.database.driverIsRequire': 'Driver is required',
|
||||||
'project.environmental.host.hostNamePlaceholder': 'Please enter the host name',
|
'project.environmental.host.hostNamePlaceholder': 'Please enter the host name',
|
||||||
'project.environmental.host.desc': 'Description',
|
'project.environmental.host.desc': 'Description',
|
||||||
'project.environmental.host.descPlaceholder': 'Please enter the description',
|
'project.environmental.host.descPlaceholder': 'Please enter the description',
|
||||||
|
|
|
@ -88,6 +88,7 @@ export default {
|
||||||
'project.environmental.database.url': '数据库连接 URL',
|
'project.environmental.database.url': '数据库连接 URL',
|
||||||
'project.environmental.database.urlExtra': '执行多条 SQL 语句需配置 allowMultiQueries=true',
|
'project.environmental.database.urlExtra': '执行多条 SQL 语句需配置 allowMultiQueries=true',
|
||||||
'project.environmental.database.urlIsRequire': '数据库连接 URL 必填',
|
'project.environmental.database.urlIsRequire': '数据库连接 URL 必填',
|
||||||
|
'project.environmental.database.driverIsRequire': '驱动必填',
|
||||||
'project.environmental.database.testConnection': '测试连接',
|
'project.environmental.database.testConnection': '测试连接',
|
||||||
'project.environmental.database.testConnectionSuccess': '连接成功',
|
'project.environmental.database.testConnectionSuccess': '连接成功',
|
||||||
'project.environmental.host.config': 'Host 配置',
|
'project.environmental.host.config': 'Host 配置',
|
||||||
|
|
Loading…
Reference in New Issue