mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 12:04:03 +00:00
Changed cert-manager overview tabs to be proper routes
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
import ms from "ms";
|
||||
|
||||
export const getCertValidUntilBadgeDetails = (notAfter: string) => {
|
||||
const currentDate = new Date().getTime();
|
||||
const notAfterDate = new Date(notAfter).getTime();
|
||||
const diffInMs = notAfterDate - currentDate;
|
||||
|
||||
let variant: "success" | "primary" | "danger" = "success";
|
||||
let label = "Healthy";
|
||||
|
||||
if (diffInMs > ms("60d")) {
|
||||
variant = "success";
|
||||
} else if (diffInMs > ms("30d")) {
|
||||
variant = "primary";
|
||||
} else {
|
||||
variant = "danger";
|
||||
}
|
||||
|
||||
if (diffInMs > ms("60d")) {
|
||||
label = "Healthy";
|
||||
} else if (diffInMs > ms("0d")) {
|
||||
label = `Expires in ${ms(diffInMs)}`;
|
||||
} else {
|
||||
label = "Expired";
|
||||
}
|
||||
|
||||
return { variant, label };
|
||||
};
|
||||
Reference in New Issue
Block a user