-
Notifications
You must be signed in to change notification settings - Fork 43
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
[MNOE-146] Display teams admin panel #583
[MNOE-146] Display teams admin panel #583
Conversation
|
||
protected | ||
|
||
def fetch_all_teams(organization_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.
what is the difference between fetch_all_teams
and fetch_teams
? keep fetch_teams
only.
@@ -19,7 +19,7 @@ def timestamp | |||
end | |||
|
|||
def parent_organization | |||
@parent_organization ||= current_user.organizations.to_a.find { |o| o.id.to_s == params[:organization_id].to_s } | |||
@parent_organization ||= MnoEnterprise::Organization.includes(:orga_relations).find(params[:organization_id]).first |
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.
replace by find_one(params[:organization_id], :orga_relations)
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.
Some changes needed.
#================================================================== | ||
# GET /mnoe/jpi/v1/admin/organizations/1/teams | ||
def index | ||
authorize! :read, parent_organization |
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.
Do we need authorize there? It's in the admin endpoint
def fetch_teams(organization_id) | ||
MnoEnterprise::Team | ||
.apply_query_params(params) | ||
.includes(RELATIONSHIPS) |
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.
Should we use select
here as part of the perf improvements?
@@ -0,0 +1,20 @@ | |||
@all_apps ||= MnoEnterprise::App.all.to_a |
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.
Do we really to load all apps for each team here?
Couldn't we load and include team -> app_instances -> app
Especially if it's just to display the logo
@@ -19,7 +19,7 @@ def timestamp | |||
end | |||
|
|||
def parent_organization | |||
@parent_organization ||= current_user.organizations.to_a.find { |o| o.id.to_s == params[:organization_id].to_s } | |||
@parent_organization ||= MnoEnterprise::Organization.find_one(params[:organization_id], :orga_relations) |
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 think this helper was not used before and is just a bad copy paste from the regular jpi controller.
How about removing it and inline the code in the controller that uses it?
- Extract TeamsController to Concern - Do not load all apps - Make a smart select - Remove unused parent_organization method
ae9675e
to
baec6de
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.
LGTM.
See my question about the xxx_id
@@ -9,6 +9,7 @@ module MnoEnterprise::Concerns::Models::AppInstance | |||
included do | |||
property :created_at, type: :time | |||
property :updated_at, type: :time | |||
property :app_id, type: :string |
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 thought we were getting rid of this in #560
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.
we are, but little by little.
No description provided.