From 40ac93ead9409d3349c59c3079033daad17c0edc Mon Sep 17 00:00:00 2001 From: Loris Sauter Date: Sun, 2 Jun 2024 08:15:24 +0200 Subject: [PATCH 1/3] Prepared next version cycle --- backend/src/main/kotlin/dev/dres/DRES.kt | 2 +- doc/oas-client.json | 4 ++-- doc/oas.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/main/kotlin/dev/dres/DRES.kt b/backend/src/main/kotlin/dev/dres/DRES.kt index 6cbfa0f5..6b7d237d 100644 --- a/backend/src/main/kotlin/dev/dres/DRES.kt +++ b/backend/src/main/kotlin/dev/dres/DRES.kt @@ -42,7 +42,7 @@ import kotlin.system.exitProcess */ object DRES { /** Version of DRES. */ - const val VERSION = "2.0.3" + const val VERSION = "2.0.4-SNAPSHOT" /** Application root; should be relative to JAR file or classes path. */ val APPLICATION_ROOT: Path = diff --git a/doc/oas-client.json b/doc/oas-client.json index 80dfdbe2..bd961af6 100644 --- a/doc/oas-client.json +++ b/doc/oas-client.json @@ -2,8 +2,8 @@ "openapi" : "3.0.3", "info" : { "title" : "DRES Client API", - "version" : "2.0.3", - "description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.3" + "version" : "2.0.4-SNAPSHOT", + "description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.4-SNAPSHOT" }, "paths" : { "/api/v2/client/evaluation/currentTask/{evaluationId}" : { diff --git a/doc/oas.json b/doc/oas.json index c7394462..8533e270 100644 --- a/doc/oas.json +++ b/doc/oas.json @@ -2,8 +2,8 @@ "openapi" : "3.0.3", "info" : { "title" : "DRES API", - "version" : "2.0.3", - "description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.3", + "version" : "2.0.4-SNAPSHOT", + "description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.4-SNAPSHOT", "contact" : { "name" : "The DRES Dev Team", "url" : "https://dres.dev" From d48e1e0660140f19d8606625e01f0faf30d853e3 Mon Sep 17 00:00:00 2001 From: Loris Sauter Date: Mon, 3 Jun 2024 17:14:11 +0200 Subject: [PATCH 2/3] Added sort-by-name to template builder / team table --- .../teams-list/teams-list.component.html | 7 +++- .../teams-list/teams-list.component.ts | 37 +++++++++++-------- .../template-builder-components.module.ts | 4 +- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.html b/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.html index bf5fba7b..167805d6 100644 --- a/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.html +++ b/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.html @@ -9,7 +9,10 @@

Teams

Add team - +
+ diff --git a/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts b/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts index c5ae9586..d6467891 100644 --- a/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts +++ b/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts @@ -1,8 +1,8 @@ -import { Component, OnDestroy, OnInit, ViewChild } from "@angular/core"; +import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from "@angular/core"; import { AbstractTemplateBuilderComponent } from "../abstract-template-builder.component"; import { ApiTeam, TemplateService, UserService } from "../../../../../../openapi"; -import { MatTable } from "@angular/material/table"; -import { Observable } from "rxjs"; +import { MatTable, MatTableDataSource } from "@angular/material/table"; +import { Observable, Subscription } from "rxjs"; import { TemplateBuilderService } from "../../template-builder.service"; import { MatDialog } from "@angular/material/dialog"; import { AppConfig } from "../../../../app.config"; @@ -10,20 +10,25 @@ import { filter, map, tap } from "rxjs/operators"; import { TeamBuilderDialogComponent } from "../team-builder-dialog/team-builder-dialog.component"; import { ActivatedRoute } from "@angular/router"; import { MatSnackBar } from "@angular/material/snack-bar"; +import { MatSort } from "@angular/material/sort"; @Component({ selector: 'app-teams-list', templateUrl: './teams-list.component.html', styleUrls: ['./teams-list.component.scss'] }) -export class TeamsListComponent extends AbstractTemplateBuilderComponent implements OnInit, OnDestroy { +export class TeamsListComponent extends AbstractTemplateBuilderComponent implements OnInit, OnDestroy, AfterViewInit { displayedColumns = ['logo', 'name', 'action']; + dataSource: MatTableDataSource + @ViewChild('teamTable') teamTable: MatTable; + @ViewChild(MatSort) sort: MatSort; + + private updateSub: Subscription; - teams: Observable = new Observable((o) => o.next([])); constructor( builderService: TemplateBuilderService, route: ActivatedRoute, @@ -34,27 +39,29 @@ export class TeamsListComponent extends AbstractTemplateBuilderComponent impleme private config: AppConfig ) { super(builderService, route, templateService, snackBar); + this.dataSource = new MatTableDataSource() } ngOnInit(): void { this.onInit(); } + ngAfterViewInit() { + this.dataSource.sort = this.sort; + } + onChange() { - this.teams = this.builderService.templateAsObservable().pipe( - map((t) => { - if (t) { - return t.teams; - } else { - return []; - } - }), - tap(_ => this.teamTable?.renderRows()) - ); + this.updateSub = this.builderService.templateAsObservable().subscribe(t => { + if(t){ + this.dataSource.data = t.teams; + this.teamTable?.renderRows(); + } + }) } ngOnDestroy() { this.onDestroy(); + this.updateSub.unsubscribe(); } /** diff --git a/frontend/src/app/template/template-builder/components/template-builder-components.module.ts b/frontend/src/app/template/template-builder/components/template-builder-components.module.ts index 7145ab40..48b14156 100644 --- a/frontend/src/app/template/template-builder/components/template-builder-components.module.ts +++ b/frontend/src/app/template/template-builder/components/template-builder-components.module.ts @@ -52,6 +52,7 @@ import { ViewersListComponent } from './viewers-list/viewers-list.component'; import { UserListFilterPipe } from './team-builder-dialog/user-list-filter.pipe'; import { UserListInOtherFilterPipe } from './team-builder-dialog/user-list-in-other-filter.pipe'; import { BatchAddTargetDialogComponent } from './batch-add-target-dialog/batch-add-target-dialog.component'; +import { MatSortModule } from "@angular/material/sort"; @NgModule({ @@ -100,7 +101,8 @@ import { BatchAddTargetDialogComponent } from './batch-add-target-dialog/batch-a ColorPickerModule, CdkDropList, CdkDrag, - MatCardModule + MatCardModule, + MatSortModule ], exports: [TemplateInformationComponent, JudgesListComponent, From f88f06d4b42130c6b698b0aa09bb5c7f9b1acaa0 Mon Sep 17 00:00:00 2001 From: Loris Sauter Date: Mon, 3 Jun 2024 17:49:01 +0200 Subject: [PATCH 3/3] Teams in viewer are sorted by name now --- backend/src/main/kotlin/dev/dres/DRES.kt | 2 +- doc/oas-client.json | 4 ++-- doc/oas.json | 4 ++-- .../components/teams-list/teams-list.component.ts | 12 +++++++++--- frontend/src/app/viewer/teams-viewer.component.html | 2 +- frontend/src/app/viewer/teams-viewer.component.ts | 13 ++++++++++--- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/backend/src/main/kotlin/dev/dres/DRES.kt b/backend/src/main/kotlin/dev/dres/DRES.kt index 6b7d237d..e488bfb8 100644 --- a/backend/src/main/kotlin/dev/dres/DRES.kt +++ b/backend/src/main/kotlin/dev/dres/DRES.kt @@ -42,7 +42,7 @@ import kotlin.system.exitProcess */ object DRES { /** Version of DRES. */ - const val VERSION = "2.0.4-SNAPSHOT" + const val VERSION = "2.0.4" /** Application root; should be relative to JAR file or classes path. */ val APPLICATION_ROOT: Path = diff --git a/doc/oas-client.json b/doc/oas-client.json index bd961af6..f62c5622 100644 --- a/doc/oas-client.json +++ b/doc/oas-client.json @@ -2,8 +2,8 @@ "openapi" : "3.0.3", "info" : { "title" : "DRES Client API", - "version" : "2.0.4-SNAPSHOT", - "description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.4-SNAPSHOT" + "version" : "2.0.4", + "description" : "Client API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.4" }, "paths" : { "/api/v2/client/evaluation/currentTask/{evaluationId}" : { diff --git a/doc/oas.json b/doc/oas.json index 8533e270..f35b8b4a 100644 --- a/doc/oas.json +++ b/doc/oas.json @@ -2,8 +2,8 @@ "openapi" : "3.0.3", "info" : { "title" : "DRES API", - "version" : "2.0.4-SNAPSHOT", - "description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.4-SNAPSHOT", + "version" : "2.0.4", + "description" : "API for DRES (Distributed Retrieval Evaluation Server), Version 2.0.4", "contact" : { "name" : "The DRES Dev Team", "url" : "https://dres.dev" diff --git a/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts b/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts index d6467891..bc0dbb8b 100644 --- a/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts +++ b/frontend/src/app/template/template-builder/components/teams-list/teams-list.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, OnDestroy, OnInit, ViewChild } from "@angular/core"; +import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from "@angular/core"; import { AbstractTemplateBuilderComponent } from "../abstract-template-builder.component"; import { ApiTeam, TemplateService, UserService } from "../../../../../../openapi"; import { MatTable, MatTableDataSource } from "@angular/material/table"; @@ -28,6 +28,7 @@ export class TeamsListComponent extends AbstractTemplateBuilderComponent impleme @ViewChild(MatSort) sort: MatSort; private updateSub: Subscription; + private afterInitComplete = false; constructor( builderService: TemplateBuilderService, @@ -36,7 +37,8 @@ export class TeamsListComponent extends AbstractTemplateBuilderComponent impleme snackBar: MatSnackBar, private userService: UserService, private dialog: MatDialog, - private config: AppConfig + private config: AppConfig, + private elementRef: ElementRef ) { super(builderService, route, templateService, snackBar); this.dataSource = new MatTableDataSource() @@ -48,13 +50,17 @@ export class TeamsListComponent extends AbstractTemplateBuilderComponent impleme ngAfterViewInit() { this.dataSource.sort = this.sort; + this.afterInitComplete = true; } onChange() { this.updateSub = this.builderService.templateAsObservable().subscribe(t => { if(t){ this.dataSource.data = t.teams; - this.teamTable?.renderRows(); + /* The elementRef.nativeElement.offsetParent checks if this component is visible */ + if(this.afterInitComplete && this.elementRef.nativeElement.offsetParent){ + this.teamTable?.renderRows(); + } } }) } diff --git a/frontend/src/app/viewer/teams-viewer.component.html b/frontend/src/app/viewer/teams-viewer.component.html index 81c9d154..6e89ba60 100644 --- a/frontend/src/app/viewer/teams-viewer.component.html +++ b/frontend/src/app/viewer/teams-viewer.component.html @@ -2,7 +2,7 @@
{ + return team1.name.localeCompare(team2.name) + } + /** * Returns an observable for the {@link ApiSubmission} for the given team. *
Logo @@ -20,7 +23,7 @@

Teams

-
NameName {{ team.name }}