From 6c60664adaffcc1deafbc4dc1e42a03175c5d39c Mon Sep 17 00:00:00 2001 From: StephGit <24672636+StephGit@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:04:56 +0100 Subject: [PATCH] fix: small issues on apps-page (#810) --- .../app/apps/apps-list/apps-list.component.html | 2 +- .../apps-servers-list.component.html | 2 ++ .../apps-servers-list.component.scss | 5 +++++ AMW_angular/io/src/app/apps/apps.component.html | 2 +- AMW_angular/io/src/app/apps/apps.component.ts | 14 +++++++------- AMW_angular/io/src/app/apps/apps.service.ts | 6 +++++- .../applist/ApplistScreenDomainServiceQueries.java | 2 +- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/AMW_angular/io/src/app/apps/apps-list/apps-list.component.html b/AMW_angular/io/src/app/apps/apps-list/apps-list.component.html index 25527fb3d..e75302fe3 100644 --- a/AMW_angular/io/src/app/apps/apps-list/apps-list.component.html +++ b/AMW_angular/io/src/app/apps/apps-list/apps-list.component.html @@ -7,7 +7,7 @@ {{ app.name }} - {{ app.release.name }} + {{ app.release.name }} } diff --git a/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.html b/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.html index 6bcc2effc..e7bbd1e9e 100644 --- a/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.html +++ b/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.html @@ -33,5 +33,7 @@ } } + } @else { +
No results found in database
} diff --git a/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.scss b/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.scss index d6d827123..6d505a116 100644 --- a/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.scss +++ b/AMW_angular/io/src/app/apps/apps-servers-list/apps-servers-list.component.scss @@ -4,3 +4,8 @@ table .w-10 { table .w-90 { width: 90%; } + +.empty-container { + padding: 1em; + text-align: center; +} diff --git a/AMW_angular/io/src/app/apps/apps.component.html b/AMW_angular/io/src/app/apps/apps.component.html index 0ad67b683..c5b821a3f 100644 --- a/AMW_angular/io/src/app/apps/apps.component.html +++ b/AMW_angular/io/src/app/apps/apps.component.html @@ -1,4 +1,4 @@ - +
Apps
diff --git a/AMW_angular/io/src/app/apps/apps.component.ts b/AMW_angular/io/src/app/apps/apps.component.ts index 831686b3c..88dc877a1 100644 --- a/AMW_angular/io/src/app/apps/apps.component.ts +++ b/AMW_angular/io/src/app/apps/apps.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, computed, inject, OnDestroy, OnInit, Signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, computed, inject, OnDestroy, OnInit, signal, Signal } from '@angular/core'; import { BehaviorSubject, skip, Subject, take } from 'rxjs'; import { LoadingIndicatorComponent } from '../shared/elements/loading-indicator.component'; import { AsyncPipe } from '@angular/common'; @@ -22,7 +22,6 @@ import { ResourceService } from '../resource/resource.service'; import { Resource } from '../resource/resource'; import { AppCreate } from './app-create'; import { ButtonComponent } from '../shared/button/button.component'; -import { offset } from '@popperjs/core'; @Component({ selector: 'app-apps', @@ -63,7 +62,10 @@ export class AppsComponent implements OnInit, OnDestroy { private error$ = new BehaviorSubject(''); private destroy$ = new Subject(); - isLoading = false; + showLoader = signal(false); + isLoading = computed(() => { + return this.appServers() === undefined || this.showLoader(); + }); permissions = computed(() => { if (this.authService.restrictions().length > 0) { @@ -111,7 +113,7 @@ export class AppsComponent implements OnInit, OnDestroy { } saveAppServer(appServer: AppServer) { - this.isLoading = true; + this.showLoader.set(true); this.appsService .createAppServer(appServer) .pipe(takeUntil(this.destroy$)) @@ -124,13 +126,12 @@ export class AppsComponent implements OnInit, OnDestroy { }, complete: () => { this.appsService.refreshData(); - this.isLoading = false; }, }); } saveApp(app: AppCreate) { - this.isLoading = true; + this.showLoader.set(true); this.appsService .createApp(app) .pipe(takeUntil(this.destroy$)) @@ -139,7 +140,6 @@ export class AppsComponent implements OnInit, OnDestroy { error: (e) => this.error$.next(e.toString()), complete: () => { this.appsService.refreshData(); - this.isLoading = false; }, }); } diff --git a/AMW_angular/io/src/app/apps/apps.service.ts b/AMW_angular/io/src/app/apps/apps.service.ts index 28d72b57e..7dd56ba18 100644 --- a/AMW_angular/io/src/app/apps/apps.service.ts +++ b/AMW_angular/io/src/app/apps/apps.service.ts @@ -58,7 +58,11 @@ export class AppsService extends BaseService { .pipe(catchError(this.handleError)) .pipe( map((response: HttpResponse) => { - this.count.set(Number(response.headers.get('x-total-count'))); + if (response.body.length <= 0) { + this.count.set(0); + } else { + this.count.set(Number(response.headers.get('x-total-count'))); + } return response.body; }), ); diff --git a/AMW_business/src/main/java/ch/puzzle/itc/mobiliar/business/domain/applist/ApplistScreenDomainServiceQueries.java b/AMW_business/src/main/java/ch/puzzle/itc/mobiliar/business/domain/applist/ApplistScreenDomainServiceQueries.java index 8575287c3..86131e678 100644 --- a/AMW_business/src/main/java/ch/puzzle/itc/mobiliar/business/domain/applist/ApplistScreenDomainServiceQueries.java +++ b/AMW_business/src/main/java/ch/puzzle/itc/mobiliar/business/domain/applist/ApplistScreenDomainServiceQueries.java @@ -91,7 +91,7 @@ Tuple, Long> getAppServersWithApps(Integer startIndex, Inte if (maxResult != null) { query.setMaxResults(maxResult); - } + } return new Tuple<>(query.getResultList(), totalCount); }