fix: 修改公共脚本不同语言分号问题&评论组件展开折叠问题
This commit is contained in:
parent
e8295cd86b
commit
6805e8cf06
|
@ -143,13 +143,6 @@ export default defineComponent({
|
|||
);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.commentList,
|
||||
() => {
|
||||
expendedIds.value = [];
|
||||
}
|
||||
);
|
||||
|
||||
const renderChildrenList = (list?: CommentItem[]) => {
|
||||
if (!list || list.length === 0) {
|
||||
return null;
|
||||
|
@ -176,6 +169,7 @@ export default defineComponent({
|
|||
const renderParentList = (list: CommentItem[]) => {
|
||||
return list.map((item) => (
|
||||
<>
|
||||
{/* {expendedIds.value}--expendedIds */}
|
||||
<Item
|
||||
mode={'parent'}
|
||||
onReply={() => handleReply(item)}
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
result: '',
|
||||
};
|
||||
|
||||
const form = ref({ ...initForm });
|
||||
const form = ref({ ...cloneDeep(initForm) });
|
||||
|
||||
const columns: MsTableColumn = [
|
||||
{
|
||||
|
@ -243,7 +243,7 @@
|
|||
() => showScriptDrawer.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
form.value = { ...initForm };
|
||||
form.value = { ...cloneDeep(initForm) };
|
||||
innerParams.value = [];
|
||||
editScriptId.value = props.scriptId;
|
||||
if (editScriptId.value) {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="p-[12px] pt-0">
|
||||
<div v-for="item of SCRIPT_MENU" :key="item.value" class="menuItem px-1" @click="handleClick(item)">
|
||||
<div v-for="item of scriptMenus" :key="item.value" class="menuItem px-1" @click="handleClick(item)">
|
||||
{{ item.title }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,7 +50,7 @@
|
|||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import type { CommonScriptMenu } from './types';
|
||||
import { getCodeTemplate, SCRIPT_MENU } from './utils';
|
||||
import { getCodeTemplate, getScriptMenu } from './utils';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -81,6 +81,10 @@
|
|||
{ text: 'JavaScript', value: LanguageEnum.JAVASCRIPT },
|
||||
];
|
||||
|
||||
const scriptMenus = computed(() => {
|
||||
return innerLanguageType.value !== LanguageEnum.PYTHON ? getScriptMenu(';') : getScriptMenu('');
|
||||
});
|
||||
|
||||
function expandedHandler() {
|
||||
innerExpand.value = !innerExpand.value;
|
||||
}
|
||||
|
|
|
@ -21,49 +21,51 @@ function getInsertCommonScript() {
|
|||
return [];
|
||||
}
|
||||
|
||||
export const SCRIPT_MENU: CommonScriptMenu[] = [
|
||||
// TODO 这个版本不上
|
||||
// {
|
||||
// title: t('project.code_segment.importApiTest'),
|
||||
// value: 'api_definition',
|
||||
// command: 'api_definition',
|
||||
// },
|
||||
{
|
||||
title: t('project.code_segment.newApiTest'),
|
||||
value: 'new_api_request',
|
||||
command: 'new_api_request',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetVariable'),
|
||||
value: 'vars.get("variable_name");',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateSetVariable'),
|
||||
value: 'vars.put("variable_name", "variable_value");',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseHeader'),
|
||||
value: 'prev.getResponseHeaders();',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseCode'),
|
||||
value: 'prev.getResponseCode();',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseResult'),
|
||||
value: 'prev.getResponseDataAsString();',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.paramEnvironmentSetGlobalVariable'),
|
||||
value: `vars.put(\${__metersphere_env_id}+"key","value");\nvars.put("key","value");`,
|
||||
},
|
||||
...getInsertCommonScript(),
|
||||
{
|
||||
title: t('project.processor.terminationTest'),
|
||||
value: 'api_stop',
|
||||
command: 'api_stop',
|
||||
},
|
||||
];
|
||||
export function getScriptMenu(SemicolonStr: string) {
|
||||
return [
|
||||
// TODO 这个版本不上
|
||||
// {
|
||||
// title: t('project.code_segment.importApiTest'),
|
||||
// value: 'api_definition',
|
||||
// command: 'api_definition',
|
||||
// },
|
||||
{
|
||||
title: t('project.code_segment.newApiTest'),
|
||||
value: 'new_api_request',
|
||||
command: 'new_api_request',
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetVariable'),
|
||||
value: `vars.get("variable_name")${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateSetVariable'),
|
||||
value: `vars.put("variable_name", "variable_value")${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseHeader'),
|
||||
value: `prev.getResponseHeaders()${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseCode'),
|
||||
value: `prev.getResponseCode()${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.codeTemplateGetResponseResult'),
|
||||
value: `prev.getResponseDataAsString()${SemicolonStr}`,
|
||||
},
|
||||
{
|
||||
title: t('project.processor.paramEnvironmentSetGlobalVariable'),
|
||||
value: `vars.put(\${__metersphere_env_id}+"key","value");\nvars.put("key","value");`,
|
||||
},
|
||||
...getInsertCommonScript(),
|
||||
{
|
||||
title: t('project.processor.terminationTest'),
|
||||
value: 'api_stop',
|
||||
command: 'api_stop',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// 处理groovyCode 请求头
|
||||
function getGroovyHeaders(requestHeaders: Record<string, any>) {
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
value: 'LIST',
|
||||
},
|
||||
],
|
||||
width: 150,
|
||||
titleSlotName: 'typeTitle',
|
||||
typeTitleTooltip: t('apiScenario.params.typeTooltip'),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue