scaffolder: wrap dry-run log body in an outer object
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ interface DryRunInput {
|
||||
}
|
||||
|
||||
interface DryRunResult {
|
||||
log: JsonObject[];
|
||||
log: Array<{ body: JsonObject }>;
|
||||
directoryContents: SerializedFile[];
|
||||
output: JsonObject;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export function createDryRunner(options: TemplateTesterCreateOptions) {
|
||||
});
|
||||
|
||||
const dryRunId = uuid();
|
||||
const log = new Array<JsonObject>();
|
||||
const log = new Array<{ body: JsonObject }>();
|
||||
const contentsPath = resolveSafeChildPath(
|
||||
options.workingDirectory,
|
||||
`dry-run-content-${dryRunId}`,
|
||||
@@ -118,8 +118,10 @@ export function createDryRunner(options: TemplateTesterCreateOptions) {
|
||||
return;
|
||||
}
|
||||
log.push({
|
||||
...logMetadata,
|
||||
message,
|
||||
body: {
|
||||
...logMetadata,
|
||||
message,
|
||||
},
|
||||
});
|
||||
},
|
||||
async complete() {
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ export function DryRunResultsList() {
|
||||
return (
|
||||
<List className={classes.root} dense>
|
||||
{dryRun.results.map(result => {
|
||||
const failed = result.log.some(l => l.status === 'failed');
|
||||
const failed = result.log.some(l => l.body.status === 'failed');
|
||||
return (
|
||||
<ListItem
|
||||
button
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ describe('DryRunResultsView', () => {
|
||||
executable: false,
|
||||
},
|
||||
],
|
||||
log: [{ message: 'Foo Message', stepId: 'foo' }],
|
||||
log: [{ body: { message: 'Foo Message', stepId: 'foo' } }],
|
||||
output: {
|
||||
links: [{ title: 'Foo Link', url: 'http://example.com' }],
|
||||
},
|
||||
|
||||
+5
-3
@@ -110,12 +110,14 @@ function LogContent() {
|
||||
}
|
||||
return (
|
||||
selectedResult.steps.map(step => {
|
||||
const stepLog = selectedResult.log.filter(l => l.stepId === step.id);
|
||||
const stepLog = selectedResult.log.filter(
|
||||
l => l.body.stepId === step.id,
|
||||
);
|
||||
return {
|
||||
id: step.id,
|
||||
name: step.name,
|
||||
logString: stepLog.map(l => l.message).join('\n'),
|
||||
status: stepLog[stepLog.length - 1]?.status ?? 'completed',
|
||||
logString: stepLog.map(l => l.body.message).join('\n'),
|
||||
status: stepLog[stepLog.length - 1]?.body.status ?? 'completed',
|
||||
};
|
||||
}) ?? []
|
||||
);
|
||||
|
||||
@@ -165,7 +165,7 @@ export interface ScaffolderDryRunResponse {
|
||||
base64Content: string;
|
||||
executable: boolean;
|
||||
}>;
|
||||
log: Array<LogEvent['body']>;
|
||||
log: Array<Pick<LogEvent, 'body'>>;
|
||||
steps: TaskStep[];
|
||||
output: ScaffolderTaskOutput;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user