From d50f4ac0456c98b530ae3ddb4aa74549c8a72f43 Mon Sep 17 00:00:00 2001 From: safwanuahmed Date: Wed, 9 Apr 2025 06:36:21 -0400 Subject: [PATCH] Remove workspace termination fields from client side code --- .../components/get_project_details_query.vue | 12 ++++-------- .../fragments/workspace_item.fragment.graphql | 1 - ...ote_development_cluster_agents.query.graphql | 1 - .../workspaces/user/pages/create.vue | 9 --------- .../get_project_details_query_spec.js | 3 +-- ee/spec/frontend/workspaces/mock_data/index.js | 17 ----------------- .../workspaces/user/pages/create_spec.js | 15 +-------------- .../workspaces/user/router/index_spec.js | 2 -- locale/gitlab.pot | 3 --- 9 files changed, 6 insertions(+), 57 deletions(-) diff --git a/ee/app/assets/javascripts/workspaces/common/components/get_project_details_query.vue b/ee/app/assets/javascripts/workspaces/common/components/get_project_details_query.vue index 53ccce75b7b820..e1131dc17ee396 100644 --- a/ee/app/assets/javascripts/workspaces/common/components/get_project_details_query.vue +++ b/ee/app/assets/javascripts/workspaces/common/components/get_project_details_query.vue @@ -90,14 +90,10 @@ export default { return { clusterAgents: - data.namespace?.remoteDevelopmentClusterAgents?.nodes.map( - ({ id, name, project, workspacesAgentConfig }) => ({ - value: id, - text: `${project.nameWithNamespace} / ${name}`, - defaultMaxHoursBeforeTermination: - workspacesAgentConfig.defaultMaxHoursBeforeTermination, - }), - ) || [], + data.namespace?.remoteDevelopmentClusterAgents?.nodes.map(({ id, name, project }) => ({ + value: id, + text: `${project.nameWithNamespace} / ${name}`, + })) || [], }; } catch (error) { return { errors: [error] }; diff --git a/ee/app/assets/javascripts/workspaces/common/graphql/fragments/workspace_item.fragment.graphql b/ee/app/assets/javascripts/workspaces/common/graphql/fragments/workspace_item.fragment.graphql index 5383b1cea0595f..7fa49723f9fa20 100644 --- a/ee/app/assets/javascripts/workspaces/common/graphql/fragments/workspace_item.fragment.graphql +++ b/ee/app/assets/javascripts/workspaces/common/graphql/fragments/workspace_item.fragment.graphql @@ -9,6 +9,5 @@ fragment WorkspaceItem on Workspace { devfileRef devfilePath devfileWebUrl - maxHoursBeforeTermination createdAt } diff --git a/ee/app/assets/javascripts/workspaces/common/graphql/queries/get_remote_development_cluster_agents.query.graphql b/ee/app/assets/javascripts/workspaces/common/graphql/queries/get_remote_development_cluster_agents.query.graphql index 548fb3219419be..745f85745fe4f0 100644 --- a/ee/app/assets/javascripts/workspaces/common/graphql/queries/get_remote_development_cluster_agents.query.graphql +++ b/ee/app/assets/javascripts/workspaces/common/graphql/queries/get_remote_development_cluster_agents.query.graphql @@ -11,7 +11,6 @@ query getRemoteDevelopmentClusterAgents($namespace: ID!) { } workspacesAgentConfig { id - defaultMaxHoursBeforeTermination } } } diff --git a/ee/app/assets/javascripts/workspaces/user/pages/create.vue b/ee/app/assets/javascripts/workspaces/user/pages/create.vue index 2a95a47cfe896d..0402d8f1de930a 100644 --- a/ee/app/assets/javascripts/workspaces/user/pages/create.vue +++ b/ee/app/assets/javascripts/workspaces/user/pages/create.vue @@ -59,7 +59,6 @@ export const i18n = { }, pathToDevfile: s__('Workspaces|Path to devfile'), agentId: s__('Workspaces|Cluster agent'), - maxHoursBeforeTermination: s__('Workspaces|Workspace automatically terminates after'), maxHoursSuffix: __('hours'), }, invalidProjectAlert: { @@ -116,7 +115,6 @@ export default { clusterAgentsMap: {}, devfileRef: '', projectId: null, - maxHoursBeforeTermination: 0, workspaceVariables: [], showWorkspaceVariableValidations: false, projectDetailsLoaded: false, @@ -158,10 +156,6 @@ export default { this.focusFirstElement(); }, methods: { - onAgentChange(agentId) { - this.maxHoursBeforeTermination = - this.clusterAgentsMap[agentId].defaultMaxHoursBeforeTermination; - }, onProjectDetailsResult({ fullPath, nameWithNamespace, clusterAgents, id, rootRef }) { // This scenario happens when the selected project is specified in the URL as a query param if (!this.selectedProject) { @@ -180,7 +174,6 @@ export default { // Select the first agent if there are any if (clusterAgents.length > 0) { this.selectedAgent = clusterAgents[0].value; - this.maxHoursBeforeTermination = clusterAgents[0].defaultMaxHoursBeforeTermination; } }, onProjectDetailsError() { @@ -223,7 +216,6 @@ export default { desiredState: DEFAULT_DESIRED_STATE, devfileRef: this.devfileRef, devfilePath: this.devfilePath, - maxHoursBeforeTermination: parseInt(this.maxHoursBeforeTermination, 10), variables: this.workspaceVariables.map((v) => omit(v, 'valid')), }, }, @@ -338,7 +330,6 @@ export default { class="gl-max-w-full" autocomplete="off" data-testid="workspace-cluster-agent-id-field" - @input="onAgentChange" />