1
1
import { thHosts } from '../helpers/constants' ;
2
2
3
+ const repoMap = new Map (
4
+ Object . entries ( {
5
+ autoland : 'firefox-autoland' ,
6
+ 'mozilla-central' : 'firefox-main' ,
7
+ 'mozilla-beta' : 'firefox-beta' ,
8
+ 'mozilla-release' : 'firefox-release' ,
9
+ } ) ,
10
+ ) ;
11
+
3
12
let _treeStatusApiUrl ;
4
13
let _treeStatusUiUrl ;
5
14
for ( const [ hostPrettyName , config ] of Object . entries ( thHosts ) ) {
@@ -23,7 +32,13 @@ const apiUrl = `${_treeStatusApiUrl}trees/`;
23
32
24
33
export default class TreeStatusModel {
25
34
static get ( repoName ) {
26
- return fetch ( `${ apiUrl } ${ repoName } ` )
35
+ let repoNameGit = repoName ;
36
+ if ( repoMap . has ( repoName ) ) {
37
+ repoNameGit = repoMap . get ( repoName ) ;
38
+ } else if ( repoName . includes ( '-esr' ) ) {
39
+ repoNameGit = `firefox-esr${ repoName . split ( '-esr' ) [ 1 ] } ` ;
40
+ }
41
+ return fetch ( `${ apiUrl } ${ repoNameGit } ` )
27
42
. then ( async ( resp ) => {
28
43
if ( resp . ok ) {
29
44
return resp . json ( ) ;
@@ -35,7 +50,7 @@ export default class TreeStatusModel {
35
50
status : 'unsupported' ,
36
51
message_of_the_day : '' ,
37
52
reason : '' ,
38
- tree : repoName ,
53
+ tree : repoNameGit ,
39
54
} ,
40
55
} ) ;
41
56
}
@@ -47,7 +62,7 @@ export default class TreeStatusModel {
47
62
status : 'error' ,
48
63
message_of_the_day : `Unable to connect to the ${ apiUrl } API` ,
49
64
reason : reason . toString ( ) ,
50
- tree : repoName ,
65
+ tree : repoNameGit ,
51
66
} ,
52
67
} ) ,
53
68
) ;
0 commit comments