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

uik: switch from global to per-rule continue option #3924

Merged
merged 1 commit into from
Jun 11, 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
154 changes: 78 additions & 76 deletions graphql2/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions graphql2/graph/univkeys.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ extend type Mutation {
}

type KeyConfig {
"""
Stop evaluating rules after the first rule that matches.
"""
stopAtFirstRule: Boolean!

rules: [KeyRule!]!

"""
Expand All @@ -79,16 +74,16 @@ type KeyRule {
conditionExpr: ExprBooleanExpression!

actions: [Action!]!

"""
Continue evaluating rules after this rule matches.
"""
continueAfterMatch: Boolean!
}

input UpdateKeyConfigInput {
keyID: ID!

"""
Stop evaluating rules after the first rule that matches.
"""
stopAtFirstRule: Boolean

rules: [KeyRuleInput!]

"""
Expand Down Expand Up @@ -122,6 +117,13 @@ input KeyRuleInput {
conditionExpr: ExprBooleanExpression!

actions: [ActionInput!]!

"""
Continue evaluating rules after this rule matches.

If this is set to false (default), no further rules will be evaluated after this rule matches.
"""
continueAfterMatch: Boolean!
}

input ActionInput {
Expand Down
22 changes: 10 additions & 12 deletions graphql2/graphqlapp/integrationkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ func (m *Mutation) UpdateKeyConfig(ctx context.Context, input graphql2.UpdateKey
return err
}

if input.StopAtFirstRule != nil {
cfg.StopAfterFirstMatchingRule = *input.StopAtFirstRule
}

if input.Rules != nil {
cfg.Rules = make([]integrationkey.Rule, 0, len(input.Rules))
for _, r := range input.Rules {
Expand All @@ -121,6 +117,8 @@ func (m *Mutation) UpdateKeyConfig(ctx context.Context, input graphql2.UpdateKey
Description: r.Description,
ConditionExpr: r.ConditionExpr,
Actions: actionsGQLToGo(r.Actions),

ContinueAfterMatch: r.ContinueAfterMatch,
})
}
}
Expand Down Expand Up @@ -213,18 +211,18 @@ func (key *IntegrationKey) Config(ctx context.Context, raw *integrationkey.Integ
var rules []graphql2.KeyRule
for _, r := range cfg.Rules {
rules = append(rules, graphql2.KeyRule{
ID: r.ID.String(),
Name: r.Name,
Description: r.Description,
ConditionExpr: r.ConditionExpr,
Actions: actionsGoToGQL(r.Actions),
ID: r.ID.String(),
Name: r.Name,
Description: r.Description,
ConditionExpr: r.ConditionExpr,
Actions: actionsGoToGQL(r.Actions),
ContinueAfterMatch: r.ContinueAfterMatch,
})
}

return &graphql2.KeyConfig{
StopAtFirstRule: cfg.StopAfterFirstMatchingRule,
Rules: rules,
DefaultActions: actionsGoToGQL(cfg.DefaultActions),
Rules: rules,
DefaultActions: actionsGoToGQL(cfg.DefaultActions),
}, nil
}

Expand Down
16 changes: 9 additions & 7 deletions graphql2/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading