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: add operator #5533

Merged
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
2 changes: 1 addition & 1 deletion apps/web/src/schema/alert-manager/event-rule/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type EventRuleUrgencyType = typeof EVENT_RULE_URGENCY[keyof typeof EVENT_
export type EventRuleScopeType = typeof EVENT_RULE_SCOPE[keyof typeof EVENT_RULE_SCOPE];

export type EventRuleConditionsKeyType = 'title' | 'description' | 'rule' | 'severity' | 'account' | 'additional_info' | 'labels' | 'period';
export type EventRuleConditionsOperatorType = 'eq' | 'contain' | 'not' | 'not_contain' | 'size_gte';
export type EventRuleConditionsOperatorType = 'eq' | 'contain' | 'not' | 'not_contain' | 'size_gte' | 'size_lte';

export type EventRuleConditionsType = {
key: EventRuleConditionsKeyType|string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const getDropdownMenu = (key: string): EventRuleConditionOperatorsType[] => {
equals: i18n.t('ALERT_MANAGER.EVENT_RULE.EQUALS'),
notEquals: i18n.t('ALERT_MANAGER.EVENT_RULE.DOES_NOT_EQUAL'),
atLeast: i18n.t('ALERT_MANAGER.EVENT_RULE.AT_LEAST'),
lessThan: i18n.t('ALERT_MANAGER.EVENT_RULE.LESS_THAN_EQUAL'),
};

const defaultMenu: EventRuleConditionOperatorsType[] = [
Expand All @@ -87,6 +88,7 @@ const getDropdownMenu = (key: string): EventRuleConditionOperatorsType[] => {
return [
...defaultMenu,
{ name: 'size_gte', label: _labels.atLeast },
{ name: 'size_lte', label: _labels.lessThan },
];
}

Expand Down Expand Up @@ -176,11 +178,13 @@ const handleClickDelete = (idx) => {
use-fixed-menu-style
is-fixed-width
/>
<div v-if="condition.key === 'labels' && condition.operator === 'size_gte'"
<div v-if="condition.key === 'labels' && (condition.operator === 'size_gte' || condition.operator === 'size_lte')"
class="input"
>
<p-text-input v-model="condition.value"
type="number"
:min="0"
:max="100"
block
/>
</div>
Expand Down
21 changes: 21 additions & 0 deletions packages/language-pack/console-translation-2.8.babel
Original file line number Diff line number Diff line change
Expand Up @@ -3287,6 +3287,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>LESS_THAN_EQUAL</name>
<definition_loaded>false</definition_loaded>
<description/>
<comment/>
<default_text/>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>ja-JP</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>LOW</name>
<definition_loaded>false</definition_loaded>
Expand Down
1 change: 1 addition & 0 deletions packages/language-pack/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"LABEL_SCOPE": "Selected Event Rule Scope",
"LABEL_SEVERITY": "Severity",
"LABEL_TITLE": "Title",
"LESS_THAN_EQUAL": "less than or equals",
"LOW": "Low",
"MATCH_ASSET": "Match Asset",
"MAX": "Max",
Expand Down
1 change: 1 addition & 0 deletions packages/language-pack/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"LABEL_SCOPE": "選択されたイベントルールのスコープ",
"LABEL_SEVERITY": "緊急度",
"LABEL_TITLE": "タイトル",
"LESS_THAN_EQUAL": "",
"LOW": "低い",
"MATCH_ASSET": "アセットをマッピングする",
"MAX": "最大",
Expand Down
1 change: 1 addition & 0 deletions packages/language-pack/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"LABEL_SCOPE": "선택된 이벤트 규칙 범위",
"LABEL_SEVERITY": "심각도",
"LABEL_TITLE": "제목",
"LESS_THAN_EQUAL": "",
"LOW": "낮음",
"MATCH_ASSET": "자산 매핑",
"MAX": "최대",
Expand Down
Loading