From 71eff21cb18228d6f05df0fed7d7a7adf809bbcd Mon Sep 17 00:00:00 2001 From: Enrique Alcantara Date: Thu, 25 Apr 2024 10:56:04 +0200 Subject: [PATCH 1/3] Use real agent-mapping API in Create Workspace UI --- ...t_remote_development_cluster_agents.query.graphql | 2 +- .../features/remote_development/workspaces_spec.rb | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ee/app/assets/javascripts/remote_development/graphql/queries/get_remote_development_cluster_agents.query.graphql b/ee/app/assets/javascripts/remote_development/graphql/queries/get_remote_development_cluster_agents.query.graphql index 18279d27a33f17..18eff19d41623b 100644 --- a/ee/app/assets/javascripts/remote_development/graphql/queries/get_remote_development_cluster_agents.query.graphql +++ b/ee/app/assets/javascripts/remote_development/graphql/queries/get_remote_development_cluster_agents.query.graphql @@ -1,7 +1,7 @@ query getRemoteDevelopmentClusterAgents($namespace: ID!) { namespace(fullPath: $namespace) { id - remoteDevelopmentClusterAgents(filter: "AVAILABLE") @client { + remoteDevelopmentClusterAgents(filter: AVAILABLE) { nodes { id name diff --git a/ee/spec/features/remote_development/workspaces_spec.rb b/ee/spec/features/remote_development/workspaces_spec.rb index 4da3fa82ccab5c..25c4e29182cf20 100644 --- a/ee/spec/features/remote_development/workspaces_spec.rb +++ b/ee/spec/features/remote_development/workspaces_spec.rb @@ -261,7 +261,15 @@ def simulate_agentk_reconcile_post(workspace_agent_infos:) context 'when creating' do # TODO Unskip feature spec once the Agent mapping GraphQL API is implemented # https://gitlab.com/gitlab-org/gitlab/-/issues/455214 - describe 'when the remote_development_namespace_agent_authorization feature flag is on', :skip do + context 'when the remote_development_namespace_agent_authorization feature flag is on' do + let_it_be(:cluster_agent_mapping) do + create( + :remote_development_namespace_cluster_agent_mapping, + user: user, agent: agent, + namespace: group + ) + end + before do stub_feature_flags(remote_development_namespace_agent_authorization: true) end @@ -269,7 +277,7 @@ def simulate_agentk_reconcile_post(workspace_agent_infos:) it_behaves_like 'creates a workspace' end - describe 'when the remote_development_namespace_agent_authorization feature flag is off' do + context 'when the remote_development_namespace_agent_authorization feature flag is off' do before do stub_feature_flags(remote_development_namespace_agent_authorization: false) end -- GitLab From 08f5a974b90dc9f9cf7d7cdcd825e7968b028131 Mon Sep 17 00:00:00 2001 From: Enrique Alcantara Date: Fri, 26 Apr 2024 14:55:55 +0200 Subject: [PATCH 2/3] Code review feedback Rewrite error message that appears when a project does not have cluster agents available to remove links that point to the documentation --- .../javascripts/remote_development/pages/create.vue | 12 ++---------- .../frontend/remote_development/pages/create_spec.js | 6 ------ locale/gitlab.pot | 6 +++--- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/ee/app/assets/javascripts/remote_development/pages/create.vue b/ee/app/assets/javascripts/remote_development/pages/create.vue index 0f773a1e58ffa6..910c233f38b38f 100644 --- a/ee/app/assets/javascripts/remote_development/pages/create.vue +++ b/ee/app/assets/javascripts/remote_development/pages/create.vue @@ -10,7 +10,6 @@ import { GlFormInputGroup, GlIcon, GlPopover, - GlSprintf, GlTooltipDirective, GlLink, } from '@gitlab/ui'; @@ -60,7 +59,7 @@ export const i18n = { invalidProjectAlert: { title: s__("Workspaces|You can't create a workspace for this project"), noAgentsContent: s__( - "Workspaces|To create a workspace for this project, an administrator must %{linkStart}configure a cluster agent%{linkEnd} for the project's group.", + 'Workspaces|You must have access to a cluster agent. An administrator can configure an agent for the project or group.', ), noDevFileContent: s__( 'Workspaces|To create a workspace, add a devfile to this project. A devfile is a configuration file for your workspace.', @@ -76,7 +75,6 @@ export const i18n = { ), }; -const clusterAgentsHelpPath = helpPagePath('user/clusters/agent/install/index.md'); export const devfileHelpPath = helpPagePath('user/workspace/index.md#devfile'); export default { @@ -90,7 +88,6 @@ export default { GlFormInput, GlIcon, GlPopover, - GlSprintf, GlLink, RefSelector, SearchProjectsListbox, @@ -241,7 +238,6 @@ export default { i18n, ROUTES, PROJECT_VISIBILITY, - clusterAgentsHelpPath, devfileHelpPath, }; @@ -281,11 +277,7 @@ export default { variant="danger" :dismissible="false" > - - - + {{ $options.i18n.invalidProjectAlert.noAgentsContent }}