Skip to content

Commit

Permalink
feat(frontend): 轮值支持排除业务、指定部分业务 TencentBlueKing#8922
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Jan 8, 2025
1 parent d1bb73a commit b08d33a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'is-clearable': clearable,
}">
<BkInput
ref="inputRef"
class="input-box"
:disabled="disabled"
:max="max"
Expand Down Expand Up @@ -60,6 +61,7 @@
import useValidtor, { type Rules } from '../../hooks/useValidtor';

interface Props {
autoFocus?: boolean;
placeholder?: string;
rules?: Rules;
disabled?: boolean;
Expand Down Expand Up @@ -90,6 +92,7 @@
}

const props = withDefaults(defineProps<Props>(), {
autoFocus: false,
placeholder: '请输入',
rules: undefined,
disabled: false,
Expand All @@ -109,6 +112,7 @@
});

const rootRef = ref<HTMLElement>();
const inputRef = ref();
const isBlur = ref(true);

const isPassword = computed(() => props.type === 'password');
Expand Down Expand Up @@ -216,6 +220,12 @@
window.changeConfirm = true;
};

onMounted(() => {
if (props.autoFocus) {
inputRef.value.focus();
}
});

defineExpose<Exposes>({
getValue() {
return validator(modelValue.value)
Expand Down
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1655,5 +1655,6 @@
"Mongo分片集群": "",
"sqlserver单节点版": "",
"sqlserver主从版": "",
"排除业务": "",
"这行勿动!新增翻译请在上一行添加!": ""
}
5 changes: 5 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3918,6 +3918,11 @@
"Influxdb实例": "Influxdb实例",
"Doris集群": "Doris集群",
"单据协作人": "单据协作人",
"获取会话ID方法:": "获取会话ID方法:",
"1. 群聊添加群机器人: 蓝鲸审批助手": "1. 群聊添加群机器人: 蓝鲸审批助手",
"2. 手动蓝鲸审批助手,获取会话ID": "2. 手动 {'@'}蓝鲸审批助手,获取会话ID",
"3. 将获取到的会话ID粘贴到输入框,多个会话ID使用逗号分隔": "3. 将获取到的会话ID粘贴到输入框,多个会话ID使用逗号分隔",
"排除业务": "排除业务",
"这行勿动!新增翻译请在上一行添加!": ""

}
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/services/model/monitor/duty-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export default class DutyRule {
exclude?: {
bk_biz_id: number;
bk_biz_name: string;
};
}[];
include?: {
bk_biz_id: number;
bk_biz_name: string;
};
}[];
};
category: string;
creator: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
resource={props.activeDbType}>
<NumberInput
type='number'
autoFocus
model-value={level}
min={1}
max={100}
Expand Down Expand Up @@ -241,6 +242,20 @@
);
},
},
{
label: t('轮值业务'),
field: 'status',
width: 250,
render: ({ data }: {data: DutyRuleModel}) => {
if (data.biz_config_display.include) {
return data.biz_config_display.include.map((biz) => biz.bk_biz_name).join(' , ')
}
if (data.biz_config_display.exclude) {
return `${t('全部业务')} (${t('排除业务')} : ${data.biz_config_display.exclude.map((biz) => biz.bk_biz_name).join(' , ')}) `
}
return t('全部业务')
},
},
{
label: t('轮值表'),
field: 'duty_arranges',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
{
label: t('日期'),
field: 'dateTime',
width: 120,
minWidth: 120,
render: ({ data }: {data: RowData}) => {
let tag = null;
const today = dayjs(new Date()).format('YYYY-MM-DD');
Expand All @@ -104,7 +104,7 @@
label: t('时段'),
field: 'timeRange',
showOverflowTooltip: true,
width: 200,
minWidth: 200,
render: ({ data }: {data: RowData}) => data.timeRange.join(' , '),
},
{
Expand Down

0 comments on commit b08d33a

Please sign in to comment.