mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 12:27:28 +00:00
refactor: streamline account path handling in PAM components
- Updated PamAccessAccountModal and PamAccountsTable to simplify account path construction by removing leading and trailing slashes. - Enhanced readability and consistency in path handling across components.
This commit is contained in:
@@ -31,9 +31,8 @@ export const PamAccessAccountModal = ({
|
|||||||
|
|
||||||
let fullAccountPath = account?.name ?? "";
|
let fullAccountPath = account?.name ?? "";
|
||||||
if (accountPath) {
|
if (accountPath) {
|
||||||
let path = accountPath;
|
const path = accountPath.replace(/^\/+|\/+$/g, "");
|
||||||
if (path.startsWith("/")) path = path.slice(1);
|
fullAccountPath = `${path}/${account?.name ?? ""}`;
|
||||||
fullAccountPath = `${path}/${account?.name}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDurationValid = useMemo(() => duration && ms(duration || "1s") > 0, [duration]);
|
const isDurationValid = useMemo(() => duration && ms(duration || "1s") > 0, [duration]);
|
||||||
|
|||||||
@@ -430,8 +430,7 @@ export const PamAccountsTable = ({ projectId }: Props) => {
|
|||||||
let fullAccountPath = e?.name;
|
let fullAccountPath = e?.name;
|
||||||
const folderPath = e.folderId ? folderPaths[e.folderId] : undefined;
|
const folderPath = e.folderId ? folderPaths[e.folderId] : undefined;
|
||||||
if (folderPath) {
|
if (folderPath) {
|
||||||
let path = folderPath;
|
const path = folderPath.replace(/^\/+|\/+$/g, "");
|
||||||
if (path.startsWith("/")) path = path.slice(1);
|
|
||||||
fullAccountPath = `${path}/${e?.name}`;
|
fullAccountPath = `${path}/${e?.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user