From 96e8abe5bb2e32bbd59963e0e30d6880add8ca91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=CC=88rkan=20Gu=CC=88ran?= Date: Tue, 6 Sep 2022 19:34:03 +0200 Subject: [PATCH] Initialize descriptors on refresh page --- .../src/modules/login/plugin.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/designer/elsa-workflows-designer/src/modules/login/plugin.tsx b/src/designer/elsa-workflows-designer/src/modules/login/plugin.tsx index 0ece07ce4..3cffa4968 100644 --- a/src/designer/elsa-workflows-designer/src/modules/login/plugin.tsx +++ b/src/designer/elsa-workflows-designer/src/modules/login/plugin.tsx @@ -3,12 +3,14 @@ import {h} from "@stencil/core"; import {Service as MiddlewareService} from 'axios-middleware'; import {EventTypes, Plugin} from "../../models"; import {Container, Service} from "typedi"; -import {StudioService, AuthContext, EventBus} from "../../services"; +import {StudioService, AuthContext, EventBus, ElsaClient, ElsaApiClientProvider} from "../../services"; +import descriptorsStore from '../../data/descriptors-store'; @Service() export class LoginPlugin implements Plugin { private readonly eventBus: EventBus; private readonly studioService: StudioService; + private elsaClient: ElsaClient; constructor() { this.eventBus = Container.get(EventBus); @@ -22,6 +24,16 @@ export class LoginPlugin implements Plugin { if (!authContext.getIsSignedIn()) { this.studioService.show(() => ); } + else { + const elsaClientProvider = Container.get(ElsaApiClientProvider); + this.elsaClient = await elsaClientProvider.getElsaClient(); + + const activityDescriptors = await this.elsaClient.descriptors.activities.list(); + const storageDrivers = await this.elsaClient.descriptors.storageDrivers.list(); + + descriptorsStore.activityDescriptors = activityDescriptors; + descriptorsStore.storageDrivers = storageDrivers; + } } private onHttpClientCreated = async (e) => {