100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Event service updates and UI component event service WIP
Rich Turner6c4914eab3aa
diff --git a/client/src/main/java/org/openremote/app/client/event/EventServiceImpl.java b/client/src/main/java/org/openremote/app/client/event/EventServiceImpl.javaindex 5131171fd..ff84a164a 100644--- a/client/src/main/java/org/openremote/app/client/event/EventServiceImpl.java+++ b/client/src/main/java/org/openremote/app/client/event/EventServiceImpl.java@@ -68,7 +68,7 @@ public class EventServiceImpl implements EventService {public <E extends SharedEvent> void subscribe(Class<E> eventClass, EventFilter<E> filter) {EventSubscription<E> subscription = new EventSubscription<>(eventClass, filter);final String key = subscription.getEventType();- final String data = EventSubscription.MESSAGE_PREFIX + eventSubscriptionMapper.write(subscription);+ final String data = EventSubscription.SUBSCRIBE_MESSAGE_PREFIX + eventSubscriptionMapper.write(subscription);if (activeSubscriptions.containsKey(key)) {DomGlobal.clearInterval(activeSubscriptions.get(key));diff --git a/client/src/main/webapp/src/or-app/or-app-events.html b/client/src/main/webapp/src/or-app/or-app-events.htmlindex d207fd3b5..23e2a412f 100644--- a/client/src/main/webapp/src/or-app/or-app-events.html+++ b/client/src/main/webapp/src/or-app/or-app-events.html@@ -51,7 +51,7 @@if (subscription.eventType in this.activeSubscriptions) {clearInterval(this.activeSubscriptions[subscription.eventType]);}- let message = "SUBSCRIBE" + JSON.stringify(subscription);+ let message = "SUBSCRIBE:" + JSON.stringify(subscription);openremote.INSTANCE.sendServiceMessage(message);let interval = setInterval(() => openremote.INSTANCE.sendServiceMessage(message), this.renewalPeriodSeconds / 2 * 1000@@ -62,7 +62,7 @@unsubscribe(eventType) {if (eventType in this.activeSubscriptions) {clearInterval(this.activeSubscriptions[eventType]);- let message = "UNSUBSCRIBE" + JSON.stringify({eventType: eventType});+ let message = "UNSUBSCRIBE:" + JSON.stringify({eventType: eventType});openremote.INSTANCE.sendServiceMessage(message);delete this.activeSubscriptions[eventType];this.notifyPath("activeSubscriptions." + eventType);diff --git a/manager/src/main/java/org/openremote/manager/event/ClientEventService.java b/manager/src/main/java/org/openremote/manager/event/ClientEventService.javaindex fe64741dd..650e44060 100644--- a/manager/src/main/java/org/openremote/manager/event/ClientEventService.java+++ b/manager/src/main/java/org/openremote/manager/event/ClientEventService.java@@ -38,7 +38,6 @@ import org.openremote.model.event.shared.UnauthorizedEventSubscription;import org.openremote.model.syslog.SyslogEvent;import java.util.Collection;-import java.util.Collections;import java.util.concurrent.CopyOnWriteArraySet;import java.util.logging.Logger;@@ -155,7 +154,7 @@ public class ClientEventService implements ContainerService {.stop().end().choice()- .when(bodyAs(String.class).startsWith(EventSubscription.MESSAGE_PREFIX))+ .when(bodyAs(String.class).startsWith(EventSubscription.SUBSCRIBE_MESSAGE_PREFIX)).convertBodyTo(EventSubscription.class).process(exchange -> {String sessionKey = getSessionKey(exchange);diff --git a/manager/src/main/java/org/openremote/manager/event/EventTypeConverters.java b/manager/src/main/java/org/openremote/manager/event/EventTypeConverters.javaindex b1c63f2f2..4218ef485 100644--- a/manager/src/main/java/org/openremote/manager/event/EventTypeConverters.java+++ b/manager/src/main/java/org/openremote/manager/event/EventTypeConverters.java@@ -74,9 +74,9 @@ public class EventTypeConverters implements TypeConverters {@Converterpublic EventSubscription readEventSubscription(String string, Exchange exchange) throws Exception {- if (!string.startsWith(EventSubscription.MESSAGE_PREFIX))+ if (!string.startsWith(EventSubscription.SUBSCRIBE_MESSAGE_PREFIX))return null;- string = string.substring(EventSubscription.MESSAGE_PREFIX.length());+ string = string.substring(EventSubscription.SUBSCRIBE_MESSAGE_PREFIX.length());return Container.JSON.readValue(string, EventSubscription.class);}diff --git a/model/src/main/java/org/openremote/model/event/shared/CancelEventSubscription.java b/model/src/main/java/org/openremote/model/event/shared/CancelEventSubscription.javaindex 860963e6a..5f1e5c8fb 100644--- a/model/src/main/java/org/openremote/model/event/shared/CancelEventSubscription.java+++ b/model/src/main/java/org/openremote/model/event/shared/CancelEventSubscription.java@@ -25,15 +25,22 @@ import org.openremote.model.event.Event;* A client can unsubscribe from {@link SharedEvent}s on the server, providing the* type of event it doesn't want to receive anymore*/+// TODO: Remove eventType once manager updated to use new UI componentspublic class CancelEventSubscription<E extends SharedEvent> {- public static final String MESSAGE_PREFIX = "UNSUBSCRIBE";+ public static final String MESSAGE_PREFIX = "UNSUBSCRIBE:";protected String eventType;+ protected Long subscriptionId;+protected CancelEventSubscription() {}+ public CancelEventSubscription(Long subscriptionId) {+ this.subscriptionId = subscriptionId;+ }+public CancelEventSubscription(String eventType) {this.eventType = eventType;}@@ -50,10 +57,19 @@ public class CancelEventSubscription<E extends SharedEvent> {this.eventType = eventType;}+ public Long getSubscriptionId() {+ return subscriptionId;+ }++ public void setSubscriptionId(Long subscriptionId) {+ this.subscriptionId = subscriptionId;+ }+@Overridepublic String toString() {return getClass().getSimpleName() + "{" +"eventType='" + eventType + '\'' ++ "subscriptionId=" + subscriptionId +'}';}}diff --git a/model/src/main/java/org/openremote/model/event/shared/EventSubscription.java b/model/src/main/java/org/openremote/model/event/shared/EventSubscription.javaindex 87e3aafa8..7de3a690f 100644--- a/model/src/main/java/org/openremote/model/event/shared/EventSubscription.java+++ b/model/src/main/java/org/openremote/model/event/shared/EventSubscription.java@@ -33,7 +33,8 @@ import java.util.function.Consumer;*/public class EventSubscription<E extends SharedEvent> {- public static final String MESSAGE_PREFIX = "SUBSCRIBE";+ public static final String SUBSCRIBE_MESSAGE_PREFIX = "SUBSCRIBE:";+ public static final String SUBSCRIBED_MESSAGE_PREFIX = "SUBSCRIBED:";public static final int RENEWAL_PERIOD_SECONDS = 300;protected String eventType;diff --git a/model/src/main/java/org/openremote/model/event/shared/SharedEvent.java b/model/src/main/java/org/openremote/model/event/shared/SharedEvent.javaindex fc4db9cf8..da5ea39f4 100644--- a/model/src/main/java/org/openremote/model/event/shared/SharedEvent.java+++ b/model/src/main/java/org/openremote/model/event/shared/SharedEvent.java@@ -64,7 +64,7 @@ import org.openremote.model.syslog.SyslogEvent;)public abstract class SharedEvent extends Event {- public static final String MESSAGE_PREFIX = "EVENT";+ public static final String MESSAGE_PREFIX = "EVENT:";public SharedEvent(long timestamp) {super(timestamp);diff --git a/model/src/main/java/org/openremote/model/event/shared/UnauthorizedEventSubscription.java b/model/src/main/java/org/openremote/model/event/shared/UnauthorizedEventSubscription.javaindex d9c9842bd..abd95bee6 100644--- a/model/src/main/java/org/openremote/model/event/shared/UnauthorizedEventSubscription.java+++ b/model/src/main/java/org/openremote/model/event/shared/UnauthorizedEventSubscription.java@@ -30,7 +30,7 @@ import org.openremote.model.event.Event;*/public class UnauthorizedEventSubscription<E extends SharedEvent> {- public static final String MESSAGE_PREFIX = "UNAUTHORIZED";+ public static final String MESSAGE_PREFIX = "UNAUTHORIZED:";protected String eventType;diff --git a/test/src/main/groovy/org/openremote/test/ClientEventService.groovy b/test/src/main/groovy/org/openremote/test/ClientEventService.groovyindex 101121031..6a8e507ce 100644--- a/test/src/main/groovy/org/openremote/test/ClientEventService.groovy+++ b/test/src/main/groovy/org/openremote/test/ClientEventService.groovy@@ -89,7 +89,7 @@ class ClientEventService implements EventService {void sendSubscription(EventSubscription subscription) {if (session == null || !session.isOpen())throw new IllegalStateException("Session not open")- final String data = EventSubscription.MESSAGE_PREFIX + objectMapper.writeValueAsString(subscription)+ final String data = EventSubscription.SUBSCRIBE_MESSAGE_PREFIX + objectMapper.writeValueAsString(subscription)session.basicRemote.sendText(data)}diff --git a/ui/component/core/src/console.ts b/ui/component/core/src/console.tsindex 70a605ed1..ae093ae64 100644--- a/ui/component/core/src/console.ts+++ b/ui/component/core/src/console.ts@@ -372,7 +372,8 @@ export class Console {provider: "push",version: "web",enabled: true,- requiresPermission: false+ requiresPermission: false,+ success: true}));break;case "PROVIDER_ENABLE":@@ -398,7 +399,8 @@ export class Console {provider: "storage",version: "1.0.0",enabled: true,- requiresPermission: false+ requiresPermission: false,+ success: true}));break;case "PROVIDER_ENABLE":diff --git a/ui/component/core/src/event.ts b/ui/component/core/src/event.tsnew file mode 100644index 000000000..54dfaaaa2--- /dev/null+++ b/ui/component/core/src/event.ts@@ -0,0 +1,396 @@+//import rest from "@openremote/rest";+import openremote from "./index";+import {Deferred} from "./util";+import {EventSubscription, SharedEvent} from "@openremote/model";++export enum EventProviderStatus {+ DISCONNECTED = "DISCONNECTED",+ CONNECTED = "CONNECTED",+ CONNECTING = "CONNECTING"+}++export interface EventProvider {+ connect(): Promise<boolean>;++ disconnect(): void;+}++interface EventSubscriptionInfo<T extends SharedEvent> {+ eventSubscription: EventSubscription<T>;+ callback: (event: T) => void;+ deferred: Deferred<number> | null;+}++const SUBSCRIBE_MESSAGE_PREFIX = "SUBSCRIBE:";+const SUBSCRIBED_MESSAGE_PREFIX = "SUBSCRIBED:";+const UNSUBSCRIBE_MESSAGE_PREFIX = "UNSUBSCRIBE:";++abstract class EventProviderImpl implements EventProvider {++ protected static MIN_RECONNECT_DELAY: number = 0;+ protected static MAX_RECONNECT_DELAY: number = 30000;+ protected _disconnectRequested: boolean = false;+ protected _reconnectDelayMillis: number = WebSocketEventProvider.MIN_RECONNECT_DELAY;+ protected _reconnectTimer: number | null = null;+ protected _statusCallback: (status: EventProviderStatus) => void;+ protected _status: EventProviderStatus = EventProviderStatus.DISCONNECTED;+ protected _connectingDeferred: Deferred<boolean> | null = null;++ protected _pendingSubscription: EventSubscriptionInfo<SharedEvent> | null = null;+ protected _queuedSubscriptions: EventSubscriptionInfo<SharedEvent>[] = [];+ protected _subscriptionMap: { [id: number]: EventSubscriptionInfo<SharedEvent> } = {};++ protected abstract _doConnect(): Promise<boolean>;++ protected abstract _doDisconnect(): void;++ protected abstract _doSubscribe<T extends SharedEvent>(subscription: EventSubscription<T>): Promise<number>;++ protected abstract _doUnsubscribe(subscriptionId: number): void;++ abstract get endpointUrl(): string;++ public get status(): EventProviderStatus {+ return this._status;+ }++ protected constructor(statusCallback: (status: EventProviderStatus) => void) {+ this._statusCallback = statusCallback;+ }++ public connect(): Promise<boolean> {+ if (this._status === EventProviderStatus.CONNECTED) {+ return Promise.resolve(true);+ }++ this._disconnectRequested = false;++ if (this._connectingDeferred) {+ return this._connectingDeferred.promise;+ }++ this._onStatusChanged(EventProviderStatus.CONNECTING);++ this._connectingDeferred = new Deferred();++ this._doConnect().then((connected: boolean) => {+ if (this._connectingDeferred) {+ let deferred = this._connectingDeferred;+ this._connectingDeferred = null;++ if (this._reconnectTimer) {+ window.clearTimeout(this._reconnectTimer);+ this._reconnectTimer = null;+ this._reconnectDelayMillis = WebSocketEventProvider.MIN_RECONNECT_DELAY;+ }++ if (connected) {+ console.debug("Connected to event service: " + this.endpointUrl);+ this._onStatusChanged(EventProviderStatus.CONNECTED);++ window.setTimeout(() => {+ this._onConnect();+ }, 0);+ } else {+ console.debug("Failed to connect to event service: " + this.endpointUrl);+ this._onStatusChanged(EventProviderStatus.DISCONNECTED);+ }++ deferred.resolve(connected);+ }+ });++ return this._connectingDeferred.promise;+ }++ public disconnect(): void {+ if (this._disconnectRequested) {+ return;+ }+ this._disconnectRequested = true;++ if (this._reconnectTimer) {+ window.clearTimeout(this._reconnectTimer);+ this._reconnectTimer = null;+ }++ if (this.status === EventProviderStatus.DISCONNECTED) {+ return;+ }++ this._doDisconnect();+ }++ public subscribe<T extends SharedEvent>(eventSubscription: EventSubscription<T>, callback: (event: T) => void): Promise<number> {++ let subscriptionInfo = {+ eventSubscription: eventSubscription,+ callback: callback as ((event: SharedEvent) => void),+ deferred: new Deferred<number>()+ };++ if (this._pendingSubscription != null || this._status !== EventProviderStatus.CONNECTED) {+ this._queuedSubscriptions.push(subscriptionInfo);+ return subscriptionInfo.deferred.promise;+ }++ this._pendingSubscription = subscriptionInfo;++ this._doSubscribe(eventSubscription).then(+ subscriptionId => {+ if (this._pendingSubscription) {+ let subscriptionInfo = this._pendingSubscription;+ this._pendingSubscription = null;++ // Store subscriptionId and callback+ this._subscriptionMap[subscriptionId] = subscriptionInfo;++ this._processNextSubscription();+ let deferred = subscriptionInfo.deferred;+ subscriptionInfo.deferred = null;++ if (deferred) {+ deferred.resolve(subscriptionId);+ }+ }+ },+ reason => {+ if (this._pendingSubscription) {+ let subscriptionInfo = this._pendingSubscription;+ this._pendingSubscription = null;+ this._processNextSubscription();+ let deferred = subscriptionInfo.deferred;+ subscriptionInfo.deferred = null;++ if (deferred) {+ deferred.reject(reason);+ }+ }+ });++ return this._pendingSubscription.deferred!.promise;+ }++ public unsubscribe<T extends SharedEvent>(subscriptionId: number) {++ let callback = this._subscriptionMap[subscriptionId];+ if (callback) {+ delete this._subscriptionMap[subscriptionId];+ this._doUnsubscribe(subscriptionId);+ }+ }++ protected _processNextSubscription() {+ if (this._status != EventProviderStatus.CONNECTED || this._queuedSubscriptions.length === 0) {+ return;+ }++ setTimeout(() => {+ let subscriptionInfo = this._queuedSubscriptions.shift();+ if (subscriptionInfo) {+ this.subscribe(subscriptionInfo.eventSubscription, subscriptionInfo.callback)+ .then(+ (id: number) => {+ let deferred = subscriptionInfo!.deferred;+ subscriptionInfo!.deferred = null;++ if (deferred) {+ deferred.resolve(id);+ }+ }, reason => {+ let deferred = subscriptionInfo!.deferred;+ subscriptionInfo!.deferred = null;++ if (deferred) {+ deferred.reject(reason);+ }+ });+ }+ }, 0);+ }++ private _onStatusChanged(status: EventProviderStatus) {+ if (status === this._status) {+ return;+ }++ console.debug("Event provider status changed: " + status);++ this._status = status;+ window.setTimeout(() => {+ this._statusCallback(status);+ }, 0);+ }++ protected _onMessageReceived(messageId: string, message: any) {+ console.debug("Event provider message received");+ }++ protected _onConnect() {+ console.debug("Event provider connected: " + this.constructor.name);++ if (Object.keys(this._subscriptionMap).length > 0) {+ for (const subscriptionId in this._subscriptionMap) {+ if (this._subscriptionMap.hasOwnProperty(subscriptionId)) {+ this._queuedSubscriptions.unshift(this._subscriptionMap[subscriptionId]);+ }+ }+ this._subscriptionMap = {};+ }++ this._processNextSubscription();+ }++ protected _onError() {+ console.debug("Event provider error");+ // Could have inconsistent state so disconnect and let consumers decide what to do and when to reconnect+ this.disconnect();+ }++ protected _onDisconnect() {+ console.debug("Event provider disconnected");+ this._onStatusChanged(EventProviderStatus.DISCONNECTED);+ if (this._pendingSubscription) {+ this._queuedSubscriptions.unshift(this._pendingSubscription);+ this._pendingSubscription = null;+ }++ this._scheduleReconnect();+ }++ protected _scheduleReconnect() {+ if (this._reconnectTimer) {+ return;+ }++ if (this._disconnectRequested) {+ return;+ }++ console.debug("Event provider scheduling reconnect in " + this._reconnectDelayMillis + "ms");++ this._reconnectTimer = setTimeout(() => {++ if (this._disconnectRequested) {+ return;+ }++ this.connect().then(connected => {+ if (connected) {+ this._reconnectDelayMillis = WebSocketEventProvider.MIN_RECONNECT_DELAY;+ } else {+ this._scheduleReconnect();+ }+ })+ }, this._reconnectDelayMillis);++ if (this._reconnectDelayMillis < WebSocketEventProvider.MAX_RECONNECT_DELAY) {+ this._reconnectDelayMillis = Math.min(WebSocketEventProvider.MAX_RECONNECT_DELAY, this._reconnectDelayMillis + 3000);+ }+ }+}++export class WebSocketEventProvider extends EventProviderImpl {++ private _endpointUrl: string;+ protected _webSocket: WebSocket | undefined = undefined;+ protected _connectDeferred: Deferred<boolean> | null = null;+ protected _subscribeDeferred: Deferred<number> | null = null;++ get endpointUrl(): string {+ return this._endpointUrl;+ }++ constructor(managerUrl: string, statusCallback: (connected: EventProviderStatus) => void) {+ super(statusCallback);++ this._endpointUrl = (managerUrl.startsWith("https:") ? "wss" : "ws") + "://" + managerUrl.substr(managerUrl.indexOf("://") + 3) + "/websocket/events";++ // Close socket on unload/refresh of page+ window.addEventListener("beforeunload", () => {+ this.disconnect();+ });+ }++ protected _doConnect(): Promise<boolean> {+ let authorisedUrl = this._endpointUrl + "?Auth-Realm=" + openremote.config.realm;++ if (openremote.authenticated) {+ authorisedUrl += "&Authorization=" + openremote.getAuthorizationHeader();+ }++ this._webSocket = new WebSocket(authorisedUrl);+ this._connectDeferred = new Deferred();++ this._webSocket!.onopen = () => {+ if (this._connectDeferred) {+ let deferred = this._connectDeferred;+ this._connectDeferred = null;+ deferred.resolve(true);+ }+ };++ this._webSocket!.onerror = () => {+ if (this._connectDeferred) {+ let deferred = this._connectDeferred;+ this._connectDeferred = null;+ deferred.resolve(false);+ } else {+ this._onError();+ }+ };++ this._webSocket!.onclose = () => {+ this._webSocket = undefined;++ if (this._connectDeferred) {+ let deferred = this._connectDeferred;+ this._connectDeferred = null;+ deferred.resolve(false);+ } else {+ this._onDisconnect();+ }+ };++ this._webSocket!.onmessage = (e) => {+ let msg = e.data as string;+ if (msg && msg.startsWith(SUBSCRIBED_MESSAGE_PREFIX)) {+ let jsonStr = msg.substring(SUBSCRIBED_MESSAGE_PREFIX.length);+ let id = JSON.parse(jsonStr) as number;++ if (this._subscribeDeferred) {+ this._subscribeDeferred.resolve(id);+ }+ } else {+ this._onMessageReceived(e.lastEventId, e.data);+ }+ };++ return this._connectDeferred.promise;+ }++ protected _doDisconnect(): void {+ this._webSocket!.close();+ }++ protected _doSubscribe<T extends SharedEvent>(subscription: EventSubscription<T>): Promise<number> {+ if (!this._webSocket) {+ return Promise.reject("Not connected");+ }++ if (this._subscribeDeferred) {+ return Promise.reject("There's already a pending subscription");+ }++ this._subscribeDeferred = new Deferred();+ this._webSocket.send(SUBSCRIBE_MESSAGE_PREFIX + JSON.stringify(subscription));+ return this._subscribeDeferred.promise;+ }++ protected _doUnsubscribe(subscriptionId: number): void {+ if (!this._webSocket) {+ return;+ }+ this._webSocket.send(UNSUBSCRIBE_MESSAGE_PREFIX + JSON.stringify(subscriptionId));+ }+}\ No newline at end of filediff --git a/ui/component/core/src/index.ts b/ui/component/core/src/index.tsindex 3460bcb28..da5a96510 100644--- a/ui/component/core/src/index.ts+++ b/ui/component/core/src/index.ts@@ -2,7 +2,7 @@ import 'url-search-params-polyfill';import {Console} from "./console";import rest from "@openremote/rest";import {AxiosRequestConfig} from 'axios';-import {EventProvider} from "./event";+import {EventProvider, EventProviderStatus, WebSocketEventProvider} from "./event";export enum ORError {NONE = "NONE",@@ -30,8 +30,7 @@ export enum OREvent {EVENTS_DISCONNECTED = "EVENTS_DISCONNECTED",}-export enum EventSubscription {- NONE = "NONE",+export enum EventProviderType {WEBSOCKET = "WEBSOCKET",POLLING = "POLLING"}@@ -55,7 +54,7 @@ export interface ManagerConfig {autoLogin?: boolean;credentials?: Credentials;consoleAutoEnable?: boolean;- eventSubscription?: EventSubscription;+ eventProviderType?: EventProviderType;pollingIntervalMillis?: number}@@ -142,8 +141,8 @@ export class Manager {normalisedConfig.consoleAutoEnable = true;}- if (!normalisedConfig.eventSubscription) {- normalisedConfig.eventSubscription = EventSubscription.WEBSOCKET;+ if (!normalisedConfig.eventProviderType) {+ normalisedConfig.eventProviderType = EventProviderType.WEBSOCKET;}if (!normalisedConfig.pollingIntervalMillis || normalisedConfig.pollingIntervalMillis < 5000) {@@ -213,6 +212,10 @@ export class Manager {success = await this.doAuthInit();}+ if (success) {+ success = this.doEventsSubscriptionInit();+ }+if (success) {this._ready = true;this._emitEvent(OREvent.READY);@@ -290,7 +293,34 @@ export class Manager {rest.initialise(this.getApiBaseUrl());return true;}-++ protected doEventsSubscriptionInit(): boolean {+ switch (this._config.eventProviderType) {+ case EventProviderType.WEBSOCKET:+ this._events = new WebSocketEventProvider(this._config.managerUrl, (status: EventProviderStatus) => {this.onEventsProviderStatusChanged(status)});+ this._events.connect();+ break;+ case EventProviderType.POLLING:+ break;+ }++ return true;+ }++ protected onEventsProviderStatusChanged(status: EventProviderStatus) {+ switch (status) {+ case EventProviderStatus.DISCONNECTED:+ this._emitEvent(OREvent.EVENTS_DISCONNECTED);+ break;+ case EventProviderStatus.CONNECTED:+ this._emitEvent(OREvent.EVENTS_CONNECTED);+ break;+ case EventProviderStatus.CONNECTING:+ this._emitEvent(OREvent.EVENTS_CONNECTING);+ break;+ }+ }+protected async doConsoleInit(): Promise<boolean> {try {let orConsole = new Console(this._config.realm, this._config.consoleAutoEnable!, () => {@@ -517,7 +547,7 @@ export class Manager {// IDENTITY_SESSION_MAX_MINUTES and IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES server configconsole.info("Access token update failed, refresh token expired, login required");this._keycloak.clearToken();- throw new Error("Access token update failed, refresh token expired, login required");+ this._keycloak.login();});});}diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.tsnew file mode 100644index 000000000..78e2d99b8--- /dev/null+++ b/ui/component/core/src/util.ts@@ -0,0 +1,27 @@++export class Deferred<T> {++ protected _resolve!: (value?: T | PromiseLike<T>) => void;+ protected _reject!: (reason?: any) => void;+ protected _promise: Promise<T>;++ get resolve() {+ return this._resolve;+ }++ get reject() {+ return this._reject;+ }++ get promise() {+ return this._promise;+ }++ constructor() {+ this._promise = new Promise<T>((resolve1, reject1) => {+ this._resolve = resolve1;+ this._reject = reject1;+ });+ Object.freeze(this);+ }+}\ No newline at end of file