fix(接口测试): case 复制使用 case 保存时的环境

This commit is contained in:
baiqi 2024-04-23 16:31:25 +08:00 committed by 刘瑞斌
parent 6d826f04e0
commit ff16b3b801
3 changed files with 11 additions and 17 deletions

View File

@ -47,6 +47,9 @@
if (val) { if (val) {
appStore.setEnvConfig(val); appStore.setEnvConfig(val);
} }
},
{
immediate: true,
} }
); );

View File

@ -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;
}, },

View File

@ -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;
// apiapicaseapi // apiapicaseapi
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); //