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

Adding enabled, description fields in label app rules #79

Merged
merged 4 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ message LabelApplicationRuleData {
string name = 1;
Condition matching_condition = 2;
Action label_action = 3;
bool enabled = 4;
optional string description = 5;

message Condition {
oneof condition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ private void validateLabelApplicationRuleData(LabelApplicationRuleData labelAppl
labelApplicationRuleData, labelApplicationRuleData.NAME_FIELD_NUMBER);
validateCondition(labelApplicationRuleData.getMatchingCondition());
validateAction(labelApplicationRuleData.getLabelAction());
validateNonDefaultPresenceOrThrow(
labelApplicationRuleData, labelApplicationRuleData.ENABLED_FIELD_NUMBER);
}

private void validateCondition(LabelApplicationRuleData.Condition condition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ private LabelApplicationRuleData buildCompositeRuleData() {
.setName("Composite rule")
.setMatchingCondition(matchingCondition)
.setLabelAction(buildAction())
.setEnabled(true)
.build();
}

Expand All @@ -235,6 +236,7 @@ private LabelApplicationRuleData buildSimpleRuleData(String key, String value) {
.setName("Simple rule")
.setMatchingCondition(matchingCondition)
.setLabelAction(buildAction())
.setEnabled(true)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ private CreateLabelApplicationRuleRequest buildCreateCreateLabelApplicationRuleR
.setName(name)
.setMatchingCondition(matchingCondition)
.setLabelAction(buildDynamicLabelAction(labelExpression.get()))
.setEnabled(true)
.build();
} else {
data =
LabelApplicationRuleData.newBuilder()
.setName(name)
.setMatchingCondition(matchingCondition)
.setLabelAction(buildAction())
.setEnabled(true)
.build();
}
return CreateLabelApplicationRuleRequest.newBuilder().setData(data).build();
Expand All @@ -240,6 +242,7 @@ private CreateLabelApplicationRuleRequest buildCreateLabelApplicationRuleRequest
LabelApplicationRuleData.newBuilder()
.setName(name)
.setMatchingCondition(matchingCondition)
.setEnabled(true)
.build();
return CreateLabelApplicationRuleRequest.newBuilder().setData(data).build();
}
Expand Down