feat: team param for query LiveView#3469
Conversation
6503c14 to
5b7bd0a
Compare
5b7bd0a to
a2ed66c
Compare
3d01fd8 to
401940c
Compare
576e885 to
779cfd3
Compare
779cfd3 to
821af82
Compare
9a50d59 to
ad6f70a
Compare
7caec45 to
4f8f2ae
Compare
| |> select([resource_team: team], team.id) | ||
| end | ||
|
|
||
| def resource_team_id_query(LogflareWeb.QueryLive, %{"q" => query}, user) |
There was a problem hiding this comment.
| def resource_team_id_query(LogflareWeb.QueryLive, %{"q" => query}, user) | |
| def resource_team_id_query(LogflareWeb.QueryLive, %{"q" => query}, user_or_team_user) |
There was a problem hiding this comment.
Also updated these in #3479 for consistency.
| team_owner = insert(:user) | ||
| other_team = insert(:team, user: team_owner) | ||
| insert(:team_user, email: user.email, team: other_team) | ||
| insert(:source, user: team_owner, name: "canonical_source") |
There was a problem hiding this comment.
What if both teams that the effective user is a team_user of has a source with the same name? Basing it on source name should only be a fallback if there's no team param provided
There was a problem hiding this comment.
Good point. The requirement to override an existing team context when a resource is specified falls down when the resource is ambiguous.
This was also an issue when running a query, when the LiveView attempts to set a team context based on the submitted query.
Updated AuthLive to only override team context when the team param is missing.
TeamContext will only change the team context when the query suggests a single team.
If a user has the same-named source in multiple teams, they will have to switch to the appropriate team before querying.
1a6d2d7 to
1590911
Compare
639b897 to
688b4e1
Compare
Follows #3454
Closes O11Y-1754