Merge branch 'refs/heads/dev_1.0.0_beta4' into preview

This commit is contained in:
xlsea 2024-06-03 19:57:51 +08:00
commit f06d0c6e56
5 changed files with 53 additions and 36 deletions

View File

@ -91,7 +91,7 @@ const getGroupNameList = async () => {
getGroupNameList(); getGroupNameList();
const typeChange = (value: number) => { const typeChange = (value: number) => {
if (value === 1) { if (value === 3) {
form.value.triggerInterval = '* * * * * ?'; form.value.triggerInterval = '* * * * * ?';
} else if (value === 2) { } else if (value === 2) {
form.value.triggerInterval = 60; form.value.triggerInterval = 60;
@ -159,7 +159,7 @@ const rules: Record<RuleKey, FormItemRule> = {
<NFormItem path="triggerInterval" label="触发间隔"> <NFormItem path="triggerInterval" label="触发间隔">
<CronInput <CronInput
v-if="form.triggerType === 3" v-if="form.triggerType === 3"
v-model:value="form.triggerInterval" v-model="form.triggerInterval as string"
placeholder="请输入Cron表达式" placeholder="请输入Cron表达式"
/> />
<NInputNumber <NInputNumber

View File

@ -21,10 +21,11 @@ export function useRouterPush(inSetup = true) {
interface RouterPushOptions { interface RouterPushOptions {
query?: Record<string, string>; query?: Record<string, string>;
params?: Record<string, string>; params?: Record<string, string>;
state?: Record<string, string>;
} }
async function routerPushByKey(key: RouteKey, options?: RouterPushOptions) { async function routerPushByKey(key: RouteKey, options?: RouterPushOptions) {
const { query, params } = options || {}; const { query, params, state } = options || {};
const routeLocation: RouteLocationRaw = { const routeLocation: RouteLocationRaw = {
name: key name: key
@ -38,6 +39,10 @@ export function useRouterPush(inSetup = true) {
routeLocation.params = params; routeLocation.params = params;
} }
if (state) {
routeLocation.state = state;
}
return routerPush(routeLocation); return routerPush(routeLocation);
} }

View File

@ -77,20 +77,18 @@ const props = withDefaults(defineProps<Props>(), {
}) })
}); });
/** 卡片 key 类型, 与卡片的路由的 name 一致, 便于直接使用 routerPushByKey */
type KeyType = 'job_task' | 'retry_task' | 'workflow_task' | 'pods';
interface CardData { interface CardData {
key: KeyType; key: string;
title: string; title: string;
tip: string; tip: string;
value: number; value: number;
click?: () => void;
color: { color: {
start: string; start: string;
end: string; end: string;
}; };
icon: string; icon: string;
bottom: { label: string; value: number }[]; bottom: { label: string; value: number; click?: () => void }[];
} }
// eslint-disable-next-line complexity // eslint-disable-next-line complexity
@ -100,6 +98,7 @@ const cardData = computed<CardData[]>(() => [
title: $t('page.home.jobTask'), title: $t('page.home.jobTask'),
tip: $t('page.home.jobTaskTip'), tip: $t('page.home.jobTaskTip'),
value: props.modelValue?.jobTask.totalNum ?? 0, value: props.modelValue?.jobTask.totalNum ?? 0,
click: () => routerPushByKey('job_task'),
color: { color: {
start: '#f5b386', start: '#f5b386',
end: '#FFD6BA' end: '#FFD6BA'
@ -108,19 +107,23 @@ const cardData = computed<CardData[]>(() => [
bottom: [ bottom: [
{ {
label: $t('common.success'), label: $t('common.success'),
value: props.modelValue?.jobTask.successNum ?? 0 value: props.modelValue?.jobTask.successNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '3' } })
}, },
{ {
label: $t('common.fail'), label: $t('common.fail'),
value: props.modelValue?.jobTask.failNum ?? 0 value: props.modelValue?.jobTask.failNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '4' } })
}, },
{ {
label: $t('common.stop'), label: $t('common.stop'),
value: props.modelValue?.jobTask.stopNum ?? 0 value: props.modelValue?.jobTask.stopNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '5' } })
}, },
{ {
label: $t('common.cancel'), label: $t('common.cancel'),
value: props.modelValue?.jobTask.cancelNum ?? 0 value: props.modelValue?.jobTask.cancelNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '6' } })
} }
] ]
}, },
@ -129,6 +132,7 @@ const cardData = computed<CardData[]>(() => [
title: $t('page.home.retryTask'), title: $t('page.home.retryTask'),
tip: $t('page.home.retryTaskTip'), tip: $t('page.home.retryTaskTip'),
value: props.modelValue?.retryTask.totalNum ?? 0, value: props.modelValue?.retryTask.totalNum ?? 0,
click: () => routerPushByKey('retry_task'),
unit: '', unit: '',
color: { color: {
start: '#40e9c5', start: '#40e9c5',
@ -159,6 +163,7 @@ const cardData = computed<CardData[]>(() => [
title: $t('page.home.workflow'), title: $t('page.home.workflow'),
tip: $t('page.home.workflowTip'), tip: $t('page.home.workflowTip'),
value: props.modelValue?.workFlowTask.totalNum, value: props.modelValue?.workFlowTask.totalNum,
click: () => routerPushByKey('workflow_task'),
unit: '', unit: '',
color: { color: {
start: '#ec6f6f', start: '#ec6f6f',
@ -189,6 +194,7 @@ const cardData = computed<CardData[]>(() => [
title: $t('page.home.onlineServiceCount'), title: $t('page.home.onlineServiceCount'),
tip: $t('page.home.onlineServiceTip'), tip: $t('page.home.onlineServiceTip'),
value: props.modelValue?.onLineService.total ?? 0, value: props.modelValue?.onLineService.total ?? 0,
click: () => routerPushByKey('pods'),
unit: '', unit: '',
color: { color: {
start: '#b686d4', start: '#b686d4',
@ -234,27 +240,25 @@ function getGradientColor(color: CardData['color']) {
<NGrid :cols="gridCol" responsive="screen" :x-gap="16" :y-gap="16"> <NGrid :cols="gridCol" responsive="screen" :x-gap="16" :y-gap="16">
<NGi v-for="item in cardData" :key="item.key"> <NGi v-for="item in cardData" :key="item.key">
<NSpin :show="false"> <NSpin :show="false">
<GradientBg <GradientBg :gradient-color="getGradientColor(item.color)" class="h-165px flex-1">
:gradient-color="getGradientColor(item.color)" <div :class="item.click ? 'cursor-pointer' : null" @click="item.click">
class="h-165px flex-1 cursor-pointer" <div class="flex justify-between">
@click="routerPushByKey(item.key)" <div class="align-center flex">
> <SvgIcon :icon="item.icon" class="text-26px" />
<div class="flex justify-between"> <h3 class="ml-2 text-18px">{{ item.title }}</h3>
<div class="align-center flex"> </div>
<SvgIcon :icon="item.icon" class="text-26px" /> <NPopover trigger="hover">
<h3 class="ml-2 text-18px">{{ item.title }}</h3> <template #trigger>
<NButton text>
<SvgIcon icon="ant-design:info-circle-outlined" class="text-20px color-white" />
</NButton>
</template>
{{ item.tip }}
</NPopover>
</div>
<div class="flex">
<CountTo :start-value="0" :end-value="item.value" class="text-30px text-white" />
</div> </div>
<NPopover trigger="hover">
<template #trigger>
<NButton text>
<SvgIcon icon="ant-design:info-circle-outlined" class="text-20px color-white" />
</NButton>
</template>
{{ item.tip }}
</NPopover>
</div>
<div class="flex">
<CountTo :start-value="0" :end-value="item.value" class="text-30px text-white" />
</div> </div>
<NProgress <NProgress
v-if="item.key === 'job_task'" v-if="item.key === 'job_task'"
@ -279,8 +283,10 @@ function getGradientColor(color: CardData['color']) {
<NDivider /> <NDivider />
<template v-for="(bottomItem, bottomIndex) in item.bottom" :key="bottomIndex"> <template v-for="(bottomItem, bottomIndex) in item.bottom" :key="bottomIndex">
<NDivider v-if="bottomIndex !== 0" vertical /> <NDivider v-if="bottomIndex !== 0" vertical />
{{ bottomItem.label }} <span :class="bottomItem.click ? 'cursor-pointer' : null" @click="bottomItem.click">
<CountTo :start-value="0" :end-value="bottomItem.value" class="text-white" /> {{ bottomItem.label }}
<CountTo :start-value="0" :end-value="bottomItem.value" class="text-white" />
</span>
</template> </template>
</GradientBg> </GradientBg>
</NSpin> </NSpin>
@ -295,7 +301,7 @@ function getGradientColor(color: CardData['color']) {
} }
.n-divider--vertical { .n-divider--vertical {
margin: 0 1px 0 5px; margin: 0 5px 0 5px;
} }
:deep(.n-progress-icon--as-text) { :deep(.n-progress-icon--as-text) {

View File

@ -23,6 +23,12 @@ function reset() {
function search() { function search() {
emit('search'); emit('search');
} }
const taskBatchStatus = history.state.taskBatchStatus;
if (taskBatchStatus) {
model.value.taskBatchStatus = Number(taskBatchStatus) as Api.Common.TaskBatchStatus;
}
</script> </script>
<template> <template>

View File

@ -13,7 +13,7 @@ onMounted(() => {
}); });
const node = ref<Flow.NodeDataType>({ const node = ref<Flow.NodeDataType>({
workflowName: `Workflow ${new Date().getTime()}`, workflowName: `WF-${new Date().getTime()}`,
workflowStatus: 1, workflowStatus: 1,
blockStrategy: 1, blockStrategy: 1,
description: undefined, description: undefined,