fix(系统设置): 添加资源池和组织项目企业版试用tooltip

This commit is contained in:
xinxin.wu 2024-05-29 17:28:09 +08:00 committed by Craftsman
parent 09b96404d2
commit cd83354545
10 changed files with 115 additions and 24 deletions

View File

@ -66,17 +66,27 @@
allow-clear
@change="emit('change')"
/>
<a-input-number
v-else-if="model.type === 'inputNumber'"
v-model:model-value="element[model.filed]"
class="flex-1"
:placeholder="t(model.placeholder || '')"
:min="model.min"
:max="model.max || 9999999"
model-event="input"
allow-clear
@change="emit('change')"
/>
<a-tooltip v-else-if="model.type === 'inputNumber'" position="tl" mini :disabled="!model.tooltip">
<a-input-number
v-if="model.type === 'inputNumber'"
v-model:model-value="element[model.filed]"
class="flex-1"
:placeholder="t(model.placeholder || '')"
:min="model.min"
:max="model.max || 9999999"
model-event="input"
allow-clear
@change="emit('change')"
/>
<template #content>
<div>
{{ model?.tooltip }}
<span class="ml-2 inline-block cursor-pointer text-[rgb(var(--primary-4))]" @click="goTry">
{{ t('system.authorized.applyTrial') }}
</span>
</div>
</template>
</a-tooltip>
<MsTagsInput
v-else-if="model.type === 'tagInput'"
v-model:model-value="element[model.filed]"
@ -163,12 +173,22 @@
</VueDraggable>
</a-scrollbar>
<div v-if="props.formMode === 'create' && !props.hideAdd" class="w-full">
<a-button class="px-0" type="text" @click="addField">
<template #icon>
<icon-plus class="text-[14px]" />
<a-tooltip position="tl" mini :disabled="!props.addToolTip">
<a-button class="px-0" type="text" @click="addField">
<template #icon>
<icon-plus class="text-[14px]" />
</template>
{{ t(props.addText) }}
</a-button>
<template #content>
<div>
{{ props.addToolTip }}
<span class="ml-2 inline-block cursor-pointer text-[rgb(var(--primary-4))]" @click="goTry">
{{ t('system.authorized.applyTrial') }}
</span>
</div>
</template>
{{ t(props.addText) }}
</a-button>
</a-tooltip>
</div>
</div>
</a-form>
@ -200,6 +220,7 @@
formWidth?: string; //
showEnable?: boolean; // switch
hideAdd?: boolean; //
addToolTip?: string;
}>(),
{
maxHeight: '30vh',
@ -318,6 +339,10 @@
formRef.value?.setFields(data);
}
function goTry() {
window.open('https://jinshuju.net/f/CzzAOe', '_blank');
}
defineExpose({
formValidate,
getFormResult,

View File

@ -25,4 +25,5 @@ export interface FormItemModel {
className?: string; // 自定义样式
defaultValue?: string | string[] | number | number[] | boolean; // 默认值
hasRedStar?: boolean; // 是否有红星
tooltip?: string;
}

View File

@ -0,0 +1,33 @@
<template>
<div v-if="!licenseStore.hasLicense()" class="mb-2">
<a-alert type="warning">
<div class="flex items-center">
{{ props.tipContent }}
<MsButton class="ml-2" type="text" @click="goTry">
{{ t('system.authorized.applyTrial') }}
</MsButton>
</div>
</a-alert>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import MsButton from '@/components/pure/ms-button/index.vue';
import { useI18n } from '@/hooks/useI18n';
import useLicenseStore from '@/store/modules/setting/license';
const licenseStore = useLicenseStore();
const { t } = useI18n();
const props = defineProps<{
tipContent: string;
}>();
function goTry() {
window.open('https://jinshuju.net/f/CzzAOe', '_blank');
}
</script>
<style scoped></style>

View File

@ -19,4 +19,9 @@ export default {
'The remaining {day} of system authorization expires. In order not to affect your use, please contact the staff as soon as possible',
'system.authorized.LicenseExpirationPromptGreaterThanThirty':
'System authorization has expired, if you need help, please contact the working staff',
'system.authorized.resourcePoolTipContent':
'The community edition only supports 1 resource pool, if you need to add more resource pools, you can apply',
'system.authorized.orgAndProTipContent':
'The community edition only supports 1 organization, if you want to add more organizations, you can apply',
'system.authorized.applyTrial': 'Enterprise trial',
};

View File

@ -18,4 +18,7 @@ export default {
'system.authorized.LicenseExpirationPromptLessThanThirty':
'系统授权剩余 {day} 天到期,为了不影响您的使用,请尽快联系工作人员',
'system.authorized.LicenseExpirationPromptGreaterThanThirty': '系统授权已过期,如需帮助,请联系工作人员',
'system.authorized.resourcePoolTipContent': '社区版仅支持 1 个资源池,如需添加更多资源池,可申请',
'system.authorized.orgAndProTipContent': '社区版仅支持 1 个组织,如需添加更多组织,可申请',
'system.authorized.applyTrial': '企业版试用',
};

View File

@ -1,5 +1,6 @@
<template>
<MsCard simple>
<MsTrialAlert :tip-content="t('system.authorized.orgAndProTipContent')" />
<div class="mb-4 flex items-center justify-between">
<div>
<a-button
@ -48,6 +49,7 @@
import { nextTick, onBeforeMount, ref, watch } from 'vue';
import MsCard from '@/components/pure/ms-card/index.vue';
import MsTrialAlert from '@/components/business/ms-trial-alert/index.vue';
import AddOrganizationModal from './components/addOrganizationModal.vue';
import AddProjectModal from './components/addProjectModal.vue';
import SystemOrganization from './components/systemOrganization.vue';

View File

@ -157,17 +157,19 @@
</a-radio-group>
</a-form-item>
<template v-if="isShowNodeResources">
<a-form-item field="addType" class="form-item">
<a-form-item
field="addType"
class="form-item"
:content-class="licenseStore.hasLicense() ? `min-h-[16px] mb-0` : ''"
>
<template #label>
<div class="flex items-center">
{{ t('system.resourcePool.addResource') }}
<a-tooltip :content="t('system.resourcePool.changeAddTypeTip')" 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-popconfirm
v-if="!getIsVisited()"
v-xpack
class="ms-pop-confirm--hidden-cancel"
position="bl"
popup-container="#typeRadioGroupRef"
@ -185,16 +187,26 @@
{{ t('system.resourcePool.changeAddTypeTip') }}
</div>
</template>
<div id="typeRadioGroupRef" class="relative">
<div id="typeRadioGroupRef" v-xpack class="relative">
<a-radio-group v-model:model-value="form.addType" type="button" @change="handleTypeChange">
<a-radio value="single">{{ t('system.resourcePool.singleAdd') }}</a-radio>
<a-radio v-xpack value="multiple">{{ t('system.resourcePool.batchAdd') }}</a-radio>
<a-radio v-xpack value="multiple">
<a-tooltip :content="t('system.resourcePool.changeAddTypeTip')" position="tl" mini
><div>{{ t('system.resourcePool.batchAdd') }}</div></a-tooltip
></a-radio
>
</a-radio-group>
</div>
</a-popconfirm>
<a-radio-group v-else v-model:model-value="form.addType" type="button" @change="handleTypeChange">
<a-radio-group v-model:model-value="form.addType" v-xpack type="button" @change="handleTypeChange">
<a-radio value="single">{{ t('system.resourcePool.singleAdd') }}</a-radio>
<a-radio v-xpack value="multiple">{{ t('system.resourcePool.batchAdd') }}</a-radio>
<a-radio v-xpack value="multiple">
<a-tooltip :content="t('system.resourcePool.changeAddTypeTip')" position="tl" mini
><span>
{{ t('system.resourcePool.batchAdd') }}
</span></a-tooltip
></a-radio
>
</a-radio-group>
</a-form-item>
<MsBatchForm
@ -206,6 +218,7 @@
:default-vals="defaultVals"
:hide-add="!isXpack"
max-height="250px"
:add-tool-tip="licenseStore.hasLicense() ? '' : t('system.resourcePool.supportMultiResource')"
@change="() => setIsSave(false)"
></MsBatchForm>
<!-- TODO:代码编辑器懒加载 -->
@ -595,6 +608,7 @@
placeholder: 'system.resourcePool.concurrentNumberPlaceholder',
min: 1,
max: maxConcurrentNumber.value,
tooltip: licenseStore.hasLicense() ? '' : t('system.resourcePool.concurrentNumberMinToolTip'),
},
]);

