feat(资源池): 资源池增加k8s配置

This commit is contained in:
baiqi 2024-10-14 11:21:56 +08:00 committed by Craftsman
parent 60a7acd9d2
commit 6a75f21754
3 changed files with 46 additions and 42 deletions

View File

@ -149,30 +149,19 @@
</a-form-item> </a-form-item>
</template> --> </template> -->
<!-- <a-form-item v-if="isShowTypeItem" :label="t('system.resourcePool.type')" field="type" class="form-item"> <a-form-item v-if="isShowTypeItem" :label="t('system.resourcePool.type')" field="type" class="form-item">
<a-radio-group v-model:model-value="form.type" type="button" @change="changeResourceType"> <a-radio-group v-model:model-value="form.type" type="button" @change="changeResourceType">
<a-radio value="Node">Node</a-radio> <a-radio value="Node">Node</a-radio>
<a-radio v-xpack value="Kubernetes">Kubernetes</a-radio> <a-radio v-xpack value="Kubernetes">Kubernetes</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> --> </a-form-item>
<template v-if="isShowNodeResources"> <template v-if="isShowNodeResources">
<div <div
class="mb-[8px] flex w-full items-center justify-between" class="mb-[8px] flex w-full items-center justify-between"
:class="`${licenseStore.hasLicense() ? '' : 'has-license-class'} form-item !w-full`" :class="`${licenseStore.hasLicense() ? '' : 'has-license-class'} form-item !w-full`"
> >
{{ t('system.resourcePool.addResource') }} {{ t('system.resourcePool.addResource') }}
<MsButton <a-popconfirm
type="text"
@click="
() => {
form.addType = form.addType === 'single' ? 'multiple' : 'single';
handleTypeChange(form.addType);
}
"
>
{{ form.addType === 'single' ? t('system.resourcePool.batchAdd') : t('system.resourcePool.singleAdd') }}
</MsButton>
<!-- <a-popconfirm
v-if="!getIsVisited()" v-if="!getIsVisited()"
v-xpack v-xpack
class="ms-pop-confirm--hidden-cancel" class="ms-pop-confirm--hidden-cancel"
@ -212,7 +201,7 @@
</span> </span>
</a-tooltip> </a-tooltip>
</a-radio> </a-radio>
</a-radio-group> --> </a-radio-group>
</div> </div>
<MsBatchForm <MsBatchForm
v-show="form.addType === 'single'" v-show="form.addType === 'single'"
@ -333,11 +322,15 @@
</span> </span>
</a-tooltip> </a-tooltip>
</a-form-item> </a-form-item>
<a-form-item <a-form-item field="testResourceDTO.concurrentNumber" class="form-item">
:label="t('system.resourcePool.testResourceDTO.concurrentNumber')" <template #label>
field="testResourceDTO.concurrentNumber" <div class="flex items-center gap-[4px]">
class="form-item" <div>{{ t('system.resourcePool.testResourceDTO.concurrentNumber') }}</div>
> <a-tooltip :content="t('system.resourcePool.concurrentNumberTip')" position="tl" mini>
<icon-question-circle class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-6))]" />
</a-tooltip>
</div>
</template>
<a-input-number <a-input-number
v-model:model-value="form.testResourceDTO.concurrentNumber" v-model:model-value="form.testResourceDTO.concurrentNumber"
:min="1" :min="1"
@ -349,11 +342,15 @@
@change="() => setIsSave(false)" @change="() => setIsSave(false)"
></a-input-number> ></a-input-number>
</a-form-item> </a-form-item>
<a-form-item <a-form-item field="testResourceDTO.podThreads" class="form-item">
:label="t('system.resourcePool.testResourceDTO.podThreads')" <template #label>
field="testResourceDTO.podThreads" <div class="flex items-center gap-[4px]">
class="form-item" <div>{{ t('system.resourcePool.testResourceDTO.podThreads') }}</div>
> <a-tooltip :content="t('system.resourcePool.testResourceDTO.podThreadsTip')" position="tl" mini>
<icon-question-circle class="ml-[4px] text-[var(--color-text-4)] hover:text-[rgb(var(--primary-6))]" />
</a-tooltip>
</div>
</template>
<a-input-number <a-input-number
v-model:model-value="form.testResourceDTO.podThreads" v-model:model-value="form.testResourceDTO.podThreads"
:min="1" :min="1"
@ -398,6 +395,7 @@
import { addPool, getPoolInfo, updatePoolInfo } from '@/api/modules/setting/resourcePool'; import { addPool, getPoolInfo, updatePoolInfo } from '@/api/modules/setting/resourcePool';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useLeaveUnSaveTip from '@/hooks/useLeaveUnSaveTip'; import useLeaveUnSaveTip from '@/hooks/useLeaveUnSaveTip';
import useVisit from '@/hooks/useVisit';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useLicenseStore from '@/store/modules/setting/license'; import useLicenseStore from '@/store/modules/setting/license';
import { downloadStringFile, sleep } from '@/utils'; import { downloadStringFile, sleep } from '@/utils';
@ -544,18 +542,18 @@
// form.value.testResourceDTO.loadTestHeap = defaultHeap; // form.value.testResourceDTO.loadTestHeap = defaultHeap;
// } // }
// const visitedKey = 'changeAddResourceType'; const visitedKey = 'changeAddResourceType';
// const { addVisited, getIsVisited } = useVisit(visitedKey); const { addVisited, getIsVisited } = useVisit(visitedKey);
// /** /**
// * 访 * 切换类型提示确认框隐藏时设置已访问标
// * @param visible / * @param visible 显示/
// */ */
// function handlePopChange(visible: boolean) { function handlePopChange(visible: boolean) {
// if (!visible) { if (!visible) {
// addVisited(); addVisited();
// } }
// } }
/** /**
* 控制表单项显示隐藏逻辑计算器 * 控制表单项显示隐藏逻辑计算器
@ -725,12 +723,12 @@
setIsSave(false); setIsSave(false);
} }
// function changeResourceType(val: string | number | boolean) { function changeResourceType(val: string | number | boolean) {
// if (val === 'Kubernetes') { if (val === 'Kubernetes') {
// setBatchFormRes(); setBatchFormRes();
// } }
// setIsSave(false); setIsSave(false);
// } }
/** /**
* 下载 yaml 文件 * 下载 yaml 文件

View File

@ -86,6 +86,8 @@ export default {
'system.resourcePool.concurrentNumberRequired': 'Please enter the maximum number of concurrency', 'system.resourcePool.concurrentNumberRequired': 'Please enter the maximum number of concurrency',
'system.resourcePool.concurrentNumberMin': 'The maximum concurrent number must be greater than or equal to 1', 'system.resourcePool.concurrentNumberMin': 'The maximum concurrent number must be greater than or equal to 1',
'system.resourcePool.concurrentNumberPlaceholder': 'Please enter the maximum number of concurrency', 'system.resourcePool.concurrentNumberPlaceholder': 'Please enter the maximum number of concurrency',
'system.resourcePool.concurrentNumberTip':
'The maximum number of concurrent users for a single node in the community version is 10. If you need a higher number of concurrent users, you can apply for a trial of the enterprise version.',
'system.resourcePool.nodeResourceRequired': 'Please fill in the Node resources added in batches correctly', 'system.resourcePool.nodeResourceRequired': 'Please fill in the Node resources added in batches correctly',
'system.resourcePool.nodeConfigEditorTip': 'system.resourcePool.nodeConfigEditorTip':
'Writing format: IP, Port, maximum concurrent number; such as 192.168.1.52,8082,10,3', 'Writing format: IP, Port, maximum concurrent number; such as 192.168.1.52,8082,10,3',
@ -109,6 +111,8 @@ export default {
'system.resourcePool.testResourceDTO.apiTestImagePlaceholder': 'Please fill in the API image', 'system.resourcePool.testResourceDTO.apiTestImagePlaceholder': 'Please fill in the API image',
'system.resourcePool.testResourceDTO.concurrentNumber': 'Maximum concurrency', 'system.resourcePool.testResourceDTO.concurrentNumber': 'Maximum concurrency',
'system.resourcePool.testResourceDTO.podThreads': 'Maximum number of threads per Pod', 'system.resourcePool.testResourceDTO.podThreads': 'Maximum number of threads per Pod',
'system.resourcePool.testResourceDTO.podThreadsTip':
'The maximum number of concurrent tasks for the community version is 3. If you need a higher number of concurrent tasks, you can apply for a trial of the enterprise version.',
'system.resourcePool.testResourceDTO.downloadRoleYaml': 'Download YAML files', 'system.resourcePool.testResourceDTO.downloadRoleYaml': 'Download YAML files',
'system.resourcePool.testResourceDTO.downloadRoleYamlTip': 'system.resourcePool.testResourceDTO.downloadRoleYamlTip':
'Please fill in the namespace before downloading the YAML file', 'Please fill in the namespace before downloading the YAML file',

View File

@ -83,6 +83,7 @@ export default {
'system.resourcePool.concurrentNumberRequired': '最大并发数不能为空', 'system.resourcePool.concurrentNumberRequired': '最大并发数不能为空',
'system.resourcePool.concurrentNumberMin': '最大并发数须大于等于 1', 'system.resourcePool.concurrentNumberMin': '最大并发数须大于等于 1',
'system.resourcePool.concurrentNumberPlaceholder': '请输入最大并发数', 'system.resourcePool.concurrentNumberPlaceholder': '请输入最大并发数',
'system.resourcePool.concurrentNumberTip': '社区版单个节点最大并发数为 10如需更大并发数 可申请企业版试用',
'system.resourcePool.nodeResourceRequired': '请正确填写批量添加的 Node 资源', 'system.resourcePool.nodeResourceRequired': '请正确填写批量添加的 Node 资源',
'system.resourcePool.nodeConfigEditorTip': '书写格式IP,Port,最大并发数;如 192.168.1.52,8082,10,3', 'system.resourcePool.nodeConfigEditorTip': '书写格式IP,Port,最大并发数;如 192.168.1.52,8082,10,3',
'system.resourcePool.testResourceDTO.ip': 'IP 地址/域名', 'system.resourcePool.testResourceDTO.ip': 'IP 地址/域名',
@ -104,6 +105,7 @@ export default {
'system.resourcePool.testResourceDTO.apiTestImagePlaceholder': '请输入 API 镜像', 'system.resourcePool.testResourceDTO.apiTestImagePlaceholder': '请输入 API 镜像',
'system.resourcePool.testResourceDTO.concurrentNumber': '最大并发数', 'system.resourcePool.testResourceDTO.concurrentNumber': '最大并发数',
'system.resourcePool.testResourceDTO.podThreads': '单 Pod 最大线程数', 'system.resourcePool.testResourceDTO.podThreads': '单 Pod 最大线程数',
'system.resourcePool.testResourceDTO.podThreadsTip': '社区版单个任务最大并发数为 3如需更大并发数 可申请企业版试用',
'system.resourcePool.testResourceDTO.downloadRoleYaml': '下载 YAML 文件', 'system.resourcePool.testResourceDTO.downloadRoleYaml': '下载 YAML 文件',
'system.resourcePool.testResourceDTO.downloadRoleYamlTip': '请先填写命名空间再下载YAML文件', 'system.resourcePool.testResourceDTO.downloadRoleYamlTip': '请先填写命名空间再下载YAML文件',
'system.resourcePool.testResourceDTO.downloadDeployYamlTip': '请先填写命名空间 和 Deploy Name 再下载YAML文件', 'system.resourcePool.testResourceDTO.downloadDeployYamlTip': '请先填写命名空间 和 Deploy Name 再下载YAML文件',