@@ -19,6 +19,7 @@ import { TestRunService } from 'src/app/services/testrun/testrun.service';
19
19
import { TestSuite , SuiteDashboard } from 'src/app/shared/models/test-suite' ;
20
20
import { colors } from 'src/app/shared/colors.service' ;
21
21
import { TestRunStat } from 'src/app/shared/models/testrun-stats' ;
22
+ import { MatSlideToggleChange } from '@angular/material/slide-toggle' ;
22
23
23
24
@Component ( {
24
25
selector : 'app-suite-dashboard' ,
@@ -48,7 +49,7 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
48
49
private testSuiteService : TestSuiteService ,
49
50
private testrunService : TestRunService ,
50
51
private route : ActivatedRoute
51
- ) { }
52
+ ) { }
52
53
53
54
@ViewChildren ( BaseChartDirective ) charts : QueryList < BaseChartDirective > ;
54
55
@@ -94,8 +95,8 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
94
95
} ) ;
95
96
}
96
97
97
- async generateChartsData ( detailed : boolean | number ) {
98
- this . detailed = detailed ;
98
+ async generateChartsData ( detailed : boolean | number | MatSlideToggleChange ) {
99
+ this . detailed = ( detailed instanceof MatSlideToggleChange ) ? detailed . checked : detailed ;
99
100
this . suite_stats = await this . getSuiteStats ( ) ;
100
101
this . detailed
101
102
? this . generateDetailedData ( this . suite_stats )
@@ -153,13 +154,12 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
153
154
`Passed | ${ suite . stat . passed } ` ,
154
155
`Application Issues | ${ suite . stat . app_issue } ` ,
155
156
`Test Issues | ${ suite . stat . warning +
156
- suite . stat . not_assigned +
157
- suite . stat . other } `,
157
+ suite . stat . not_assigned +
158
+ suite . stat . other } `,
158
159
`Total | ${ suite . stat . total } `
159
160
] ;
160
- const options = JSON . parse ( JSON . stringify ( this . chartOptions ) ) ;
161
- options . id = suite . id ;
162
- suite [ 'options' ] = options ;
161
+
162
+ this . addChartOptionsToSuite ( suite ) ;
163
163
}
164
164
}
165
165
return suites ;
@@ -223,11 +223,19 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
223
223
`Other | ${ suite . stat . other } ` ,
224
224
`Total | ${ suite . stat . total } `
225
225
] ;
226
+
227
+ this . addChartOptionsToSuite ( suite ) ;
226
228
}
227
229
}
228
230
return suites ;
229
231
}
230
232
233
+ addChartOptionsToSuite ( suite : any ) {
234
+ const options = JSON . parse ( JSON . stringify ( this . chartOptions ) ) ;
235
+ options . id = suite . id ;
236
+ suite [ 'options' ] = options ;
237
+ }
238
+
231
239
getDuration ( testrunStat : TestRunStat ) : string {
232
240
return this . testrunService . calculateDuration ( testrunStat ) ;
233
241
}
@@ -284,7 +292,7 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
284
292
isDashboardNameValid ( ) : boolean {
285
293
const isAlreadyExists = this . dashboards
286
294
? this . dashboards . find ( x => x . name === this . newDashboardName ) !==
287
- undefined
295
+ undefined
288
296
: true ;
289
297
return (
290
298
this . newDashboardName &&
0 commit comments