Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Remove slug from application

Carlos Monastyrskic7f296a678b8
diff --git a/backend/src/db/migrations/20260504432352_cert-manager-applications.ts b/backend/src/db/migrations/20260504432352_cert-manager-applications.ts
index 0b985f43d0..fb53288412 100644
--- a/backend/src/db/migrations/20260504432352_cert-manager-applications.ts
+++ b/backend/src/db/migrations/20260504432352_cert-manager-applications.ts
@@ -18,10 +18,9 @@ export async function up(knex: Knex): Promise<void> {
t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");
t.index("projectId");
t.string("name", 64).notNullable();
- t.string("slug", 64).notNullable();
t.string("description", 256);
t.timestamps(true, true, true);
- t.unique(["slug", "projectId"]);
+ t.unique(["name", "projectId"]);
});
await createOnUpdateTrigger(knex, TableName.PkiApplication);
}
diff --git a/backend/src/db/schemas/pki-applications.ts b/backend/src/db/schemas/pki-applications.ts
index 65fb914ff5..65a19cdf61 100644
--- a/backend/src/db/schemas/pki-applications.ts
+++ b/backend/src/db/schemas/pki-applications.ts
@@ -11,7 +11,6 @@ export const PkiApplicationsSchema = z.object({
id: z.string().uuid(),
projectId: z.string(),
name: z.string(),
- slug: z.string(),
description: z.string().nullable().optional(),
createdAt: z.date(),
updatedAt: z.date()
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 51755bdaaa..ba9152fde8 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -3469,7 +3469,6 @@ interface CreatePkiApplication {
type: EventType.CREATE_PKI_APPLICATION;
metadata: {
applicationId: string;
- slug: string;
name: string;
profileIds?: string[];
};
@@ -3479,7 +3478,7 @@ interface UpdatePkiApplication {
type: EventType.UPDATE_PKI_APPLICATION;
metadata: {
applicationId: string;
- slug: string;
+ name: string;
};
}
@@ -3487,7 +3486,7 @@ interface DeletePkiApplication {
type: EventType.DELETE_PKI_APPLICATION;
metadata: {
applicationId: string;
- slug: string;
+ name: string;
};
}
@@ -3495,7 +3494,7 @@ interface GetPkiApplication {
type: EventType.GET_PKI_APPLICATION;
metadata: {
applicationId: string;
- slug: string;
+ name: string;
};
}
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index 4dedb1983d..74913b3a41 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -123,6 +123,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
body: z
.object({
profileId: z.string().uuid(),
+ applicationId: z.string().uuid().optional(),
csr: z
.string()
.trim()
@@ -243,6 +244,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId,
profileId: requestBody.profileId,
+ applicationId: requestBody.applicationId,
certificateOrder: certificateOrderObject,
metadata,
removeRootsFromChain: requestBody.removeRootsFromChain
@@ -277,6 +279,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId,
profileId: requestBody.profileId,
+ applicationId: requestBody.applicationId,
csr,
validity: { ttl: attributes?.ttl || "" },
notBefore: attributes?.notBefore ? new Date(attributes.notBefore) : undefined,
@@ -345,6 +348,7 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId,
profileId: requestBody.profileId,
+ applicationId: requestBody.applicationId,
certificateRequest: mappedCertificateRequest,
metadata,
removeRootsFromChain: requestBody.removeRootsFromChain
diff --git a/backend/src/server/routes/v1/pki-application-router.ts b/backend/src/server/routes/v1/pki-application-router.ts
index c5055a599d..5764c6b575 100644
--- a/backend/src/server/routes/v1/pki-application-router.ts
+++ b/backend/src/server/routes/v1/pki-application-router.ts
@@ -17,8 +17,8 @@ import { registerPkiApplicationSyncRoutes } from "./pki-application-sync-router"
export { ApplicationProfileSchema };
-const APPLICATION_SLUG_REGEX = new RE2("^[a-z0-9-]+$");
-const APPLICATION_SLUG_MESSAGE = "Slug must contain only lowercase letters, numbers, and hyphens";
+const APPLICATION_NAME_REGEX = new RE2("^[a-z0-9-]+$");
+const APPLICATION_NAME_MESSAGE = "Name must contain only lowercase letters, numbers, and hyphens";
const ApplicationListItemSchema = PkiApplicationsSchema.extend({
profileCount: z.number().int().nonnegative(),
@@ -37,8 +37,7 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
description: "Create a Cert Manager application.",
tags: [ApiDocsTags.PkiApplications],
body: z.object({
- name: z.string().trim().min(1).max(64),
- slug: z.string().trim().min(1).max(64).regex(APPLICATION_SLUG_REGEX, APPLICATION_SLUG_MESSAGE),
+ name: z.string().trim().min(1).max(64).regex(APPLICATION_NAME_REGEX, APPLICATION_NAME_MESSAGE),
description: z.string().max(256).optional(),
profileIds: z.array(z.string().uuid()).optional()
}),
@@ -55,7 +54,6 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
actorOrgId: req.permission.orgId,
projectId: req.certManagerProjectId,
name: req.body.name,
- slug: req.body.slug,
description: req.body.description,
profileIds: req.body.profileIds
});
@@ -67,7 +65,6 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
type: EventType.CREATE_PKI_APPLICATION,
metadata: {
applicationId: application.id,
- slug: application.slug,
name: application.name,
profileIds: req.body.profileIds
}
@@ -153,7 +150,7 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
projectId: req.certManagerProjectId,
event: {
type: EventType.GET_PKI_APPLICATION,
- metadata: { applicationId: application.id, slug: application.slug }
+ metadata: { applicationId: application.id, name: application.name }
}
});
@@ -163,25 +160,25 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
server.route({
method: "GET",
- url: "/slug/:slug",
+ url: "/by-name/:name",
config: { rateLimit: readLimit },
schema: {
hide: false,
- operationId: "getPkiApplicationBySlug",
- description: "Get a Cert Manager application by slug.",
+ operationId: "getPkiApplicationByName",
+ description: "Get a Cert Manager application by name.",
tags: [ApiDocsTags.PkiApplications],
- params: z.object({ slug: z.string().regex(APPLICATION_SLUG_REGEX, APPLICATION_SLUG_MESSAGE) }),
+ params: z.object({ name: z.string().regex(APPLICATION_NAME_REGEX, APPLICATION_NAME_MESSAGE) }),
response: { 200: z.object({ application: PkiApplicationsSchema }) }
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
- const application = await server.services.pkiApplication.getApplicationBySlug({
+ const application = await server.services.pkiApplication.getApplicationByName({
actor: req.permission.type,
actorId: req.permission.id,
actorAuthMethod: req.permission.authMethod,
actorOrgId: req.permission.orgId,
projectId: req.certManagerProjectId,
- slug: req.params.slug
+ name: req.params.name
});
await server.services.auditLog.createAuditLog({
@@ -189,7 +186,7 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
projectId: req.certManagerProjectId,
event: {
type: EventType.GET_PKI_APPLICATION,
- metadata: { applicationId: application.id, slug: application.slug }
+ metadata: { applicationId: application.id, name: application.name }
}
});
@@ -209,12 +206,11 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
params: ApplicationIdParamsSchema,
body: z
.object({
- name: z.string().trim().min(1).max(64).optional(),
- slug: z.string().trim().min(1).max(64).regex(APPLICATION_SLUG_REGEX, APPLICATION_SLUG_MESSAGE).optional(),
+ name: z.string().trim().min(1).max(64).regex(APPLICATION_NAME_REGEX, APPLICATION_NAME_MESSAGE).optional(),
description: z.string().max(256).nullable().optional()
})
- .refine((d) => d.name !== undefined || d.slug !== undefined || d.description !== undefined, {
- message: "At least one of name, slug, or description must be provided."
+ .refine((d) => d.name !== undefined || d.description !== undefined, {
+ message: "At least one of name or description must be provided."
}),
response: { 200: z.object({ application: PkiApplicationsSchema }) }
},
@@ -228,7 +224,6 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
projectId: req.certManagerProjectId,
applicationId: req.params.applicationId,
name: req.body.name,
- slug: req.body.slug,
description: req.body.description
});
@@ -237,7 +232,7 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
projectId: req.certManagerProjectId,
event: {
type: EventType.UPDATE_PKI_APPLICATION,
- metadata: { applicationId: application.id, slug: application.slug }
+ metadata: { applicationId: application.id, name: application.name }
}
});
@@ -273,7 +268,7 @@ export const registerPkiApplicationRouter = async (server: FastifyZodProvider) =
projectId: req.certManagerProjectId,
event: {
type: EventType.DELETE_PKI_APPLICATION,
- metadata: { applicationId: application.id, slug: application.slug }
+ metadata: { applicationId: application.id, name: application.name }
}
});
diff --git a/backend/src/services/pki-application/pki-application-dal.ts b/backend/src/services/pki-application/pki-application-dal.ts
index 9c199d398b..66f0dcd198 100644
--- a/backend/src/services/pki-application/pki-application-dal.ts
+++ b/backend/src/services/pki-application/pki-application-dal.ts
@@ -12,12 +12,12 @@ export type TPkiApplicationDALFactory = ReturnType<typeof pkiApplicationDALFacto
export const pkiApplicationDALFactory = (db: TDbClient) => {
const orm = ormify(db, TableName.PkiApplication);
- const findBySlugAndProjectId = async (slug: string, projectId: string, tx?: Knex) => {
+ const findByNameAndProjectId = async (name: string, projectId: string, tx?: Knex) => {
try {
- const row = await (tx || db.replicaNode())(TableName.PkiApplication).where({ slug, projectId }).first();
+ const row = await (tx || db.replicaNode())(TableName.PkiApplication).where({ name, projectId }).first();
return row;
} catch (error) {
- throw new DatabaseError({ error, name: "Find pki application by slug and project id" });
+ throw new DatabaseError({ error, name: "Find pki application by name and project id" });
}
};
@@ -68,7 +68,6 @@ export const pkiApplicationDALFactory = (db: TDbClient) => {
`${TableName.PkiApplication}.id`,
`${TableName.PkiApplication}.projectId`,
`${TableName.PkiApplication}.name`,
- `${TableName.PkiApplication}.slug`,
`${TableName.PkiApplication}.description`,
`${TableName.PkiApplication}.createdAt`,
`${TableName.PkiApplication}.updatedAt`,
@@ -84,7 +83,6 @@ export const pkiApplicationDALFactory = (db: TDbClient) => {
query = query.where((qb) => {
void qb
.whereILike(`${TableName.PkiApplication}.name`, `%${search}%`)
- .orWhereILike(`${TableName.PkiApplication}.slug`, `%${search}%`)
.orWhereILike(`${TableName.PkiApplication}.description`, `%${search}%`);
});
}
@@ -110,10 +108,7 @@ export const pkiApplicationDALFactory = (db: TDbClient) => {
let query = (tx || db.replicaNode())(TableName.PkiApplication).where({ projectId });
if (search) {
query = query.where((qb) => {
- void qb
- .whereILike("name", `%${search}%`)
- .orWhereILike("slug", `%${search}%`)
- .orWhereILike("description", `%${search}%`);
+ void qb.whereILike("name", `%${search}%`).orWhereILike("description", `%${search}%`);
});
}
if (applicationIds) {
@@ -128,7 +123,7 @@ export const pkiApplicationDALFactory = (db: TDbClient) => {
return {
...orm,
- findBySlugAndProjectId,
+ findByNameAndProjectId,
findByProjectId,
countByProjectId
};
diff --git a/backend/src/services/pki-application/pki-application-profile-dal.ts b/backend/src/services/pki-application/pki-application-profile-dal.ts
index 9d9f7c30cb..68849d79ff 100644
--- a/backend/src/services/pki-application/pki-application-profile-dal.ts
+++ b/backend/src/services/pki-application/pki-application-profile-dal.ts
@@ -88,26 +88,12 @@ export const pkiApplicationProfileDALFactory = (db: TDbClient) => {
}
};
- const findOtherJunctionsForProfiles = async (profileIds: string[], excludeApplicationId: string, tx?: Knex) => {
- try {
- if (profileIds.length === 0) return [];
- const rows = await (tx || db.replicaNode())(TableName.PkiApplicationProfile)
- .whereIn("profileId", profileIds)
- .whereNot({ applicationId: excludeApplicationId })
- .select("profileId", "applicationId");
- return rows as { profileId: string; applicationId: string }[];
- } catch (error) {
- throw new DatabaseError({ error, name: "Find other junctions for profiles" });
- }
- };
-
return {
...orm,
findAllByProfileId,
findByApplicationId,
findOne,
findProfilesInProject,
- findOtherJunctionsForProfiles,
findByProfileId
};
};
diff --git a/backend/src/services/pki-application/pki-application-service.ts b/backend/src/services/pki-application/pki-application-service.ts
index 42ef4447ef..9a5126d03c 100644
--- a/backend/src/services/pki-application/pki-application-service.ts
+++ b/backend/src/services/pki-application/pki-application-service.ts
@@ -22,7 +22,7 @@ import {
TCreatePkiApplicationDTO,
TDeletePkiApplicationDTO,
TDetachProfileDTO,
- TGetPkiApplicationBySlugDTO,
+ TGetPkiApplicationByNameDTO,
TGetPkiApplicationDTO,
TListApplicationProfilesDTO,
TListPkiApplicationsDTO,
@@ -37,18 +37,13 @@ type TPkiApplicationServiceFactoryDep = {
| "updateById"
| "deleteById"
| "transaction"
- | "findBySlugAndProjectId"
+ | "findByNameAndProjectId"
| "findByProjectId"
| "countByProjectId"
>;
pkiApplicationProfileDAL: Pick<
TPkiApplicationProfileDALFactory,
- | "insertMany"
- | "delete"
- | "findByApplicationId"
- | "findOne"
- | "findProfilesInProject"
- | "findOtherJunctionsForProfiles"
+ "insertMany" | "delete" | "findByApplicationId" | "findOne" | "findProfilesInProject"
>;
membershipDAL: Pick<TMembershipDALFactory, "find" | "delete">;
membershipRoleDAL: Pick<TMembershipRoleDALFactory, "delete">;
@@ -104,7 +99,6 @@ export const pkiApplicationServiceFactory = ({
const createApplication = async ({
name,
- slug,
description,
profileIds,
projectId,
@@ -120,9 +114,9 @@ export const pkiApplicationServiceFactory = ({
ProjectPermissionSub.Application
);
- const existing = await pkiApplicationDAL.findBySlugAndProjectId(slug, projectId);
+ const existing = await pkiApplicationDAL.findByNameAndProjectId(name, projectId);
if (existing) {
- throw new BadRequestError({ message: `An application with slug '${slug}' already exists in this project.` });
+ throw new BadRequestError({ message: `An application with name '${name}' already exists in this project.` });
}
if (profileIds && profileIds.length > 0) {
@@ -135,10 +129,7 @@ export const pkiApplicationServiceFactory = ({
}
return pkiApplicationDAL.transaction(async (tx) => {
- const application = await pkiApplicationDAL.create(
- { projectId, name, slug, description: description ?? null },
- tx
- );
+ const application = await pkiApplicationDAL.create({ projectId, name, description: description ?? null }, tx);
if (profileIds && profileIds.length > 0) {
await pkiApplicationProfileDAL.insertMany(
@@ -179,17 +170,17 @@ export const pkiApplicationServiceFactory = ({
return application;
};
- const getApplicationBySlug = async ({
- slug,
+ const getApplicationByName = async ({
+ name,
projectId,
actor,
actorId,
actorAuthMethod,
actorOrgId
- }: TGetPkiApplicationBySlugDTO) => {
- const application = await pkiApplicationDAL.findBySlugAndProjectId(slug, projectId);
+ }: TGetPkiApplicationByNameDTO) => {
+ const application = await pkiApplicationDAL.findByNameAndProjectId(name, projectId);
if (!application) {
- throw new NotFoundError({ message: `Application with slug '${slug}' not found in this project.` });
+ throw new NotFoundError({ message: `Application with name '${name}' not found in this project.` });
}
const { permission } = await $loadResourcePermission(application.id, projectId, {
@@ -260,7 +251,6 @@ export const pkiApplicationServiceFactory = ({
const updateApplication = async ({
applicationId,
name,
- slug,
description,
projectId,
actor,
@@ -285,16 +275,15 @@ export const pkiApplicationServiceFactory = ({
ResourcePermissionSub.Application
);
- if (slug && slug !== application.slug) {
- const collision = await pkiApplicationDAL.findBySlugAndProjectId(slug, projectId);
+ if (name && name !== application.name) {
+ const collision = await pkiApplicationDAL.findByNameAndProjectId(name, projectId);
if (collision) {
- throw new BadRequestError({ message: `An application with slug '${slug}' already exists in this project.` });
+ throw new BadRequestError({ message: `An application with name '${name}' already exists in this project.` });
}
}
return pkiApplicationDAL.updateById(applicationId, {
...(name !== undefined && { name }),
- ...(slug !== undefined && { slug }),
...(description !== undefined && { description })
});
};
@@ -405,16 +394,6 @@ export const pkiApplicationServiceFactory = ({
}
return pkiApplicationDAL.transaction(async (tx) => {
- const conflicts = await pkiApplicationProfileDAL.findOtherJunctionsForProfiles(profileIds, applicationId, tx);
- if (conflicts.length > 0) {
- const profilesByOtherApp = Array.from(new Set(conflicts.map((c) => c.profileId)));
- throw new BadRequestError({
- message:
- `Profile(s) [${profilesByOtherApp.join(", ")}] are already attached to a different ` +
- `Application. Each Profile can belong to one Application at a time — detach it first.`
- });
- }
-
const existing = await pkiApplicationProfileDAL.findByApplicationId(applicationId, tx);
const existingProfileIds = new Set(existing.map((row) => row.profileId));
const toAttach = profileIds.filter((id) => !existingProfileIds.has(id));
@@ -470,7 +449,7 @@ export const pkiApplicationServiceFactory = ({
return {
createApplication,
getApplicationById,
- getApplicationBySlug,
+ getApplicationByName,
listApplications,
updateApplication,
deleteApplication,
diff --git a/backend/src/services/pki-application/pki-application-types.ts b/backend/src/services/pki-application/pki-application-types.ts
index f94f7e1842..b75e5286ad 100644
--- a/backend/src/services/pki-application/pki-application-types.ts
+++ b/backend/src/services/pki-application/pki-application-types.ts
@@ -4,7 +4,6 @@ export type TPkiApplicationListItem = {
id: string;
projectId: string;
name: string;
- slug: string;
description?: string | null;
profileCount: number;
memberCount: number;
@@ -28,7 +27,6 @@ export type TPkiApplicationProfile = {
export type TCreatePkiApplicationDTO = {
name: string;
- slug: string;
description?: string;
profileIds?: string[];
} & TProjectPermission;
@@ -36,7 +34,6 @@ export type TCreatePkiApplicationDTO = {
export type TUpdatePkiApplicationDTO = {
applicationId: string;
name?: string;
- slug?: string;
description?: string | null;
} & TProjectPermission;
@@ -44,8 +41,8 @@ export type TGetPkiApplicationDTO = {
applicationId: string;
} & TProjectPermission;
-export type TGetPkiApplicationBySlugDTO = {
- slug: string;
+export type TGetPkiApplicationByNameDTO = {
+ name: string;
} & TProjectPermission;
export type TListPkiApplicationsDTO = {
diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.ts
index 889aceb063..a6f9271b64 100644
--- a/frontend/src/hooks/api/certificates/types.ts
+++ b/frontend/src/hooks/api/certificates/types.ts
@@ -122,6 +122,7 @@ export type TDownloadPkcs12DTO = {
export type TUnifiedCertificateIssuanceDTO = {
profileId: string;
+ applicationId?: string;
csr?: string;
attributes?: {
commonName?: string | null;
diff --git a/frontend/src/hooks/api/pkiApplications/queries.ts b/frontend/src/hooks/api/pkiApplications/queries.ts
index 903b3f6193..0a496ccc97 100644
--- a/frontend/src/hooks/api/pkiApplications/queries.ts
+++ b/frontend/src/hooks/api/pkiApplications/queries.ts
@@ -15,7 +15,7 @@ export const pkiApplicationKeys = {
all: ["pki-applications"] as const,
list: (search?: string) => [...pkiApplicationKeys.all, "list", { search }] as const,
byId: (applicationId: string) => [...pkiApplicationKeys.all, "by-id", { applicationId }] as const,
- bySlug: (slug: string) => [...pkiApplicationKeys.all, "by-slug", { slug }] as const,
+ byName: (name: string) => [...pkiApplicationKeys.all, "by-name", { name }] as const,
profiles: (applicationId: string) =>
[...pkiApplicationKeys.all, "profiles", { applicationId }] as const,
members: (applicationId: string) =>
@@ -75,27 +75,27 @@ export const useGetPkiApplication = (
...options
});
-export const useGetPkiApplicationBySlug = (
- slug: string,
+export const useGetPkiApplicationByName = (
+ name: string,
options?: Omit<
UseQueryOptions<
{ application: TPkiApplication },
unknown,
TPkiApplication,
- ReturnType<typeof pkiApplicationKeys.bySlug>
+ ReturnType<typeof pkiApplicationKeys.byName>
>,
"queryKey" | "queryFn"
>
) =>
useQuery({
- queryKey: pkiApplicationKeys.bySlug(slug),
+ queryKey: pkiApplicationKeys.byName(name),
queryFn: async () => {
const { data } = await apiRequest.get<{ application: TPkiApplication }>(
- `${BASE_URL}/slug/${slug}`
+ `${BASE_URL}/by-name/${name}`
);
return data;
},
- enabled: Boolean(slug),
+ enabled: Boolean(name),
select: (data) => data.application,
...options
});
diff --git a/frontend/src/hooks/api/pkiApplications/types.ts b/frontend/src/hooks/api/pkiApplications/types.ts
index 3e44ce4c75..1b2aaf5da7 100644
--- a/frontend/src/hooks/api/pkiApplications/types.ts
+++ b/frontend/src/hooks/api/pkiApplications/types.ts
@@ -2,7 +2,6 @@ export type TPkiApplication = {
id: string;
projectId: string;
name: string;
- slug: string;
description?: string | null;
createdAt: string;
updatedAt: string;
@@ -75,7 +74,6 @@ export type TPkiApplicationEnrollmentState = {
export type TCreatePkiApplicationDTO = {
name: string;
- slug: string;
description?: string;
profileIds?: string[];
};
@@ -83,7 +81,6 @@ export type TCreatePkiApplicationDTO = {
export type TUpdatePkiApplicationDTO = {
applicationId: string;
name?: string;
- slug?: string;
description?: string | null;
};
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
index a38655098f..ff2f254206 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
@@ -3,7 +3,7 @@ import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
import { PageHeader, Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
- useGetPkiApplicationBySlug,
+ useGetPkiApplicationByName,
useListPkiApplicationMembers,
useListPkiApplicationProfiles
} from "@app/hooks/api/pkiApplications";
@@ -26,7 +26,7 @@ export const ApplicationDetailsByIDPage = () => {
const search = useSearch({ strict: false }) as { selectedTab?: string };
const navigate = useNavigate();
- const { data: application, isPending } = useGetPkiApplicationBySlug(applicationName ?? "");
+ const { data: application, isPending } = useGetPkiApplicationByName(applicationName ?? "");
const { data: profiles = [] } = useListPkiApplicationProfiles(application?.id ?? "");
const { data: members = [] } = useListPkiApplicationMembers(application?.id ?? "");
@@ -62,7 +62,7 @@ export const ApplicationDetailsByIDPage = () => {
value={selectedTab}
onValueChange={(v) =>
navigate({
- to: `/organizations/${orgId ?? ""}/projects/cert-manager/${projectId ?? ""}/applications/${application.slug}`,
+ to: `/organizations/${orgId ?? ""}/projects/cert-manager/${projectId ?? ""}/applications/${application.name}`,
search: { selectedTab: v } as never
} as never)
}
@@ -106,7 +106,7 @@ export const ApplicationDetailsByIDPage = () => {
<TabPanel value="syncs">
<ApplicationSyncsTab
applicationId={application.id}
- applicationName={application.slug}
+ applicationName={application.name}
projectId={projectId ?? ""}
/>
</TabPanel>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
index f552212b30..934f2bb699 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
@@ -1,7 +1,14 @@
import { useMemo, useState } from "react";
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { MoreHorizontalIcon, PlusIcon, SettingsIcon, Trash2Icon } from "lucide-react";
+import {
+ FilePlusIcon,
+ MoreHorizontalIcon,
+ PencilIcon,
+ PlusIcon,
+ SettingsIcon,
+ Trash2Icon
+} from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
@@ -64,6 +71,8 @@ import {
} from "@app/hooks/api/pkiApplications";
import { PoliciesTable } from "@app/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable";
import { PolicyModal } from "@app/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicyModal";
+import { PkiApplicationModal } from "@app/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal";
+import { CertificateIssuanceModal } from "@app/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal";
import { CreatePkiAlertV2Modal } from "@app/views/PkiAlertsV2Page/components/CreatePkiAlertV2Modal";
import { PkiAlertV2Row } from "@app/views/PkiAlertsV2Page/components/PkiAlertV2Row";
import { ViewPkiAlertV2Modal } from "@app/views/PkiAlertsV2Page/components/ViewPkiAlertV2Modal";
@@ -95,6 +104,17 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
"policy",
"deletePolicy"
] as const);
+ const {
+ popUp: issuePopUp,
+ handlePopUpOpen: handleIssuePopUpOpen,
+ handlePopUpToggle: handleIssuePopUpToggle
+ } = usePopUp(["issueCertificate"] as const);
+ const {
+ popUp: editPopUp,
+ handlePopUpOpen: handleEditPopUpOpen,
+ handlePopUpToggle: handleEditPopUpToggle
+ } = usePopUp(["application"] as const);
+ const [profileToIssue, setProfileToIssue] = useState<TPkiApplicationProfile | null>(null);
const deletePolicy = useDeleteApprovalPolicy();
const { data: alertsData, isLoading: isAlertsLoading } = useGetPkiAlertsV2({
@@ -200,21 +220,29 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
<CardHeader>
<CardTitle>General</CardTitle>
<CardDescription>Edit core metadata for this Application.</CardDescription>
+ <CardAction>
+ <IconButton
+ variant="ghost"
+ size="xs"
+ onClick={() => handleEditPopUpOpen("application", application)}
+ aria-label="Edit application"
+ >
+ <PencilIcon />
+ </IconButton>
+ </CardAction>
</CardHeader>
<CardContent>
<dl className="grid grid-cols-1 gap-3 text-sm md:grid-cols-2">
<div>
<dt className="text-xs text-accent">Name</dt>
- <dd className="text-foreground">{application.name}</dd>
- </div>
- <div>
- <dt className="text-xs text-accent">Slug</dt>
- <dd className="font-mono text-foreground">{application.slug}</dd>
- </div>
- <div className="col-span-full">
- <dt className="text-xs text-accent">Description</dt>
- <dd className="text-foreground">{application.description ?? "—"}</dd>
+ <dd className="font-mono text-foreground">{application.name}</dd>
</div>
+ {application.description?.length ? (
+ <div className="col-span-full">
+ <dt className="text-xs text-accent">Description</dt>
+ <dd className="text-foreground">{application.description}</dd>
+ </div>
+ ) : null}
</dl>
</CardContent>
</Card>
@@ -288,6 +316,17 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
<SettingsIcon />
Configure method
</DropdownMenuItem>
+ {p.apiConfigId ? (
+ <DropdownMenuItem
+ onClick={() => {
+ setProfileToIssue(p);
+ handleIssuePopUpOpen("issueCertificate");
+ }}
+ >
+ <FilePlusIcon />
+ Request Certificate
+ </DropdownMenuItem>
+ ) : null}
<DropdownMenuItem
variant="danger"
onClick={() => setProfileToDetach(p)}
@@ -484,6 +523,18 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
applicationId={application.id}
profile={profileToConfigure}
/>
+
+ <CertificateIssuanceModal
+ popUp={issuePopUp}
+ handlePopUpToggle={(name, state) => {
+ handleIssuePopUpToggle(name, state);
+ if (state === false) setProfileToIssue(null);
+ }}
+ profileId={profileToIssue?.profileId}
+ applicationId={application.id}
+ />
+
+ <PkiApplicationModal popUp={editPopUp} handlePopUpToggle={handleEditPopUpToggle} />
</div>
);
};
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
index 8ca40322b2..cfe227b56d 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
@@ -88,7 +88,7 @@ export const ApplicationsPage = () => {
className="cursor-pointer"
onClick={() =>
navigate({
- to: `/organizations/${orgId ?? ""}/projects/cert-manager/${projectId ?? ""}/applications/${app.slug}` as never
+ to: `/organizations/${orgId ?? ""}/projects/cert-manager/${projectId ?? ""}/applications/${app.name}` as never
} as never)
}
>
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx
index 2521a04174..3ce8fbbca4 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/components/PkiApplicationModal.tsx
@@ -77,14 +77,12 @@ export const PkiApplicationModal = ({ popUp, handlePopUpToggle }: Props) => {
await update.mutateAsync({
applicationId: editing.id,
name: data.name,
- slug: data.name,
description: data.description?.length ? data.description : null
});
createNotification({ type: "success", text: "Application updated" });
} else {
await create.mutateAsync({
name: data.name,
- slug: data.name,
description: data.description
});
createNotification({ type: "success", text: "Application created" });
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
index 22c32d6c7a..267e517d0d 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateIssuanceModal.tsx
@@ -133,9 +133,15 @@ type Props = {
state?: boolean
) => void;
profileId?: string;
+ applicationId?: string;
};
-export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }: Props) => {
+export const CertificateIssuanceModal = ({
+ popUp,
+ handlePopUpToggle,
+ profileId,
+ applicationId
+}: Props) => {
const { currentProject } = useProject();
const { currentOrg } = useOrganization();
const navigate = useNavigate();
@@ -312,6 +318,7 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }
const metadataEntries = formData.metadata?.filter((m) => m.key);
const response = await issueCertificate({
profileId: formProfileId,
+ ...(applicationId && { applicationId }),
csr: formData.csr,
attributes: { ttl },
...(metadataEntries?.length && { metadata: metadataEntries })
@@ -335,6 +342,7 @@ export const CertificateIssuanceModal = ({ popUp, handlePopUpToggle, profileId }
const managedMetadataEntries = formMetadata?.filter((m) => m.key);
const request: any = {
profileId: formProfileId,
+ ...(applicationId && { applicationId }),
attributes: {
ttl,
signatureAlgorithm: signatureAlgorithm || "",
diff --git a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
index a3f3b4dc88..c7a328f6c0 100644
--- a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
+++ b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
@@ -119,8 +119,8 @@ export const RequestsPage = () => {
const { data: apps = [] } = useListPkiApplications();
const appById = useMemo(() => {
- const map = new Map<string, { id: string; name: string; slug: string }>();
- apps.forEach((a) => map.set(a.id, { id: a.id, name: a.name, slug: a.slug }));
+ const map = new Map<string, { id: string; name: string }>();
+ apps.forEach((a) => map.set(a.id, { id: a.id, name: a.name }));
return map;
}, [apps]);
@@ -292,11 +292,11 @@ export const RequestsPage = () => {
{app ? (
<Link
to={
- `/organizations/${orgId}/projects/cert-manager/${projectId}/applications/${app.slug}` as never
+ `/organizations/${orgId}/projects/cert-manager/${projectId}/applications/${app.name}` as never
}
className="text-foreground hover:text-project"
>
- {app.slug}
+ {app.name}
</Link>
) : (
<span className="text-accent">—</span>