Merge branch '1.2.0-beta2' into preview

This commit is contained in:
xlsea 2024-10-25 10:30:27 +08:00
commit 1e2974a7d8
11 changed files with 67 additions and 13 deletions

2
.env
View File

@ -4,7 +4,7 @@ VITE_APP_TITLE=Snail Job
VITE_APP_DESC=A flexible, reliable, and fast platform for distributed task retry and distributed task scheduling. VITE_APP_DESC=A flexible, reliable, and fast platform for distributed task retry and distributed task scheduling.
VITE_APP_VERSION=1.2.0-beta1 VITE_APP_VERSION=1.2.0-beta2
VITE_APP_DEFAULT_TOKEN=SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj VITE_APP_DEFAULT_TOKEN=SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj

View File

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { $t } from '@/locales'; import { $t } from '@/locales';
import { monthRange } from '@/utils/common'; import { dayRange, monthRange } from '@/utils/common';
defineOptions({ defineOptions({
name: 'DatetimeRange' name: 'DatetimeRange'
@ -13,6 +13,9 @@ const modelValue = defineModel<[string, string] | null>('value');
const createShortcuts = () => { const createShortcuts = () => {
const shortcuts: any = {}; const shortcuts: any = {};
shortcuts[$t('common.today')] = dayRange(1);
shortcuts[$t('common.lastWeek')] = dayRange(7);
shortcuts[$t('common.lastMonth')] = monthRange(1, 'month');
shortcuts[$t('common.currentMonth')] = monthRange(0, 'month'); shortcuts[$t('common.currentMonth')] = monthRange(0, 'month');
shortcuts[$t('common.lastMonth')] = monthRange(1, 'month'); shortcuts[$t('common.lastMonth')] = monthRange(1, 'month');
shortcuts[$t('common.lastTwoMonth')] = monthRange(2, 'month'); shortcuts[$t('common.lastTwoMonth')] = monthRange(2, 'month');

View File

@ -77,7 +77,7 @@ const rules: FormRules = {
<NDrawer v-model:show="drawer" display-directive="if" :width="500" @after-leave="close"> <NDrawer v-model:show="drawer" display-directive="if" :width="500" @after-leave="close">
<NDrawerContent> <NDrawerContent>
<template #header> <template #header>
<div class="w-460px flex-center"> <div class="w-460px flex items-center">
<EditableInput v-model="form.nodeName" class="mr-16px max-w-320px min-w-320px" /> <EditableInput v-model="form.nodeName" class="mr-16px max-w-320px min-w-320px" />
</div> </div>
</template> </template>

View File

@ -146,9 +146,17 @@ const getClass = (item: Workflow.ConditionNodeType) => {
<div class="auto-judge" :class="getClass(item)" @click="showDetail(item, index)"> <div class="auto-judge" :class="getClass(item)" @click="showDetail(item, index)">
<div class="title"> <div class="title">
<span class="text text-#935af6"> <span class="text text-#935af6">
<span class="flex items-center">
<NBadge processing dot :color="item.workflowNodeStatus === 1 ? '#52c41a' : '#ff4d4f'" /> <NBadge processing dot :color="item.workflowNodeStatus === 1 ? '#52c41a' : '#ff4d4f'" />
&nbsp;{{ item.nodeName }} &nbsp;{{ item.nodeName }}
<span v-if="item.id">&nbsp;({{ item.id }})</span> <span v-if="item.id">&nbsp;({{ item.id }})</span>
<NTooltip>
<template #trigger>
<icon-ant-design:info-circle-outlined class="ml-3px text-16px" />
</template>
此节点后续将废弃请使用定时任务中的 HTTP 内置执行器进行替换
</NTooltip>
</span>
</span> </span>
<icon-ant-design:close-outlined v-if="!disabled" class="close" @click.stop="delTerm" /> <icon-ant-design:close-outlined v-if="!disabled" class="close" @click.stop="delTerm" />
</div> </div>

View File

@ -210,6 +210,8 @@ const local: App.I18n.Schema = {
}, },
updateDt: 'Updated Time', updateDt: 'Updated Time',
createDt: 'Created Time', createDt: 'Created Time',
today: 'Today',
lastWeek: 'Last Week',
currentMonth: 'Current Month', currentMonth: 'Current Month',
lastMonth: 'Last Month', lastMonth: 'Last Month',
lastTwoMonth: 'Last 2 Month' lastTwoMonth: 'Last 2 Month'

View File

@ -148,7 +148,7 @@ const local: App.I18n.Schema = {
items: { items: {
cluster: '集群', cluster: '集群',
broadcast: '广播', broadcast: '广播',
slice: '静态片', slice: '静态片',
map: 'Map', map: 'Map',
mapreduce: 'MapReduce' mapreduce: 'MapReduce'
} }
@ -210,6 +210,8 @@ const local: App.I18n.Schema = {
}, },
updateDt: '更新时间', updateDt: '更新时间',
createDt: '创建时间', createDt: '创建时间',
today: '今天',
lastWeek: '最近一周',
currentMonth: '当月', currentMonth: '当月',
lastMonth: '最近一月', lastMonth: '最近一月',
lastTwoMonth: '最近两月' lastTwoMonth: '最近两月'

View File

@ -491,6 +491,8 @@ declare namespace App {
}; };
updateDt: string; updateDt: string;
createDt: string; createDt: string;
today: string;
lastWeek: string;
currentMonth: string; currentMonth: string;
lastMonth: string; lastMonth: string;
lastTwoMonth: string; lastTwoMonth: string;

View File

@ -133,6 +133,23 @@ export function monthRange(months: number = 1, startOf: dayjs.OpUnitType = 'day'
]; ];
} }
/**
* `最近n个自然月` timestamp
*
* @param days
* @param startOf
* @returns timestamp时间区间
*/
export function dayRange(days: number = 1) {
return [
dayjs()
.subtract(days - 1, 'day')
.startOf('day')
.valueOf(),
dayjs().endOf('day').valueOf()
] as [number, number];
}
/** /**
* `最近n个自然月` * `最近n个自然月`
* *
@ -147,6 +164,13 @@ export function monthRangeISO8601(months: number = 1, startOf: dayjs.OpUnitType
] as [string, string]; ] as [string, string];
} }
export function weekRangeISO8601(weeks: number = 1, startOf: dayjs.OpUnitType = 'day') {
return [
dayjs().subtract(weeks, 'week').startOf(startOf).format('YYYY-MM-DDTHH:mm:ss'),
dayjs().endOf('day').format('YYYY-MM-DDTHH:mm:ss')
] as [string, string];
}
export function isNotNull(value: any) { export function isNotNull(value: any) {
return value !== undefined && value !== null && value !== '' && value !== 'undefined'; return value !== undefined && value !== null && value !== '' && value !== 'undefined';
} }
@ -190,7 +214,7 @@ export function stringToContent(
if (typeof jsonString === 'string') { if (typeof jsonString === 'string') {
try { try {
parsedObj = JSON.parse(jsonString); parsedObj = JSON.parse(jsonString);
} catch (e) { } catch {
return []; return [];
} }
} }

View File

@ -14,7 +14,7 @@ import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app'; import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table'; import { useTable, useTableOperate } from '@/hooks/common/table';
import { operationReasonRecord, taskBatchStatusRecord, taskTypeRecord } from '@/constants/business'; import { operationReasonRecord, taskBatchStatusRecord, taskTypeRecord } from '@/constants/business';
import { monthRangeISO8601, tagColor } from '@/utils/common'; import { tagColor, weekRangeISO8601 } from '@/utils/common';
import SvgIcon from '@/components/custom/svg-icon.vue'; import SvgIcon from '@/components/custom/svg-icon.vue';
import JobBatchSearch from './modules/job-batch-search.vue'; import JobBatchSearch from './modules/job-batch-search.vue';
import JobBatchDetailDrawer from './modules/job-batch-detail-drawer.vue'; import JobBatchDetailDrawer from './modules/job-batch-detail-drawer.vue';
@ -38,7 +38,7 @@ const { columnChecks, columns, data, getData, loading, mobilePagination, searchP
jobName: null, jobName: null,
taskBatchStatus: null, taskBatchStatus: null,
jobId: null, jobId: null,
datetimeRange: monthRangeISO8601() datetimeRange: weekRangeISO8601()
}, },
searchParams: { searchParams: {
jobId, jobId,

View File

@ -53,6 +53,8 @@ watch(
model.value.jobName = value; model.value.jobName = value;
} else { } else {
noSearchFlag.value = false; noSearchFlag.value = false;
model.value.jobId = null;
model.value.jobName = null;
} }
} }
); );
@ -89,6 +91,8 @@ function renderLabel(option: SelectOption) {
<NFormItemGi span="24 s:12 m:8" :label="$t('page.jobBatch.taskBatchStatus')" path="taskBatchStatus" class="pr-24px"> <NFormItemGi span="24 s:12 m:8" :label="$t('page.jobBatch.taskBatchStatus')" path="taskBatchStatus" class="pr-24px">
<NSelect <NSelect
v-model:value="model.taskBatchStatus" v-model:value="model.taskBatchStatus"
multiple
max-tag-count="responsive"
:placeholder="$t('common.taskBatchStatus.form')" :placeholder="$t('common.taskBatchStatus.form')"
:options=" :options="
translateOptions(taskBatchStatusRecordOptions).filter(item => ![98, 99].includes(item.value as number)) translateOptions(taskBatchStatusRecordOptions).filter(item => ![98, 99].includes(item.value as number))

View File

@ -188,6 +188,7 @@ const executorCustomOptions = [
type ScriptParams = { type ScriptParams = {
method: string; method: string;
scriptParams: string; scriptParams: string;
charset: string;
}; };
const scriptParams = reactive<ScriptParams>(createDefaultScriptParams()); const scriptParams = reactive<ScriptParams>(createDefaultScriptParams());
@ -195,7 +196,8 @@ const scriptParams = reactive<ScriptParams>(createDefaultScriptParams());
function createDefaultScriptParams() { function createDefaultScriptParams() {
return { return {
method: 'LOCAL_SCRIPT', method: 'LOCAL_SCRIPT',
scriptParams: '' scriptParams: '',
charset: ''
}; };
} }
@ -589,6 +591,9 @@ const scriptMethodOptions = [
<NFormItem label="脚本参数"> <NFormItem label="脚本参数">
<CodeMirror v-model="scriptParams.scriptParams" lang="json" placeholder="请输入脚本参数" /> <CodeMirror v-model="scriptParams.scriptParams" lang="json" placeholder="请输入脚本参数" />
</NFormItem> </NFormItem>
<NFormItem label="编码格式">
<NInput v-model:value="scriptParams.charset" placeholder="请输入编码格式" />
</NFormItem>
</NForm> </NForm>
</template> </template>
</NFormItem> </NFormItem>
@ -659,7 +664,11 @@ const scriptMethodOptions = [
</NFormItem> </NFormItem>
</NGi> </NGi>
<NGi> <NGi>
<NFormItem v-if="model.taskType !== 1" :label="$t('page.jobTask.parallelNum')" path="parallelNum"> <NFormItem
v-if="model.taskType !== 1 && model.taskType !== 2"
:label="$t('page.jobTask.parallelNum')"
path="parallelNum"
>
<NInputNumber <NInputNumber
v-model:value="model.parallelNum" v-model:value="model.parallelNum"
:min="1" :min="1"