Skip to content

Commit cbc9f0a

Browse files
DmitryBogatkod.bogatko
andauthored
Fix of an issue with switching between detailed/non-detailed view on the dashboard (#122)
Co-authored-by: d.bogatko <[email protected]>
1 parent a081423 commit cbc9f0a

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# CHANGELOG
22

3-
## 1.2.1 (2020-12-16)
3+
## 1.2.2 (2021-01-19)
4+
- Fix of an issue with switching between detailed/non-detailed view on the dashboard
5+
6+
## 1.2.1 (2021-01-17)
47
- Fix [[BUG] on a dashboard page cannot delete a dashboard](https://github.com/aquality-automation/aquality-tracking/issues/130)
58

69
## 1.2.0 (2020-12-15)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aquality-tracking-ui",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

src/app/pages/project/suite/suite-dashboard/suite-dashboard.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
color: var(--light);
8080
}
8181

82+
::ng-deep .mat-slide-toggle {
83+
color: #ffffff;
84+
}
85+
8286
.autoRefresh {
8387
margin-top: 10px;
8488
margin-bottom: 10px;

src/app/pages/project/suite/suite-dashboard/suite-dashboard.component.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { TestRunService } from 'src/app/services/testrun/testrun.service';
1919
import { TestSuite, SuiteDashboard } from 'src/app/shared/models/test-suite';
2020
import { colors } from 'src/app/shared/colors.service';
2121
import { TestRunStat } from 'src/app/shared/models/testrun-stats';
22+
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
2223

2324
@Component({
2425
selector: 'app-suite-dashboard',
@@ -48,7 +49,7 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
4849
private testSuiteService: TestSuiteService,
4950
private testrunService: TestRunService,
5051
private route: ActivatedRoute
51-
) {}
52+
) { }
5253

5354
@ViewChildren(BaseChartDirective) charts: QueryList<BaseChartDirective>;
5455

@@ -94,8 +95,8 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
9495
});
9596
}
9697

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;
99100
this.suite_stats = await this.getSuiteStats();
100101
this.detailed
101102
? this.generateDetailedData(this.suite_stats)
@@ -153,13 +154,12 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
153154
`Passed | ${suite.stat.passed}`,
154155
`Application Issues | ${suite.stat.app_issue}`,
155156
`Test Issues | ${suite.stat.warning +
156-
suite.stat.not_assigned +
157-
suite.stat.other}`,
157+
suite.stat.not_assigned +
158+
suite.stat.other}`,
158159
`Total | ${suite.stat.total}`
159160
];
160-
const options = JSON.parse(JSON.stringify(this.chartOptions));
161-
options.id = suite.id;
162-
suite['options'] = options;
161+
162+
this.addChartOptionsToSuite(suite);
163163
}
164164
}
165165
return suites;
@@ -223,11 +223,19 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
223223
`Other | ${suite.stat.other}`,
224224
`Total | ${suite.stat.total}`
225225
];
226+
227+
this.addChartOptionsToSuite(suite);
226228
}
227229
}
228230
return suites;
229231
}
230232

233+
addChartOptionsToSuite(suite: any) {
234+
const options = JSON.parse(JSON.stringify(this.chartOptions));
235+
options.id = suite.id;
236+
suite['options'] = options;
237+
}
238+
231239
getDuration(testrunStat: TestRunStat): string {
232240
return this.testrunService.calculateDuration(testrunStat);
233241
}
@@ -284,7 +292,7 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy {
284292
isDashboardNameValid(): boolean {
285293
const isAlreadyExists = this.dashboards
286294
? this.dashboards.find(x => x.name === this.newDashboardName) !==
287-
undefined
295+
undefined
288296
: true;
289297
return (
290298
this.newDashboardName &&

0 commit comments

Comments
 (0)