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

Toolbar refactoring: Ops #417

Merged
merged 13 commits into from
Feb 24, 2017
Merged

Conversation

vecerek
Copy link

@vecerek vecerek commented Feb 17, 2017

Toolbar button ids Toolbar button classes created or edited
schedule_run_now ScheduleRunNow < Basic
rbac_tenant_add, rbac_project_add TenantAdd < GenericFeatureButton
reload_server_tree ReloadServerTree < Basic
refresh_server_summary, restart_server DiagnosticsSummary < Basic
restart_workers RefreshWorkers < Basic
collect_current_logs, collect_logs, log_depot_edit DiagnosticsLogs < CollectLogs
refresh_log, fetch_log DiagnosticsEvmLogs < Basic
refresh_audit_log, fetch_audit_log DiagnosticsAuditLogs < Basic
refresh_production_log, fetch_production_log DiagnosticsProductionLogs < Basic
db_refresh DbRefsresh < Basic

Links

Parent issue: ManageIQ/manageiq#6259
Related issue: ManageIQ/manageiq#6554
Pending (not anymore): ManageIQ/manageiq#13982
Pivotal Tracker: https://www.pivotaltracker.com/story/show/133670283

@miq-bot miq-bot added the wip label Feb 17, 2017
@vecerek vecerek force-pushed the toolbar_refactoring__ops branch 2 times, most recently from 2623819 to 33d903d Compare February 20, 2017 11:18
@miq-bot
Copy link
Member

miq-bot commented Feb 20, 2017

@vecerek Cannot apply the following label because they are not recognized: pending_core

@miq-bot
Copy link
Member

miq-bot commented Feb 20, 2017

@vecerek Cannot apply the following label because they are not recognized: pending-core

1 similar comment
@miq-bot
Copy link
Member

miq-bot commented Feb 20, 2017

@vecerek Cannot apply the following label because they are not recognized: pending-core

@vecerek vecerek force-pushed the toolbar_refactoring__ops branch 3 times, most recently from 9019e7c to 6700090 Compare February 23, 2017 11:22
@miq-bot miq-bot changed the title [WIP] Toolbar refactoring: Ops Toolbar refactoring: Ops Feb 23, 2017
@miq-bot miq-bot added refactoring and removed wip labels Feb 23, 2017
@vecerek vecerek force-pushed the toolbar_refactoring__ops branch from 6700090 to 34ea18f Compare February 23, 2017 14:09
@@ -23,7 +23,8 @@ class ApplicationHelper::Toolbar::MiqScheduleCenter < ApplicationHelper::Toolbar
:schedule_run_now,
Copy link
Member

@romanblanco romanblanco Feb 23, 2017

Choose a reason for hiding this comment

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

'fa fa-play-circle-o fa-lg', missing here

@@ -0,0 +1,7 @@
class ApplicationHelper::Button::ScheduleRunNow < ApplicationHelper::Button::ButtonWithoutRbacCheck
Copy link
Member

@romanblanco romanblanco Feb 23, 2017

Choose a reason for hiding this comment

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

@vecerek Hm, i know I've suggested to use ButtonWithoutRbacCheck class, but now, when I'm trying the button, I'm getting back error message:

screenshot from 2017-02-23 15-18-33

So, the buttons parent class probably should be Basic, as it was apparently disabled for me for a reason, and the only strange thing to me, is that the OOTB admin user does not have rights to use this feature.

Seems like other issue to me.

cc/ @dclarizio

@@ -3,7 +3,8 @@ class ApplicationHelper::Button::GenericFeatureButton < ApplicationHelper::Butto

def initialize(view_context, view_binding, instance_data, props)
super
@feature = props[:options][:feature]
# TODO: use #dig when ruby2.2 is no longer supported
@feature = props.fetch(:options, {}).fetch(:feature, nil)
Copy link
Member

@romanblanco romanblanco Feb 23, 2017

Choose a reason for hiding this comment

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

@vecerek Why not just

@feature = props.fetch_path(:options, :feature)

delegate :rbac_common_feature_for_buttons, :to => :@view_context

def role_allows_feature?
role_allows?(:feature => rbac_common_feature_for_buttons(@feature))
Copy link
Member

