feat(core): add table actions (edit, pause, delete confirmation) and global action log
- Add Edit and Pause/Resume actions to connections table - Add delete confirmation modal to secrets table - Add 'paused' status to connections with full backend support - Skip paused connections in health checks and secrets scanning - Add global ActionLog service with filesystem persistence - Instrument all mutation handlers (connections, secrets, pipelines) with action logging - Add Action Log view with entity type filtering to dashboard
This commit is contained in:
@@ -11,6 +11,10 @@ export class ConnectionsHandler {
|
||||
this.registerHandlers();
|
||||
}
|
||||
|
||||
private get actionLog() {
|
||||
return this.opsServerRef.gitopsAppRef.actionLog;
|
||||
}
|
||||
|
||||
private registerHandlers(): void {
|
||||
// Get all connections
|
||||
this.typedrouter.addTypedHandler(
|
||||
@@ -36,6 +40,14 @@ export class ConnectionsHandler {
|
||||
dataArg.baseUrl,
|
||||
dataArg.token,
|
||||
);
|
||||
this.actionLog.append({
|
||||
actionType: 'create',
|
||||
entityType: 'connection',
|
||||
entityId: connection.id,
|
||||
entityName: connection.name,
|
||||
details: `Created ${dataArg.providerType} connection "${dataArg.name}" (${dataArg.baseUrl})`,
|
||||
username: dataArg.identity.username,
|
||||
});
|
||||
return { connection };
|
||||
},
|
||||
),
|
||||
@@ -55,6 +67,42 @@ export class ConnectionsHandler {
|
||||
token: dataArg.token,
|
||||
},
|
||||
);
|
||||
const fields = [
|
||||
dataArg.name && 'name',
|
||||
dataArg.baseUrl && 'baseUrl',
|
||||
dataArg.token && 'token',
|
||||
].filter(Boolean).join(', ');
|
||||
this.actionLog.append({
|
||||
actionType: 'update',
|
||||
entityType: 'connection',
|
||||
entityId: dataArg.connectionId,
|
||||
entityName: connection.name,
|
||||
details: `Updated connection "${connection.name}" (fields: ${fields})`,
|
||||
username: dataArg.identity.username,
|
||||
});
|
||||
return { connection };
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
// Pause/resume connection
|
||||
this.typedrouter.addTypedHandler(
|
||||
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_PauseConnection>(
|
||||
'pauseConnection',
|
||||
async (dataArg) => {
|
||||
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||
const connection = await this.opsServerRef.gitopsAppRef.connectionManager.pauseConnection(
|
||||
dataArg.connectionId,
|
||||
dataArg.paused,
|
||||
);
|
||||
this.actionLog.append({
|
||||
actionType: dataArg.paused ? 'pause' : 'resume',
|
||||
entityType: 'connection',
|
||||
entityId: dataArg.connectionId,
|
||||
entityName: connection.name,
|
||||
details: `${dataArg.paused ? 'Paused' : 'Resumed'} connection "${connection.name}"`,
|
||||
username: dataArg.identity.username,
|
||||
});
|
||||
return { connection };
|
||||
},
|
||||
),
|
||||
@@ -69,6 +117,16 @@ export class ConnectionsHandler {
|
||||
const result = await this.opsServerRef.gitopsAppRef.connectionManager.testConnection(
|
||||
dataArg.connectionId,
|
||||
);
|
||||
const conn = this.opsServerRef.gitopsAppRef.connectionManager.getConnections()
|
||||
.find((c) => c.id === dataArg.connectionId);
|
||||
this.actionLog.append({
|
||||
actionType: 'test',
|
||||
entityType: 'connection',
|
||||
entityId: dataArg.connectionId,
|
||||
entityName: conn?.name || dataArg.connectionId,
|
||||
details: `Tested connection: ${result.ok ? 'success' : `failed — ${result.error || 'unknown error'}`}`,
|
||||
username: dataArg.identity.username,
|
||||
});
|
||||
return result;
|
||||
},
|
||||
),
|
||||
@@ -80,9 +138,19 @@ export class ConnectionsHandler {
|
||||
'deleteConnection',
|
||||
async (dataArg) => {
|
||||
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||
const conn = this.opsServerRef.gitopsAppRef.connectionManager.getConnections()
|
||||
.find((c) => c.id === dataArg.connectionId);
|
||||
await this.opsServerRef.gitopsAppRef.connectionManager.deleteConnection(
|
||||
dataArg.connectionId,
|
||||
);
|
||||
this.actionLog.append({
|
||||
actionType: 'delete',
|
||||
entityType: 'connection',
|
||||
entityId: dataArg.connectionId,
|
||||
entityName: conn?.name || dataArg.connectionId,
|
||||
details: `Deleted connection "${conn?.name || dataArg.connectionId}"`,
|
||||
username: dataArg.identity.username,
|
||||
});
|
||||
return { ok: true };
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user