@@ -59,8 +59,9 @@ function cache_set(cache, key, value) {
5959}
6060
6161let 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 ) ;
6465 if ( data ) {
6566 return data ;
6667 }
@@ -69,33 +70,47 @@ export async function get_path_coverage(path, changeset) {
6970 if ( changeset && changeset !== REV_LATEST ) {
7071 params += `&changeset=${ changeset } ` ;
7172 }
73+ if ( platform && platform !== 'all' ) {
74+ params += `&platform=${ platform } ` ;
75+ }
76+ if ( suite && suite !== 'all' ) {
77+ params += `&suite=${ suite } ` ;
78+ }
7279 let response = await fetch ( `${ COVERAGE_BACKEND_HOST } /v2/path?${ params } ` ) . catch ( alert ) ;
7380 if ( response . status !== 200 ) {
7481 throw new Error ( response . status + ' - ' + response . statusText ) ;
7582 }
7683 data = await response . json ( ) ;
7784
78- cache_set ( path_coverage_cache , ` ${ changeset } _ ${ path } ` , data ) ;
85+ cache_set ( path_coverage_cache , cache_key , data ) ;
7986
8087 return data ;
8188}
8289
8390let history_cache = { } ;
84- export async function get_history ( path ) {
91+ export async function get_history ( path , platform , suite ) {
8592 // Backend needs path without trailing /
8693 if ( path && path . endsWith ( '/' ) ) {
8794 path = path . substring ( 0 , path . length - 1 ) ;
8895 }
8996
90- let data = cache_get ( history_cache , path ) ;
97+ let cache_key = `${ path } _${ platform } _${ suite } ` ;
98+ let data = cache_get ( history_cache , cache_key ) ;
9199 if ( data ) {
92100 return data ;
93101 }
94102
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 } ` ) ;
96111 data = await response . json ( ) ;
97112
98- cache_set ( history_cache , path , data ) ;
113+ cache_set ( history_cache , cache_key , data ) ;
99114
100115 // Check data has coverage values
101116 // These values are missing when going above 2 levels right now
@@ -126,6 +141,22 @@ export async function get_zero_coverage_data() {
126141}
127142
128143
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+
129160// Option handling.
130161
131162function is_enabled ( opt ) {
0 commit comments