Add eslint rule and fix as many issues as possible

This commit is contained in:
Khoa Le
2023-06-19 23:42:04 -04:00
parent e9eacc445d
commit 9d33e4756b
689 changed files with 9446 additions and 21821 deletions
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function updates user permissions for a certain environment in a project
@@ -18,9 +18,9 @@ const updateUserProjectPermission = async ({
}[]
}) =>
SecurityClient.fetchCall(`/api/v1/membership/${membershipId}/deny-permissions`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
permissions: denials
@@ -32,7 +32,7 @@ const updateUserProjectPermission = async ({
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to update user permissions for a certain environment in a project');
console.log("Failed to update user permissions for a certain environment in a project");
return undefined;
});
+4 -4
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface WorkspaceProps {
actionId: string;
@@ -12,15 +12,15 @@ interface WorkspaceProps {
*/
const getActionData = async ({ actionId }: WorkspaceProps) =>
SecurityClient.fetchCall(`/api/v1/action/${actionId}`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).action;
}
console.log('Failed to get the info about an action');
console.log("Failed to get the info about an action");
return undefined;
});
+11 -11
View File
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface WorkspaceProps {
workspaceId: string;
@@ -26,49 +26,49 @@ const getProjectLogs = async ({
actionNames
}: WorkspaceProps) => {
let payload;
if (userId !== '' && actionNames !== '') {
if (userId !== "" && actionNames !== "") {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent',
sortBy: "recent",
userId: JSON.stringify(userId),
actionNames
};
} else if (userId !== '') {
} else if (userId !== "") {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent',
sortBy: "recent",
userId: JSON.stringify(userId)
};
} else if (actionNames !== '') {
} else if (actionNames !== "") {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent',
sortBy: "recent",
actionNames
};
} else {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent'
sortBy: "recent"
};
}
return SecurityClient.fetchCall(
`/api/v1/workspace/${workspaceId}/logs?${new URLSearchParams(payload)}`,
{
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}
).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).logs;
}
console.log('Failed to get project logs');
console.log("Failed to get project logs");
return undefined;
});
};
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface WorkspaceProps {
workspaceId: string;
@@ -21,16 +21,16 @@ const getProjectSecretShanpshots = async ({ workspaceId, offset, limit }: Worksp
limit: String(limit)
})}`,
{
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}
).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).secretSnapshots;
}
console.log('Failed to get project secret snapshots');
console.log("Failed to get project secret snapshots");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface WorkspaceProps {
workspaceId: string;
@@ -12,15 +12,15 @@ interface WorkspaceProps {
*/
const getProjectSercetSnapshotsCount = async ({ workspaceId }: WorkspaceProps) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/secret-snapshots/count`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).count;
}
console.log('Failed to get the count of project secret snapshots');
console.log("Failed to get the count of project secret snapshots");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface SnapshotProps {
secretSnapshotId: string;
@@ -12,15 +12,15 @@ interface SnapshotProps {
*/
const getSecretSnapshotData = async ({ secretSnapshotId }: SnapshotProps) =>
SecurityClient.fetchCall(`/api/v1/secret-snapshot/${secretSnapshotId}`, {
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}).then(async (res) => {
if (res && res.status === 200) {
return (await res.json()).secretSnapshot;
}
console.log('Failed to get the secrets of a certain snapshot');
console.log("Failed to get the secrets of a certain snapshot");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
interface SecretVersionProps {
secretId: string;
@@ -21,16 +21,16 @@ const getSecretVersions = async ({ secretId, offset, limit }: SecretVersionProps
limit: String(limit)
})}`,
{
method: 'GET',
method: "GET",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
}
}
).then(async (res) => {
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to get secret version history');
console.log("Failed to get secret version history");
return undefined;
});
@@ -1,4 +1,4 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
import SecurityClient from "@app/components/utilities/SecurityClient";
/**
* This function performs a rollback of secrets in a certain project
@@ -15,9 +15,9 @@ const performSecretRollback = async ({
version: number;
}) =>
SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/secret-snapshots/rollback`, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json"
},
body: JSON.stringify({
version
@@ -26,7 +26,7 @@ const performSecretRollback = async ({
if (res && res.status === 200) {
return res.json();
}
console.log('Failed to perform the secret rollback');
console.log("Failed to perform the secret rollback");
return undefined;
});
+25 -25
View File
@@ -1,18 +1,18 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { faXmark } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import Image from "next/image";
import { useRouter } from "next/router";
import { faXmark } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import getActionData from '@app/ee/api/secrets/GetActionData';
import patienceDiff from '@app/ee/utilities/findTextDifferences';
import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
import getActionData from "@app/ee/api/secrets/GetActionData";
import patienceDiff from "@app/ee/utilities/findTextDifferences";
import getLatestFileKey from "@app/pages/api/workspace/getLatestFileKey";
import {
decryptAssymmetric,
decryptSymmetric
} from '../../components/utilities/cryptography/crypto';
} from "../../components/utilities/cryptography/crypto";
interface SideBarProps {
toggleSidebar: (value: string) => void;
@@ -64,7 +64,7 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
setIsLoading(true);
const tempActionData = await getActionData({ actionId: currentAction });
const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) });
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY");
// #TODO: make this a separate function and reuse across the app
let decryptedLatestKey: string;
@@ -128,7 +128,7 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
return (
<div
className={`absolute border-l border-mineshaft-500 ${
isLoading ? 'bg-bunker-800' : 'bg-bunker'
isLoading ? "bg-bunker-800" : "bg-bunker"
} fixed top-14 right-0 z-40 flex h-[calc(100vh-56px)] w-96 flex-col justify-between shadow-xl`}
>
{isLoading ? (
@@ -151,15 +151,15 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
onKeyDown={() => null}
role="button"
tabIndex={0}
onClick={() => toggleSidebar('')}
onClick={() => toggleSidebar("")}
>
<FontAwesomeIcon icon={faXmark} className="h-4 w-4 cursor-pointer text-bunker-300" />
</div>
</div>
<div className="overflow-y-autp flex h-[calc(100vh-120px)] flex-col overflow-y-auto px-4">
{(actionMetaData?.name === 'readSecrets' ||
actionMetaData?.name === 'addSecrets' ||
actionMetaData?.name === 'deleteSecrets') &&
{(actionMetaData?.name === "readSecrets" ||
actionMetaData?.name === "addSecrets" ||
actionMetaData?.name === "deleteSecrets") &&
actionData?.map((item, id) => (
<div key={`secret.${id + 1}`}>
<div className="ph-no-capture mt-4 pl-1 text-xs text-bunker-200">
@@ -174,7 +174,7 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
</div>
</div>
))}
{actionMetaData?.name === 'updateSecrets' &&
{actionMetaData?.name === "updateSecrets" &&
actionData?.map((item, id) => (
<>
<div className="mt-4 pl-1 text-xs text-bunker-200">
@@ -182,10 +182,10 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
</div>
<div className="overflow-hidden break-all rounded-md border border-mineshaft-500 font-mono text-bunker-200">
<div className="ph-no-capture bg-red/40 px-2">
-{' '}
-{" "}
{patienceDiff(
item.oldSecretVersion.value.split(''),
item.newSecretVersion.value.split(''),
item.oldSecretVersion.value.split(""),
item.newSecretVersion.value.split(""),
false
).lines.map(
(character, lineId) =>
@@ -193,7 +193,7 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
<span
key={`actionData.${id + 1}.line.${lineId + 1}`}
className={`${
character.aIndex === -1 && 'bg-red-700/80 text-bunker-100'
character.aIndex === -1 && "bg-red-700/80 text-bunker-100"
}`}
>
{character.line}
@@ -202,10 +202,10 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
)}
</div>
<div className="ph-no-capture break-all bg-green-500/40 px-2">
+{' '}
+{" "}
{patienceDiff(
item.oldSecretVersion.value.split(''),
item.newSecretVersion.value.split(''),
item.oldSecretVersion.value.split(""),
item.newSecretVersion.value.split(""),
false
).lines.map(
(character, lineId) =>
@@ -213,7 +213,7 @@ const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
<span
key={`actionData.${id + 1}.linev2.${lineId + 1}`}
className={`${
character.bIndex === -1 && 'bg-green-700/80 text-bunker-100'
character.bIndex === -1 && "bg-green-700/80 text-bunker-100"
}`}
>
{character.line}
+16 -16
View File
@@ -1,12 +1,12 @@
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { faAngleDown, faAngleRight, faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { faAngleDown, faAngleRight, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import timeSince from '@app/ee/utilities/timeSince';
import timeSince from "@app/ee/utilities/timeSince";
import guidGenerator from '../../components/utilities/randomId';
import guidGenerator from "../../components/utilities/randomId";
interface PayloadProps {
_id: string;
@@ -51,7 +51,7 @@ const ActivityLogsRow = ({
if (row?.serviceAccount) return `Service Account: ${row.serviceAccount.name}`;
if (row?.serviceTokenData.name) return `Service Token: ${row.serviceTokenData.name}`;
return '';
return "";
};
return (
<>
@@ -64,7 +64,7 @@ const ActivityLogsRow = ({
<FontAwesomeIcon
icon={payloadOpened ? faAngleDown : faAngleRight}
className={`ml-6 mb-2 text-mineshaft-300 cursor-pointer ${
payloadOpened ? 'bg-mineshaft-500 hover:bg-mineshaft-500' : 'hover:bg-mineshaft-700'
payloadOpened ? "bg-mineshaft-500 hover:bg-mineshaft-500" : "hover:bg-mineshaft-700"
} h-4 w-4 rounded-md p-1 duration-100`}
/>
</button>
@@ -74,7 +74,7 @@ const ActivityLogsRow = ({
(action) =>
`${String(action.secretVersions.length)} ${t(`activity.event.${action.name}`)}`
)
.join(' and ')}
.join(" and ")}
</div>
<div className="border-t border-mineshaft-700 py-3 pl-6 w-1/4">{renderUser()}</div>
<div className="border-t border-mineshaft-700 py-3 pl-6 w-1/4">{row.channel}</div>
@@ -86,7 +86,7 @@ const ActivityLogsRow = ({
<div className="h-9 border-t border-mineshaft-700 text-sm text-bunker-200 bg-mineshaft-900/50 w-full flex flex-row items-center">
<div className='max-w-xl w-full flex flex-row items-center'>
<div className='w-24' />
<div className='w-1/2'>{String(t('common.timestamp'))}</div>
<div className='w-1/2'>{String(t("common.timestamp"))}</div>
<div className='w-1/2'>{row.createdAt}</div>
</div>
</div>
@@ -108,7 +108,7 @@ const ActivityLogsRow = ({
className='w-1/2 text-primary-300 hover:text-primary-500 flex flex-row justify-left items-center duration-100'
>
{action.secretVersions.length +
(action.secretVersions.length !== 1 ? ' secrets' : ' secret')}
(action.secretVersions.length !== 1 ? " secrets" : " secret")}
<FontAwesomeIcon
icon={faUpRightFromSquare}
className="ml-2 mb-0.5 h-3 w-3 font-light"
@@ -122,7 +122,7 @@ const ActivityLogsRow = ({
<div className="h-9 border-t border-mineshaft-700 text-sm text-bunker-200 bg-mineshaft-900/50 w-full flex flex-row items-center">
<div className='max-w-xl w-full flex flex-row items-center'>
<div className='w-24' />
<div className='w-1/2'>{String(t('activity.ip-address'))}</div>
<div className='w-1/2'>{String(t("activity.ip-address"))}</div>
<div className='w-1/2'>{row.ipAddress}</div>
</div>
</div>
@@ -169,16 +169,16 @@ const ActivityTable = ({
</button>
<div className="flex flex-row justify-between w-full">
<div className="pt-2.5 pb-3 text-left font-semibold w-1/4 pl-6">
{String(t('common.event')).toUpperCase()}
{String(t("common.event")).toUpperCase()}
</div>
<div className="pl-6 pt-2.5 pb-3 text-left font-semibold w-1/4 pl-6">
{String(t('common.user')).toUpperCase()}
{String(t("common.user")).toUpperCase()}
</div>
<div className="pl-6 pt-2.5 pb-3 text-left font-semibold w-1/4 pl-6">
{String(t('common.source')).toUpperCase()}
{String(t("common.source")).toUpperCase()}
</div>
<div className="pl-6 pt-2.5 pb-3 text-left font-semibold w-1/4 pl-6">
{String(t('common.time')).toUpperCase()}
{String(t("common.time")).toUpperCase()}
</div>
</div>
</div>
@@ -1,20 +1,20 @@
/* eslint-disable no-nested-ternary */
import { useEffect, useState } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { faXmark } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Tag } from 'public/data/frequentInterfaces';
import { useEffect, useState } from "react";
import Image from "next/image";
import { useRouter } from "next/router";
import { faXmark } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Tag } from "public/data/frequentInterfaces";
import Button from '@app/components/basic/buttons/Button';
import Button from "@app/components/basic/buttons/Button";
import {
decryptAssymmetric,
decryptSymmetric
} from '@app/components/utilities/cryptography/crypto';
import getProjectSecretShanpshots from '@app/ee/api/secrets/GetProjectSercetShanpshots';
import getSecretSnapshotData from '@app/ee/api/secrets/GetSecretSnapshotData';
import timeSince from '@app/ee/utilities/timeSince';
import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
} from "@app/components/utilities/cryptography/crypto";
import getProjectSecretShanpshots from "@app/ee/api/secrets/GetProjectSercetShanpshots";
import getSecretSnapshotData from "@app/ee/api/secrets/GetSecretSnapshotData";
import timeSince from "@app/ee/utilities/timeSince";
import getLatestFileKey from "@app/pages/api/workspace/getLatestFileKey";
export interface SecretDataProps {
pos: number;
@@ -47,7 +47,7 @@ interface EncrypetedSecretVersionListProps {
secretKeyIV: string;
secretKeyTag: string;
environment: string;
type: 'personal' | 'shared';
type: "personal" | "shared";
tags: Tag[];
}
@@ -87,7 +87,7 @@ const PITRecoverySidebar = ({ toggleSidebar, setSnapshotData, chosenSnapshot }:
const secretSnapshotData = await getSecretSnapshotData({ secretSnapshotId: snapshotId });
const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) });
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY");
let decryptedLatestKey: string;
if (latestKey) {
@@ -135,44 +135,44 @@ const PITRecoverySidebar = ({ toggleSidebar, setSnapshotData, chosenSnapshot }:
const result = secretKeys.map((key, index) =>
decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
(secret: SecretDataProps) => secret.key === key && secret.type === "shared"
)[0]?.id
? {
id: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
(secret: SecretDataProps) => secret.key === key && secret.type === "shared"
)[0].id,
pos: index,
key,
environment: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
(secret: SecretDataProps) => secret.key === key && secret.type === "shared"
)[0].environment,
tags: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
(secret: SecretDataProps) => secret.key === key && secret.type === "shared"
)[0].tags,
value: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
(secret: SecretDataProps) => secret.key === key && secret.type === "shared"
)[0]?.value,
valueOverride: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'personal'
(secret: SecretDataProps) => secret.key === key && secret.type === "personal"
)[0]?.value
}
: {
id: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'personal'
(secret: SecretDataProps) => secret.key === key && secret.type === "personal"
)[0].id,
pos: index,
key,
environment: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'personal'
(secret: SecretDataProps) => secret.key === key && secret.type === "personal"
)[0].environment,
tags: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'personal'
(secret: SecretDataProps) => secret.key === key && secret.type === "personal"
)[0].tags,
value: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
(secret: SecretDataProps) => secret.key === key && secret.type === "shared"
)[0]?.value,
valueOverride: decryptedSecretVersions.filter(
(secret: SecretDataProps) => secret.key === key && secret.type === 'personal'
(secret: SecretDataProps) => secret.key === key && secret.type === "personal"
)[0]?.value
}
);
@@ -182,14 +182,14 @@ const PITRecoverySidebar = ({ toggleSidebar, setSnapshotData, chosenSnapshot }:
version: secretSnapshotData.version,
createdAt: secretSnapshotData.createdAt,
secretVersions: result,
comment: ''
comment: ""
});
};
return (
<div
className={`min-w-sm absolute w-full max-w-sm border-l border-mineshaft-500 ${
isLoading ? 'bg-bunker-800' : 'bg-bunker'
isLoading ? "bg-bunker-800" : "bg-bunker"
} fixed sticky right-0 top-0 z-[40] flex h-full flex-col justify-between shadow-xl`}
>
{isLoading ? (
@@ -227,41 +227,41 @@ const PITRecoverySidebar = ({ toggleSidebar, setSnapshotData, chosenSnapshot }:
key={snapshot._id}
onClick={() => exploreSnapshot({ snapshotId: snapshot._id })}
className={`${
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
? 'pointer-events-none bg-primary text-black'
: 'cursor-pointer bg-mineshaft-700 duration-200 hover:bg-mineshaft-500'
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === "")
? "pointer-events-none bg-primary text-black"
: "cursor-pointer bg-mineshaft-700 duration-200 hover:bg-mineshaft-500"
} mb-2 flex flex-row items-center justify-between rounded-md py-3 px-4`}
>
<div className="flex flex-row items-start">
<div
className={`${
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
? 'text-bunker-800'
: 'text-bunker-200'
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === "")
? "text-bunker-800"
: "text-bunker-200"
} mr-1.5 text-sm`}
>
{timeSince(new Date(snapshot.createdAt))}
</div>
<div
className={`${
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
? 'text-bunker-900'
: 'text-bunker-300'
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === "")
? "text-bunker-900"
: "text-bunker-300"
} text-sm `}
>{` - ${snapshot.secretVersions.length} Secrets`}</div>
</div>
<div
className={`${
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
? 'pointer-events-none text-bunker-800'
: 'cursor-pointer text-bunker-200 duration-200 hover:text-primary'
chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === "")
? "pointer-events-none text-bunker-800"
: "cursor-pointer text-bunker-200 duration-200 hover:text-primary"
} text-sm`}
>
{id === 0
? 'Current Version'
? "Current Version"
: chosenSnapshot === snapshot._id
? 'Currently Viewing'
: 'Explore'}
? "Currently Viewing"
: "Explore"}
</div>
</div>
))}
@@ -1,16 +1,16 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { faCircle, faDotCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import Image from "next/image";
import { useRouter } from "next/router";
import { faCircle, faDotCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
decryptAssymmetric,
decryptSymmetric
} from '@app/components/utilities/cryptography/crypto';
import getSecretVersions from '@app/ee/api/secrets/GetSecretVersions';
import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
} from "@app/components/utilities/cryptography/crypto";
import getSecretVersions from "@app/ee/api/secrets/GetSecretVersions";
import getLatestFileKey from "@app/pages/api/workspace/getLatestFileKey";
interface DecryptedSecretVersionListProps {
createdAt: string;
@@ -41,7 +41,7 @@ const SecretVersionList = ({ secretId }: { secretId: string }) => {
const encryptedSecretVersions = await getSecretVersions({ secretId, offset: 0, limit: 10 });
const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) });
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY");
let decryptedLatestKey: string;
if (latestKey) {
@@ -77,7 +77,7 @@ const SecretVersionList = ({ secretId }: { secretId: string }) => {
return (
<div className="min-w-40 overflow-x-none dark mt-4 h-[12.4rem] w-full px-4 text-sm text-bunker-300">
<p className="">{t('dashboard.sidebar.version-history')}</p>
<p className="">{t("dashboard.sidebar.version-history")}</p>
<div className="overflow-x-none h-full rounded-md border border-mineshaft-500 bg-bunker-800 py-0.5 pl-1">
{isLoading ? (
<div className="flex h-full items-center justify-center">
@@ -103,13 +103,13 @@ const SecretVersionList = ({ secretId }: { secretId: string }) => {
</div>
<div className="flex w-full max-w-[calc(100%-2.3rem)] flex-col">
<div className="pr-2 text-bunker-300/90">
{new Date(version.createdAt).toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
{new Date(version.createdAt).toLocaleDateString("en-US", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
})}
</div>
<div className="">