@orchestrator-ui/orchestrator-ui-components 7.6.0 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +7 -7
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +63 -45
- package/dist/index.js +766 -639
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.tsx +3 -1
- package/src/components/WfoBadges/WfoWebsocketStatusBadge/WfoWebsocketStatusBadge.tsx +9 -3
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +34 -3
- package/src/components/WfoTitleWithWebsocketBadge/WfoTitleWithWebsocketBadge.tsx +3 -2
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +57 -40
- package/src/components/WfoWorkflowSteps/WfoStep/useStepDetailOverride.ts +9 -0
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +0 -1
- package/src/configuration/version.ts +1 -1
- package/src/messages/en-GB.json +2 -0
- package/src/messages/nl-NL.json +2 -0
- package/src/pages/metadata/WfoScheduleTaskFormPage.tsx +153 -35
- package/src/rtk/endpoints/forms.ts +1 -1
- package/src/rtk/endpoints/metadata/scheduledTasks.ts +9 -17
- package/src/rtk/endpoints/streamMessages.ts +10 -23
- package/src/rtk/slices/orchestratorComponentOverride.ts +5 -1
- package/src/utils/compareVersions.ts +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { debounce } from 'lodash';
|
|
2
2
|
|
|
3
3
|
import { getWebSocket, orchestratorApi } from '@/rtk';
|
|
4
|
-
import
|
|
5
|
-
import { CacheTag, CacheTagType } from '@/types';
|
|
4
|
+
import { CacheTag } from '@/types';
|
|
6
5
|
|
|
7
6
|
const PING_INTERVAL_MS = 30000;
|
|
8
7
|
const NO_PONG_RECEIVED_TIMEOUT_MS = 35000;
|
|
@@ -29,32 +28,26 @@ enum MessageTypes {
|
|
|
29
28
|
* - It invalidates the cache entry with the tag received in the message event
|
|
30
29
|
* - WfoWebsocketStatusBadge contains logic that handles automatic reconnection and their circumstances
|
|
31
30
|
*/
|
|
31
|
+
|
|
32
32
|
const streamMessagesApi = orchestratorApi.injectEndpoints({
|
|
33
33
|
endpoints: (build) => ({
|
|
34
|
-
streamMessages: build.query<boolean,
|
|
34
|
+
streamMessages: build.query<boolean, string>({
|
|
35
35
|
queryFn: () => {
|
|
36
36
|
return { data: true };
|
|
37
37
|
},
|
|
38
|
-
async onCacheEntryAdded(
|
|
38
|
+
async onCacheEntryAdded(wsEndpoint, { cacheDataLoaded, cacheEntryRemoved, dispatch, updateCachedData }) {
|
|
39
39
|
const cleanUp = () => {
|
|
40
40
|
clearInterval(pingInterval);
|
|
41
41
|
updateCachedData(() => false);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
const invalidateTag = (cacheTag: CacheTag) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
dispatch(cacheInvalidationAction);
|
|
48
|
-
} else {
|
|
49
|
-
console.error(`Trying to invalidate a cache entry with an unknown tag: ${cacheTag.type}`);
|
|
50
|
-
}
|
|
45
|
+
const cacheInvalidationAction = orchestratorApi.util.invalidateTags([cacheTag]);
|
|
46
|
+
dispatch(cacheInvalidationAction);
|
|
51
47
|
};
|
|
52
48
|
|
|
53
49
|
await cacheDataLoaded;
|
|
54
50
|
let initialConnection = true;
|
|
55
|
-
const state = getState() as RootState;
|
|
56
|
-
const { orchestratorWebsocketUrl } = state.orchestratorConfig;
|
|
57
|
-
const validCacheTags = Object.values(CacheTagType);
|
|
58
51
|
|
|
59
52
|
const getDebounce = (delay: number) => {
|
|
60
53
|
return debounce(() => {
|
|
@@ -68,8 +61,7 @@ const streamMessagesApi = orchestratorApi.injectEndpoints({
|
|
|
68
61
|
const closeConnectionAfterFirstPing = getDebounce(INITIAL_CONNECTION_CHECK_INTERVAL_MS);
|
|
69
62
|
const debounceClosingConnection = getDebounce(NO_PONG_RECEIVED_TIMEOUT_MS);
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
const webSocket = await getWebSocket(orchestratorWebsocketUrl);
|
|
64
|
+
const webSocket = await getWebSocket(wsEndpoint);
|
|
73
65
|
|
|
74
66
|
const sendPing = () => {
|
|
75
67
|
if (webSocket.readyState === WebSocket.OPEN) {
|
|
@@ -82,9 +74,7 @@ const streamMessagesApi = orchestratorApi.injectEndpoints({
|
|
|
82
74
|
// run less frequently at the discretion of the browser causing the websocket to disconnect
|
|
83
75
|
// sometimes. WfoWebsocketStatusBadge contains logic to reconnect based on the pageVisibility api
|
|
84
76
|
// to handle that situation.
|
|
85
|
-
const pingInterval = setInterval(
|
|
86
|
-
sendPing();
|
|
87
|
-
}, PING_INTERVAL_MS);
|
|
77
|
+
const pingInterval = setInterval(sendPing, PING_INTERVAL_MS);
|
|
88
78
|
|
|
89
79
|
webSocket.onopen = () => {
|
|
90
80
|
// Check the connection right after it is established
|
|
@@ -106,6 +96,7 @@ const streamMessagesApi = orchestratorApi.injectEndpoints({
|
|
|
106
96
|
}
|
|
107
97
|
return;
|
|
108
98
|
}
|
|
99
|
+
|
|
109
100
|
const message = JSON.parse(data) as WebSocketMessage;
|
|
110
101
|
if (message.name === MessageTypes.invalidateCache) {
|
|
111
102
|
invalidateTag(message.value);
|
|
@@ -114,17 +105,13 @@ const streamMessagesApi = orchestratorApi.injectEndpoints({
|
|
|
114
105
|
}
|
|
115
106
|
});
|
|
116
107
|
|
|
117
|
-
webSocket.onerror = (event) =>
|
|
118
|
-
console.error('WebSocket error', event);
|
|
119
|
-
};
|
|
120
|
-
|
|
108
|
+
webSocket.onerror = (event) => console.error('WebSocket error', event);
|
|
121
109
|
webSocket.onclose = () => {
|
|
122
110
|
console.error('WebSocket closed');
|
|
123
111
|
cleanUp();
|
|
124
112
|
};
|
|
125
113
|
|
|
126
114
|
await cacheEntryRemoved;
|
|
127
|
-
|
|
128
115
|
webSocket.close();
|
|
129
116
|
},
|
|
130
117
|
}),
|
|
@@ -2,7 +2,7 @@ import { ReactElement, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Slice, createSlice } from '@reduxjs/toolkit';
|
|
4
4
|
|
|
5
|
-
import { FieldValue, RenderableFieldValue, SubscriptionDetail } from '@/types';
|
|
5
|
+
import { FieldValue, RenderableFieldValue, Step, SubscriptionDetail } from '@/types';
|
|
6
6
|
|
|
7
7
|
export type ValueOverrideFunction = (
|
|
8
8
|
fieldValue: FieldValue | RenderableFieldValue,
|
|
@@ -19,6 +19,10 @@ export type OrchestratorComponentOverride = {
|
|
|
19
19
|
startPage?: {
|
|
20
20
|
summaryCardConfigurationOverride?: (defaultItems: ReactElement[]) => ReactElement[];
|
|
21
21
|
};
|
|
22
|
+
stepDetail?: {
|
|
23
|
+
stepHeader?: React.JSXElementConstructor<{ step?: Step }>;
|
|
24
|
+
stepBody?: React.JSXElementConstructor<{ step?: Step }>;
|
|
25
|
+
};
|
|
22
26
|
subscriptionDetail?: {
|
|
23
27
|
valueOverrides?: ValueOverrideConfiguration;
|
|
24
28
|
generalSectionConfigurationOverride?: (
|