mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-10 21:23:36 +08:00
feat(项目设置): 应用管理同步缺陷对接form-create
This commit is contained in:
parent
af23997c9f
commit
ba9378fa29
@ -38,6 +38,6 @@ export function postValidate(data: any, pluginId: string) {
|
|||||||
export function configScript(pluginId: string) {
|
export function configScript(pluginId: string) {
|
||||||
return MSR.get({ url: ConfigServiceScriptUrl, params: pluginId });
|
return MSR.get({ url: ConfigServiceScriptUrl, params: pluginId });
|
||||||
}
|
}
|
||||||
export function getLogo(pluginId: string) {
|
export function getLogo(pluginId: string, params: { imagePath: string }) {
|
||||||
return MSR.get({ url: getLogoUrl, params: pluginId });
|
return MSR.get({ url: `${getLogoUrl}${pluginId}`, params, responseType: 'blob' }, { isReturnNativeResponse: true });
|
||||||
}
|
}
|
||||||
|
@ -5,4 +5,4 @@ export const ResetServiceUrl = '/service/integration/delete';
|
|||||||
export const GetValidateServiceUrl = '/service/integration/validate';
|
export const GetValidateServiceUrl = '/service/integration/validate';
|
||||||
export const PostValidateServiceUrl = '/service/integration/validate/';
|
export const PostValidateServiceUrl = '/service/integration/validate/';
|
||||||
export const ConfigServiceScriptUrl = '/service/integration/script';
|
export const ConfigServiceScriptUrl = '/service/integration/script';
|
||||||
export const getLogoUrl = '/plugin/image';
|
export const getLogoUrl = '/plugin/image/';
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
{{ null }}
|
{{ null }}
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<img class="h-[247px] w-[398px]" :src="props.instructionsIcon" />
|
<img
|
||||||
|
class="h-[247px] w-[398px]"
|
||||||
|
:style="{
|
||||||
|
border: '1px solid red',
|
||||||
|
}"
|
||||||
|
:src="previewIcon"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<span class="cursor-pointer text-[rgb(var(--primary-5))]">{{ t('project.menu.preview') }}</span>
|
<span class="cursor-pointer text-[rgb(var(--primary-5))]">{{ t('project.menu.preview') }}</span>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
@ -20,6 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { getLogo } from '@/api/modules/setting/serviceIntegration';
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
|
|
||||||
const attrs = useAttrs();
|
const attrs = useAttrs();
|
||||||
@ -28,11 +35,21 @@
|
|||||||
modelValue: string;
|
modelValue: string;
|
||||||
instructionsIcon: string;
|
instructionsIcon: string;
|
||||||
}>();
|
}>();
|
||||||
|
const previewIcon = ref<string>('');
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'update:modelValue', value: string): void;
|
(event: 'update:modelValue', value: string): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
onMounted(() => {
|
||||||
|
const pluginId = sessionStorage.getItem('platformKey');
|
||||||
|
if (!props.instructionsIcon || !pluginId) return;
|
||||||
|
getLogo(pluginId, { imagePath: props.instructionsIcon }).then((res) => {
|
||||||
|
const { data } = res;
|
||||||
|
previewIcon.value = URL.createObjectURL(new Blob([data]));
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
@ -158,8 +158,7 @@ export const JIRAKEY = {
|
|||||||
title: '',
|
title: '',
|
||||||
value: '',
|
value: '',
|
||||||
props: {
|
props: {
|
||||||
moduleValue: '',
|
modelValue: '',
|
||||||
placeholder: t('formCreate.PleaseEnter'),
|
|
||||||
instructionsIcon: '',
|
instructionsIcon: '',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<a-form ref="formRef" class="rounded-[4px]" :model="form" layout="vertical">
|
<a-form ref="formRef" class="rounded-[4px]" :model="form" layout="vertical">
|
||||||
<a-form-item field="platformKey" :label="t('project.menu.platformLabel')">
|
<a-form-item field="platformKey" :label="t('project.menu.platformLabel')">
|
||||||
<a-select
|
<a-select
|
||||||
v-model="form.platformKey"
|
v-model="form.PLATFORM_KEY"
|
||||||
allow-clear
|
allow-clear
|
||||||
:disabled="platformDisabled"
|
:disabled="platformDisabled"
|
||||||
:options="platformOption"
|
:options="platformOption"
|
||||||
@ -29,6 +29,7 @@
|
|||||||
<!-- form-create -->
|
<!-- form-create -->
|
||||||
<MsFormCreate
|
<MsFormCreate
|
||||||
v-if="platformRules && platformRules.length"
|
v-if="platformRules && platformRules.length"
|
||||||
|
v-model:api="fApi"
|
||||||
:form-rule="platformRules"
|
:form-rule="platformRules"
|
||||||
:form-create-key="FormCreateKeyEnum.PROJECT_DEFECT_SYNC_TEMPLATE"
|
:form-create-key="FormCreateKeyEnum.PROJECT_DEFECT_SYNC_TEMPLATE"
|
||||||
/>
|
/>
|
||||||
@ -76,9 +77,12 @@
|
|||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<template #footerLeft>
|
<template v-if="platformOption.length" #footerLeft>
|
||||||
<div class="flex flex-row items-center gap-[4px]">
|
<div class="flex flex-row items-center gap-[4px]">
|
||||||
<a-switch size="small" />
|
<a-tooltip v-if="okDisabled" :content="t('project.menu.defect.enableAfterConfig')">
|
||||||
|
<a-switch size="small" disabled />
|
||||||
|
</a-tooltip>
|
||||||
|
<a-switch v-else v-model="form.SYNC_ENABLE" size="small" />
|
||||||
<span class="text-[var(--color-text-1)]">
|
<span class="text-[var(--color-text-1)]">
|
||||||
{{ t('project.menu.status') }}
|
{{ t('project.menu.status') }}
|
||||||
</span>
|
</span>
|
||||||
@ -99,7 +103,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { FormInstance, Message, ValidatedError } from '@arco-design/web-vue';
|
import { FormInstance, Message } from '@arco-design/web-vue';
|
||||||
|
|
||||||
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
|
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
|
||||||
import MsFormCreate from '@/components/pure/ms-form-create/form-create.vue';
|
import MsFormCreate from '@/components/pure/ms-form-create/form-create.vue';
|
||||||
@ -124,10 +128,10 @@
|
|||||||
const currentVisible = ref<boolean>(props.visible);
|
const currentVisible = ref<boolean>(props.visible);
|
||||||
const platformOption = ref<PoolOption[]>([]);
|
const platformOption = ref<PoolOption[]>([]);
|
||||||
const frequencyOption = ref([
|
const frequencyOption = ref([
|
||||||
{ label: '0 0 0/1 * * ?', extra: '(每隔1小时)', value: '1H' },
|
{ label: '0 0 0/1 * * ?', extra: '(每隔1小时)', value: '0 0 0/1 * * ?' },
|
||||||
{ label: '0 0 0/6 * * ?', extra: '(每隔6小时)', value: '6H' },
|
{ label: '0 0 0/6 * * ?', extra: '(每隔6小时)', value: '0 0 0/6 * * ?' },
|
||||||
{ label: '0 0 0/12 * * ?', extra: '(每隔12小时)', value: '12H' },
|
{ label: '0 0 0/12 * * ?', extra: '(每隔12小时)', value: '0 0 0/12 * * ?' },
|
||||||
{ label: '0 0 0 * * ?', extra: '(每隔一天)', value: '1D' },
|
{ label: '0 0 0 * * ?', extra: '(每隔一天)', value: '0 0 0 * * ?' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
@ -140,18 +144,14 @@
|
|||||||
const platformRules = ref<FormItem[]>([]);
|
const platformRules = ref<FormItem[]>([]);
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
platformKey: '',
|
PLATFORM_KEY: '',
|
||||||
MECHANISM: '', // 同步机制
|
MECHANISM: 'increment', // 同步机制
|
||||||
SYNC_ENABLE: 'false', // 同步开关
|
SYNC_ENABLE: 'false', // 同步开关
|
||||||
CRON_EXPRESSION: '', // 同步频率
|
CRON_EXPRESSION: '0 0 0/1 * * ?', // 同步频率
|
||||||
organizationId: '',
|
|
||||||
projectKey: '',
|
|
||||||
projectId: '',
|
|
||||||
azureId: '',
|
|
||||||
bugType: '',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const okDisabled = computed(() => !form.platformKey);
|
const okDisabled = computed(() => !form.PLATFORM_KEY);
|
||||||
|
const fApi = ref<any>({});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'cancel', shouldSearch: boolean): void;
|
(e: 'cancel', shouldSearch: boolean): void;
|
||||||
@ -159,12 +159,15 @@
|
|||||||
|
|
||||||
const handleCancel = (shouldSearch: boolean) => {
|
const handleCancel = (shouldSearch: boolean) => {
|
||||||
emit('cancel', shouldSearch);
|
emit('cancel', shouldSearch);
|
||||||
|
sessionStorage.removeItem('platformKey');
|
||||||
|
fApi.value.clearValidateState();
|
||||||
};
|
};
|
||||||
const handlePlatformChange = async (value: SelectValue) => {
|
const handlePlatformChange = async (value: SelectValue) => {
|
||||||
try {
|
try {
|
||||||
if (value) {
|
if (value) {
|
||||||
const res = await getPlatformInfo(value as string, MenuEnum.bugManagement);
|
const res = await getPlatformInfo(value as string, MenuEnum.bugManagement);
|
||||||
platformRules.value = res.formItems;
|
platformRules.value = res.formItems;
|
||||||
|
sessionStorage.setItem('platformKey', value as string);
|
||||||
} else {
|
} else {
|
||||||
platformRules.value = [];
|
platformRules.value = [];
|
||||||
}
|
}
|
||||||
@ -175,13 +178,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
await formRef.value?.validate(async (errors: undefined | Record<string, ValidatedError>) => {
|
await fApi.value?.submit(async (formData: FormData) => {
|
||||||
if (errors) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
okLoading.value = true;
|
okLoading.value = true;
|
||||||
await postSaveDefectSync(form, currentProjectId.value);
|
await postSaveDefectSync({ ...form, BUG_PLATFORM_CONFIG: formData }, currentProjectId.value);
|
||||||
Message.success(t('common.createSuccess'));
|
Message.success(t('common.createSuccess'));
|
||||||
handleCancel(true);
|
handleCancel(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -67,6 +67,8 @@ export default {
|
|||||||
'project.menu.defect.enableTip': '开启:平台创建的缺陷同步至第三方项目管理平台',
|
'project.menu.defect.enableTip': '开启:平台创建的缺陷同步至第三方项目管理平台',
|
||||||
'project.menu.defect.closeTip': '关闭:平台创建的缺陷则无法同步至第三方项目管理平台',
|
'project.menu.defect.closeTip': '关闭:平台创建的缺陷则无法同步至第三方项目管理平台',
|
||||||
'project.menu.defect.customLabel': '自定义频率',
|
'project.menu.defect.customLabel': '自定义频率',
|
||||||
|
'project.menu.defect.enableAfterConfig': '配置第三方信息后可开启',
|
||||||
|
// 误报规则
|
||||||
'project.menu.rule.name': '名称',
|
'project.menu.rule.name': '名称',
|
||||||
'project.menu.rule.enable': '状态',
|
'project.menu.rule.enable': '状态',
|
||||||
'project.menu.rule.label': '标签',
|
'project.menu.rule.label': '标签',
|
||||||
|
Loading…
Reference in New Issue
Block a user