-
Notifications
You must be signed in to change notification settings - Fork 356
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
Identify invalid Catalog Items/Bundles in the UI #6448
Identify invalid Catalog Items/Bundles in the UI #6448
Conversation
@miq-bot add_label services, enhancement |
eabfb89
to
e8b10bc
Compare
6979c64
to
cb5a189
Compare
cb5a189
to
187f11e
Compare
@h-kataria This is ready for review. Thanks ❇️ |
187f11e
to
a3ec01d
Compare
Let's talk what you need to do and how to do it in a generic way. Let's investigate there's / there's not already someone else doing it elsewhere. If an exception is really needed from the generic behavior, let's put it closest to the place where it's actually needed. |
@martinpovolny Thank you very much for the review. Yes, let's talk about this. I am not happy about my changes, too. And I haven't found any better possibilities yet. There is some more info in #6320 |
a3ec01d
to
e23761c
Compare
82f5faa
to
2d64f44
Compare
@@ -44,10 +44,12 @@ | |||
.form-group | |||
.col-md-1{:align => "center"} | |||
#buttons | |||
- template_invalid = Array(@flash_array).any? { |f| f[:level] == :warning } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not how we want to do it, you have access to the @record
, use that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you, I know. 👍 I was about to change it but you were faster.
:onclick => "#{@row_button[:function]}(\"#{row['id']}\");" | ||
} | ||
# Append a button if @row_button is set and the button is defined in the related decorator | ||
button = item.decorate.try(:gtl_button_cell, row['id'], @row_button[:label], @row_button[:title], @row_button[:function]) if @row_button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button = item.decorate.try(:gtl_button_cell, row['id'], @row_button[:label], @row_button[:title], @row_button[:function]) if @row_button | |
button = item.decorate.try(:gtl_button_cell, row['id'], @row_button.permit(:label, :function, :title)) if @row_button |
This way you can access the params in the decorator and decrease the number of arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better if we move the constants from @row_button
into the decorator and keep it here as a boolean. Let's talk about this when you're at the office.
2995fd9
to
cdd6af0
Compare
@miq-bot add_label pending core |
@miq-bot remove_label wip |
@row_button = {:label => _("Order"), | ||
:function => "miqOrderService", | ||
:title => _("Order this Service")} # Show a button instead of the checkbox | ||
@row_button = true # Show a button instead of the checkbox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this a one-liner:
@row_button = true # Show a button instead of the checkbox | |
# Show a button instead of the checkbox | |
@row_button = true if role_allows?(:feature => 'svc_catalog_provision') |
:alt => t = @template_valid ? _("Order this Service") : _("This Service cannot be ordered"), | ||
:title => t, | ||
:disabled => !@template_valid, | ||
:onclick => "miqOrderService(#{@record.id})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reuse the information from the decorator here...
150ef99
to
7c365b3
Compare
@miq-bot rm_label pending core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7c365b3
to
7b5746a
Compare
@hstastna The current CI failures seem related. |
7b5746a
to
f4d2fb4
Compare
Checked commits hstastna/manageiq-ui-classic@50d6bdf~...f4d2fb4 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
Issue: #6320
DEPENDS ON: ManageIQ/manageiq-decorators#26 (merged)
This PR:
After:
Services > Catalogs > Catalog Items:
Services > Catalogs > Service Catalogs:
Services > Catalogs > Service Catalogs, details' screen of a selected Service:
Services > Catalogs > Catalog Items, details' screen of a selected Service: