mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-13 10:34:47 +00:00
FEAT: enhance pipeline run jobs endpoint with error handling and response structure
This commit is contained in:
@@ -72,6 +72,10 @@ export class PlatformApiController {
|
||||
return id?.replace(/-/g, '_') || '';
|
||||
}
|
||||
|
||||
private decodePathParam(value: string): string {
|
||||
return value ? decodeURIComponent(value) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Denormalize ID back to UUID format (replace _ with -).
|
||||
* Used when we receive a normalized ID but need the original UUID.
|
||||
@@ -778,10 +782,10 @@ export class PlatformApiController {
|
||||
@User() user: RequestUser,
|
||||
) {
|
||||
const normalizedPipelineId = this.normalizePipelineId(pipelineId);
|
||||
const normalizedRunId = this.normalizePipelineId(runId);
|
||||
const decodedRunId = this.decodePathParam(runId);
|
||||
return this.platformApiService.proxy(
|
||||
'GET',
|
||||
`/pipeline/${normalizedPipelineId}/pipeline_run/${normalizedRunId}`,
|
||||
`/pipeline/${normalizedPipelineId}/pipeline_run/${decodedRunId}`,
|
||||
user,
|
||||
);
|
||||
}
|
||||
@@ -794,10 +798,10 @@ export class PlatformApiController {
|
||||
@User() user: RequestUser,
|
||||
@Query() query: Record<string, string>,
|
||||
) {
|
||||
const normalizedRunId = this.normalizePipelineId(runId);
|
||||
const decodedRunId = this.decodePathParam(runId);
|
||||
return this.platformApiService.proxy(
|
||||
'GET',
|
||||
`/pipeline/pipeline_run/${normalizedRunId}/logs`,
|
||||
`/pipeline/pipeline_run/${decodedRunId}/logs`,
|
||||
user,
|
||||
undefined,
|
||||
query,
|
||||
@@ -813,7 +817,7 @@ export class PlatformApiController {
|
||||
@User() user: RequestUser,
|
||||
) {
|
||||
const normalizedPipelineId = this.normalizePipelineId(pipelineId);
|
||||
const normalizedRunId = this.normalizePipelineId(runId);
|
||||
const decodedRunId = this.decodePathParam(runId);
|
||||
|
||||
const status = await this.platformApiService.proxy(
|
||||
'GET',
|
||||
@@ -827,7 +831,7 @@ export class PlatformApiController {
|
||||
|
||||
return this.platformApiService.proxy(
|
||||
'POST',
|
||||
`/pipeline/${normalizedPipelineId}/pipeline_run/${normalizedRunId}/cancel`,
|
||||
`/pipeline/${normalizedPipelineId}/pipeline_run/${decodedRunId}/cancel`,
|
||||
user,
|
||||
);
|
||||
}
|
||||
@@ -857,13 +861,25 @@ export class PlatformApiController {
|
||||
@User() user: RequestUser,
|
||||
) {
|
||||
const normalizedPipelineId = this.normalizePipelineId(pipelineId);
|
||||
const normalizedRunId = this.normalizePipelineId(runId);
|
||||
const decodedRunId = this.decodePathParam(runId);
|
||||
|
||||
return this.platformApiService.proxy(
|
||||
'GET',
|
||||
`/pipeline/${normalizedPipelineId}/pipeline_run/${normalizedRunId}/jobs`,
|
||||
user,
|
||||
);
|
||||
try {
|
||||
return await this.platformApiService.proxy(
|
||||
'GET',
|
||||
`/pipeline/${normalizedPipelineId}/pipeline_run/${decodedRunId}/jobs`,
|
||||
user,
|
||||
);
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException && error.getStatus() === 404) {
|
||||
this.logger.warn('Platform API pipeline run jobs not found; returning empty jobs list', {
|
||||
pipelineId: normalizedPipelineId,
|
||||
runId: decodedRunId,
|
||||
});
|
||||
return { jobs: [] };
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== JOBS - COLUMN EDITING ROUTES ====================
|
||||
|
||||
Reference in New Issue
Block a user