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