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

Fixes #19873: Saving a rule with deleted directives/groups does not correct it #3855

Conversation

fanf
Copy link
Member

@fanf fanf commented Aug 27, 2021

https://issues.rudder.io/issues/19873

It adds the following display, which allows to remove the bad directive:

image

|> List.sortWith (compareOn .displayName)
directives =
let
knownDirectives = model.directives
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could have been done in one go, but with the sort lost with function from List.Extra

                ids
                  |> List.map (\id ->
                     model.directives
                       |> List.Extra.find (.id >> (==) id)
                       |> Maybe.withDefault (Directive id ("Missing directive with ID "++id.value) "" "" "" False False "")
                     )
                  |> List.sortWith (compareOn .displayName)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway that does not sort the unknown directive to the end, maybe with List.extra.span

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not important: this is only a workaround for a case that should be rare, and you just want to remove them all in all case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum, perhaps I didn't understood - did you mean 1/ "that unknow directives, which in the end, are not sorted (on ID for ex)" or "the unknow directives get mixed with the known one?". I understood 1/, but if it was 2/: they are well all grouped together in the end, because of the List.append

@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 25b9a98 into Normation:branches/rudder/7.0 Aug 27, 2021
@fanf fanf deleted the bug_19873/saving_a_rule_with_deleted_directives_groups_does_not_correct_it branch March 15, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants