fix: 修改报告&环境&前后置bug

This commit is contained in:
xinxin.wu 2024-03-28 21:55:42 +08:00 committed by Craftsman
parent a20b54d570
commit 655ea48f14
18 changed files with 112 additions and 55 deletions

View File

@ -75,7 +75,7 @@
:content-style="{ width: '480px' }"
>
<template #content>
<moreSetting v-model:config="activeRecord" is-popover class="mt-[12px]" />
<!-- <moreSetting v-model:config="activeRecord" is-popover class="mt-[12px]" /> -->
<div class="flex items-center justify-end gap-[8px]">
<a-button type="secondary" size="mini" @click="record.moreSettingPopoverVisible = false">
{{ t('common.cancel') }}
@ -169,7 +169,7 @@
:content-style="{ width: '480px' }"
>
<template #content>
<moreSetting v-model:config="activeRecord" is-popover class="mt-[12px]" />
<!-- <moreSetting v-model:config="activeRecord" is-popover class="mt-[12px]" /> -->
<div class="flex items-center justify-end gap-[8px]">
<a-button type="secondary" size="mini" @click="record.moreSettingPopoverVisible = false">
{{ t('common.cancel') }}
@ -475,10 +475,10 @@
eventTag: 'copy',
label: 'common.copy',
},
{
eventTag: 'setting',
label: 'common.setting',
},
// {
// eventTag: 'setting',
// label: 'common.setting',
// },
],
},
];
@ -550,10 +550,10 @@
eventTag: 'copy',
label: 'common.copy',
},
{
eventTag: 'setting',
label: 'common.setting',
},
// {
// eventTag: 'setting',
// label: 'common.setting',
// },
],
},
];

View File

@ -26,7 +26,7 @@
</div>
</div>
<div v-if="showBody" class="ms-assertion-body w-full">
<div class="ms-assertion-body-left h-full w-[20%] min-w-[220px]">
<div class="ms-assertion-body-left h-full w-[25%] min-w-[220px]">
<VueDraggable v-model="assertions" ghost-class="ghost" handle=".sort-handle">
<div
v-for="(item, index) in assertions"
@ -40,14 +40,15 @@
>
<div class="ms-assertion-body-left-item-row">
<span class="ms-assertion-body-left-item-row-num">{{ index + 1 }}</span>
<span class="one-text-line">{{ item.name }}</span>
<div class="one-text-line">{{ item.name }}</div>
</div>
<div class="ms-assertion-body-left-item-switch">
<div v-show="!props.disabled" class="ms-assertion-body-left-item-switch-action">
<MsIcon
<!-- <MsIcon
type="icon-icon_drag"
class="action-btn-move sort-handle cursor-move text-[12px] text-[var(--color-text-4)]"
/>
/> -->
<icon-drag-dot-vertical class="ms-list-drag-icon" />
<MsTableMoreAction
:list="getItemMoreActions(item)"
trigger="click"
@ -150,7 +151,7 @@
import { ExecuteAssertionConfig } from '@/models/apiTest/common';
import { ResponseAssertionType, ResponseBodyAssertionType } from '@/enums/apiEnum';
import { ExecuteAssertion, MsAssertionItem } from './type';
import { MsAssertionItem } from './type';
defineOptions({
name: 'MsAssertion',
@ -191,6 +192,7 @@
{
label: 'project.fileManagement.delete',
eventTag: 'delete',
danger: true,
},
];
function getItemMoreActions(item: any) {
@ -454,6 +456,14 @@
display: flex;
align-items: center;
gap: 4px;
.ms-list-drag-icon {
@apply invisible cursor-move;
}
}
}
&:hover {
.ms-list-drag-icon {
@apply visible;
}
}
}

View File

