diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 13:43:29 +0300 |
commit | 3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 (patch) | |
tree | 3bc4a40e0ee51ec27eabf917c537033c0c5b14d4 /app/assets/javascripts/clusters_list/graphql | |
parent | 9bba14be3f2c211bf79e15769cd9b77bc73a13bc (diff) |
Add latest changes from gitlab-org/gitlab@16-1-stable-eev16.1.0-rc42
Diffstat (limited to 'app/assets/javascripts/clusters_list/graphql')
3 files changed, 22 insertions, 35 deletions
diff --git a/app/assets/javascripts/clusters_list/graphql/cache_update.js b/app/assets/javascripts/clusters_list/graphql/cache_update.js index e68f6a378c0..1c58652744d 100644 --- a/app/assets/javascripts/clusters_list/graphql/cache_update.js +++ b/app/assets/javascripts/clusters_list/graphql/cache_update.js @@ -2,27 +2,6 @@ import produce from 'immer'; export const hasErrors = ({ errors = [] }) => errors?.length; -export function addAgentToStore(store, createClusterAgent, query, variables) { - if (!hasErrors(createClusterAgent)) { - const { clusterAgent } = createClusterAgent; - const sourceData = store.readQuery({ - query, - variables, - }); - - const data = produce(sourceData, (draftData) => { - draftData.project.clusterAgents.nodes.push(clusterAgent); - draftData.project.clusterAgents.count += 1; - }); - - store.writeQuery({ - query, - variables, - data, - }); - } -} - export function addAgentConfigToStore( store, clusterAgentTokenCreate, @@ -65,7 +44,12 @@ export function removeAgentFromStore(store, deleteClusterAgent, query, variables draftData.project.clusterAgents.nodes = draftData.project.clusterAgents.nodes.filter( ({ id }) => id !== deleteClusterAgent.id, ); - draftData.project.clusterAgents.count -= 1; + draftData.project.ciAccessAuthorizedAgents.nodes = draftData.project.ciAccessAuthorizedAgents.nodes.filter( + ({ agent }) => agent.id !== deleteClusterAgent.id, + ); + draftData.project.userAccessAuthorizedAgents.nodes = draftData.project.userAccessAuthorizedAgents.nodes.filter( + ({ agent }) => agent.id !== deleteClusterAgent.id, + ); }); store.writeQuery({ diff --git a/app/assets/javascripts/clusters_list/graphql/fragments/cluster_agent.fragment.graphql b/app/assets/javascripts/clusters_list/graphql/fragments/cluster_agent.fragment.graphql index 05d2525ab98..31897b50407 100644 --- a/app/assets/javascripts/clusters_list/graphql/fragments/cluster_agent.fragment.graphql +++ b/app/assets/javascripts/clusters_list/graphql/fragments/cluster_agent.fragment.graphql @@ -2,6 +2,7 @@ fragment ClusterAgentFragment on ClusterAgent { id name webPath + createdAt connections { nodes { metadata { diff --git a/app/assets/javascripts/clusters_list/graphql/queries/get_agents.query.graphql b/app/assets/javascripts/clusters_list/graphql/queries/get_agents.query.graphql index 76920a0aef4..2a4f7b42eff 100644 --- a/app/assets/javascripts/clusters_list/graphql/queries/get_agents.query.graphql +++ b/app/assets/javascripts/clusters_list/graphql/queries/get_agents.query.graphql @@ -1,26 +1,28 @@ -#import "~/graphql_shared/fragments/page_info.fragment.graphql" #import "../fragments/cluster_agent.fragment.graphql" -query getAgents( - $defaultBranchName: String! - $projectPath: ID! - $first: Int - $last: Int - $afterAgent: String - $beforeAgent: String -) { +query getAgents($defaultBranchName: String!, $projectPath: ID!) { project(fullPath: $projectPath) { id - clusterAgents(first: $first, last: $last, before: $beforeAgent, after: $afterAgent) { + clusterAgents { nodes { ...ClusterAgentFragment } + } - pageInfo { - ...PageInfo + ciAccessAuthorizedAgents { + nodes { + agent { + ...ClusterAgentFragment + } } + } - count + userAccessAuthorizedAgents { + nodes { + agent { + ...ClusterAgentFragment + } + } } repository { |