@@ -16,6 +16,7 @@ import { AnomaliesTableSk } from '../anomalies-table-sk/anomalies-table-sk';
1616
1717import '@material/web/button/outlined-button.js' ;
1818import { HintableObject } from '../../../infra-sk/modules/hintable' ;
19+ import { errorMessage } from '../errorMessage' ;
1920
2021// State is the local UI state of regressions-page-sk
2122interface State {
@@ -57,6 +58,8 @@ export class RegressionsPageSk extends ElementSk {
5758
5859 private anomaliesLoadingSpinner = false ;
5960
61+ private showMoreLoadingSpinner = false ;
62+
6063 constructor ( ) {
6164 super ( RegressionsPageSk . template ) ;
6265 this . state = {
@@ -93,6 +96,12 @@ export class RegressionsPageSk extends ElementSk {
9396 }
9497 ) ;
9598 this . anomaliesTable = document . getElementById ( 'anomaly-table' ) as AnomaliesTableSk ;
99+ const showMoreClick = document . getElementById ( 'showMoreAnomalies' ) ;
100+ showMoreClick ! . onclick = ( ) => {
101+ this . anomaliesLoadingSpinner = false ;
102+ this . showMoreLoadingSpinner = true ;
103+ this . _render ( ) ;
104+ } ;
96105 }
97106
98107 async fetchRegressions ( ) : Promise < void > {
@@ -120,14 +129,22 @@ export class RegressionsPageSk extends ElementSk {
120129 }
121130
122131 const url = ANOMALY_LIST_ENDPOINT + queryStr ;
132+
123133 this . anomaliesLoadingSpinner = true ;
134+ this . _render ( ) ;
124135 await fetch ( url , {
125136 method : 'GET' ,
126137 headers : {
127138 'Content-Type' : 'application/json' ,
128139 } ,
129140 } )
130141 . then ( jsonOrThrow )
142+ . catch ( ( msg ) => {
143+ errorMessage ( msg ) ;
144+ this . anomaliesLoadingSpinner = false ;
145+ this . showMoreLoadingSpinner = false ;
146+ this . _render ( ) ;
147+ } )
131148 . then ( ( response ) => {
132149 const json : GetAnomaliesResponse = response ;
133150 const regs : Anomaly [ ] = json . anomaly_list || [ ] ;
@@ -138,14 +155,11 @@ export class RegressionsPageSk extends ElementSk {
138155 }
139156 this . cpAnomalies = this . cpAnomalies . concat ( [ ...regs ] ) ;
140157 this . anomalyCursor = json . anomaly_cursor ;
141- this . anomaliesLoadingSpinner = false ;
142158 this . anomaliesTable ! . populateTable ( this . cpAnomalies ) ;
143- this . _render ( ) ;
144- } )
145- . catch ( ( ) => {
146- this . anomaliesLoadingSpinner = false ;
147- this . _render ( ) ;
148159 } ) ;
160+ this . anomaliesLoadingSpinner = false ;
161+ this . showMoreLoadingSpinner = false ;
162+ this . _render ( ) ;
149163 }
150164
151165 private async init ( ) {
@@ -162,6 +176,7 @@ export class RegressionsPageSk extends ElementSk {
162176 this . regressions = [ ] ;
163177 this . cpAnomalies = [ ] ;
164178 this . showMoreAnomalies = false ;
179+ this . anomaliesLoadingSpinner = false ;
165180 this . stateHasChanged ( ) ;
166181 this . _render ( ) ;
167182 }
@@ -174,15 +189,15 @@ export class RegressionsPageSk extends ElementSk {
174189 < option disabled selected value > -- select an option --</ option >
175190 ${ RegressionsPageSk . allSubscriptions ( ele ) } ]
176191 </ select >
192+ < spinner-sk id ="upper-spin " ?active =${ ele . anomaliesLoadingSpinner } > </ spinner-sk >
177193 < button id ="btnTriaged " @click =${ ( ) => ele . triagedChange ( ) } > Show Triaged</ button >
178194 < button id ="btnImprovements " @click =${ ( ) => ele . improvementChange ( ) } > Show Improvements</ button >
179195 < anomalies-table-sk id ="anomaly-table "> </ anomalies-table-sk >
180- < spinner-sk ?active =${ ele . anomaliesLoadingSpinner } > </ spinner-sk >
181196 < div id ="showmore " ?hidden =${ ! ele . showMoreAnomalies } >
182197 < button id ="showMoreAnomalies " @click =${ ( ) => ele . fetchRegressions ( ) } >
183198 < div > Show More</ div >
184199 </ button >
185- < spinner-sk ?active =${ ele . anomaliesLoadingSpinner } > </ spinner-sk >
200+ < spinner-sk ?active =${ ele . showMoreLoadingSpinner } > </ spinner-sk >
186201 </ div >
187202 ${ ele . regressions . length > 0
188203 ? html ` < div id ="regressions_container "> ${ ele . getRegTemplate ( ele . regressions ) } </ div > `
0 commit comments