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

Order custom buttons by array of ids #18060

Merged

Conversation

lpichler
Copy link
Contributor

@lpichler lpichler commented Oct 4, 2018

This PR updates #18049 and replacing order.

There user defined order for custom buttons so order is determined by set of ids in custom_button_set.set_data[:button_order] (not by name)

I used PostgreSQL for order.

Links

@miq-bot assign @bdunne
cc @gtanzillo
thanks @h-kataria

@miq-bot add_label hammer/yes, gaprindashvili/yes

@lpichler
Copy link
Contributor Author

lpichler commented Oct 4, 2018

@simaishi so BZ https://bugzilla.redhat.com/show_bug.cgi?id=1628737 don't have merged last PR yet at this moment.

end

context 'by string column' do
it 'orders by memory_shares column' do
Copy link
Member

Choose a reason for hiding this comment

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

Ordering by name here, right?

@@ -3,6 +3,11 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true

scope :with_array_order, lambda { |ids, column = :id, column_type = :bigint|
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this is ApplicationRecord?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this BZ no. Now we need it only for CustomButtonSet model. But it looks to me as useful functionality so I put it here because we have user defined-order on more places.

What do you think? Where I should put it? Should I put it only to CustomButtonSet model and then eventually in the future put it to the mixin?

Copy link
Member

Choose a reason for hiding this comment

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

@bdunne Are you ok with leaving this in ApplicationRecord? Seems like it wouldn't hurt to have it there.

Copy link
Member

Choose a reason for hiding this comment

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

I guess so

Copy link
Member

Choose a reason for hiding this comment

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

@lpichler I'm interpreting @bdunne response to 👎 for keeping this in ApplicationRecord. Let's move it to CustomButtonSet. We can always elevate it later is another model needs it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, just small correction for what I wrote - it was about CustomButton model

@lpichler lpichler force-pushed the order_custom_buttons_by_array_of_ids branch from 30ba222 to 8d1d914 Compare October 5, 2018 14:59
@miq-bot
Copy link
Member

miq-bot commented Oct 5, 2018

Checked commits lpichler/manageiq@54de2a3~...8d1d914 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
4 files checked, 0 offenses detected
Everything looks fine. 🍰

@h-kataria
Copy link
Contributor

looks good. Thx for fixing @lpichler

@lpichler lpichler force-pushed the order_custom_buttons_by_array_of_ids branch from 8d1d914 to cfb3c21 Compare October 10, 2018 16:49
@lpichler
Copy link
Contributor Author

lpichler commented Oct 10, 2018

done, thanks @gtanzillo @bdunne @h-kataria

@miq-bot assign @gtanzillo
@miq-bot unassign @bdunne

@miq-bot
Copy link
Member

miq-bot commented Oct 10, 2018

@lpichler unrecognized command 'unassign', ignoring...

Accepted commands are: add_label, add_reviewer, assign, close_issue, move_issue, remove_label, rm_label, set_milestone

@miq-bot miq-bot assigned gtanzillo and unassigned bdunne Oct 10, 2018
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

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

👍

@gtanzillo gtanzillo added this to the Sprint 97 Ending Oct 22, 2018 milestone Oct 10, 2018
@gtanzillo gtanzillo merged commit 4995683 into ManageIQ:master Oct 10, 2018
@himdel
Copy link
Contributor

himdel commented Oct 11, 2018

@lpichler This causes a travis failure for UI classic:

 PG::UndefinedFunction: ERROR:  function array_position(bigint[], bigint) does not exist

According to https://www.postgresql.org/docs/9.4/static/functions-array.html vs https://www.postgresql.org/docs/9.5/static/functions-array.html, that function only appeared in postgres 9.5.

Can you fix please? :)

@lpichler lpichler deleted the order_custom_buttons_by_array_of_ids branch October 11, 2018 10:29
@bdunne
Copy link
Member

bdunne commented Oct 11, 2018

@carbonin Haven't we been running Postgres 9.5 since euwe branch?

@carbonin
Copy link
Member

Yeah, I'm not sure why we're testing against 9.4 anywhere at this point.

