Merge pull request #1236 from akhilmhdh/feat/bring-back-secret-index

feat: brought back secret indexing popup in overview page
This commit is contained in:
Maidul Islam
2023-12-13 12:59:37 -05:00
committed by GitHub
5 changed files with 9381 additions and 319 deletions
+9353 -299
View File
File diff suppressed because it is too large Load Diff
+7 -4
View File
@@ -12,6 +12,9 @@
"storybook": "storybook dev -p 6006 -s ./public", "storybook": "storybook dev -p 6006 -s ./public",
"build-storybook": "storybook build" "build-storybook": "storybook build"
}, },
"overrides": {
"@radix-ui/react-focus-scope": "1.0.4"
},
"dependencies": { "dependencies": {
"@casl/ability": "^6.5.0", "@casl/ability": "^6.5.0",
"@casl/react": "^3.1.0", "@casl/react": "^3.1.0",
@@ -30,16 +33,16 @@
"@hookform/resolvers": "^2.9.10", "@hookform/resolvers": "^2.9.10",
"@octokit/rest": "^19.0.7", "@octokit/rest": "^19.0.7",
"@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-alert-dialog": "^1.0.2", "@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-checkbox": "^1.0.1", "@radix-ui/react-checkbox": "^1.0.1",
"@radix-ui/react-dialog": "^1.0.2", "@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.2", "@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-hover-card": "^1.0.3", "@radix-ui/react-hover-card": "^1.0.3",
"@radix-ui/react-label": "^2.0.0", "@radix-ui/react-label": "^2.0.0",
"@radix-ui/react-popover": "^1.0.3", "@radix-ui/react-popover": "^1.0.3",
"@radix-ui/react-popper": "^1.1.1", "@radix-ui/react-popper": "^1.1.1",
"@radix-ui/react-progress": "^1.0.1", "@radix-ui/react-progress": "^1.0.1",
"@radix-ui/react-select": "^1.2.0", "@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-switch": "^1.0.1", "@radix-ui/react-switch": "^1.0.1",
"@radix-ui/react-tabs": "^1.0.2", "@radix-ui/react-tabs": "^1.0.2",
"@radix-ui/react-toast": "^1.1.2", "@radix-ui/react-toast": "^1.1.2",
@@ -88,10 +88,12 @@ export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
} = useForm<FormData>({ } = useForm<FormData>({
resolver: yupResolver(schema), resolver: yupResolver(schema),
defaultValues: { defaultValues: {
scopes: [{ scopes: [
secretPath: "/", {
environment: currentWorkspace?.environments?.[0]?.slug secretPath: "/",
}] environment: currentWorkspace?.environments?.[0]?.slug
}
]
} }
}); });
@@ -136,7 +138,7 @@ export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
plaintext: key, plaintext: key,
key: randomBytes key: randomBytes
}); });
const { serviceToken } = await createServiceToken.mutateAsync({ const { serviceToken } = await createServiceToken.mutateAsync({
encryptedKey: ciphertext, encryptedKey: ciphertext,
iv, iv,
@@ -279,7 +281,7 @@ export const AddServiceTokenModal = ({ popUp, handlePopUpToggle }: Props) => {
className="w-full" className="w-full"
> >
{apiTokenExpiry.map(({ label, value }) => ( {apiTokenExpiry.map(({ label, value }) => (
<SelectItem value={String(value || "")} key={label}> <SelectItem value={String(value)} key={label}>
{label} {label}
</SelectItem> </SelectItem>
))} ))}
@@ -41,6 +41,7 @@ import {
} from "@app/hooks/api"; } from "@app/hooks/api";
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs"; import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
// import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection"; // import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
import { SecretOverviewFolderRow } from "./components/SecretOverviewFolderRow"; import { SecretOverviewFolderRow } from "./components/SecretOverviewFolderRow";
import { SecretOverviewTableRow } from "./components/SecretOverviewTableRow"; import { SecretOverviewTableRow } from "./components/SecretOverviewTableRow";
@@ -260,7 +261,7 @@ export const SecretOverviewPage = () => {
return ( return (
<div className="container mx-auto px-6 text-mineshaft-50 dark:[color-scheme:dark]"> <div className="container mx-auto px-6 text-mineshaft-50 dark:[color-scheme:dark]">
{/* <ProjectIndexSecretsSection decryptFileKey={latestFileKey!} /> */} <ProjectIndexSecretsSection decryptFileKey={latestFileKey!} />
<div className="relative right-5 ml-4"> <div className="relative right-5 ml-4">
<NavHeader pageName={t("dashboard.title")} isProjectRelated /> <NavHeader pageName={t("dashboard.title")} isProjectRelated />
</div> </div>
@@ -328,7 +329,7 @@ export const SecretOverviewPage = () => {
<div className="flex items-center justify-center border-b border-mineshaft-600 px-5 pt-3.5 pb-3"> <div className="flex items-center justify-center border-b border-mineshaft-600 px-5 pt-3.5 pb-3">
<button <button
type="button" type="button"
className="font-medium hover:text-mineshaft-100 duration-100 text-sm" className="text-sm font-medium duration-100 hover:text-mineshaft-100"
onClick={() => handleExploreEnvClick(slug)} onClick={() => handleExploreEnvClick(slug)}
> >
{name} {name}
@@ -61,22 +61,24 @@ export const ProjectIndexSecretsSection = ({ decryptFileKey }: Props) => {
} }
}; };
return !isBlindIndexedLoading && !isBlindIndexed ? ( // for non admin this would throw an error
<div className="p-4 mt-4 bg-mineshaft-900 rounded-lg border border-mineshaft-600"> // so no need to render
return !isBlindIndexedLoading && typeof isBlindIndexed === "boolean" && !isBlindIndexed ? (
<div className="mt-4 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
{isIndexing && ( {isIndexing && (
<div className="w-screen absolute top-0 left-0 h-screen z-50 bg-bunker-500 bg-opacity-80 flex items-center justify-center"> <div className="absolute top-0 left-0 z-50 flex h-screen w-screen items-center justify-center bg-bunker-500 bg-opacity-80">
<Spinner size="lg" className="text-primary" /> <Spinner size="lg" className="text-primary" />
<div className="flex flex-col space-y-1 ml-4"> <div className="ml-4 flex flex-col space-y-1">
<div className="text-3xl font-medium">Please wait</div> <div className="text-3xl font-medium">Please wait</div>
<span className="inline-block">Re-indexing your secrets...</span> <span className="inline-block">Re-indexing your secrets...</span>
</div> </div>
</div> </div>
)} )}
<p className="mb-2 text-lg font-semibold">Enable Blind Indices</p> <p className="mb-2 text-lg font-semibold">Enable Blind Indices</p>
<p className="text-gray-400 mb-4 leading-7"> <p className="mb-4 leading-7 text-gray-400">
Your project was created before the introduction of blind indexing. Your project was created before the introduction of blind indexing. To continue accessing
To continue accessing secrets by name through the SDK, public API and web dashboard, please enable blind secrets by name through the SDK, public API and web dashboard, please enable blind indexing.{" "}
indexing. <b>This is a one time process.</b> <b>This is a one time process.</b>
</p> </p>
<ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}> <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.Settings}>
{(isAllowed) => ( {(isAllowed) => (