diff --git a/src/app/components/experiment-timeline/experiment-timeline.component.html b/src/app/components/experiment-timeline/experiment-timeline.component.html index b0990a2..29f24bd 100644 --- a/src/app/components/experiment-timeline/experiment-timeline.component.html +++ b/src/app/components/experiment-timeline/experiment-timeline.component.html @@ -53,6 +53,16 @@

Experiment Timeline

[value]="unclearedSubstepValue.value">{{unclearedSubstepValue.viewValue}} +
+ + Result quality + + Not Selected + {{resultQualityValue.charAt(0).toUpperCase() + resultQualityValue.slice(1).toLowerCase()}} + + +
diff --git a/src/app/components/experiment-timeline/experiment-timeline.component.ts b/src/app/components/experiment-timeline/experiment-timeline.component.ts index ee92ff9..ed88c77 100644 --- a/src/app/components/experiment-timeline/experiment-timeline.component.ts +++ b/src/app/components/experiment-timeline/experiment-timeline.component.ts @@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'; import { Observable, Subscription, of } from 'rxjs'; import { catchError, map } from 'rxjs/operators'; import { CurrentExperimentService } from 'src/app/services/current-experiment.service'; -import { QhanaBackendService, TimelineStepApiObject } from 'src/app/services/qhana-backend.service'; +import { ExperimentResultQuality, ExperimentResultQualityValues, QhanaBackendService, TimelineStepApiObject } from 'src/app/services/qhana-backend.service'; import { ServiceRegistryService } from 'src/app/services/service-registry.service'; interface SelectValue { @@ -50,6 +50,8 @@ export class ExperimentTimelineComponent implements OnInit, OnDestroy { { value: 1, viewValue: "Only steps with uncleared substeps" }, { value: -1, viewValue: "Only steps with cleared substeps" } ]; + resultQuality: ExperimentResultQuality | "" = ""; + resultQualityValues = ExperimentResultQualityValues; constructor(private route: ActivatedRoute, private experiment: CurrentExperimentService, private backend: QhanaBackendService, private serviceRegistry: ServiceRegistryService) { } @@ -99,6 +101,7 @@ export class ExperimentTimelineComponent implements OnInit, OnDestroy { version: this.version ?? "", stepStatus: this.stepStatus, unclearedSubstep: this.unclearedSubstep, + resultQuality: this.resultQuality, }).pipe( map(value => { if (this.currentPage !== currentRequest) { diff --git a/src/app/components/timeline-step/timeline-step.component.ts b/src/app/components/timeline-step/timeline-step.component.ts index 27f5336..b2a7e40 100644 --- a/src/app/components/timeline-step/timeline-step.component.ts +++ b/src/app/components/timeline-step/timeline-step.component.ts @@ -4,7 +4,7 @@ import { BehaviorSubject, Observable, Subject, Subscription, from, of, timer } f import { catchError, concatMap, debounceTime, filter, mergeAll, mergeMap, take, throttleTime } from 'rxjs/operators'; import { ApiLink, CollectionApiObject, PageApiObject } from 'src/app/services/api-data-types'; import { CurrentExperimentService } from 'src/app/services/current-experiment.service'; -import { QhanaBackendService, TimelineStepApiObject, TimelineSubStepApiObject } from 'src/app/services/qhana-backend.service'; +import { ExperimentResultQuality, QhanaBackendService, TimelineStepApiObject, TimelineSubStepApiObject } from 'src/app/services/qhana-backend.service'; import { PluginRegistryBaseService } from 'src/app/services/registry.service'; import { TabDefinition } from '../timeline-step-nav/timeline-step-nav.component'; @@ -46,7 +46,7 @@ export class TimelineStepComponent implements OnInit, OnDestroy { ]; timelineStep: TimelineStepApiObject | null = null; - resultQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE" = "UNKNOWN"; + resultQuality: ExperimentResultQuality = "UNKNOWN"; stepProcessor: Promise | null = null; stepProgress: Progress | null = null; substeps: TimelineSubStepApiObject[] | null = null; @@ -248,7 +248,7 @@ export class TimelineStepComponent implements OnInit, OnDestroy { }); } - saveResultQuality(newQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE") { + saveResultQuality(newQuality: ExperimentResultQuality) { if (this.stepId == null) { return; } diff --git a/src/app/services/qhana-backend.service.ts b/src/app/services/qhana-backend.service.ts index ddfc0bc..1489f02 100644 --- a/src/app/services/qhana-backend.service.ts +++ b/src/app/services/qhana-backend.service.ts @@ -20,6 +20,9 @@ import { Observable, Subject } from 'rxjs'; import { filter, map, mergeMap, take } from 'rxjs/operators'; import { ServiceRegistryService } from './service-registry.service'; +export const ExperimentResultQualityValues = ["UNKNOWN", "NEUTRAL", "GOOD", "BAD", "ERROR", "UNUSABLE"] as const; +export type ExperimentResultQuality = typeof ExperimentResultQualityValues[number]; + export interface ApiObject { "@self": string; } @@ -142,7 +145,7 @@ export interface TimelineStepApiObject extends ApiObject { start: string; end: string; status: string; - resultQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE"; + resultQuality: ExperimentResultQuality; resultLog?: string; notes: string; processorName: string; @@ -175,6 +178,7 @@ export interface TimelineStepPageOptions { version?: string; stepStatus?: "SUCCESS" | "PENDING" | "ERROR" | ""; unclearedSubstep?: number; + resultQuality?: ExperimentResultQuality | ""; } export interface TemplateApiObject extends ApiObject { @@ -446,12 +450,13 @@ export class QhanaBackendService { ); } - public getTimelineStepsPage(experimentId: number | string, { page = 0, itemCount = 10, sort = 1, pluginName = "", version = "", stepStatus = "", unclearedSubstep = 0 }: TimelineStepPageOptions): Observable> { + public getTimelineStepsPage(experimentId: number | string, { page = 0, itemCount = 10, sort = 1, pluginName = "", version = "", stepStatus = "", unclearedSubstep = 0, resultQuality = "", }: TimelineStepPageOptions): Observable> { const queryParams = new HttpParams() .append("plugin-name", pluginName) .append("version", version) .append("status", stepStatus) .append("uncleared-substep", unclearedSubstep) + .append("result-quality", resultQuality) .append("page", page) .append("item-count", itemCount) .append("sort", sort); @@ -486,7 +491,7 @@ export class QhanaBackendService { ); } - public saveTimelineStepResultQuality(experimentId: number | string, step: number | string, newQuality: "UNKNOWN" | "NEUTRAL" | "GOOD" | "BAD" | "ERROR" | "UNUSABLE"): Observable { + public saveTimelineStepResultQuality(experimentId: number | string, step: number | string, newQuality: ExperimentResultQuality): Observable { return this.callWithRootUrl( rootUrl => this.http.put(`${rootUrl}/experiments/${experimentId}/timeline/${step}`, { resultQuality: newQuality }) );