mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 04:59:48 +08:00
fix(接口测试): case 复制使用 case 保存时的环境
This commit is contained in:
parent
6d826f04e0
commit
ff16b3b801
@ -47,6 +47,9 @@
|
|||||||
if (val) {
|
if (val) {
|
||||||
appStore.setEnvConfig(val);
|
appStore.setEnvConfig(val);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -12,13 +12,12 @@
|
|||||||
* import rehypeStringify from 'rehype-stringify';
|
* import rehypeStringify from 'rehype-stringify';
|
||||||
* return unified().use(rehypeParse).use(rehypeFormat).use(rehypeStringify).processSync(content.value);
|
* return unified().use(rehypeParse).use(rehypeFormat).use(rehypeStringify).processSync(content.value);
|
||||||
*/
|
*/
|
||||||
import { useDebounceFn, useLocalStorage, useVModel } from '@vueuse/core';
|
import { useDebounceFn, useVModel } from '@vueuse/core';
|
||||||
|
|
||||||
import type { MsFileItem } from '@/components/pure/ms-upload/types';
|
import type { MsFileItem } from '@/components/pure/ms-upload/types';
|
||||||
import AttachmentSelectorModal from './attachmentSelectorModal.vue';
|
import AttachmentSelectorModal from './attachmentSelectorModal.vue';
|
||||||
|
|
||||||
import { editorUploadFile } from '@/api/modules/case-management/featureCase';
|
import { editorUploadFile } from '@/api/modules/case-management/featureCase';
|
||||||
import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase';
|
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useLocale from '@/locale/useLocale';
|
import useLocale from '@/locale/useLocale';
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
@ -30,15 +29,12 @@
|
|||||||
DecorationSet,
|
DecorationSet,
|
||||||
Editor,
|
Editor,
|
||||||
Extension,
|
Extension,
|
||||||
ExtensionAudio,
|
|
||||||
ExtensionBlockquote,
|
ExtensionBlockquote,
|
||||||
ExtensionBold,
|
ExtensionBold,
|
||||||
ExtensionBulletList,
|
ExtensionBulletList,
|
||||||
ExtensionCode,
|
ExtensionCode,
|
||||||
ExtensionCodeBlock,
|
ExtensionCodeBlock,
|
||||||
ExtensionColor,
|
ExtensionColor,
|
||||||
ExtensionColumn,
|
|
||||||
ExtensionColumns,
|
|
||||||
ExtensionCommands,
|
ExtensionCommands,
|
||||||
ExtensionDocument,
|
ExtensionDocument,
|
||||||
ExtensionDraggable,
|
ExtensionDraggable,
|
||||||
@ -50,7 +46,6 @@
|
|||||||
ExtensionHighlight,
|
ExtensionHighlight,
|
||||||
ExtensionHistory,
|
ExtensionHistory,
|
||||||
ExtensionHorizontalRule,
|
ExtensionHorizontalRule,
|
||||||
ExtensionIframe,
|
|
||||||
ExtensionIndent,
|
ExtensionIndent,
|
||||||
ExtensionItalic,
|
ExtensionItalic,
|
||||||
ExtensionLink,
|
ExtensionLink,
|
||||||
@ -60,19 +55,15 @@
|
|||||||
ExtensionStrike,
|
ExtensionStrike,
|
||||||
ExtensionSubscript,
|
ExtensionSubscript,
|
||||||
ExtensionSuperscript,
|
ExtensionSuperscript,
|
||||||
ExtensionTable,
|
|
||||||
ExtensionTaskList,
|
ExtensionTaskList,
|
||||||
ExtensionText,
|
ExtensionText,
|
||||||
ExtensionTextAlign,
|
ExtensionTextAlign,
|
||||||
ExtensionTrailingNode,
|
ExtensionTrailingNode,
|
||||||
ExtensionUnderline,
|
ExtensionUnderline,
|
||||||
ExtensionVideo,
|
|
||||||
lowlight,
|
lowlight,
|
||||||
Plugin,
|
Plugin,
|
||||||
PluginKey,
|
PluginKey,
|
||||||
RichTextEditor,
|
RichTextEditor,
|
||||||
ToolbarItem,
|
|
||||||
ToolboxItem,
|
|
||||||
} from '@halo-dev/richtext-editor';
|
} from '@halo-dev/richtext-editor';
|
||||||
import Mention from '@tiptap/extension-mention';
|
import Mention from '@tiptap/extension-mention';
|
||||||
import type { queueAsPromised } from 'fastq';
|
import type { queueAsPromised } from 'fastq';
|
||||||
@ -147,10 +138,8 @@
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const showSidebar = useLocalStorage('halo:editor:show-sidebar', true);
|
|
||||||
|
|
||||||
const attachmentSelectorModal = ref(false);
|
const attachmentSelectorModal = ref(false);
|
||||||
const selectedimagesNode = ref<string>();
|
const selectedImagesNode = ref<string>();
|
||||||
const selectedCommentNode = ref<string>();
|
const selectedCommentNode = ref<string>();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -210,9 +199,9 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
imagesNodesIds.value = images;
|
imagesNodesIds.value = images;
|
||||||
if (!selectedimagesNode.value) {
|
if (!selectedImagesNode.value) {
|
||||||
// eslint-disable-next-line prefer-destructuring
|
// eslint-disable-next-line prefer-destructuring
|
||||||
selectedimagesNode.value = images[0];
|
selectedImagesNode.value = images[0];
|
||||||
}
|
}
|
||||||
return DecorationSet.empty;
|
return DecorationSet.empty;
|
||||||
},
|
},
|
||||||
|
@ -122,7 +122,6 @@
|
|||||||
import { getGenerateId } from '@/utils';
|
import { getGenerateId } from '@/utils';
|
||||||
|
|
||||||
import { AddApiCaseParams, ApiCaseDetail, ApiDefinitionDetail } from '@/models/apiTest/management';
|
import { AddApiCaseParams, ApiCaseDetail, ApiDefinitionDetail } from '@/models/apiTest/management';
|
||||||
import { EnvConfig } from '@/models/projectManagement/environmental';
|
|
||||||
import { RequestCaseStatus, RequestMethods } from '@/enums/apiEnum';
|
import { RequestCaseStatus, RequestMethods } from '@/enums/apiEnum';
|
||||||
|
|
||||||
import { casePriorityOptions, defaultResponse } from '@/views/api-test/components/config';
|
import { casePriorityOptions, defaultResponse } from '@/views/api-test/components/config';
|
||||||
@ -188,6 +187,7 @@
|
|||||||
const isEdit = ref(false);
|
const isEdit = ref(false);
|
||||||
|
|
||||||
async function open(apiId: string, record?: ApiCaseDetail | RequestParam, isCopy?: boolean) {
|
async function open(apiId: string, record?: ApiCaseDetail | RequestParam, isCopy?: boolean) {
|
||||||
|
appStore.showLoading();
|
||||||
apiDefinitionId.value = apiId;
|
apiDefinitionId.value = apiId;
|
||||||
// 从api下的用例里打开抽屉有api信息,从case下直接复制没有api信息
|
// 从api下的用例里打开抽屉有api信息,从case下直接复制没有api信息
|
||||||
if (props.apiDetail) {
|
if (props.apiDetail) {
|
||||||
@ -196,6 +196,7 @@
|
|||||||
await getApiDetail();
|
await getApiDetail();
|
||||||
}
|
}
|
||||||
// 创建的时候,请求参数为接口定义的请求参数
|
// 创建的时候,请求参数为接口定义的请求参数
|
||||||
|
environmentId.value = appStore.currentEnvConfig?.id;
|
||||||
detailForm.value = {
|
detailForm.value = {
|
||||||
...cloneDeep(defaultDetail.value),
|
...cloneDeep(defaultDetail.value),
|
||||||
...(apiDetailInfo.value.protocol === 'HTTP'
|
...(apiDetailInfo.value.protocol === 'HTTP'
|
||||||
@ -215,11 +216,11 @@
|
|||||||
if (isCopy) {
|
if (isCopy) {
|
||||||
detailForm.value = cloneDeep(record as RequestParam);
|
detailForm.value = cloneDeep(record as RequestParam);
|
||||||
detailForm.value.name = `copy_${record?.name}`;
|
detailForm.value.name = `copy_${record?.name}`;
|
||||||
|
environmentId.value = record?.environmentId;
|
||||||
if (detailForm.value.name.length > 255) {
|
if (detailForm.value.name.length > 255) {
|
||||||
detailForm.value.name = detailForm.value.name.slice(0, 255);
|
detailForm.value.name = detailForm.value.name.slice(0, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
environmentId.value = appStore.currentEnvConfig?.id;
|
|
||||||
// 编辑
|
// 编辑
|
||||||
if (!isCopy && record?.id) {
|
if (!isCopy && record?.id) {
|
||||||
isEdit.value = true;
|
isEdit.value = true;
|
||||||
@ -227,6 +228,7 @@
|
|||||||
environmentId.value = record.environmentId;
|
environmentId.value = record.environmentId;
|
||||||
detailForm.value.isNew = false;
|
detailForm.value.isNew = false;
|
||||||
}
|
}
|
||||||
|
appStore.hideLoading();
|
||||||
innerVisible.value = true;
|
innerVisible.value = true;
|
||||||
await nextTick();
|
await nextTick();
|
||||||
requestCompositionRef.value?.changeVerticalExpand(false); // 响应内容默认折叠
|
requestCompositionRef.value?.changeVerticalExpand(false); // 响应内容默认折叠
|
||||||
|
Loading…
Reference in New Issue
Block a user