-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from onattech/DA-230_Frontend_For_Deployments
DA-230: Deployments page is ready.
- Loading branch information
Showing
18 changed files
with
747 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { gql, GraphQLClient } from 'graphql-request'; | ||
import { useGlobalAuthState } from '../Auth/UserAuth'; | ||
|
||
const graphlqlEndpoint = process.env.REACT_APP_GRAPHQL_ENDPOINT_PRIVATE; | ||
|
||
const query = gql` | ||
mutation deleteDeployment($pipelineID: String!, $environmentID: String!, $version: String!) { | ||
deleteDeployment(environmentID: $environmentID, pipelineID: $pipelineID, version: $version) | ||
} | ||
`; | ||
|
||
export const useDeleteDeployment = () => { | ||
const authState = useGlobalAuthState(); | ||
const jwt = authState.authToken.get(); | ||
|
||
const headers = { | ||
Authorization: 'Bearer ' + jwt, | ||
}; | ||
|
||
const client = new GraphQLClient(graphlqlEndpoint, { | ||
headers, | ||
}); | ||
|
||
return async (input) => { | ||
try { | ||
const res = await client.request(query, input); | ||
return res?.deleteDeployment; | ||
} catch (error) { | ||
return JSON.parse(JSON.stringify(error, undefined, 2)).response; | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ const query = gql` | |
version | ||
name | ||
environmentID | ||
fromEnvironmentID | ||
description | ||
active | ||
online | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ const query = gql` | |
version | ||
name | ||
environmentID | ||
fromEnvironmentID | ||
description | ||
active | ||
online | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { gql, GraphQLClient } from 'graphql-request'; | ||
import { useGlobalAuthState } from '../Auth/UserAuth'; | ||
|
||
const graphlqlEndpoint = process.env.REACT_APP_GRAPHQL_ENDPOINT_PRIVATE; | ||
|
||
const query = gql` | ||
mutation turnOnOffDeployment($pipelineID: String!, $environmentID: String!, $online: Boolean!) { | ||
turnOnOffDeployment(environmentID: $environmentID, pipelineID: $pipelineID, online: $online) | ||
} | ||
`; | ||
|
||
export const useTurnOnOffDeployment = () => { | ||
const authState = useGlobalAuthState(); | ||
const jwt = authState.authToken.get(); | ||
|
||
const headers = { | ||
Authorization: 'Bearer ' + jwt, | ||
}; | ||
|
||
const client = new GraphQLClient(graphlqlEndpoint, { | ||
headers, | ||
}); | ||
|
||
return async (input) => { | ||
try { | ||
const res = await client.request(query, input); | ||
return res?.turnOnOffDeployment; | ||
} catch (error) { | ||
return JSON.parse(JSON.stringify(error, undefined, 2)).response; | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.