mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 15:27:27 +00:00
Merge pull request #2426 from scott-ray-wilson/secret-env-access-warning
Fix: Restricted Secret Environment UI Corrections
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@ type Props = {
|
|||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 20;
|
||||||
|
|
||||||
export const IdentityTable = ({ handlePopUpOpen }: Props) => {
|
export const IdentityTable = ({ handlePopUpOpen }: Props) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ import { IdentityModal } from "./components/IdentityModal";
|
|||||||
import { IdentityRoleForm } from "./components/IdentityRoleForm";
|
import { IdentityRoleForm } from "./components/IdentityRoleForm";
|
||||||
|
|
||||||
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
|
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 20;
|
||||||
const formatRoleName = (role: string, customRoleName?: string) => {
|
const formatRoleName = (role: string, customRoleName?: string) => {
|
||||||
if (role === ProjectMembershipRole.Custom) return customRoleName;
|
if (role === ProjectMembershipRole.Custom) return customRoleName;
|
||||||
if (role === ProjectMembershipRole.Member) return "Developer";
|
if (role === ProjectMembershipRole.Member) return "Developer";
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const LOADER_TEXT = [
|
|||||||
"Getting secret import links..."
|
"Getting secret import links..."
|
||||||
];
|
];
|
||||||
|
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 20;
|
||||||
export const SecretMainPage = () => {
|
export const SecretMainPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentWorkspace, isLoading: isWorkspaceLoading } = useWorkspace();
|
const { currentWorkspace, isLoading: isWorkspaceLoading } = useWorkspace();
|
||||||
@@ -344,7 +344,15 @@ export const SecretMainPage = () => {
|
|||||||
<NavHeader
|
<NavHeader
|
||||||
pageName={t("dashboard.title")}
|
pageName={t("dashboard.title")}
|
||||||
currentEnv={environment}
|
currentEnv={environment}
|
||||||
userAvailableEnvs={currentWorkspace?.environments}
|
userAvailableEnvs={currentWorkspace?.environments.filter(({ slug }) =>
|
||||||
|
permission.can(
|
||||||
|
ProjectPermissionActions.Read,
|
||||||
|
subject(ProjectPermissionSub.Secrets, {
|
||||||
|
environment: slug,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)}
|
||||||
isFolderMode
|
isFolderMode
|
||||||
secretPath={secretPath}
|
secretPath={secretPath}
|
||||||
isProjectRelated
|
isProjectRelated
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ enum RowType {
|
|||||||
Secret = "Secret"
|
Secret = "Secret"
|
||||||
}
|
}
|
||||||
|
|
||||||
const INIT_PER_PAGE = 10;
|
const INIT_PER_PAGE = 20;
|
||||||
|
|
||||||
export const SecretOverviewPage = () => {
|
export const SecretOverviewPage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -173,11 +173,31 @@ export const SecretOverviewPage = () => {
|
|||||||
}, [isWorkspaceLoading, workspaceId, router.isReady]);
|
}, [isWorkspaceLoading, workspaceId, router.isReady]);
|
||||||
|
|
||||||
const userAvailableEnvs = currentWorkspace?.environments || [];
|
const userAvailableEnvs = currentWorkspace?.environments || [];
|
||||||
const [visibleEnvs, setVisibleEnvs] = useState(userAvailableEnvs);
|
const [visibleEnvs, setVisibleEnvs] = useState(
|
||||||
|
userAvailableEnvs?.filter(({ slug }) =>
|
||||||
|
permission.can(
|
||||||
|
ProjectPermissionActions.Read,
|
||||||
|
subject(ProjectPermissionSub.Secrets, {
|
||||||
|
environment: slug,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setVisibleEnvs(userAvailableEnvs);
|
setVisibleEnvs(
|
||||||
}, [userAvailableEnvs]);
|
userAvailableEnvs?.filter(({ slug }) =>
|
||||||
|
permission.can(
|
||||||
|
ProjectPermissionActions.Read,
|
||||||
|
subject(ProjectPermissionSub.Secrets, {
|
||||||
|
environment: slug,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}, [userAvailableEnvs, secretPath]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: secrets,
|
data: secrets,
|
||||||
@@ -580,7 +600,17 @@ export const SecretOverviewPage = () => {
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
<DropdownMenuLabel>Choose visible environments</DropdownMenuLabel>
|
<DropdownMenuLabel>Choose visible environments</DropdownMenuLabel>
|
||||||
{userAvailableEnvs.map((availableEnv) => {
|
{userAvailableEnvs
|
||||||
|
.filter(({ slug }) =>
|
||||||
|
permission.can(
|
||||||
|
ProjectPermissionActions.Read,
|
||||||
|
subject(ProjectPermissionSub.Secrets, {
|
||||||
|
environment: slug,
|
||||||
|
secretPath
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.map((availableEnv) => {
|
||||||
const { id: envId, name } = availableEnv;
|
const { id: envId, name } = availableEnv;
|
||||||
|
|
||||||
const isEnvSelected = visibleEnvs.map((env) => env.id).includes(envId);
|
const isEnvSelected = visibleEnvs.map((env) => env.id).includes(envId);
|
||||||
|
|||||||
+7
-4
@@ -53,6 +53,8 @@ export const SecretOverviewTableRow = ({
|
|||||||
onSecretDelete,
|
onSecretDelete,
|
||||||
isImportedSecretPresentInEnv,
|
isImportedSecretPresentInEnv,
|
||||||
getImportedSecretByKey,
|
getImportedSecretByKey,
|
||||||
|
// temporary until below todo is resolved
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
expandableColWidth,
|
expandableColWidth,
|
||||||
onToggleSecretSelect,
|
onToggleSecretSelect,
|
||||||
isSelected
|
isSelected
|
||||||
@@ -150,10 +152,11 @@ export const SecretOverviewTableRow = ({
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="ml-2 p-2"
|
className="ml-2 w-[99%] p-2"
|
||||||
style={{
|
// TODO: scott expandableColWidth sometimes 0 due to parent ref not mounting, opting for relative width until resolved
|
||||||
width: `calc(${expandableColWidth}px - 1rem)`
|
// style={{
|
||||||
}}
|
// width: `calc(${expandableColWidth} - 1rem)`
|
||||||
|
// }}
|
||||||
>
|
>
|
||||||
<SecretRenameRow
|
<SecretRenameRow
|
||||||
secretKey={secretKey}
|
secretKey={secretKey}
|
||||||
|
|||||||
Reference in New Issue
Block a user