@@ -74,31 +74,41 @@ export class RunPresenter {
7474 } ,
7575 } ) ;
7676
77+ const showLogs = showDeletedLogs ? true : run . logsDeletedAt ? false : true ;
78+
79+ const runData = {
80+ id : run . id ,
81+ number : run . number ,
82+ friendlyId : run . friendlyId ,
83+ traceId : run . traceId ,
84+ spanId : run . spanId ,
85+ status : run . status ,
86+ isFinished : isFinalRunStatus ( run . status ) ,
87+ completedAt : run . completedAt ,
88+ logsDeletedAt : showDeletedLogs ? null : run . logsDeletedAt ,
89+ rootTaskRun : run . rootTaskRun ,
90+ environment : {
91+ id : run . runtimeEnvironment . id ,
92+ organizationId : run . runtimeEnvironment . organizationId ,
93+ type : run . runtimeEnvironment . type ,
94+ slug : run . runtimeEnvironment . slug ,
95+ userId : run . runtimeEnvironment . orgMember ?. user . id ,
96+ userName : getUsername ( run . runtimeEnvironment . orgMember ?. user ) ,
97+ } ,
98+ } ;
99+
100+ if ( ! showLogs ) {
101+ return {
102+ run : runData ,
103+ trace : undefined ,
104+ } ;
105+ }
106+
77107 // get the events
78108 const traceSummary = await eventRepository . getTraceSummary ( run . traceId ) ;
79-
80109 if ( ! traceSummary ) {
81110 return {
82- run : {
83- id : run . id ,
84- number : run . number ,
85- friendlyId : run . friendlyId ,
86- traceId : run . traceId ,
87- spanId : run . spanId ,
88- status : run . status ,
89- isFinished : isFinalRunStatus ( run . status ) ,
90- completedAt : run . completedAt ,
91- logsDeletedAt : run . logsDeletedAt ,
92- rootTaskRun : run . rootTaskRun ,
93- environment : {
94- id : run . runtimeEnvironment . id ,
95- organizationId : run . runtimeEnvironment . organizationId ,
96- type : run . runtimeEnvironment . type ,
97- slug : run . runtimeEnvironment . slug ,
98- userId : run . runtimeEnvironment . orgMember ?. user . id ,
99- userName : getUsername ( run . runtimeEnvironment . orgMember ?. user ) ,
100- } ,
101- } ,
111+ run : runData ,
102112 trace : undefined ,
103113 } ;
104114 }
@@ -141,26 +151,7 @@ export class RunPresenter {
141151 }
142152
143153 return {
144- run : {
145- id : run . id ,
146- number : run . number ,
147- friendlyId : run . friendlyId ,
148- traceId : run . traceId ,
149- spanId : run . spanId ,
150- status : run . status ,
151- isFinished : isFinalRunStatus ( run . status ) ,
152- completedAt : run . completedAt ,
153- logsDeletedAt : showDeletedLogs ? false : run . logsDeletedAt ,
154- rootTaskRun : run . rootTaskRun ,
155- environment : {
156- id : run . runtimeEnvironment . id ,
157- organizationId : run . runtimeEnvironment . organizationId ,
158- type : run . runtimeEnvironment . type ,
159- slug : run . runtimeEnvironment . slug ,
160- userId : run . runtimeEnvironment . orgMember ?. user . id ,
161- userName : getUsername ( run . runtimeEnvironment . orgMember ?. user ) ,
162- } ,
163- } ,
154+ run : runData ,
164155 trace : {
165156 rootSpanStatus,
166157 events : events ,
0 commit comments