@ -699,6 +699,7 @@ if (!result){
condition.value.dataSourceName = sqlSource.dataSource;
condition.value.dataSourceId = sqlSource.id;
emit('change');
Message.success(t('apiTestDebug.introduceSourceApplySuccess'));
}
function handleSqlSourceParamTableChange(resultArr: any[], isInit?: boolean) {

View File

@ -19,7 +19,7 @@
<template #title="{ item, index }">
<div class="flex items-center gap-[4px]">
<div
:class="`flex h-[16px] w-[16px] items-center justify-center rounded-full ${
:class="`flex h-[16px] w-[16px] flex-shrink-0 items-center justify-center rounded-full ${
activeItem.id === item.id ? ' bg-white' : 'bg-[var(--color-text-n8)]'
}`"
>
@ -32,12 +32,11 @@
>
{{ `${t('apiTestDebug.wait')}${item.delay}` }} ms
</div>
<div v-else class="flex items-center">
{{ t(conditionTypeNameMap[item.processorType]) }}
<div v-else class="flex min-w-[42px] items-center justify-between">
<div class="one-line-text"> {{ t(conditionTypeNameMap[item.processorType]) }}</div>
<a-badge
v-if="item.processorType === RequestConditionProcessor.REQUEST_SCRIPT"
class="ml-1 mt-[2px]"
class="ml-1 mt-[2px] min-w-[48px]"
:text="
item.beforeStepScript
? t('project.environmental.preOrPost.pre')
@ -123,6 +122,7 @@
{
label: 'common.delete',
eventTag: 'delete',
danger: true,
},
];

View File

@ -4,6 +4,7 @@
:width="960"
:title="t('apiTestDebug.quoteSource')"
:ok-disabled="selectedKey === ''"
:ok-text="t('common.apply')"
@confirm="handleConfirm"
>
<div class="mb-[16px] flex items-center justify-between">

View File

@ -234,8 +234,9 @@
* 响应状态码对应颜色
*/
const statusCodeColor = computed(() => {
if (activeStepDetail.value?.content?.requestResult) {
const code = Number(activeStepDetail.value?.content?.responseResult.responseCode);
debugger;
if (activeStepDetailCopy.value?.content) {
const code = Number(activeStepDetailCopy.value?.content?.responseResult.responseCode);
if (code >= 200 && code < 300) {
return 'rgb(var(--success-7)';
}

View File

@ -85,6 +85,7 @@ export default {
'apiTestDebug.parameters': 'Pass parameters',
'apiTestDebug.scriptContent': 'Script content',
'apiTestDebug.introduceSource': 'Introduce data sources',
'apiTestDebug.introduceSourceApplySuccess': 'apply Success',
'apiTestDebug.quoteSource': 'Reference data source',
'apiTestDebug.sourceList': 'Data source list',
'apiTestDebug.quoteSourcePlaceholder': 'Please select a data source',

View File

@ -81,6 +81,7 @@ export default {
'apiTestDebug.parameters': '传递参数',
'apiTestDebug.scriptContent': '脚本内容',
'apiTestDebug.introduceSource': '引入数据源',
'apiTestDebug.introduceSourceApplySuccess': '应用成功',
'apiTestDebug.quoteSource': '引用数据源',
'apiTestDebug.sourceList': '数据源列表',
'apiTestDebug.quoteSourcePlaceholder': '请选择数据源',

View File

@ -3,6 +3,10 @@
<!-- 报告参数开始 -->
<div class="report-header flex items-center justify-between">
<span>
<span v-if="route.query.shareId" class="font-medium"
>报告名称 <span>{{ detail.name }}</span>
<a-divider direction="vertical" :margin="4" class="!mx-2"></a-divider
></span>
<a-popover position="left" content-class="response-popover-content">
<span> {{ detail.environmentName || '-' }}</span>
<a-divider direction="vertical" :margin="4" class="!mx-2"></a-divider>
@ -62,11 +66,7 @@
<div class="request-analyze min-h-[110px]">
<div class="block-title mb-4">{{ t('report.detail.api.requestAnalysis') }}</div>
<!-- 独立报告 -->
<SetReportChart
:legend-data="legendData"
:options="charOptions"
:request-total="getIndicators(detail.requestTotal)"
/>
<SetReportChart :legend-data="legendData" :options="charOptions" :request-total="getIndicators(detail.total)" />
<!-- 集合报告 -->
<!-- </div> -->
</div>
@ -146,6 +146,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import dayjs from 'dayjs';
import SetReportChart from './case/setReportChart.vue';
@ -159,6 +160,8 @@
import { getIndicators } from '../utils';
const route = useRoute();
const { t } = useI18n();
const props = defineProps<{
detailInfo?: ReportDetail;

View File

@ -17,17 +17,25 @@
>
<template #titleRight="{ loading }">
<div class="rightButtons flex items-center">
<MsButton
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)]"
:disabled="loading"
:loading="shareLoading"
@click="shareHandler"
>
<MsIcon type="icon-icon_share1" class="mr-2 font-[16px]" />
{{ t('common.share') }}
</MsButton>
<a-dropdown position="br" @select="shareHandler">
<MsButton
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)]"
:disabled="loading"
:loading="shareLoading"
@click="shareHandler"
>
<MsIcon type="icon-icon_share1" class="mr-2 font-[16px]" />
{{ t('common.share') }}
</MsButton>
<template #content>
<a-doption>
<span>{{ t('report.detail.api.copyLink') }}</span
><span>{{ t('report.detail.api.copyLinkTimeEnd') }}</span>
</a-doption>
</template>
</a-dropdown>
<!-- <MsButton
type="icon"
status="secondary"

View File

@ -17,17 +17,25 @@
>
<template #titleRight="{ loading }">
<div class="rightButtons flex items-center">
<MsButton
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)]"
:disabled="loading"
:loading="shareLoading"
@click="shareHandler"
>
<MsIcon type="icon-icon_share1" class="mr-2 font-[16px]" />
{{ t('common.share') }}
</MsButton>
<a-dropdown position="br" @select="shareHandler">
<MsButton
type="icon"
status="secondary"
class="mr-4 !rounded-[var(--border-radius-small)]"
:disabled="loading"
:loading="shareLoading"
@click="shareHandler"
>
<MsIcon type="icon-icon_share1" class="mr-2 font-[16px]" />
{{ t('common.share') }}
</MsButton>
<template #content>
<a-doption>
<span>{{ t('report.detail.api.copyLink') }}</span
><span>{{ t('report.detail.api.copyLinkTimeEnd') }}</span>
</a-doption>
</template>
</a-dropdown>
<!-- TODO 这个版本不上导出 -->
<!-- <MsButton
type="icon"

View File

@ -269,7 +269,7 @@
x: '100%',
},
showSetting: true,
selectable: true,
selectable: hasAnyPermission(['PROJECT_API_REPORT:READ+DELETE', 'PROJECT_API_REPORT:READ']),
heightUsed: 330,
showSelectorAll: true,
},
@ -297,7 +297,7 @@
const tableBatchActions = {
baseAction: [
{
label: 'report.batch.delete',
label: 'common.delete',
eventTag: 'batchStop',
permission: ['PROJECT_API_REPORT:READ+DELETE'],
},

View File

@ -92,7 +92,7 @@
<div>{{ step.scriptIdentifier }}</div>
</template>
</a-popover>
<div v-show="step.children && step.children.length > 0" class="flex">
<div v-show="showStatus(step)" class="flex">
<span class="statusCode mx-2">
<div class="mr-2"> {{ t('report.detail.api.statusCode') }}</div>
<a-popover position="left" content-class="response-popover-content">
@ -282,6 +282,13 @@
}
return props.activeType === 'tab' && !item.fold;
}
function showStatus(item: ScenarioItemType) {
if (showApiType.value.includes(item.stepType)) {
return true;
}
return item.children && item.children.length > 0;
}
</script>
<style scoped lang="less">

View File

@ -75,4 +75,6 @@ export default {
'report.detail.api.executeEnv': 'Running environment',
'report.detail.api.reportCreator': 'Report creator',
'report.detail.api.runMode': 'Run mode',
'report.detail.api.copyLink': 'Copy link',
'report.detail.api.copyLinkTimeEnd': '(Valid 24 hours)',
};

View File

@ -74,4 +74,6 @@ export default {
'report.detail.api.executeEnv': '运行环境',
'report.detail.api.reportCreator': '报告创建人',
'report.detail.api.runMode': '运行模式',
'report.detail.api.copyLink': '复制链接',
'report.detail.api.copyLinkTimeEnd': '(24小时有效)',
};

View File

@ -29,6 +29,17 @@
/>
</div>
</template>
<template v-if="(keyword || '').trim() === ''" #empty>
<div class="flex w-full items-center justify-center text-[var(--color-text-4)]">
<span v-if="hasAnyPermission(['PROJECT_ENVIRONMENT:READ+UPDATE'])">{{
t('caseManagement.caseReview.tableNoData')
}}</span>
<span v-else>{{ t('caseManagement.featureCase.tableNoData') }}</span>
<MsButton v-permission="['PROJECT_ENVIRONMENT:READ+UPDATE']" class="ml-[8px]">
{{ t('project.environmental.database.addDatabase') }}
</MsButton>
</div>
</template>
</MsBaseTable>
<AddDatabaseModal
v-model:visible="addVisible"
@ -76,8 +87,8 @@
},
{
title: 'project.environmental.database.driver',
dataIndex: 'driverId',
slotName: 'driverId',
dataIndex: 'driver',
slotName: 'driver',
showDrag: true,
showInTable: true,
showTooltip: true,

View File

@ -71,6 +71,7 @@
class="w-[152px]"
mode="button"
:min="1"
:precision="0"
:default-value="1"
/>
</a-form-item>

View File

@ -110,7 +110,7 @@ export default {
'project.environmental.postScriptBefore': '后置脚本前',
'project.environmental.postScriptAfter': '后置脚本后',
'project.environmental.http.preTextPreTip': '前置脚本前,环境中脚本在请求的前置脚本执行前执行;',
'project.environmental.http.preTextPostTip': '前置脚本后,环境中脚本在请求的前置脚本执行后执行;',
'project.environmental.http.preTextPostTip': '前置脚本后,环境中脚本在请求的前置脚本执行后执行;',
'project.environmental.http.postTextPreTip': '后置脚本前,环境中脚本在请求的后置脚本执行前执行;',
'project.environmental.http.postTextPostTip': '后置脚本后,环境中脚本在请求的前置脚本执行后执行;',
'project.environmental.preOrPost.ignoreProtocols': '忽略请求:',