@@ -59,8 +59,9 @@ function cache_set(cache, key, value) {
59
59
}
60
60
61
61
let path_coverage_cache = { } ;
62
- export async function get_path_coverage ( path , changeset ) {
63
- let data = cache_get ( path_coverage_cache , `${ changeset } _${ path } ` ) ;
62
+ export async function get_path_coverage ( path , changeset , platform , suite ) {
63
+ let cache_key = `${ changeset } _${ path } _${ platform } _${ suite } ` ;
64
+ let data = cache_get ( path_coverage_cache , cache_key ) ;
64
65
if ( data ) {
65
66
return data ;
66
67
}
@@ -69,33 +70,47 @@ export async function get_path_coverage(path, changeset) {
69
70
if ( changeset && changeset !== REV_LATEST ) {
70
71
params += `&changeset=${ changeset } ` ;
71
72
}
73
+ if ( platform && platform !== 'all' ) {
74
+ params += `&platform=${ platform } ` ;
75
+ }
76
+ if ( suite && suite !== 'all' ) {
77
+ params += `&suite=${ suite } ` ;
78
+ }
72
79
let response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/path?${ params } ` ) . catch ( alert ) ;
73
80
if ( response . status !== 200 ) {
74
81
throw new Error ( response . status + ' - ' + response . statusText ) ;
75
82
}
76
83
data = await response . json ( ) ;
77
84
78
- cache_set ( path_coverage_cache , ` ${ changeset } _ ${ path } ` , data ) ;
85
+ cache_set ( path_coverage_cache , cache_key , data ) ;
79
86
80
87
return data ;
81
88
}
82
89
83
90
let history_cache = { } ;
84
- export async function get_history ( path ) {
91
+ export async function get_history ( path , platform , suite ) {
85
92
// Backend needs path without trailing /
86
93
if ( path && path . endsWith ( '/' ) ) {
87
94
path = path . substring ( 0 , path . length - 1 ) ;
88
95
}
89
96
90
- let data = cache_get ( history_cache , path ) ;
97
+ let cache_key = `${ path } _${ platform } _${ suite } ` ;
98
+ let data = cache_get ( history_cache , cache_key ) ;
91
99
if ( data ) {
92
100
return data ;
93
101
}
94
102
95
- let response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/history?path=${ path } ` ) ;
103
+ let params = `path=${ path } ` ;
104
+ if ( platform && platform !== 'all' ) {
105
+ params += `&platform=${ platform } ` ;
106
+ }
107
+ if ( suite && suite !== 'all' ) {
108
+ params += `&suite=${ suite } ` ;
109
+ }
110
+ let response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/history?${ params } ` ) ;
96
111
data = await response . json ( ) ;
97
112
98
- cache_set ( history_cache , path , data ) ;
113
+ cache_set ( history_cache , cache_key , data ) ;
99
114
100
115
// Check data has coverage values
101
116
// These values are missing when going above 2 levels right now
@@ -126,6 +141,22 @@ export async function get_zero_coverage_data() {
126
141
}
127
142
128
143
144
+ let filters_cache = { } ;
145
+ export async function get_filters ( ) {
146
+ let data = cache_get ( filters_cache , '' ) ;
147
+ if ( data ) {
148
+ return data ;
149
+ }
150
+
151
+ let response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/filters` ) ;
152
+ data = await response . json ( ) ;
153
+
154
+ cache_set ( filters_cache , '' , data ) ;
155
+
156
+ return data ;
157
+ }
158
+
159
+
129
160
// Option handling.
130
161
131
162
function is_enabled ( opt ) {
0 commit comments