Add GQL mutation for redeploying deployment to production (#42)

* Add graphql mutation to redeploy deployment to production

* Implement frontend to redeploy deployment to production

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
2024-02-01 11:37:57 +05:30
committed by Ashwin Phatak
co-authored by neeraj
parent 5310d7c7d0
commit 0feeb9408d
11 changed files with 99 additions and 22 deletions
+13 -2
View File
@@ -1,8 +1,8 @@
import { ApolloClient, DefaultOptions, InMemoryCache, NormalizedCacheObject } from '@apollo/client';
import { getUser, getOrganizations, getDeployments, getProjectMembers, searchProjects, getEnvironmentVariables, getProject } from './queries';
import { AddEnvironmentVariableInput, AddEnvironmentVariablesResponse, GetDeploymentsResponse, GetEnvironmentVariablesResponse, GetOrganizationsResponse, GetProjectMembersResponse, SearchProjectsResponse, GetUserResponse, RemoveMemberResponse, UpdateDeploymentToProdResponse, GetProjectResponse, UpdateProjectResponse, UpdateProjectInput } from './types';
import { removeMember, addEnvironmentVariables, updateDeploymentToProd, updateProjectMutation } from './mutations';
import { AddEnvironmentVariableInput, AddEnvironmentVariablesResponse, GetDeploymentsResponse, GetEnvironmentVariablesResponse, GetOrganizationsResponse, GetProjectMembersResponse, SearchProjectsResponse, GetUserResponse, RemoveMemberResponse, UpdateDeploymentToProdResponse, GetProjectResponse, UpdateProjectResponse, UpdateProjectInput, RedeployToProdResponse } from './types';
import { removeMember, addEnvironmentVariables, updateDeploymentToProd, updateProjectMutation, redeployToProd } from './mutations';
export interface GraphQLConfig {
gqlEndpoint: string;
@@ -147,4 +147,15 @@ export class GQLClient {
return data;
}
async redeployToProd (deploymentId: string): Promise<RedeployToProdResponse> {
const { data } = await this.client.mutate({
mutation: redeployToProd,
variables: {
deploymentId
}
});
return data;
}
}
+5
View File
@@ -21,5 +21,10 @@ mutation ($deploymentId: String!) {
export const updateProjectMutation = gql`
mutation ($projectId: String!, $updateProject: UpdateProjectInput) {
updateProject(projectId: $projectId, updateProject: $updateProject)
}`;
export const redeployToProd = gql`
mutation ($deploymentId: String!) {
redeployToProd(deploymentId: $deploymentId)
}
`;
+4
View File
@@ -182,3 +182,7 @@ export type UpdateProjectInput = {
name: string
description: string
}
export type RedeployToProdResponse = {
redeployToProd: boolean
}