feature secret rotations v2

This commit is contained in:
Scott Wilson
2025-03-31 20:34:48 -07:00
parent da094383b8
commit 766c1242fd
275 changed files with 9692 additions and 783 deletions
@@ -72,6 +72,55 @@ export const useDynamicSecretOverview = (
return { dynamicSecretNames, isDynamicSecretPresentInEnv };
};
export const useSecretRotationOverview = (
secretRotations: DashboardProjectSecretsOverview["secretRotations"]
) => {
const secretRotationNames = useMemo(() => {
const names = new Set<string>();
secretRotations?.forEach((secretRotation) => {
names.add(secretRotation.name);
});
return [...names];
}, [secretRotations]);
const isSecretRotationPresentInEnv = useCallback(
(name: string, env: string) => {
return Boolean(
secretRotations?.find(
({ name: secretRotationName, environment }) =>
secretRotationName === name && environment.slug === env
)
);
},
[secretRotations]
);
const getSecretRotationByName = useCallback(
(env: string, name: string) => {
const secretRotation = secretRotations?.find(
(rotation) => rotation.environment.slug === env && rotation.name === name
);
return secretRotation;
},
[secretRotations]
);
const getSecretRotationStatusesByName = useCallback(
(name: string) =>
secretRotations
?.filter((rotation) => rotation.name === name)
.map((rotation) => rotation.rotationStatus),
[secretRotations]
);
return {
secretRotationNames,
isSecretRotationPresentInEnv,
getSecretRotationByName,
getSecretRotationStatusesByName
};
};
export const useSecretOverview = (secrets: DashboardProjectSecretsOverview["secrets"]) => {
const secKeys = useMemo(() => {
const keys = new Set<string>();