-
Notifications
You must be signed in to change notification settings - Fork 357
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
Add new Tagging instead of RBAC tree for groups #5482
Add new Tagging instead of RBAC tree for groups #5482
Conversation
c6342c0
to
e4c502c
Compare
9bff3fd
to
2afe3f4
Compare
Depends on ManageIQ/react-ui-components#99 |
@PanSpagetka can you please update the react-ui-components version to |
f4c8100
to
7249537
Compare
Now I'm getting this error when I try to display a group:
|
Depends on ManageIQ/react-ui-components#105 |
847dcbb
to
dcfc155
Compare
:filters => @filters, | ||
:group => @group) | ||
cats = Classification.categories.find_all do |c| | ||
c if c.show || !%w[folder_path_blue folder_path_yellow].include?(c.name) |
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 Enumerable#find_all
expects a boolean from the block, therefore, I don't understand why you want to use an if
inside and return with the data itself. Also a select
or a reject
might be more understandable.
c if c.show || !%w[folder_path_blue folder_path_yellow].include?(c.name) | ||
end | ||
cats.sort_by! { |t| t.description.try(:downcase) } # Get the categories, sort by description | ||
cats.delete_if { |c| c.read_only? || c.entries.empty? } # Remove categories that are read only or have no entries |
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 combine this into the future select
or reject
described in my previous comment above.
end | ||
} | ||
end | ||
filters = @edit&.dig(:new)&.dig(:filters) || @filters |
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.
fetch_path
else | ||
arr << tag | ||
end | ||
end |
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 might be a little complext, will think about it.
end | ||
|
||
assigned_tags.uniq! { |tag| tag[:id] } | ||
@tags = {:tags => @tags, :assignedTags => assigned_tags, :affectedItems => [@group.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.
Recursively setting a variable increases code complexity, it counts as a double if you do it for an instance variable.
@tags = { :tags => @tags }
cat, tag = params[:id].split('cl-').last.split("_xx-") # Get the category and tag | ||
# cat, tag = params[:id].split('cl-').last.split("_xx-") # Get the category and tag | ||
cat = params[:cat] | ||
tag = params[:val] |
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.
cat, tag = params.values_at(:cat, :val)
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.
But I'd just simply use the params[:cat]
and params[:tag]
in the code below, no need for allocation if you don't use it elsewhere.
1f392d2
to
fd386db
Compare
@miq-bot add_reviewer @epwinchell |
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.
Looks fine. (the column layout/responsiveness is still messed up on react side, but that's for another PR)
7e5705c
to
1b6473c
Compare
@@ -1,8 +1,9 @@ | |||
import React from 'react'; | |||
import { connect } from 'react-redux'; | |||
import { applyMiddleware } from 'redux' |
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 not used.
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.
One small nitpick.
Can we add a test to the middleware? You can use the mock store and the middleware to it and check whether the api call was made or not.
@PanSpagetka please resolve the merge conflict |
1b6473c
to
d4f164a
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.
Middleware test looks good
64fa565
to
1fe8593
Compare
Checked commits PanSpagetka/manageiq-ui-classic@f95ecf8~...1fe8593 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
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.
Add new Tagging instead of RBAC tree for groups
Links [Optional]
ManageIQ/react-ui-components#105
Steps for Testing/QA [Optional]
Go to Ops -> Account Settings -> Groups
Old:
New:
@skateman