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

[WIP] Display mapped classifications and tags in tag assignments #4723

Closed
wants to merge 1 commit into from

Conversation

lpichler
Copy link
Contributor

@lpichler lpichler commented Oct 2, 2018

@lpichler
Copy link
Contributor Author

lpichler commented Oct 2, 2018

@miq-bot assign @mzazrivec
cc @gtanzillo
@miq-bot add_label enhancement

@miq-bot
Copy link
Member

miq-bot commented Oct 2, 2018

Checked commit lpichler@a1e5671 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. ⭐

@lpichler lpichler changed the title Display mapped classifications and tags in tag assignments [WIP] Display mapped classifications and tags in tag assignments Oct 9, 2018
@miq-bot miq-bot added the wip label Oct 12, 2018
@miq-bot
Copy link
Member

miq-bot commented Oct 22, 2018

This pull request is not mergeable. Please rebase and repush.

@categories = {} # Classifications array for first chooser

mapped_categories = cats.select { |c| ContainerLabelTagMapping::TAG_PREFIXES.any? { |pattern| c.tag.name.include?(pattern) } }
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like TAG_PREFIXES to remain an implementation detail internal to the model.
I did this kludge after the "correct" join, through parent category, to ContainerLabelTagMapping proved too complicated to debug, but in any case my hope was to encapsulate that in ContainerLabelTagMapping.controls_tag? and Tag.controlled_by_mapping scope.
If these are not sufficient, perhaps we need more abstraction eg. adding Classification.controlled_by_mapping but let's not leak TAG_PREFIXES...

cats.delete_if { |c| c.read_only? || c.entries.length == 0 } # Remove categories that are read only or have no entries
cats += mapped_categories
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we instead drop read_only? check above?
AFAIK, checking read_only? is the only reason mapped tags don't appear in several places in UI, including here.

However, I think this was deliberate UX here:
Mapped tags are read_only to reflect the fact manually un/assigning them is meaningless — they're "owned" by the mapping mechanism and will be reset in next refresh.
AFAICT, being impossible to manually un/assign is the meaning of read_only field, and I strongly suspect mapped tags are the only use of read_only.
(well ideally they should not have been omitted but greyed out)

@cben
Copy link
Contributor

cben commented Jan 8, 2019

Apologies for drive-by review — I briefly saw ManageIQ/manageiq#17971, the BZ and these PRs, but I do NOT yet understand the cross-region nuances...
So I tried to just make some implementation notes without commenting much on the behavior.

Do ping me if you're actively working on this and want any help / better review / moral support (I accept all blame for the horrors of tag mapping 😢)

@lpichler
Copy link
Contributor Author

@cben thank you very much for review I appreciated it but it is not needed it, I will back to these PRs when we will needed it. closing

@lpichler lpichler closed this Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants