From a081423cca148026678c2f74928e39a1f9f341fd Mon Sep 17 00:00:00 2001 From: DmitryBogatko Date: Sat, 16 Jan 2021 21:59:39 +0300 Subject: [PATCH] added fix of dashboards creation and deletion by converting UI suite to required DTO (#121) Co-authored-by: d.bogatko --- CHANGELOG.md | 3 +++ package.json | 2 +- .../suite-dashboard/suite-dashboard.component.ts | 3 ++- src/app/shared/models/test-suite.ts | 14 +++++++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3391b38..90d27682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +## 1.2.1 (2020-12-16) + - Fix [[BUG] on a dashboard page cannot delete a dashboard](https://github.com/aquality-automation/aquality-tracking/issues/130) + ## 1.2.0 (2020-12-15) - Fix [Test result view is empty if it was opened by shared link or by opening in new tab] (https://github.com/aquality-automation/aquality-tracking/issues/126) - Fix [Select items on the page] (https://github.com/aquality-automation/aquality-tracking/issues/127) diff --git a/package.json b/package.json index 3e71f218..5fad8694 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aquality-tracking-ui", - "version": "1.2.0", + "version": "1.2.1", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/src/app/pages/project/suite/suite-dashboard/suite-dashboard.component.ts b/src/app/pages/project/suite/suite-dashboard/suite-dashboard.component.ts index 2eb57d8a..f0c5f9de 100644 --- a/src/app/pages/project/suite/suite-dashboard/suite-dashboard.component.ts +++ b/src/app/pages/project/suite/suite-dashboard/suite-dashboard.component.ts @@ -270,9 +270,10 @@ export class SuiteDashboardComponent implements OnInit, OnDestroy { } async saveDashboard() { + let suites = TestSuite.getCreateDashboardDtos(this.suitesToShow); await this.testSuiteService.createSuiteDashboard({ name: this.newDashboardName, - suites: this.suitesToShow, + suites: suites, detailed: this.detailed === true || this.detailed === 1 ? 1 : 0, project_id: this.route.snapshot.params['projectId'] }); diff --git a/src/app/shared/models/test-suite.ts b/src/app/shared/models/test-suite.ts index 6dcf3c83..3f64a6ff 100644 --- a/src/app/shared/models/test-suite.ts +++ b/src/app/shared/models/test-suite.ts @@ -5,6 +5,18 @@ export class TestSuite { id?: number; project_id?: number; tests?: Test[]; + + static getCreateDashboardDtos(suites: TestSuite[]): TestSuite[] { + let suiteDtos: TestSuite[] = []; + suites.forEach(suite => { + suiteDtos.push(TestSuite.getCreateDashboardDto(suite)); + }); + return suiteDtos; + } + + static getCreateDashboardDto(suite: TestSuite): TestSuite { + return { id: suite.id, name: suite.name, project_id: suite.project_id }; + } } export class TestSuiteStat { @@ -22,7 +34,7 @@ export class TestSuiteStat { export class SuiteDashboard { id?: number; project_id?: number; - detailed: boolean|number; + detailed: boolean | number; name: string; suites: TestSuite[]; notDeletable?: boolean;