mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 23:52:09 +00:00
feat: renamed old frontend and fixed some minor bugs
This commit is contained in:
@@ -74,7 +74,7 @@ const decryptPrivateKeyHelper = async ({
|
||||
} else {
|
||||
throw new Error("Insufficient details to decrypt private key");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch {
|
||||
throw new Error("Failed to decrypt private key");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
const INTEGRATION_PROJECT_ID = "integration_project_id";
|
||||
export const localStorageService = {
|
||||
getIintegrationProjectId() {
|
||||
return localStorage.getItem(INTEGRATION_PROJECT_ID);
|
||||
},
|
||||
setIntegrationProjectId(projectId: string) {
|
||||
return localStorage.setItem(INTEGRATION_PROJECT_ID, projectId);
|
||||
}
|
||||
};
|
||||
@@ -1,31 +1,31 @@
|
||||
/** Extracts the key and value from a passed in env string based on the provided delimiters. */
|
||||
export const getKeyValue = (pastedContent: string, delimiters: string[]) => {
|
||||
if (!pastedContent) {
|
||||
return { key: "", value: "" };
|
||||
}
|
||||
|
||||
let firstDelimiterIndex = -1;
|
||||
let foundDelimiter = "";
|
||||
|
||||
delimiters.forEach((delimiter) => {
|
||||
const index = pastedContent.indexOf(delimiter);
|
||||
if (index !== -1 && (firstDelimiterIndex === -1 || index < firstDelimiterIndex)) {
|
||||
firstDelimiterIndex = index;
|
||||
foundDelimiter = delimiter;
|
||||
}
|
||||
});
|
||||
|
||||
const hasValueAfterDelimiter = pastedContent.length > firstDelimiterIndex + foundDelimiter.length;
|
||||
|
||||
if (firstDelimiterIndex === -1 || !hasValueAfterDelimiter) {
|
||||
return { key: pastedContent.trim(), value: "" };
|
||||
}
|
||||
|
||||
const key = pastedContent.substring(0, firstDelimiterIndex);
|
||||
const value = pastedContent.substring(firstDelimiterIndex + foundDelimiter.length);
|
||||
|
||||
return {
|
||||
key: key.trim(),
|
||||
value: value.trim()
|
||||
};
|
||||
};
|
||||
/** Extracts the key and value from a passed in env string based on the provided delimiters. */
|
||||
export const getKeyValue = (pastedContent: string, delimiters: string[]) => {
|
||||
if (!pastedContent) {
|
||||
return { key: "", value: "" };
|
||||
}
|
||||
|
||||
let firstDelimiterIndex = -1;
|
||||
let foundDelimiter = "";
|
||||
|
||||
delimiters.forEach((delimiter) => {
|
||||
const index = pastedContent.indexOf(delimiter);
|
||||
if (index !== -1 && (firstDelimiterIndex === -1 || index < firstDelimiterIndex)) {
|
||||
firstDelimiterIndex = index;
|
||||
foundDelimiter = delimiter;
|
||||
}
|
||||
});
|
||||
|
||||
const hasValueAfterDelimiter = pastedContent.length > firstDelimiterIndex + foundDelimiter.length;
|
||||
|
||||
if (firstDelimiterIndex === -1 || !hasValueAfterDelimiter) {
|
||||
return { key: pastedContent.trim(), value: "" };
|
||||
}
|
||||
|
||||
const key = pastedContent.substring(0, firstDelimiterIndex);
|
||||
const value = pastedContent.substring(firstDelimiterIndex + foundDelimiter.length);
|
||||
|
||||
return {
|
||||
key: key.trim(),
|
||||
value: value.trim()
|
||||
};
|
||||
};
|
||||
|
||||
@@ -9,4 +9,4 @@ export const policyDetails: Record<PolicyType, { name: string; className: string
|
||||
className: "bg-indigo-900 text-indigo-100",
|
||||
name: "Change Policy"
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -60,20 +60,8 @@ export const initProjectHelper = async ({ projectName }: { projectName: string }
|
||||
|
||||
return project;
|
||||
};
|
||||
|
||||
export const getProjectHomePage = (workspace: Workspace) => {
|
||||
if (workspace.type === ProjectType.SecretManager) {
|
||||
return `/${workspace.type}/${workspace.id}/secrets/overview`;
|
||||
}
|
||||
if (workspace.type === ProjectType.CertificateManager) {
|
||||
return `/${workspace.type}/${workspace.id}/certificates`;
|
||||
}
|
||||
|
||||
if (workspace.type === ProjectType.KMS) {
|
||||
return `/${workspace.type}/${workspace.id}/kms`;
|
||||
}
|
||||
|
||||
return `/${workspace.type}/${workspace.id}/ssh`;
|
||||
return `/${workspace.type}/$projectId/overview` as const;
|
||||
};
|
||||
|
||||
export const getProjectTitle = (type: ProjectType) => {
|
||||
|
||||
@@ -11,4 +11,4 @@ export const isValidPath = (val: string): boolean => {
|
||||
// Check for valid characters and no consecutive slashes
|
||||
const validPathRegex = /^[a-zA-Z0-9-_.:]+(?:\/[a-zA-Z0-9-_.:]+)*$/;
|
||||
return validPathRegex.test(val);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user