fix: show popup only for admins

This commit is contained in:
Akhil Mohan
2023-12-13 11:55:44 +05:30
parent d2f959558e
commit 8bf7eba07b
@@ -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) => (