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

Physical server routing #1162

Merged
merged 1 commit into from May 3, 2017

Conversation

gabrielsvinha
Copy link
Contributor

@gabrielsvinha gabrielsvinha commented Apr 26, 2017

This Pull Request adds the specific routes and controller.

  • physical_server/show_list
  • physical_server/show
  • physical_server/protect
  • physical_server/download_data
  • physical_server/perf_top_chart

Obs: This Pull Request fixes the physical_server.png error (#1252)

captura de tela de 2017-04-26 20-25-36

@gabrielsvinha
Copy link
Contributor Author

@AparnaKarve ping

"physical_server_blink_loc_led" => [:blink_loc_led, "Blink LED"],
"physical_server_turn_on_loc_led" => [:turn_on_loc_led, "Turn On LED"],
"physical_server_turn_off_loc_led" => [:turn_off_loc_led, "Turn Off LED"]}.freeze

Copy link
Contributor

Choose a reason for hiding this comment

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

@gabrielsvinha Since this is a PR that just shows us the basic show_list view with a basic toolbar, can you remove the ACTIONS hash and all related code around it?

Copy link
Contributor

Choose a reason for hiding this comment

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

All you really need for this first pass is the show_list method.
Please remove all the other unused methods that are never called.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rodneyhbrown7
Copy link

@miq-bot assign @AparnaKarve

@AparnaKarve
Copy link
Contributor

@gabrielsvinha I'm thinking if we should also include show in this PR.
Could you point me to the PR that implements the show method?

Since show is currently not implemented in this PR, I get --

[----] F, [2017-05-02T16:04:04.108307 #77531:3fd8bd1043cc] FATAL -- : Error caught: [ActionController::UnknownFormat] PhysicalServerController#show is missing a template for this request format and variant.

request.formats: ["text/html"]
request.variant: []

NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.

@gabrielsvinha
Copy link
Contributor Author

@AparnaKarve This one: #1169

@AparnaKarve
Copy link
Contributor

Looks like #1169 would also have to be broken down into smaller functioning units.

Can you include the show implementation in this PR? That way we would not get the above error.
A basic detail page with a basic toolbar should be good enough for now.

@gabrielsvinha
Copy link
Contributor Author

Without the toolbar also?

@AparnaKarve
Copy link
Contributor

Either with a basic toolbar or without the toolbar

@gabrielsvinha gabrielsvinha force-pushed the physical_server_routing branch 3 times, most recently from 60b5ec3 to 9f619d1 Compare May 3, 2017 11:59
@lastaction = session[:physical_server_lastaction]
end

def collect_data(server_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you delete this method too?
It might be needed later, but not now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@AparnaKarve
Copy link
Contributor

The rails log shows this error since it is not able to find physical_server.png

[----] F, [2017-05-03T14:06:29.210734 #20011:3fcd4b565f74] FATAL -- : ActionController::RoutingError (No route matches [GET] "/images/100/physical_server.png"):

Do you have a PR that would address this?

Other than this issue, and the comment above to remove the collect_data method, everything else looks great.

@miq-bot
Copy link
Member

miq-bot commented May 3, 2017

Checked commit gabrielsvinha@c0f9dbe with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks fine. 👍

- Add physical server controller.

  - app/controllers/physical_server_controller.rb

- Implement show_list view and basic toolbar

- Implements show view for specific physical server
@gabrielsvinha
Copy link
Contributor Author

@AparnaKarve The PR we are thinking is #1252

@AparnaKarve
Copy link
Contributor

@gabrielsvinha Thanks.

@dclarizio This PR gets us the basic Physical Server view.
There are other PRs in the pipeline that depend on this.
This is now ready to go.

@dclarizio dclarizio merged commit 5bb3535 into ManageIQ:master May 3, 2017
@dclarizio dclarizio added this to the Sprint 60 Ending May 8, 2017 milestone May 3, 2017
@gabrielsvinha
Copy link
Contributor Author

cat-saying-thank-you-cats-picture-mxpmgy-clipart

@martinpovolny
Copy link

martinpovolny commented May 4, 2017

@gabrielsvinha, @AparnaKarve, @dclarizio : we have invested a significant effort to remove the

app/views/*/_main.html.haml and cleanup app/views/*/show.html.haml partials.

This PR introduces back the stuff that we have spent time removing. See:
app/views/physical_server/_main.html.haml and app/views/physical_server/show.html.haml partials.

Please, make sure that these files go away in the follow up PRs.

+#main_div
 +    - arr = %w(physical_server physical_servers)
 +    - if arr.include?(@display) && @showtype != "compare"
 +        = render(:partial => "layouts/gtl", :locals => {:action_url => "show/#{@ph_server.id}"})
 +    - else
 +        = render(:partial => @showtype)
  • compare has a separate path, does not have to go through here.
  • Prefer to use helpers to construct URLs or you will introduce bugs when moving to the "restful" URLs.
  • don't ever render :partial => VARIABLE. It is hard to get rid of as you have to find elsewhere what are the allowed values and it can have serious security implications!

@dclarizio
Copy link

@gabrielsvinha see Martin's note above ... might be best to just do a follow up PR with these changes alone ... Thx, Dan

@AparnaKarve
Copy link
Contributor

@martinpovolny Thanks for catching that.

@gabrielsvinha The original PR #755 for Physical Server view had a lot of these issues addressed.
Please refer back to this PR for addressing the _main and _showrelated changes. Thanks.

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.

None yet

6 participants