Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 【策略配置】策略配置支持实时与非实时链路 --story=119522802 #449

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/frontend/src/views/strategy-manage/language/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,9 @@ export default {
'在单据页,鼠标移入label,即可显示字段说明': 'On the ticket page, move the mouse into the label to display the field description',
请输入风险单名称: 'Please enter the name of the risk order',
请选择通知组: 'Please select a notification group',
调度方式: 'Scheduling method',
固定周期调度: 'Periodic scheduling',
实时调度: 'Real-time scheduling',
策略实时运行: 'Strategies run in real time',
},
};
4 changes: 4 additions & 0 deletions src/frontend/src/views/strategy-manage/language/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,9 @@ export default {
'在单据页,鼠标移入label,即可显示字段说明': '在单据页,鼠标移入label,即可显示字段说明',
请输入风险单名称: '请输入风险单名称',
请选择通知组: '请选择通知组',
调度方式: '调度方式',
固定周期调度: '固定周期调度',
实时调度: '实时调度',
策略实时运行: '策略实时运行',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,51 +73,71 @@
</collapse-panel>

<collapse-panel
v-if="formData.configs.data_source.source_type !== 'stream_source'"
:is-active="isActive"
:label="t('调度配置')"
style="margin-bottom: 12px;">
<div class="dispatch-wrap">
<span
v-bk-tooltips="t('策略运行的周期')"
class="label-is-required"
style="color: #63656e; cursor: pointer; border-bottom: 1px dashed #979ba5;">
{{ t('调度周期') }}
</span>
<div class="flex-center">
<bk-form-item
class="is-required no-label"
label-width="0"
property="configs.aiops_config.count_freq"
style="margin-bottom: 12px;">
<bk-input
v-model="formData.configs.aiops_config.count_freq"
class="schedule-input"
:min="1"
onkeypress="return( /[\d]/.test(String.fromCharCode(event.keyCode) ) )"
:placeholder="t('请输入')"
type="number"
@change="handleAiopsConfig" />
</bk-form-item>
<bk-form-item
class="is-required no-label"
label-width="0"
property="configs.aiops_config.schedule_period"
style="margin-bottom: 12px;">
<bk-select
v-model="formData.configs.aiops_config.schedule_period"
class="schedule-select"
:clearable="false"
style="width: 68px;"
@change="handleAiopsConfig">
<bk-option
v-for="(item, index) in commonData.offset_unit"
:key="index"
:label="item.label"
:value="item.value" />
</bk-select>
</bk-form-item>
</div>
<bk-form-item
:label="t('调度方式')"
property="source_type"
style="margin-bottom: 12px;">
<bk-radio-group
v-model="formData.configs.data_source.source_type"
@change="handleSourceTypeChange">
<bk-radio label="batch_join_source">
{{ t('固定周期调度') }}
</bk-radio>
<bk-radio label="stream_source">
<span
v-bk-tooltips="t('策略实时运行')"
style="color: #63656e; cursor: pointer; border-bottom: 1px dashed #979ba5;">
{{ t('实时调度') }}
</span>
</bk-radio>
</bk-radio-group>
</bk-form-item>
<template v-if="formData.configs.data_source.source_type !== 'stream_source'">
<span
v-bk-tooltips="t('策略运行的周期')"
class="label-is-required"
style="color: #63656e; cursor: pointer; border-bottom: 1px dashed #979ba5;">
{{ t('调度周期') }}
</span>
<div class="flex-center">
<bk-form-item
class="is-required no-label"
label-width="0"
property="configs.aiops_config.count_freq"
style="margin-bottom: 12px;">
<bk-input
v-model="formData.configs.aiops_config.count_freq"
class="schedule-input"
:min="1"
onkeypress="return( /[\d]/.test(String.fromCharCode(event.keyCode) ) )"
:placeholder="t('请输入')"
type="number"
@change="handleAiopsConfig" />
</bk-form-item>
<bk-form-item
class="is-required no-label"
label-width="0"
property="configs.aiops_config.schedule_period"
style="margin-bottom: 12px;">
<bk-select
v-model="formData.configs.aiops_config.schedule_period"
class="schedule-select"
:clearable="false"
style="width: 68px;"
@change="handleAiopsConfig">
<bk-option
v-for="(item, index) in commonData.offset_unit"
:key="index"
:label="item.label"
:value="item.value" />
</bk-select>
</bk-form-item>
</div>
</template>
</div>
</collapse-panel>
</bk-form-item>
Expand Down Expand Up @@ -280,6 +300,18 @@
if (!isInit) return;
emits('updateDataSource', dataSource);
};
const handleSourceTypeChange = (type: string) => {
if (type === 'stream_source') {
formData.value.configs.aiops_config = {
count_freq: '',
schedule_period: 'hour',
};
}
emits('updateAiopsConfig', formData.value.configs.data_source.source_type !== 'stream_source'
? formData.value.configs.aiops_config
: undefined);
emits('updateDataSource', formData.value.configs.data_source);
};

watch(() => props.controlDetail, (data) => {
if (data && data.input_config) {
Expand Down
Loading