mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 00:29:34 +00:00
feat(#31): implemented ui for multi env and integrated api with backend
fix(#31): fixed all v2 release conflict
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import SecurityClient from '~/utilities/SecurityClient';
|
||||
|
||||
type NewEnvironmentInfo = {
|
||||
environmentSlug: string;
|
||||
environmentName: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* This route deletes a specified workspace.
|
||||
* @param {*} workspaceId
|
||||
* @returns
|
||||
*/
|
||||
const createEnvironment = (workspaceId:string, newEnv: NewEnvironmentInfo) => {
|
||||
return SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(newEnv)
|
||||
}).then(async (res) => {
|
||||
if (res && res.status == 200) {
|
||||
return res;
|
||||
} else {
|
||||
console.log('Failed to create environment');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export default createEnvironment;
|
||||
@@ -0,0 +1,26 @@
|
||||
import SecurityClient from '~/utilities/SecurityClient';
|
||||
/**
|
||||
* This route deletes a specified env.
|
||||
* @param {*} workspaceId
|
||||
* @returns
|
||||
*/
|
||||
const deleteEnvironment = (workspaceId: string, environmentSlug: string) => {
|
||||
return SecurityClient.fetchCall(
|
||||
`/api/v2/workspace/${workspaceId}/environments`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ environmentSlug }),
|
||||
}
|
||||
).then(async (res) => {
|
||||
if (res && res.status == 200) {
|
||||
return res;
|
||||
} else {
|
||||
console.log('Failed to delete environment');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export default deleteEnvironment;
|
||||
@@ -0,0 +1,33 @@
|
||||
import SecurityClient from '~/utilities/SecurityClient';
|
||||
|
||||
type EnvironmentInfo = {
|
||||
oldEnvironmentSlug: string;
|
||||
environmentSlug: string;
|
||||
environmentName: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* This route updates a specified environment.
|
||||
* @param {*} workspaceId
|
||||
* @returns
|
||||
*/
|
||||
const updateEnvironment = (workspaceId: string, env: EnvironmentInfo) => {
|
||||
return SecurityClient.fetchCall(
|
||||
`/api/v2/workspace/${workspaceId}/environments`,
|
||||
{
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(env),
|
||||
}
|
||||
).then(async (res) => {
|
||||
if (res && res.status == 200) {
|
||||
return res;
|
||||
} else {
|
||||
console.log('Failed to update environment');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export default updateEnvironment;
|
||||
@@ -5,6 +5,7 @@ interface Workspace {
|
||||
_id: string;
|
||||
name: string;
|
||||
organization: string;
|
||||
environments: Array<{name:string, slug:string}>
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user