-
Notifications
You must be signed in to change notification settings - Fork 987
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
fixes #3912 - add inheritance for locations / organizations #1105
Conversation
@@ -203,6 +203,7 @@ select{padding: initial;} | |||
.collapse .inputs-list li{ margin-left:20px; } | |||
|
|||
.delete{color: #b94a48 !important; cursor: auto;} | |||
.inherited{font-weight: bold !important; cursor: auto;} |
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 just to differentiate disabled items that are disabled because used by host or disabled because inherited. There is is a tooltip if disabled because inherited
re-committed. added some tests and ready for review |
@@ -35,6 +35,14 @@ def new | |||
end | |||
end | |||
|
|||
def nest | |||
@taxonomy = taxonomy_class.new | |||
Taxonomy.no_taxonomy_scope do |
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.
why without scope? shouldnt it be the parent scope or something like that? could this be abused?
@ohadlevy, do you want this feature merged soon? |
@isratrade yes please :) |
@abenari, I have one failure caused by
|
@isratrade ping? |
@ohadlevy, I don't understand the test failure to classification_test. It would be good if another set of eyes could look at it. |
re-committed and access_permission_test now passes. [test] |
same issue. failure only on mysql / ruby 2 that I don't think is relevant |
Added new commit to disable used locations/organizations on edit form for domain, subnet, etc. I also included the js needed in PR #1104 |
re-committed with fixes to taxonomix.rb that caused failing tests |
@isratrade ignore the sqlite/1.9.3 error, but you have integration test failures |
@domcleal, not sure about the integration failures that popped up. I can't reproduce them locally. I'm continue tomorrow. |
@@ -17,6 +17,7 @@ class ApplicationController < ActionController::Base | |||
before_filter :set_taxonomy, :require_mail, :check_empty_taxonomy | |||
before_filter :welcome, :only => :index, :unless => :api_request? | |||
before_filter :authorize | |||
before_filter :clean_taxonomy_ids, :only => [:create, :update] |
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 needed, since the the locations / organizations tab was switch to use multi-select.js and apparently this js library sends duplicate ids
ex.
params[:domain][:location_ids] = [","45", "45"] even though the [selected_ids] array does not have any duplicates.
there are still two test failures on cloning location / organization because Smart Proxy fixtures are not valid due to duplicate URL's |
conditions[:organization_id] = Array.wrap(org).map(&:id) if org | ||
conditions[:location_id] = Array.wrap(loc).map(&:id) if loc | ||
conditions[:organization_id] = org.path_ids if org | ||
conditions[:location_id] = loc.path_ids if loc |
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.
all tests should now pass. I also made this change above and squashed it.
added new commit. changes are.
|
end | ||
|
||
def selected_or_inherited_parameters | ||
LocationParameter.where(:reference_id => path_ids) |
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 isn't as intelligent as Hostgroup#parameters
. The hg version will iterate over the ancestry in order and override parameters as it gets deeper, while this implementation won't - we should unify them.
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.
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'll do 1155 first then, thanks.
By the way, you have some integration test failures. One more difference I noticed between this and host groups is that the parent host group is shown in a select box when you edit it. Could we add this to the taxonomy edit page? I think it'd be safe to make it editable even, but if there's an issue, then it could be left disabled. |
} | ||
|
||
scoped_search :on => :label, :complete_value => :true, :default_order => true |
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 was added to location.rb and organization.rb even though it appears in the NestedAncestryCommon mix. Otherwise, the autocompleter won't find "label = "
I assume the failure on Ruby 1.8.7 sqlite3 only is from jenkins. |
@@ -87,6 +95,9 @@ def destroy | |||
else | |||
process_error | |||
end | |||
rescue Ancestry::AncestryException |
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.
[done] Can you add this to the taxonomies API controller concern too please?
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, added to api controller
re-factored and with all fixes to comments. |
@@ -70,8 +75,7 @@ def step2 | |||
|
|||
def update | |||
result = Taxonomy.no_taxonomy_scope do | |||
(params[taxonomy_single.to_sym][:ignore_types] -= ["0"]) if params[taxonomy_single.to_sym][:ignore_types] |
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 now handle in the before_validation
in the model
@domcleal, if I use the same code for inherited parameters in locs/orgs as in hostgroups, then it doesn't show inherited values. Should this bug http://projects.theforeman.org/issues/4348 need to prevent the merger of this PR? |
@isratrade no, let's fix that later, it's only a UI issue |
@ohadlevy, removed unused view partial and re-commited |
rebased after multi-select commit |
Thanks @isratrade! Merged as 1fa008a for Foreman 1.5. Nice work :) |
No description provided.