View File

@ -1,5 +1,6 @@
<template>
<MsCard :loading="loading" simple>
<MsTrialAlert :tip-content="t('system.authorized.resourcePoolTipContent')" />
<div class="mb-4 flex items-center justify-between">
<a-button v-permission="['SYSTEM_TEST_RESOURCE_POOL:READ+ADD']" v-xpack type="primary" @click="addPool">
{{ t('system.resourcePool.createPool') }}
@ -89,6 +90,7 @@
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import type { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import { TagType, Theme } from '@/components/pure/ms-tag/ms-tag.vue';
import MsTrialAlert from '@/components/business/ms-trial-alert/index.vue';
import JobTemplateDrawer from './components/jobTemplateDrawer.vue';
import { delPoolInfo, getPoolInfo, getPoolList, togglePoolStatus } from '@/api/modules/setting/resourcePool';

View File

@ -123,4 +123,8 @@ export default {
'system.resourcePool.atLeastOnePool': 'Reserve at least one resource pool',
'system.resourcePool.add': 'Add',
'system.resourcePool.addAndContinue': 'Save and continue adding',
'system.resourcePool.supportMultiResource':
'The community edition only supports 1 resource, if you need to add more resources, you can apply',
'system.resourcePool.concurrentNumberMinToolTip':
'The maximum number of concurrent requests for a single node in the Community version is 10. If you want more, you can apply',
};

View File

@ -117,4 +117,6 @@ export default {
'system.resourcePool.atLeastOnePool': '至少保留一个资源池',
'system.resourcePool.add': '添加',
'system.resourcePool.addAndContinue': '保存并继续添加',
'system.resourcePool.supportMultiResource': '社区版仅支持 1 个资源,如需添加更多资源,可申请',
'system.resourcePool.concurrentNumberMinToolTip': '社区版单个节点最大并发数为 10如需更大并发数可申请',
};