-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-queue.component.ts
More file actions
65 lines (56 loc) · 2.05 KB
/
Copy pathbuild-queue.component.ts
File metadata and controls
65 lines (56 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { platforms, PlatformSpec } from '../../../../shared/platforms';
import { PopupCoordinatorService } from '../popup-coordinator.service';
import { PopupComponent } from '../popup/popup.component';
import { VisibilityService } from '../visibility/visibility.service';
@Component({
selector: 'app-build-queue',
templateUrl: './build-queue.component.html',
styleUrls: ['./build-queue.component.css'],
changeDetection: ChangeDetectionStrategy.Eager,
standalone: false
})
export class BuildQueueComponent extends PopupComponent implements OnInit {
@Input() queue: any;
@Input() status: any;
constructor(popupCoordinator: PopupCoordinatorService, visibilityService: VisibilityService) {
super(popupCoordinator, visibilityService);
}
buildTypeFromConfig(buildTypeId: string, pspec: PlatformSpec) {
if(!pspec.configs) {
return undefined;
}
let config = Object.getOwnPropertyNames(pspec.configs).find(c => pspec.configs[c] == buildTypeId);
switch(config) {
case 'alpha':
case 'beta':
case 'stable':
return 'release';
}
return config;
}
isPullRequest(build) {
return !!build.branchName?.match(/^\d+$/);
}
getPlatformSpec(build) {
const pspec = platforms.find(p => this.buildTypeFromConfig(build.buildTypeId, p) != undefined);
return pspec ?? platforms.find(p => p.id == 'common');
}
getPlatform(build) {
const pspec = this.getPlatformSpec(build);
return pspec.name;
}
getBuildType(build) {
const pspec = this.getPlatformSpec(build);
return this.buildTypeFromConfig(build.buildTypeId, pspec) ?? build.buildTypeId;
}
getPullRequestTitle(build) {
const prNumber = parseInt(build.branchName, 10);
const pullRequest = this.status.keymanRepo?.pullRequests?.edges?.find(pr => pr.node?.number == prNumber)?.node;
return pullRequest ? pullRequest.title : '<unknown pull request>';
}
ngOnInit(): void {
this.popupId = 'queue-popup';
super.ngOnInit();
}
}