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
Fix error for Datastore custom button #4745
Fix error for Datastore custom button #4745
Conversation
|
@miq-bot remove_label wip |
|
@miq-bot add_label blocker |
|
@miq-bot assign @romanblanco |
d54cae5
to
c8e50dd
Compare
|
@romanblanco Error handling changed as discussed. |
|
I guess the codecliemate issues are worth investigating / fixing. |
c8e50dd
to
40367f2
Compare
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.
I'm seeing the same results in UI after setting Open URL: true, but there's still an error:
[----] F, [2018-10-18T13:39:24.849133 #24431:2b018ad638bc] FATAL -- : Error caught: [NoMethodError] undefined method `url' for nil:NilClass
/home/rblanco/devel/manageiq-ui-classic/app/controllers/application_controller/buttons.rb:252:in `open_url_after_dialog'
|
Yep it's broken. @miq-bot add_label wip Edit: Blamed wrong thing. If |
- Add open_url to local_options for non-explorer screens - Fix error handling when Automate does not return url Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1574403 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1635797
40367f2
to
27fdb39
Compare
|
@miq-bot remove_label wip @romanblanco Now it has to work even with your |
27fdb39
to
c6ff820
Compare
|
Checked commits ZitaNemeckova/manageiq-ui-classic@77b692a~...c6ff820 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
|
@miq-bot remove_label wip @romanblanco Now it has to work even with your |
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.
The GitHub page is currently not getting updated correctly.
After the last changes, the fix works:
diff --git a/app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js b/app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js
index f52fcf90e..cff19f0ba 100644
--- a/app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js
+++ b/app/assets/javascripts/controllers/dialog_user/dialog_user_controller.js
@@ -79,8 +79,13 @@ ManageIQ.angular.app.controller('dialogUserController', ['API', 'dialogFieldRefr
return $http.post("open_url_after_dialog", {targetId: vm.targetId});
})
.then(function(response) {
- window.open(response.data.open_url);
- miqService.redirectBack(__('Order Request was Submitted'), 'success', finishSubmitEndpoint);
+ if (response.data.open_url) {
+ window.open(response.data.open_url);
+ miqService.redirectBack(__('Order Request was Submitted'), 'success', finishSubmitEndpoint);
+ } else {
+ miqService.miqFlash('error', __('Automate failed to obtain URL.'));
+ miqService.sparkleOff();
+ };
})
.catch(function() {
return Promise.reject({data: {error: {message: '-'.concat(__('Automate failed to obtain URL.')) }}});
diff --git a/app/controllers/application_controller/buttons.rb b/app/controllers/application_controller/buttons.rb
index 1da917ec2..5669e6ae7 100644
--- a/app/controllers/application_controller/buttons.rb
+++ b/app/controllers/application_controller/buttons.rb
@@ -254,7 +254,8 @@ module ApplicationController::Buttons
end
def open_url_after_dialog
- url = SystemConsole.find_by(:vm_id => params[:targetId]).url
+ system_console = SystemConsole.find_by(:vm_id => params[:targetId])
+ url = system_console.try(:url)
render :json => {:open_url => url}
end
Whoever merges this, please make sure the @ZitaNemeckova's commits with changes are in place
|
@ZitaNemeckova as this is for a 5.9.5 blocker, is this still a WIP. |
|
@JPrause It's not WIP anymore, but because of the website error the label probably is not getting updated as well as the commited changes. |
|
@JPrause I tried to remove wip via miq-bot #4745 (comment) . |
|
@miq-bot remove_label wip EDIT: ..because I didn't see the comments :) .. also removed manually, hopefully it sticks |
|
Merged. Tested locally, because checks don't seem to be responding consistently today. |
Fix error for Datastore custom button (cherry picked from commit fe7f419) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1641669 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1641670
|
Gaprindashvili backport details: |
Fix error for Datastore custom button (cherry picked from commit fe7f419) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1574403 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1635797
|
Hammer backport details: |
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1574403
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1635797
Create custom button with dialog but without Open URL for Datastore with
Display forset toSingle.Automation -> Automate -> Customization -> Buttons
Go to Datastore summary page and click the new button.
Before:
After:


Without Open URL
With Open URL
@miq-bot add_label wip, bug, hammer/yes, gaprindashvili/yes