From 7c7d567b5809e150b29c51d3a16318bc1407ed55 Mon Sep 17 00:00:00 2001 From: tpikna Date: Sun, 7 Jun 2026 07:46:24 +0200 Subject: [PATCH] pokus o opravu loadingu --- main_web/src/app/store/service-status.state.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main_web/src/app/store/service-status.state.ts b/main_web/src/app/store/service-status.state.ts index 2a019fd..01c2abe 100644 --- a/main_web/src/app/store/service-status.state.ts +++ b/main_web/src/app/store/service-status.state.ts @@ -64,13 +64,23 @@ export class ServiceStatusState { @Action(CheckAllServicesStatus) checkServicesStatus(ctx: StateContext) { - ctx.patchState({ loading: true }); const config = ctx.getState().config; if (!config || !Array.isArray(config)) { ctx.patchState({ services: [], loading: false }); return; } + + const currentServices = ctx.getState().services; + const initialServices = config.map((service: Service) => { + const existing = currentServices.find(s => s.name === service.name); + return existing + ? { ...existing, status: 'loading' } + : { ...service, status: 'loading' }; + }); + + ctx.patchState({ services: initialServices, loading: true }); + const statusObservables = config.map((service: Service) => this.checkServiceStatus.checkStatus(service.name, service.url, service.headers).pipe( map((status: Status) => ({ ...service, status, lastChecked: Date.now() }))