feat: 资源池-编辑

This commit is contained in:
baiqi 2023-07-19 13:43:14 +08:00 committed by rubylliu
parent aaf949113e
commit 08edab0974
2 changed files with 16 additions and 8 deletions

View File

@ -18,14 +18,14 @@
const props = defineProps<{ const props = defineProps<{
visible: boolean; visible: boolean;
value: string; value: string | null;
}>(); }>();
const emit = defineEmits(['update:value', 'update:visible']); const emit = defineEmits(['update:value', 'update:visible']);
const { t } = useI18n(); const { t } = useI18n();
const showJobDrawer = ref(props.visible); const showJobDrawer = ref(props.visible);
const jobDefinition = ref(props.value); const jobDefinition = ref(props.value || '');
watch( watch(
() => props.visible, () => props.visible,

View File

@ -173,7 +173,7 @@
v-show="form.addType === 'single'" v-show="form.addType === 'single'"
ref="batchFormRef" ref="batchFormRef"
:models="batchFormModels" :models="batchFormModels"
:form-mode="isEdit ? 'edit' : 'create'" form-mode="create"
add-text="system.resourcePool.addResource" add-text="system.resourcePool.addResource"
:default-vals="defaultVals" :default-vals="defaultVals"
max-height="250px" max-height="250px"
@ -402,11 +402,19 @@
try { try {
loading.value = true; loading.value = true;
const res = await getPoolInfo(route.query.id); const res = await getPoolInfo(route.query.id);
const { testResourceDTO } = res;
const { girdConcurrentNumber, podThreads, concurrentNumber } = testResourceDTO;
form.value = { form.value = {
...res, ...res,
addType: 'single', addType: 'single',
orgType: res.allOrg ? 'allOrg' : 'set', orgType: res.allOrg ? 'allOrg' : 'set',
use: [res.loadTest ? 'performance' : '', res.apiTest ? 'API' : '', res.uiTest ? 'UI' : ''].filter((e) => e), use: [res.loadTest ? 'performance' : '', res.apiTest ? 'API' : '', res.uiTest ? 'UI' : ''].filter((e) => e),
testResourceDTO: {
...testResourceDTO,
girdConcurrentNumber: girdConcurrentNumber || 1,
podThreads: podThreads || 1,
concurrentNumber: concurrentNumber || 1,
},
}; };
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@ -464,10 +472,10 @@
// K8S // K8S
const isShowK8SResources = computed(() => form.value.type === 'Kubernetes' && isShowTypeItem.value); const isShowK8SResources = computed(() => form.value.type === 'Kubernetes' && isShowTypeItem.value);
// //
const isFillNameSpaces = computed(() => form.value.testResourceDTO.nameSpaces.trim() !== ''); const isFillNameSpaces = computed(() => form.value.testResourceDTO.nameSpaces?.trim() !== '');
// Deploy Name // Deploy Name
const isFillNameSpacesAndDeployName = computed( const isFillNameSpacesAndDeployName = computed(
() => isFillNameSpaces.value && form.value.testResourceDTO.deployName.trim() !== '' () => isFillNameSpaces.value && form.value.testResourceDTO.deployName?.trim() !== ''
); );
const batchFormRef = ref<MsBatchFormInstance | null>(null); const batchFormRef = ref<MsBatchFormInstance | null>(null);
@ -564,11 +572,11 @@
monitor: line[2], monitor: line[2],
concurrentNumber: Number(line[3]), concurrentNumber: Number(line[3]),
}; };
if (form.value.testResourceDTO.nodesList.length === 0) { if (i === 0) {
// concurrentNumber // concurrentNumber
form.value.testResourceDTO.nodesList.push(item);
} else {
form.value.testResourceDTO.nodesList = [item]; form.value.testResourceDTO.nodesList = [item];
} else {
form.value.testResourceDTO.nodesList.push(item);
} }
} }
} }