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

Quadicon definition needs refactoring #3036

Closed
karelhala opened this issue Dec 12, 2017 · 6 comments
Closed

Quadicon definition needs refactoring #3036

karelhala opened this issue Dec 12, 2017 · 6 comments

Comments

@karelhala
Copy link
Contributor

Missing quadicon definition

When new provider has quadicon visible, there is no place to define qhich square should have which value and new if/case has to be added to let's say quadicon_helper.rb#L555
. This is not good aproach since there is no way to move this to JSON and ask for such things over API, not talking about new providers making code less readable.

Related UI part

screenshot from 2017-12-12 17-22-15

@karelhala
Copy link
Contributor Author

ping @skateman @himdel @martinpovolny any suggestion about this? I guess decorator would be nice (am I correct), but let's discuss the format and what should be returned from such function.

@skateman
Copy link
Member

skateman commented Dec 12, 2017

@karelhala decorator sounds nice, we already have a fonticon and a fileicon there, so it would be logical to have a quadicon 🍷

def quadicon(_n = nil)
  {
    :topLeft     => {:fonticon => fonticon},
    :topRight    => {:text => servers.count,
    :bottomleft  => {:tooltip => power_state, :fileicon => ...},
    :bottomRight => {:text => templates.count}
  }
end

The values on the right side can be both methods on the record that's being decorated or methods of the decorator. For compatibility I would like to reserve at least one argument to set the size of the quad (1 or 4) but for now don't use that. What do you think @himdel && @martinpovolny?

@himdel
Copy link
Contributor

himdel commented Dec 12, 2017

bottomLeft ;)

Otherwise agreed :).

(The code calling this should probably make sure that either only :single is provided, or all of :topLeft, :topRight, :bottomLeft and :bottomRight are there. :).

And we should probably document all the possibilities (I'm thinking :policy => true for the yellow shield thing, etc.).

@skateman
Copy link
Member

bottom_left is more ruby-like

@himdel
Copy link
Contributor

himdel commented Dec 12, 2017

And more readable 👍

@skateman
Copy link
Member

skateman commented May 4, 2018

@karelhala this can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants