diff --git a/apps/api/src/routes/api/v1/services/handlers.ts b/apps/api/src/routes/api/v1/services/handlers.ts index 1dec25c54..690bcbe7b 100644 --- a/apps/api/src/routes/api/v1/services/handlers.ts +++ b/apps/api/src/routes/api/v1/services/handlers.ts @@ -2653,6 +2653,27 @@ export async function activatePlausibleUsers(request: FastifyRequest, re return errorHandler({ status, message }) } } +export async function cleanupPlausibleLogs(request: FastifyRequest, reply: FastifyReply) { + try { + const { id } = request.params + const teamId = request.user.teamId; + const { + destinationDockerId, + destinationDocker, + plausibleAnalytics: { postgresqlUser, postgresqlPassword, postgresqlDatabase } + } = await getServiceFromDB({ id, teamId }); + if (destinationDockerId) { + await executeDockerCmd({ + dockerId: destinationDocker.id, + command: `docker exec ${id}-clickhouse 'clickhouse-client -q "SELECT name FROM system.tables WHERE name LIKE '%log%';" | xargs -I{} clickhouse-client -q "TRUNCATE TABLE system.{};"'` + }) + return await reply.code(201).send() + } + throw { status: 500, message: 'Could cleanup logs.' } + } catch ({ status, message }) { + return errorHandler({ status, message }) + } +} export async function activateWordpressFtp(request: FastifyRequest, reply: FastifyReply) { const { id } = request.params const { ftpEnabled } = request.body; diff --git a/apps/api/src/routes/api/v1/services/index.ts b/apps/api/src/routes/api/v1/services/index.ts index bb5ab7670..c43966f78 100644 --- a/apps/api/src/routes/api/v1/services/index.ts +++ b/apps/api/src/routes/api/v1/services/index.ts @@ -4,6 +4,7 @@ import { activateWordpressFtp, checkService, checkServiceDomain, + cleanupPlausibleLogs, deleteService, deleteServiceSecret, deleteServiceStorage, @@ -74,6 +75,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { fastify.post('/:id/:type/settings', async (request, reply) => await setSettingsService(request, reply)); fastify.post('/:id/plausibleanalytics/activate', async (request, reply) => await activatePlausibleUsers(request, reply)); + fastify.post('/:id/plausibleanalytics/cleanup', async (request, reply) => await cleanupPlausibleLogs(request, reply)); fastify.post('/:id/wordpress/ftp', async (request, reply) => await activateWordpressFtp(request, reply)); }; diff --git a/apps/ui/src/routes/__layout.svelte b/apps/ui/src/routes/__layout.svelte index f05acc5b0..e808f555a 100644 --- a/apps/ui/src/routes/__layout.svelte +++ b/apps/ui/src/routes/__layout.svelte @@ -126,7 +126,7 @@
diff --git a/apps/ui/src/routes/applications/[id]/__layout.svelte b/apps/ui/src/routes/applications/[id]/__layout.svelte index 9a165b635..4cb126eda 100644 --- a/apps/ui/src/routes/applications/[id]/__layout.svelte +++ b/apps/ui/src/routes/applications/[id]/__layout.svelte @@ -352,7 +352,7 @@ >
diff --git a/apps/ui/src/tailwind.css b/apps/ui/src/tailwind.css index cf23653b8..66dcfd1b2 100644 --- a/apps/ui/src/tailwind.css +++ b/apps/ui/src/tailwind.css @@ -91,11 +91,8 @@ label { @apply inline-block w-64 text-xs tracking-tight md:text-sm; } .btn { - @apply text-white tracking-tighter; + @apply text-white text-base; } -/*button, .button { - @apply rounded bg-coolgray-200 p-2 px-3 text-sm outline-none transition-all duration-100 hover:bg-coolgray-500 disabled:cursor-not-allowed disabled:bg-coolblack disabled:text-stone-600; -}*/ a { @apply underline hover:text-white;