Skip to content

Refactor workspaces graphql fields - Part 2

Issue: Refactor workspaces graphql fields - Part 2 (#431515 - closed)

What does this MR do and why?

See detailed description in Refactor workspaces graphql fields - Part 2 (#431515 - closed)

See overview of Category:Remote Development Workspaces Admin UI issues and MRs in MVP of Admin UI for Workspaces (&11992 - closed)

Screenshots or screen recordings

N/A, only contains GraphQL API changes, no UI changes.

How to set up and validate locally

  • Test all new and changed graphql resolvers. TODO: Add example queries

Database Info

Rails Console Commands to obtain finder query with all arguments

[11] pry(main)> current_user = User.find_by_username('root')
  User Load (0.9ms)  SELECT "users".* FROM "users" WHERE (LOWER("users"."username") IN (LOWER('root'))) LIMIT 1 /*application:console,db_config_name:main,console_hostname:woolley.local,console_username:cwoolley,line:/app/models/user.rb:897:in `find_by_username'*/
=> #<User id:1 @root>
[12] pry(main)> finder = RemoteDevelopment::WorkspacesFinder.execute(current_user: current_user, ids: [72,-1], user_ids: [1,-1], project_ids: [2,-1], agent_ids: [4,-1], actual_states: ['Terminated','Starting']).to_a
  RemoteDevelopment::Workspace Load (0.6ms)  SELECT "workspaces".* FROM "workspaces" WHERE "workspaces"."id" IN (72, -1) AND "workspaces"."user_id" IN (1, -1) AND "workspaces"."project_id" IN (2, -1) AND "workspaces"."cluster_agent_id" IN (4, -1) AND "workspaces"."actual_state" IN ('Terminated', 'Starting') ORDER BY "workspaces"."id" DESC /*application:console,db_config_name:main,console_hostname:woolley.local,console_username:cwoolley,line:(pry):12:in `__pry__'*/

Raw SQL query

SELECT "workspaces".* FROM "workspaces" WHERE "workspaces"."id" IN (1000620, -1) AND "workspaces"."user_id" IN (4985794, -1) AND "workspaces"."project_id" IN (74823, -1) AND "workspaces"."cluster_agent_id" IN (73241, -1) AND "workspaces"."actual_state" IN ('Terminated', 'Starting') ORDER BY "workspaces"."id" DESC 

Query Plan

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Chad Woolley

Merge request reports