mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 14:27:23 +00:00
merge main
This commit is contained in:
@@ -25,6 +25,8 @@ import {
|
||||
HumanitecConnectionMethod,
|
||||
LdapConnectionMethod,
|
||||
MsSqlConnectionMethod,
|
||||
MySqlConnectionMethod,
|
||||
OnePassConnectionMethod,
|
||||
PostgresConnectionMethod,
|
||||
TAppConnection,
|
||||
TeamCityConnectionMethod,
|
||||
@@ -36,7 +38,7 @@ import { OCIConnectionMethod } from "@app/hooks/api/appConnections/types/oci-con
|
||||
|
||||
export const APP_CONNECTION_MAP: Record<
|
||||
AppConnection,
|
||||
{ name: string; image: string; size?: number; icon?: IconDefinition }
|
||||
{ name: string; image: string; size?: number; icon?: IconDefinition; enterprise?: boolean }
|
||||
> = {
|
||||
[AppConnection.AWS]: { name: "AWS", image: "Amazon Web Services.png" },
|
||||
[AppConnection.GitHub]: { name: "GitHub", image: "GitHub.png" },
|
||||
@@ -64,13 +66,15 @@ export const APP_CONNECTION_MAP: Record<
|
||||
[AppConnection.Vercel]: { name: "Vercel", image: "Vercel.png" },
|
||||
[AppConnection.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
|
||||
[AppConnection.MsSql]: { name: "Microsoft SQL Server", image: "MsSql.png" },
|
||||
[AppConnection.MySql]: { name: "MySQL", image: "MySql.png" },
|
||||
[AppConnection.Camunda]: { name: "Camunda", image: "Camunda.png" },
|
||||
[AppConnection.Windmill]: { name: "Windmill", image: "Windmill.png" },
|
||||
[AppConnection.Auth0]: { name: "Auth0", image: "Auth0.png", size: 40 },
|
||||
[AppConnection.HCVault]: { name: "Hashicorp Vault", image: "Vault.png", size: 65 },
|
||||
[AppConnection.LDAP]: { name: "LDAP", image: "LDAP.png", size: 65 },
|
||||
[AppConnection.TeamCity]: { name: "TeamCity", image: "TeamCity.png" },
|
||||
[AppConnection.OCI]: { name: "OCI", image: "Oracle.png" }
|
||||
[AppConnection.OCI]: { name: "OCI", image: "Oracle.png", enterprise: true },
|
||||
[AppConnection.OnePass]: { name: "1Password", image: "1Password.png" }
|
||||
};
|
||||
|
||||
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
|
||||
@@ -98,9 +102,11 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
|
||||
case HumanitecConnectionMethod.ApiToken:
|
||||
case TerraformCloudConnectionMethod.ApiToken:
|
||||
case VercelConnectionMethod.ApiToken:
|
||||
case OnePassConnectionMethod.ApiToken:
|
||||
return { name: "API Token", icon: faKey };
|
||||
case PostgresConnectionMethod.UsernameAndPassword:
|
||||
case MsSqlConnectionMethod.UsernameAndPassword:
|
||||
case MySqlConnectionMethod.UsernameAndPassword:
|
||||
return { name: "Username & Password", icon: faLock };
|
||||
case HCVaultConnectionMethod.AccessToken:
|
||||
case TeamCityConnectionMethod.AccessToken:
|
||||
|
||||
@@ -15,6 +15,11 @@ export const SECRET_ROTATION_MAP: Record<
|
||||
image: "MsSql.png",
|
||||
size: 50
|
||||
},
|
||||
[SecretRotation.MySqlCredentials]: {
|
||||
name: "MySQL Credentials",
|
||||
image: "MySql.png",
|
||||
size: 50
|
||||
},
|
||||
[SecretRotation.Auth0ClientSecret]: {
|
||||
name: "Auth0 Client Secret",
|
||||
image: "Auth0.png",
|
||||
@@ -40,6 +45,7 @@ export const SECRET_ROTATION_MAP: Record<
|
||||
export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {
|
||||
[SecretRotation.PostgresCredentials]: AppConnection.Postgres,
|
||||
[SecretRotation.MsSqlCredentials]: AppConnection.MsSql,
|
||||
[SecretRotation.MySqlCredentials]: AppConnection.MySql,
|
||||
[SecretRotation.Auth0ClientSecret]: AppConnection.Auth0,
|
||||
[SecretRotation.AzureClientSecret]: AppConnection.AzureClientSecrets,
|
||||
[SecretRotation.LdapPassword]: AppConnection.LDAP,
|
||||
@@ -50,6 +56,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
|
||||
export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
|
||||
[SecretRotation.PostgresCredentials]: true,
|
||||
[SecretRotation.MsSqlCredentials]: true,
|
||||
[SecretRotation.MySqlCredentials]: true,
|
||||
[SecretRotation.Auth0ClientSecret]: false,
|
||||
[SecretRotation.AzureClientSecret]: true,
|
||||
[SecretRotation.LdapPassword]: false,
|
||||
|
||||
@@ -51,6 +51,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
|
||||
[SecretSync.OCIVault]: {
|
||||
name: "OCI Vault",
|
||||
image: "Oracle.png"
|
||||
},
|
||||
[SecretSync.OnePass]: {
|
||||
name: "1Password",
|
||||
image: "1Password.png"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,7 +73,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
|
||||
[SecretSync.Windmill]: AppConnection.Windmill,
|
||||
[SecretSync.HCVault]: AppConnection.HCVault,
|
||||
[SecretSync.TeamCity]: AppConnection.TeamCity,
|
||||
[SecretSync.OCIVault]: AppConnection.OCI
|
||||
[SecretSync.OCIVault]: AppConnection.OCI,
|
||||
[SecretSync.OnePass]: AppConnection.OnePass
|
||||
};
|
||||
|
||||
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
|
||||
|
||||
@@ -15,3 +15,5 @@ export const isValidPath = (val: string): boolean => {
|
||||
|
||||
export const DistinguishedNameRegex =
|
||||
/^(?:(?:[a-zA-Z0-9]+=[^,+="<>#;\\\\]+)(?:(?:\\+[a-zA-Z0-9]+=[^,+="<>#;\\\\]+)*)(?:,(?:[a-zA-Z0-9]+=[^,+="<>#;\\\\]+)(?:(?:\\+[a-zA-Z0-9]+=[^,+="<>#;\\\\]+)*))*)?$/;
|
||||
|
||||
export const UserPrincipalNameRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
const TABLE_PREFERENCES_KEY = "userTablePreferences";
|
||||
|
||||
export enum PreferenceKey {
|
||||
PerPage = "perPage"
|
||||
}
|
||||
|
||||
interface TableSpecificPreferences {
|
||||
[preferenceKey: string]: any;
|
||||
}
|
||||
|
||||
interface UserTablePreferences {
|
||||
[tableName: string]: TableSpecificPreferences;
|
||||
}
|
||||
|
||||
// Retrieves all table preferences from localStorage
|
||||
const getAllTablePreferences = (): UserTablePreferences => {
|
||||
try {
|
||||
const preferencesString = localStorage.getItem(TABLE_PREFERENCES_KEY);
|
||||
if (preferencesString) {
|
||||
return JSON.parse(preferencesString) as UserTablePreferences;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error reading user table preferences from localStorage:", error);
|
||||
}
|
||||
return {};
|
||||
};
|
||||
|
||||
// Saves all table preferences to localStorage
|
||||
const saveAllTablePreferences = (preferences: UserTablePreferences): void => {
|
||||
try {
|
||||
localStorage.setItem(TABLE_PREFERENCES_KEY, JSON.stringify(preferences));
|
||||
} catch (error) {
|
||||
console.error("Error saving user table preferences to localStorage:", error);
|
||||
}
|
||||
};
|
||||
|
||||
// Retrieves a specific preference for a given table
|
||||
export const getUserTablePreference = <T>(
|
||||
tableName: string,
|
||||
preferenceKey: PreferenceKey,
|
||||
defaultValue: T
|
||||
): T => {
|
||||
const preferences = getAllTablePreferences();
|
||||
if (
|
||||
preferences &&
|
||||
typeof preferences === "object" &&
|
||||
tableName in preferences &&
|
||||
preferenceKey in preferences[tableName]
|
||||
) {
|
||||
const value = preferences[tableName][preferenceKey];
|
||||
|
||||
if (value !== undefined && value !== null) {
|
||||
return value as T;
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
};
|
||||
|
||||
// Sets a specific preference for a given table and saves it to localStorage
|
||||
export const setUserTablePreference = (
|
||||
tableName: string,
|
||||
preferenceKey: PreferenceKey,
|
||||
value: any
|
||||
): void => {
|
||||
const preferences = getAllTablePreferences();
|
||||
|
||||
if (!preferences[tableName]) {
|
||||
preferences[tableName] = {};
|
||||
}
|
||||
|
||||
preferences[tableName][preferenceKey] = value;
|
||||
saveAllTablePreferences(preferences);
|
||||
};
|
||||
Reference in New Issue
Block a user