pokus o opravu loadingu

This commit is contained in:
tpikna
2026-06-07 07:46:24 +02:00
parent e84f9f09e7
commit 7c7d567b58
+11 -1
View File
@@ -64,13 +64,23 @@ export class ServiceStatusState {
@Action(CheckAllServicesStatus)
checkServicesStatus(ctx: StateContext<ServiceStatusModel>) {
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() }))