@carbonin
Copy link
Member

Aside from that, is there any reason to use this sorting strategy vs the one in #18087? The list of custom buttons should be rather small so there's probably not much of a performance difference, right? @lpichler ?

@himdel
Copy link
Contributor

himdel commented Oct 11, 2018

OK, so sounds like we can change the ui-classic travis to use 9.5 and close #18087 ?

@bdunne Please note that config/initializers/postgres_required_versions.rb in master still only complains about <9.4, not 9.4.

So.. are we sure people know that 9.4 is not supported? :)

(Also, we need to know when it was dropped, since this PR is gaprindashvili/yes.)

@himdel
Copy link
Contributor

himdel commented Oct 11, 2018

Also, the last mention of PostgreSQL in the manageiq CHANGELOG points at #16171. Which is from last year, against gaprindashvili and explicitly states that 9.4 is supported.

So far, looks like the only justification for #15994 was "because we can" and not "because we dropped 9.4".

(That said, I definitely don't object to dropping 9.4, assuming postgres_required_versions is changed to match.)

EDIT for completenes:

developer_setup also mentions 9.4,
and so do the latest docs (though I have no idea what ManageIQ 4.x is)

@lpichler
Copy link
Contributor Author

@carbonin yes, we would not face performance issues regard to count of custom buttons. So both solutions are usable.

@carbonin
Copy link
Member

@himdel The appliance (which is the only way manageiq ships to users) is using 9.5 and has been for at least a year.

If this is not what you are testing against then that is a problem and should be changed regardless of what the docs say. If the docs say that 9.4 is supported then maybe that is true for developers, but it is not the version that we are shipping in production so that should be made clear.

@himdel
Copy link
Contributor

himdel commented Oct 11, 2018

IMO 9.4 is supported only as long as we're testing it.
So, dropping 9.4 from ui-travis means dropping support for 9.4.
I'm willing to fix the docs, but... I'd like an answer stronger than "maybe" :).

(posted on gitter hoping for stronger anwsers :))

@carbonin And does that mean that even gaprindashvili appliances are always 9.5?

@carbonin
Copy link
Member

Yes, I think we should drop 9.4 @Fryguy @jrafanie Want to ack that?

@jrafanie
Copy link
Member

@himdel I'd say we drop support for a postgresql version the branch "After" we update appliances to use the newer version. Since we're at 9.5 in euwe, fine, gaprindashvili, and hammer, I'm 👍 to dropping 9.4 completely

@gtanzillo
Copy link
Member

I am also 👍 for dropping 9.4. Especially if continuing to test with 9.4 means that we are not testing on 9.5

simaishi pushed a commit that referenced this pull request Oct 12, 2018
@simaishi
Copy link
Contributor

Hammer backport details:

$ git log -1
commit dae2099d765d92dceb996ab7ff1133f160092acb
Author: Gregg Tanzillo <gtanzill@redhat.com>
Date:   Wed Oct 10 14:09:50 2018 -0400

    Merge pull request #18060 from lpichler/order_custom_buttons_by_array_of_ids
    
    Order custom buttons by array of ids
    
    (cherry picked from commit 49956837c8143e928004beb8fce4bf4babedc081)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1628737

@simaishi
Copy link
Contributor

simaishi commented Nov 5, 2018

Gaprindashvili backport details:

$ git log -1
commit b5765185e779217d33bc8a457c28e507ced06d6e
Author: Gregg Tanzillo <gtanzill@redhat.com>
Date:   Wed Oct 10 14:09:50 2018 -0400

    Merge pull request #18060 from lpichler/order_custom_buttons_by_array_of_ids
    
    Order custom buttons by array of ids
    
    (cherry picked from commit 49956837c8143e928004beb8fce4bf4babedc081)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1635759

nizaminabeel pushed a commit to nizaminabeel/manageiq that referenced this pull request Dec 11, 2018
…by_array_of_ids

Order custom buttons by array of ids

(cherry picked from commit 4995683)

https://bugzilla.redhat.com/show_bug.cgi?id=1635759
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.

9 participants