parent
66492cf9fd
commit
564d18f6b7
@ -117,12 +117,12 @@ export const backOffRecord: Record<Api.RetryScene.BackOff, App.I18n.I18nKey> = {
|
||||
export const backOffRecordOptions = transformRecordToNumberOption(backOffRecord, true);
|
||||
|
||||
export const routeKeyRecord: Record<Api.Common.RouteKey, App.I18n.I18nKey> = {
|
||||
'1': 'common.routeKey.items.consistentHash',
|
||||
'2': 'common.routeKey.items.random',
|
||||
'3': 'common.routeKey.items.lru',
|
||||
'4': 'common.routeKey.items.round'
|
||||
1: 'common.routeKey.items.consistentHash',
|
||||
2: 'common.routeKey.items.random',
|
||||
3: 'common.routeKey.items.lru',
|
||||
4: 'common.routeKey.items.round'
|
||||
};
|
||||
export const routeKeyRecordOptions = transformRecordToOption(routeKeyRecord);
|
||||
export const routeKeyRecordOptions = transformRecordToNumberOption(routeKeyRecord, true);
|
||||
|
||||
/** 阻塞策略 */
|
||||
export const blockStrategyRecord: Record<Api.Common.BlockStrategy, App.I18n.I18nKey> = {
|
||||
|
2
src/typings/api.d.ts
vendored
2
src/typings/api.d.ts
vendored
@ -71,7 +71,7 @@ declare namespace Api {
|
||||
} & T;
|
||||
|
||||
/** 1: 一致性Hash 2: 随机 3: LRU 4: 轮询 */
|
||||
type RouteKey = '1' | '2' | '3' | '4';
|
||||
type RouteKey = 1 | 2 | 3 | 4;
|
||||
|
||||
/** 阻塞策略 1:丢弃 2:覆盖 3:并行 */
|
||||
type BlockStrategy = 1 | 2 | 3;
|
||||
|
@ -69,9 +69,7 @@ export function translateOptions2(options: string[]) {
|
||||
*
|
||||
* @param index
|
||||
*/
|
||||
export function tagColor(index: number | string) {
|
||||
const indexNumber = Number(index);
|
||||
|
||||
export function tagColor(index: number) {
|
||||
const tagMap: Record<number, NaiveUI.ThemeColor> = {
|
||||
0: 'error',
|
||||
1: 'info',
|
||||
@ -80,9 +78,9 @@ export function tagColor(index: number | string) {
|
||||
4: 'primary'
|
||||
};
|
||||
|
||||
if (indexNumber === null || indexNumber < 0) {
|
||||
if (index === null || index < 0) {
|
||||
return tagMap[1];
|
||||
}
|
||||
|
||||
return tagMap[indexNumber % 5];
|
||||
return tagMap[index % 5];
|
||||
}
|
||||
|
@ -53,33 +53,27 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
|
||||
return null;
|
||||
}
|
||||
const tagMap: Record<Api.Common.OperationReason, NaiveUI.ThemeColor> = {
|
||||
0: 'warning',
|
||||
1: 'warning',
|
||||
2: 'warning',
|
||||
3: 'warning',
|
||||
4: 'warning',
|
||||
5: 'warning',
|
||||
6: 'warning',
|
||||
7: 'warning',
|
||||
8: 'warning',
|
||||
9: 'warning',
|
||||
10: 'warning',
|
||||
11: 'warning',
|
||||
12: 'warning',
|
||||
13: 'warning',
|
||||
14: 'warning'
|
||||
0: 'default',
|
||||
1: 'default',
|
||||
2: 'error',
|
||||
3: 'default',
|
||||
4: 'default',
|
||||
5: 'default',
|
||||
6: 'default',
|
||||
7: 'default',
|
||||
8: 'default',
|
||||
9: 'default',
|
||||
10: 'default',
|
||||
11: 'default',
|
||||
12: 'default',
|
||||
13: 'default',
|
||||
14: 'default'
|
||||
};
|
||||
const label = $t(operationReasonRecord[row.operationReason!]);
|
||||
|
||||
return <NTag type={tagMap[row.operationReason!]}>{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'createDt',
|
||||
title: $t('common.createDt'),
|
||||
align: 'center',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
@ -90,9 +84,6 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
|
||||
<NButton type="primary" ghost size="small" onClick={() => detail(row.id!)}>
|
||||
{$t('common.detail')}
|
||||
</NButton>
|
||||
<NButton type="primary" ghost size="small" onClick={() => handleExecute(row.id!)}>
|
||||
{$t('common.execute')}
|
||||
</NButton>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -102,10 +93,6 @@ const { columns, data, getData, loading, mobilePagination, searchParams, resetSe
|
||||
function detail(id: string) {
|
||||
console.log(id);
|
||||
}
|
||||
|
||||
function handleExecute(id: string) {
|
||||
console.log(id);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -80,7 +80,7 @@ function createDefaultModel(): Model {
|
||||
argsStr: '',
|
||||
argsType: 1,
|
||||
jobStatus: 1,
|
||||
routeKey: '1',
|
||||
routeKey: 1,
|
||||
executorType: 1,
|
||||
triggerType: 2,
|
||||
executorInfo: '',
|
||||
|
@ -76,7 +76,7 @@ function createDefaultModel(): Model {
|
||||
deadlineRequest: 60000,
|
||||
executorTimeout: 60,
|
||||
description: '',
|
||||
routeKey: '4'
|
||||
routeKey: 4
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user