@romanblanco romanblanco Feb 23, 2017

Choose a reason for hiding this comment

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

@vecerek I was pretty confused at this point, because you check availability of a @feature for a role at a lot of buttons, where you don't even define the feature to check (in toolbar).

After explanation, I've understood, that's why you've changed feature loading in previous commit af8a4e2, but still, it seems i bit wrong.

Isn't it better to use GenericFeatureButton based class only for the two buttons, that the rbac_common_feature_for_buttons method checks?

/cc @PanSpagetka

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that it look confusing when you have button named RbacCommonFeatureButton and you intentionally don't set any feature. Also I think, that it will hide button, which probably isn't right.

@@ -13,7 +13,8 @@ class ApplicationHelper::Toolbar::TenantsCenter < ApplicationHelper::Toolbar::Ba
N_('Edit the selected item'),
:url_parms => "main_div",
:enabled => false,
:onwhen => "1"),
:onwhen => "1",
:klass => ApplicationHelper::Button::TenantEdit),
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this class because you can use Basic button.

def disabled?
@record.source
@record.try!(:source)
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to modify this class, because it is not needed to add this to summary toolbar.

When ButtonWithoutRbacCheck has been the parent, an error message has been being thrown which stated: 'The user is not authorized for this task or item.'; even though the user has had an admin role.
@romanblanco
Copy link
Member

@vecerek Please complete the description, at least add the related issues

@@ -0,0 +1,7 @@
class ApplicationHelper::Button::ReloadServerTree < ApplicationHelper::Button::Basic
Copy link
Author

Choose a reason for hiding this comment

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

No button has been assigned to this class. The assignment needs to be added.

/cc @romanblanco

Copy link
Author

Choose a reason for hiding this comment

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

@romanblanco just pushed the changes, could you check it in UI, please?

@@ -4,7 +4,7 @@ class ApplicationHelper::Button::GenericFeatureButton < ApplicationHelper::Butto
def initialize(view_context, view_binding, instance_data, props)
super
# TODO: use #dig when ruby2.2 is no longer supported
@feature = props.fetch(:options, {}).fetch(:feature, nil)
@feature = props.fetch_path(:options, :feature)
Copy link
Member

Choose a reason for hiding this comment

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

@vecerek Please remove this prevention. As we discussed, we'd like to have it in a way, that if you have a button that should check for a feature, you should always set the feature in a toolbar.

Copy link
Author

Choose a reason for hiding this comment

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

done, changes pushed

@romanblanco
Copy link
Member

romanblanco commented Feb 24, 2017

Once all the mentioned issues are fixed, it LGTM. Good job, @vecerek! 👍

@vecerek
Copy link
Author

vecerek commented Feb 24, 2017

All issues fixed.

/cc @martinpovolny @mzazrivec

Also add the button property feature option in specs.
@vecerek vecerek force-pushed the toolbar_refactoring__ops branch from 9cc0497 to 0cd906f Compare February 24, 2017 14:38
@miq-bot
Copy link
Member

miq-bot commented Feb 24, 2017

Checked commits vecerek/manageiq-ui-classic@2b51370~...0cd906f with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
33 files checked, 17 offenses detected

app/helpers/application_helper/toolbar/diagnostics_region_center.rb

app/helpers/application_helper/toolbar/diagnostics_server_center.rb

app/helpers/application_helper/toolbar/diagnostics_zone_center.rb

app/helpers/application_helper/toolbar/miq_schedule_center.rb

app/helpers/application_helper/toolbar/miq_schedules_center.rb

app/helpers/application_helper/toolbar/vmdb_table_center.rb

app/helpers/application_helper/toolbar/vmdb_tables_center.rb

@mzazrivec mzazrivec self-assigned this Feb 24, 2017
@mzazrivec mzazrivec added this to the Sprint 55 Ending Feb 27, 2017 milestone Feb 24, 2017
@mzazrivec mzazrivec merged commit ef884b3 into ManageIQ:master Feb 24, 2017
@vecerek vecerek deleted the toolbar_refactoring__ops branch February 24, 2017 15:41
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.

5 participants