Changed frontend to use the new secrets routes

This commit is contained in:
Vladyslav Matsiiako
2023-01-09 13:14:07 -08:00
parent b6189a90f4
commit 486aa139c2
23 changed files with 648 additions and 390 deletions
@@ -273,7 +273,7 @@ export const updateSecrets = async (req: Request, res: Response) => {
});
await Secret.bulkWrite(ops);
let newSecretsObj: { [key: string]: PatchSecret } = {};
const newSecretsObj: { [key: string]: PatchSecret } = {};
req.body.secrets.forEach((secret: PatchSecret) => {
newSecretsObj[secret.id] = secret;
});
@@ -323,7 +323,7 @@ export const updateSecrets = async (req: Request, res: Response) => {
// group secrets into workspaces so updated secrets can
// be logged and snapshotted separately for each workspace
let workspaceSecretObj: any = {};
const workspaceSecretObj: any = {};
req.secrets.forEach((s: any) => {
if (s.workspace.toString() in workspaceSecretObj) {
workspaceSecretObj[s.workspace.toString()].push(s);
@@ -399,7 +399,7 @@ export const deleteSecrets = async (req: Request, res: Response) => {
// group secrets into workspaces so deleted secrets can
// be logged and snapshotted separately for each workspace
let workspaceSecretObj: any = {};
const workspaceSecretObj: any = {};
req.secrets.forEach((s: any) => {
if (s.workspace.toString() in workspaceSecretObj) {
workspaceSecretObj[s.workspace.toString()].push(s);
@@ -445,7 +445,7 @@ export const deleteSecrets = async (req: Request, res: Response) => {
}
});
return res.status(400).send({
return res.status(200).send({
secrets: req.secrets
});
}
+1 -1
View File
@@ -138,7 +138,7 @@ router.patch(
router.delete(
'/',
[
check('secretIds')
body('secretIds')
.exists()
.custom((value) => {
// case: delete 1 secret
+4 -4
View File
@@ -7,12 +7,12 @@ import {
} from '../config';
import { getLogger } from '../utils/logger';
if(TELEMETRY_ENABLED){
if(!TELEMETRY_ENABLED){
getLogger("backend-main").info([
"",
"Infisical collects telemetry data about general usage.",
"The data helps us understand how the product is doing and guide our product development to create the best possible platform; it also helps us demonstrate growth for investors as we support Infisical as open-source software.",
"To opt out of telemetry, you can set `TELEMETRY_ENABLED=false` within the environment variables",
"To improve, Infisical collects telemetry data about general usage.",
"This helps us understand how the product is doing and guide our product development to create the best possible platform; it also helps us demonstrate growth as we support Infisical as open-source software.",
"To opt into telemetry, you can set `TELEMETRY_ENABLED=true` within the environment variables.",
].join('\n'))
}