From 59d123acc5b87bcaa10dd8f941bb3761fdbae655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6hler?= Date: Thu, 26 Oct 2023 14:14:01 +0200 Subject: [PATCH] load default tmplate from environment variables deactivate buttons when qb running show info message when qb failed --- .../quality-report.component.html | 6 +++--- .../quality-report/quality-report.component.ts | 17 +++++++++++------ src/i18n/messages.en.xlf | 9 +++++++++ src/i18n/messages.xlf | 8 ++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/app/embedded/quality-report/quality-report.component.html b/src/app/embedded/quality-report/quality-report.component.html index 563f070..8cd8521 100644 --- a/src/app/embedded/quality-report/quality-report.component.html +++ b/src/app/embedded/quality-report/quality-report.component.html @@ -7,19 +7,19 @@

Qualitätsbericht

Template - -
+
- +
diff --git a/src/app/embedded/quality-report/quality-report.component.ts b/src/app/embedded/quality-report/quality-report.component.ts index 0004500..27c7377 100644 --- a/src/app/embedded/quality-report/quality-report.component.ts +++ b/src/app/embedded/quality-report/quality-report.component.ts @@ -1,11 +1,10 @@ import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute} from "@angular/router"; - -import {DatePipe} from '@angular/common'; import {MatTableDataSource} from "@angular/material/table"; import {MatPaginator} from "@angular/material/paginator"; import {QualityReportService, reportLog} from "../../teiler/quality-report.service"; import {Subscription} from "rxjs"; +import {environment} from "../../../environments/environment"; export interface QualityReports { id: string; @@ -59,7 +58,7 @@ export class QualityReportComponent implements OnInit, OnDestroy { buttonDisabled: boolean = false; fileName: string | undefined; importTemplate: string = ""; - selectedTemplate: string = "ccp"; + selectedTemplate: string = environment.config.REPORTER_DEFAULT_TEMPLATE_ID; templateIDs: Templates[] = [] constructor(private route: ActivatedRoute, private qualityReportService: QualityReportService) { @@ -104,15 +103,17 @@ export class QualityReportComponent implements OnInit, OnDestroy { this.buttonDisabled = true; this.subscriptionGenerateQB = this.qualityReportService.generateQB(this.selectedTemplate, this.importTemplate).subscribe({ next: (response:QBResponse) => { - const url = new URL(response.responseUrl) + const url = new URL(response.responseUrl); const id = url.searchParams.get("report-id"); - this.qbStatus = QBStatus.RUNNING + this.qbStatus = QBStatus.RUNNING; if (id) { this.pollingStatusAndLogs(id, false); } }, error: (error) => { console.log(error); + this.buttonDisabled = false; + this.qbStatus = QBStatus.ERROR; }, complete: () => {} }); @@ -233,7 +234,7 @@ export class QualityReportComponent implements OnInit, OnDestroy { templateList.forEach((template) => { this.templateIDs.push({value: template, display: template}) }) - this.templateIDs.push({value: "custom", display:"Eigenes Template"}) + this.templateIDs.push({value: "custom", display:$localize`Eigenes Template`}) }, error: (error) => { console.log(error); @@ -251,4 +252,8 @@ export class QualityReportComponent implements OnInit, OnDestroy { downloadTemplate(): void { window.location.href = this.reportUrl + 'report-template?template-id=' + this.selectedTemplate; } + + changeTemplateSelection(): void { + this.qbStatus = QBStatus.EMPTY; + } } diff --git a/src/i18n/messages.en.xlf b/src/i18n/messages.en.xlf index d80b02d..c036f82 100644 --- a/src/i18n/messages.en.xlf +++ b/src/i18n/messages.en.xlf @@ -586,6 +586,15 @@ link + + + src/app/embedded/quality-report/quality-report.component.ts:237 + + + Eigenes Template + custom template + + src/app/embedded/uploads/uploads.component.html:5 diff --git a/src/i18n/messages.xlf b/src/i18n/messages.xlf index 2a68cbf..83a62ba 100644 --- a/src/i18n/messages.xlf +++ b/src/i18n/messages.xlf @@ -520,6 +520,14 @@ Link + + + src/app/embedded/quality-report/quality-report.component.ts:237 + + + Eigenes Template + + src/app/embedded/uploads/uploads.component.html:5