@@ -9,7 +9,11 @@ import { Badge, OverlayTrigger, Table, Tooltip } from "react-bootstrap";
9
9
import { FormattedMessage } from "react-intl" ;
10
10
import { lt as SemverLessThan } from "semver" ;
11
11
12
- import { CompileJobResponse , DreamDaemonSecurity } from "../../ApiClient/generatedcode/generated" ;
12
+ import {
13
+ CompileJobResponse ,
14
+ DreamDaemonSecurity ,
15
+ TestMerge
16
+ } from "../../ApiClient/generatedcode/generated" ;
13
17
import { InstanceEditContext } from "../../contexts/InstanceEditContext" ;
14
18
import Engine from "../views/Instance/Edit/Engine" ;
15
19
import { DebugJsonViewer } from "./JsonViewer" ;
@@ -31,6 +35,7 @@ export interface CompileJobsPaging {
31
35
export interface DeploymentsData {
32
36
viewDataType : ViewDataType ;
33
37
compileJobs ?: CompileJobResponse [ ] ;
38
+ prevCompileJob ?: CompileJobResponse | null ;
34
39
paging : CompileJobsPaging ;
35
40
}
36
41
@@ -198,12 +203,19 @@ class DeploymentViewer extends React.Component<IProps, IState> {
198
203
</ React . Fragment >
199
204
) ;
200
205
}
206
+
201
207
private renderDeployments ( viewData : DeploymentsData ) : React . ReactNode {
202
208
return (
203
209
< React . Fragment >
204
210
{ this . renderTable (
205
211
< React . Fragment >
206
- { viewData . compileJobs ! . map ( compileJob => this . renderCompileJob ( compileJob ) ) }
212
+ { viewData . compileJobs ! . map ( ( compileJob , i , jobs ) => {
213
+ if ( i < jobs . length - 1 ) {
214
+ return this . renderCompileJob ( compileJob , jobs [ i + 1 ] ) ;
215
+ } else {
216
+ return this . renderCompileJob ( compileJob , viewData . prevCompileJob ) ;
217
+ }
218
+ } ) }
207
219
</ React . Fragment >
208
220
) }
209
221
< PageHelper
@@ -216,7 +228,32 @@ class DeploymentViewer extends React.Component<IProps, IState> {
216
228
) ;
217
229
}
218
230
219
- private renderCompileJob ( compileJob : CompileJobResponse ) {
231
+ private getTestMergeDiffStatus (
232
+ testMerge : TestMerge ,
233
+ previousCompileJob ?: CompileJobResponse | null
234
+ ) {
235
+ const oldTestMerges = previousCompileJob ?. revisionInformation ?. activeTestMerges ;
236
+ if ( ! oldTestMerges || oldTestMerges . length == 0 ) {
237
+ return < FormattedMessage id = "view.utils.deployment_viewer.table.pr.tm_diff.tm_added" /> ;
238
+ }
239
+ for ( let index = 0 ; index < oldTestMerges . length ; index ++ ) {
240
+ const oldTestMerge = oldTestMerges [ index ] ;
241
+ if ( oldTestMerge . number == testMerge . number ) {
242
+ if ( oldTestMerge . targetCommitSha != testMerge . targetCommitSha ) {
243
+ return (
244
+ < FormattedMessage id = "view.utils.deployment_viewer.table.pr.tm_diff.tm_updated" />
245
+ ) ;
246
+ }
247
+ return "" ;
248
+ }
249
+ }
250
+ return < FormattedMessage id = "view.utils.deployment_viewer.table.pr.tm_diff.tm_added" /> ;
251
+ }
252
+
253
+ private renderCompileJob (
254
+ compileJob : CompileJobResponse ,
255
+ previousCompileJob ?: CompileJobResponse | null
256
+ ) {
220
257
const engineVersion = Engine . friendlyVersion ( compileJob . engineVersion ) ;
221
258
222
259
// we use en-GB so we get the fucking SANE DD/MM/YYYY
@@ -354,6 +391,9 @@ class DeploymentViewer extends React.Component<IProps, IState> {
354
391
< th >
355
392
< FormattedMessage id = "view.utils.deployment_viewer.table.pr.number" />
356
393
</ th >
394
+ < th >
395
+ < FormattedMessage id = "view.utils.deployment_viewer.table.pr.tm_diff" />
396
+ </ th >
357
397
< th >
358
398
< FormattedMessage id = "view.utils.deployment_viewer.table.pr.title" />
359
399
</ th >
@@ -378,6 +418,12 @@ class DeploymentViewer extends React.Component<IProps, IState> {
378
418
< td >
379
419
< a href = { testMerge . url } > #{ testMerge . number } </ a >
380
420
</ td >
421
+ < td >
422
+ { this . getTestMergeDiffStatus (
423
+ testMerge ,
424
+ previousCompileJob
425
+ ) }
426
+ </ td >
381
427
< td >
382
428
< a href = { testMerge . url } >
383
429
{ testMerge . titleAtMerge }
0 commit comments