@orchestrator-ui/orchestrator-ui-components 0.4.0 → 0.5.1
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 +5 -5
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +14 -0
- package/dist/index.d.ts +213 -56
- package/dist/index.js +7335 -1613
- package/package.json +8 -9
- package/src/components/WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.tsx +8 -5
- package/src/components/WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.tsx +2 -1
- package/src/components/WfoDateTime/WfoDateTime.tsx +2 -9
- package/src/components/WfoErrorBoundary/WfoErrorBoundary.tsx +45 -0
- package/src/components/WfoErrorBoundary/index.ts +1 -0
- package/src/components/WfoForms/formFields/OrganisationField.tsx +10 -10
- package/src/components/WfoProcessList/WfoProcessesList.tsx +30 -35
- package/src/components/WfoProcessList/processListObjectMappers.ts +41 -1
- package/src/components/WfoSettings/WfoEngineStatusButton.tsx +11 -13
- package/src/components/WfoSettings/WfoFlushSettings.tsx +23 -35
- package/src/components/WfoSettings/WfoModifySettings.tsx +3 -16
- package/src/components/WfoSettings/WfoStatus.tsx +4 -9
- package/src/components/WfoSettings/index.ts +4 -1
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +8 -6
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +5 -5
- package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +5 -0
- package/src/components/WfoToastsList/WfoToastsList.tsx +11 -11
- package/src/components/index.ts +1 -0
- package/src/contexts/OrchestratorConfigContext.tsx +2 -4
- package/src/contexts/index.ts +0 -1
- package/src/graphqlQueries/index.ts +1 -1
- package/src/graphqlQueries/processListQuery.ts +29 -29
- package/src/graphqlQueries/subscriptionsListQuery.ts +4 -1
- package/src/hooks/index.ts +1 -2
- package/src/hooks/useCheckEngineStatus.ts +10 -9
- package/src/hooks/useOrchestratorConfig.ts +1 -16
- package/src/hooks/useShowToastMessage.ts +43 -0
- package/src/hooks/useStoredTableConfig.ts +5 -4
- package/src/index.ts +1 -0
- package/src/messages/en-GB.json +4 -1
- package/src/messages/nl-NL.json +4 -1
- package/src/pages/metadata/WfoProductBlocksPage.tsx +5 -5
- package/src/pages/metadata/WfoProductsPage.tsx +5 -5
- package/src/pages/metadata/WfoResourceTypesPage.tsx +5 -5
- package/src/pages/metadata/WfoWorkflowsPage.tsx +5 -5
- package/src/pages/settings/WfoSettingsPage.tsx +14 -23
- package/src/pages/startPage/WfoStartPage.tsx +6 -6
- package/src/rtk/api.ts +40 -0
- package/src/rtk/endpoints/customers.ts +27 -0
- package/src/rtk/endpoints/index.ts +3 -0
- package/src/rtk/endpoints/processList.ts +89 -0
- package/src/rtk/endpoints/settings.ts +72 -0
- package/src/rtk/hooks.ts +7 -0
- package/src/rtk/index.ts +5 -0
- package/src/rtk/slices/index.ts +1 -0
- package/src/rtk/slices/orchestratorConfig.ts +16 -0
- package/src/rtk/slices/toastMessages.ts +56 -0
- package/src/rtk/store.ts +40 -0
- package/src/rtk/storeProvider.tsx +26 -0
- package/src/types/types.ts +31 -0
- package/src/utils/csvDownload.ts +15 -19
- package/src/utils/date.ts +8 -0
- package/src/components/WfoSettings/WfoSettings.tsx +0 -40
- package/src/contexts/ToastContext.tsx +0 -136
- package/src/graphqlQueries/customersQuery.ts +0 -20
- package/src/hooks/useEngineStatusQuery.ts +0 -64
- package/src/hooks/useToastMessage.ts +0 -5
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
SortOrder,
|
|
24
24
|
Subscription,
|
|
25
25
|
} from '@/types';
|
|
26
|
-
import {
|
|
26
|
+
import { formatDate } from '@/utils';
|
|
27
27
|
|
|
28
28
|
export const WfoStartPage = () => {
|
|
29
29
|
const t = useTranslations('startPage');
|
|
@@ -71,7 +71,7 @@ export const WfoStartPage = () => {
|
|
|
71
71
|
subscriptionsSummaryResult?.subscriptions.page.map(
|
|
72
72
|
(subscription) => ({
|
|
73
73
|
title: subscription.description,
|
|
74
|
-
value:
|
|
74
|
+
value: formatDate(subscription.startDate),
|
|
75
75
|
url: `${PATH_SUBSCRIPTIONS}/${subscription.subscriptionId}`,
|
|
76
76
|
}),
|
|
77
77
|
) ?? [],
|
|
@@ -90,7 +90,7 @@ export const WfoStartPage = () => {
|
|
|
90
90
|
listItems:
|
|
91
91
|
processesSummaryResult?.processes.page.map((workflow) => ({
|
|
92
92
|
title: workflow.workflowName,
|
|
93
|
-
value: workflow
|
|
93
|
+
value: formatDate(workflow?.startedAt),
|
|
94
94
|
url: `${PATH_WORKFLOWS}/${workflow.processId}`,
|
|
95
95
|
})) ?? [],
|
|
96
96
|
button: {
|
|
@@ -109,7 +109,7 @@ export const WfoStartPage = () => {
|
|
|
109
109
|
listItems:
|
|
110
110
|
failedTasksSummaryResult?.processes.page.map((task) => ({
|
|
111
111
|
title: task.workflowName,
|
|
112
|
-
value: task
|
|
112
|
+
value: formatDate(task?.startedAt),
|
|
113
113
|
url: `${PATH_TASKS}/${task.processId}`,
|
|
114
114
|
})) ?? [],
|
|
115
115
|
button: {
|
|
@@ -154,9 +154,9 @@ export const WfoStartPage = () => {
|
|
|
154
154
|
<EuiFlexItem>
|
|
155
155
|
<WfoSummaryCards
|
|
156
156
|
summaryCards={[
|
|
157
|
-
latestActiveSubscriptionsSummaryCard,
|
|
158
|
-
latestWorkflowsSummaryCard,
|
|
159
157
|
failedTasksSummaryCard,
|
|
158
|
+
latestWorkflowsSummaryCard,
|
|
159
|
+
latestActiveSubscriptionsSummaryCard,
|
|
160
160
|
productsSummaryCard,
|
|
161
161
|
]}
|
|
162
162
|
/>
|
package/src/rtk/api.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
|
|
2
|
+
import { graphqlRequestBaseQuery } from '@rtk-query/graphql-request-base-query';
|
|
3
|
+
|
|
4
|
+
import type { RootState } from './store';
|
|
5
|
+
|
|
6
|
+
export enum BaseQueryTypes {
|
|
7
|
+
fetch = 'fetch',
|
|
8
|
+
graphql = 'graphql',
|
|
9
|
+
custom = 'custom',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type ExtraOptions = {
|
|
13
|
+
baseQueryType?: BaseQueryTypes;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const orchestratorApi = createApi({
|
|
17
|
+
reducerPath: 'orchestratorApi',
|
|
18
|
+
baseQuery: (args, api, extraOptions: ExtraOptions) => {
|
|
19
|
+
const { baseQueryType } = extraOptions || {};
|
|
20
|
+
|
|
21
|
+
const state = api.getState() as RootState;
|
|
22
|
+
const { orchestratorApiBaseUrl, graphqlEndpointCore } =
|
|
23
|
+
state.orchestratorConfig;
|
|
24
|
+
|
|
25
|
+
switch (baseQueryType) {
|
|
26
|
+
case BaseQueryTypes.fetch:
|
|
27
|
+
const fetchFn = fetchBaseQuery({
|
|
28
|
+
baseUrl: orchestratorApiBaseUrl,
|
|
29
|
+
});
|
|
30
|
+
return fetchFn(args, api, {});
|
|
31
|
+
default:
|
|
32
|
+
const graphqlFn = graphqlRequestBaseQuery({
|
|
33
|
+
url: graphqlEndpointCore,
|
|
34
|
+
});
|
|
35
|
+
return graphqlFn(args, api, {});
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
endpoints: () => ({}),
|
|
39
|
+
tagTypes: ['engineStatus'],
|
|
40
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Customer, CustomersResult } from '@/types';
|
|
2
|
+
|
|
3
|
+
import { orchestratorApi } from '../api';
|
|
4
|
+
|
|
5
|
+
const customersQuery = `query Customers {
|
|
6
|
+
customers(first: 1000000, after: 0) {
|
|
7
|
+
page {
|
|
8
|
+
fullname
|
|
9
|
+
identifier
|
|
10
|
+
shortcode
|
|
11
|
+
}:
|
|
12
|
+
}
|
|
13
|
+
}`;
|
|
14
|
+
|
|
15
|
+
const customersApi = orchestratorApi.injectEndpoints({
|
|
16
|
+
endpoints: (build) => ({
|
|
17
|
+
getCustomers: build.query<Customer[], void>({
|
|
18
|
+
query: () => ({ document: customersQuery }),
|
|
19
|
+
transformResponse: (response: CustomersResult): Customer[] => {
|
|
20
|
+
const customers = response?.customers?.page || [];
|
|
21
|
+
return customers;
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const { useGetCustomersQuery } = customersApi;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseGraphQlResult,
|
|
3
|
+
GraphqlQueryVariables,
|
|
4
|
+
Process,
|
|
5
|
+
ProcessListResult,
|
|
6
|
+
} from '@/types';
|
|
7
|
+
|
|
8
|
+
import { orchestratorApi } from '../api';
|
|
9
|
+
|
|
10
|
+
export const processListQuery = `
|
|
11
|
+
query ProcessList(
|
|
12
|
+
$first: Int!
|
|
13
|
+
$after: Int!
|
|
14
|
+
$sortBy: [GraphqlSort!]
|
|
15
|
+
$filterBy: [GraphqlFilter!]
|
|
16
|
+
$query: String
|
|
17
|
+
) {
|
|
18
|
+
processes(
|
|
19
|
+
first: $first
|
|
20
|
+
after: $after
|
|
21
|
+
sortBy: $sortBy
|
|
22
|
+
filterBy: $filterBy
|
|
23
|
+
query: $query
|
|
24
|
+
) {
|
|
25
|
+
page {
|
|
26
|
+
workflowName
|
|
27
|
+
lastStep
|
|
28
|
+
lastStatus
|
|
29
|
+
workflowTarget
|
|
30
|
+
product {
|
|
31
|
+
name
|
|
32
|
+
tag
|
|
33
|
+
}
|
|
34
|
+
customer {
|
|
35
|
+
fullname
|
|
36
|
+
shortcode
|
|
37
|
+
}
|
|
38
|
+
createdBy
|
|
39
|
+
assignee
|
|
40
|
+
processId
|
|
41
|
+
startedAt
|
|
42
|
+
lastModifiedAt
|
|
43
|
+
isTask
|
|
44
|
+
subscriptions {
|
|
45
|
+
page {
|
|
46
|
+
subscriptionId
|
|
47
|
+
description
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
pageInfo {
|
|
52
|
+
hasNextPage
|
|
53
|
+
hasPreviousPage
|
|
54
|
+
startCursor
|
|
55
|
+
totalItems
|
|
56
|
+
endCursor
|
|
57
|
+
sortFields
|
|
58
|
+
filterFields
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export type ProcessListResponse = {
|
|
65
|
+
processes: Process[];
|
|
66
|
+
} & BaseGraphQlResult;
|
|
67
|
+
|
|
68
|
+
const processApi = orchestratorApi.injectEndpoints({
|
|
69
|
+
endpoints: (build) => ({
|
|
70
|
+
getProcessList: build.query<
|
|
71
|
+
ProcessListResponse,
|
|
72
|
+
GraphqlQueryVariables<Process>
|
|
73
|
+
>({
|
|
74
|
+
query: (variables) => ({ document: processListQuery, variables }),
|
|
75
|
+
transformResponse: (
|
|
76
|
+
response: ProcessListResult,
|
|
77
|
+
): ProcessListResponse => {
|
|
78
|
+
const processes = response?.processes?.page || [];
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
processes,
|
|
82
|
+
pageInfo: response.processes?.pageInfo || {},
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
}),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const { useGetProcessListQuery } = processApi;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EngineStatus } from '@/types';
|
|
2
|
+
|
|
3
|
+
import { BaseQueryTypes, orchestratorApi } from '../api';
|
|
4
|
+
|
|
5
|
+
interface EngineStatusReturnValue {
|
|
6
|
+
engineStatus: EngineStatus;
|
|
7
|
+
runningProcesses: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const statusApi = orchestratorApi.injectEndpoints({
|
|
11
|
+
endpoints: (build) => ({
|
|
12
|
+
getEngineStatus: build.query<EngineStatusReturnValue, void>({
|
|
13
|
+
query: () => '/settings/status',
|
|
14
|
+
extraOptions: {
|
|
15
|
+
baseQueryType: BaseQueryTypes.fetch,
|
|
16
|
+
},
|
|
17
|
+
transformResponse(data: {
|
|
18
|
+
global_status: string;
|
|
19
|
+
running_processes: number;
|
|
20
|
+
}) {
|
|
21
|
+
const engineStatus = (() => {
|
|
22
|
+
switch (data?.global_status) {
|
|
23
|
+
case 'RUNNING':
|
|
24
|
+
return EngineStatus.RUNNING;
|
|
25
|
+
case 'PAUSING':
|
|
26
|
+
return EngineStatus.PAUSING;
|
|
27
|
+
case 'PAUSED':
|
|
28
|
+
return EngineStatus.PAUSED;
|
|
29
|
+
default:
|
|
30
|
+
return EngineStatus.UNKNOWN;
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
return {
|
|
34
|
+
engineStatus,
|
|
35
|
+
runningProcesses: data?.running_processes || 0,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
providesTags: ['engineStatus'],
|
|
39
|
+
}),
|
|
40
|
+
clearCache: build.mutation<void, string>({
|
|
41
|
+
query: (settingName) => ({
|
|
42
|
+
url: `/settings/cache/${settingName}`,
|
|
43
|
+
method: 'DELETE',
|
|
44
|
+
}),
|
|
45
|
+
extraOptions: {
|
|
46
|
+
baseQueryType: BaseQueryTypes.fetch,
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
setEngineStatus: build.mutation<EngineStatusReturnValue, boolean>({
|
|
50
|
+
query: (globalStatus) => ({
|
|
51
|
+
url: `/settings/status`,
|
|
52
|
+
method: 'PUT',
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
global_lock: globalStatus,
|
|
55
|
+
}),
|
|
56
|
+
headers: {
|
|
57
|
+
'Content-Type': 'application/json',
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
extraOptions: {
|
|
61
|
+
baseQueryType: BaseQueryTypes.fetch,
|
|
62
|
+
},
|
|
63
|
+
invalidatesTags: ['engineStatus'],
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const {
|
|
69
|
+
useGetEngineStatusQuery,
|
|
70
|
+
useClearCacheMutation,
|
|
71
|
+
useSetEngineStatusMutation,
|
|
72
|
+
} = statusApi;
|
package/src/rtk/hooks.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
2
|
+
import type { TypedUseSelectorHook } from 'react-redux';
|
|
3
|
+
|
|
4
|
+
import type { AppDispatch, RootState } from './store';
|
|
5
|
+
|
|
6
|
+
export const useAppDispatch: () => AppDispatch = useDispatch;
|
|
7
|
+
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
package/src/rtk/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './toastMessages';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import type { Slice } from '@reduxjs/toolkit';
|
|
3
|
+
|
|
4
|
+
import type { OrchestratorConfig } from '@/types';
|
|
5
|
+
|
|
6
|
+
type OrchestratorConfigSlice = Slice<OrchestratorConfig>;
|
|
7
|
+
|
|
8
|
+
export const getOrchestratorConfigSlice = (
|
|
9
|
+
config: OrchestratorConfig,
|
|
10
|
+
): OrchestratorConfigSlice => {
|
|
11
|
+
return createSlice({
|
|
12
|
+
name: 'orchestrator',
|
|
13
|
+
initialState: config,
|
|
14
|
+
reducers: {},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import type { PayloadAction, Reducer, Slice } from '@reduxjs/toolkit';
|
|
3
|
+
|
|
4
|
+
import { Toast } from '@/types';
|
|
5
|
+
|
|
6
|
+
export type ToastState = {
|
|
7
|
+
messages: Toast[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const initialState: ToastState = {
|
|
11
|
+
messages: [],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type ToastMessagesSlice = Slice<
|
|
15
|
+
ToastState,
|
|
16
|
+
{
|
|
17
|
+
addToastMessage: (
|
|
18
|
+
state: ToastState,
|
|
19
|
+
action: PayloadAction<Toast>,
|
|
20
|
+
) => ToastState;
|
|
21
|
+
removeToastMessage: (
|
|
22
|
+
state: ToastState,
|
|
23
|
+
action: PayloadAction<Toast['id']>,
|
|
24
|
+
) => ToastState;
|
|
25
|
+
},
|
|
26
|
+
'toastMessages',
|
|
27
|
+
'toastMessages'
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export const toastMessagesSlice: ToastMessagesSlice = createSlice({
|
|
31
|
+
name: 'toastMessages',
|
|
32
|
+
initialState,
|
|
33
|
+
reducers: {
|
|
34
|
+
addToastMessage: (state, action: PayloadAction<Toast>) => {
|
|
35
|
+
return {
|
|
36
|
+
...state,
|
|
37
|
+
messages: [...state.messages, action.payload],
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
removeToastMessage: (state, action: PayloadAction<Toast['id']>) => {
|
|
41
|
+
return {
|
|
42
|
+
...state,
|
|
43
|
+
messages: state.messages.filter(
|
|
44
|
+
(message) => message.id !== action.payload,
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Action creators are generated for each case reducer function
|
|
52
|
+
export const { addToastMessage, removeToastMessage } =
|
|
53
|
+
toastMessagesSlice.actions;
|
|
54
|
+
|
|
55
|
+
export const toastMessagesReducer: Reducer<ToastState> =
|
|
56
|
+
toastMessagesSlice.reducer;
|
package/src/rtk/store.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import type { EnhancedStore } from '@reduxjs/toolkit';
|
|
3
|
+
import type { Dispatch, UnknownAction } from '@reduxjs/toolkit';
|
|
4
|
+
import { CombinedState } from '@reduxjs/toolkit/query';
|
|
5
|
+
|
|
6
|
+
import type { OrchestratorConfig } from '@/types';
|
|
7
|
+
|
|
8
|
+
import { orchestratorApi } from './api';
|
|
9
|
+
import { getOrchestratorConfigSlice } from './slices/orchestratorConfig';
|
|
10
|
+
import { toastMessagesReducer } from './slices/toastMessages';
|
|
11
|
+
|
|
12
|
+
export type RootState = {
|
|
13
|
+
orchestratorApi: CombinedState<
|
|
14
|
+
Record<string, never>,
|
|
15
|
+
'engineStatus',
|
|
16
|
+
'orchestratorApi'
|
|
17
|
+
>;
|
|
18
|
+
toastMessages: ReturnType<typeof toastMessagesReducer>;
|
|
19
|
+
orchestratorConfig: OrchestratorConfig;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const getOrchestratorStore = (
|
|
23
|
+
orchestratorConfig: OrchestratorConfig,
|
|
24
|
+
): EnhancedStore<RootState> => {
|
|
25
|
+
const configSlice = getOrchestratorConfigSlice(orchestratorConfig);
|
|
26
|
+
|
|
27
|
+
const orchestratorStore = configureStore({
|
|
28
|
+
reducer: {
|
|
29
|
+
[orchestratorApi.reducerPath]: orchestratorApi.reducer,
|
|
30
|
+
toastMessages: toastMessagesReducer,
|
|
31
|
+
orchestratorConfig: configSlice.reducer,
|
|
32
|
+
},
|
|
33
|
+
middleware: (getDefaultMiddleware) =>
|
|
34
|
+
getDefaultMiddleware().concat(orchestratorApi.middleware),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return orchestratorStore;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type AppDispatch = Dispatch<UnknownAction>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import { Provider } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
import { useOrchestratorConfig } from '@/hooks';
|
|
6
|
+
import type { OrchestratorConfig } from '@/types';
|
|
7
|
+
|
|
8
|
+
import { getOrchestratorStore } from './store';
|
|
9
|
+
|
|
10
|
+
export type StoreProviderProps = {
|
|
11
|
+
initialOrchestratorConfig: OrchestratorConfig;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const StoreProvider = ({
|
|
16
|
+
initialOrchestratorConfig,
|
|
17
|
+
children,
|
|
18
|
+
}: StoreProviderProps) => {
|
|
19
|
+
const { orchestratorConfig } = useOrchestratorConfig(
|
|
20
|
+
initialOrchestratorConfig,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const store = getOrchestratorStore(orchestratorConfig);
|
|
24
|
+
|
|
25
|
+
return <Provider store={store}>{children}</Provider>;
|
|
26
|
+
};
|
package/src/types/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Toast } from '@elastic/eui/src/components/toast/global_toast_list';
|
|
2
|
+
|
|
1
3
|
import { InputForm } from './forms';
|
|
2
4
|
|
|
3
5
|
export type Nullable<T> = T | null;
|
|
@@ -18,6 +20,7 @@ export enum EngineStatus {
|
|
|
18
20
|
RUNNING = 'RUNNING',
|
|
19
21
|
PAUSING = 'PAUSING',
|
|
20
22
|
PAUSED = 'PAUSED',
|
|
23
|
+
UNKNOWN = 'UNKNOWN',
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export type Customer = {
|
|
@@ -266,6 +269,10 @@ export type GraphQLPageInfo = {
|
|
|
266
269
|
filterFields: string[];
|
|
267
270
|
};
|
|
268
271
|
|
|
272
|
+
export type BaseGraphQlResult = {
|
|
273
|
+
pageInfo: GraphQLPageInfo;
|
|
274
|
+
};
|
|
275
|
+
|
|
269
276
|
export interface SubscriptionsResult<T = Subscription> {
|
|
270
277
|
subscriptions: GraphQlResultPage<T>;
|
|
271
278
|
}
|
|
@@ -440,3 +447,27 @@ export type ExternalService = {
|
|
|
440
447
|
};
|
|
441
448
|
|
|
442
449
|
export type WfoTreeNodeMap = { [key: number]: TreeBlock };
|
|
450
|
+
|
|
451
|
+
export type { Toast };
|
|
452
|
+
|
|
453
|
+
export enum ToastTypes {
|
|
454
|
+
ERROR = 'ERROR',
|
|
455
|
+
SUCCESS = 'SUCCESS',
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export enum Environment {
|
|
459
|
+
DEVELOPMENT = 'Development',
|
|
460
|
+
PRODUCTION = 'Production',
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export type OrchestratorConfig = {
|
|
464
|
+
environmentName: Environment | string;
|
|
465
|
+
orchestratorApiBaseUrl: string;
|
|
466
|
+
graphqlEndpointCore: string;
|
|
467
|
+
engineStatusEndpoint: string;
|
|
468
|
+
processStatusCountsEndpoint: string;
|
|
469
|
+
processesEndpoint: string;
|
|
470
|
+
subscriptionActionsEndpoint: string;
|
|
471
|
+
subscriptionProcessesEndpoint: string;
|
|
472
|
+
authActive: boolean;
|
|
473
|
+
};
|
package/src/utils/csvDownload.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TranslationValues } from 'next-intl';
|
|
2
2
|
|
|
3
3
|
import { MAXIMUM_ITEMS_FOR_BULK_FETCHING } from '@/configuration/constants';
|
|
4
|
-
import { ToastTypes } from '@/
|
|
4
|
+
import { ToastTypes } from '@/types';
|
|
5
5
|
import { GraphQLPageInfo } from '@/types';
|
|
6
6
|
import { sortObjectKeys } from '@/utils/sortObjectKeys';
|
|
7
7
|
|
|
@@ -48,24 +48,19 @@ export const getCsvFileNameWithDate = (fileNameWithoutExtension: string) => {
|
|
|
48
48
|
return `${fileNameWithoutExtension}_${year}-${month}-${day}-${hour}${minute}${second}.csv`;
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
export const csvDownloadHandler =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
translationKey: string,
|
|
65
|
-
variables?: TranslationValues,
|
|
66
|
-
) => string,
|
|
67
|
-
) =>
|
|
68
|
-
async () => {
|
|
51
|
+
export const csvDownloadHandler = <T extends object, U extends object>(
|
|
52
|
+
dataFetchFunction: () => Promise<T | undefined>,
|
|
53
|
+
dataMapper: (data: T) => U[],
|
|
54
|
+
pageInfoMapper: (data: T) => GraphQLPageInfo,
|
|
55
|
+
keyOrder: string[],
|
|
56
|
+
filename: string,
|
|
57
|
+
addToastFunction: (type: ToastTypes, text: string, title: string) => void,
|
|
58
|
+
translationFunction: (
|
|
59
|
+
translationKey: string,
|
|
60
|
+
variables?: TranslationValues,
|
|
61
|
+
) => string,
|
|
62
|
+
) => {
|
|
63
|
+
return async () => {
|
|
69
64
|
const data: T | undefined = await dataFetchFunction();
|
|
70
65
|
|
|
71
66
|
if (data) {
|
|
@@ -85,3 +80,4 @@ export const csvDownloadHandler =
|
|
|
85
80
|
initiateCsvFileDownload(dataForExport, filename);
|
|
86
81
|
}
|
|
87
82
|
};
|
|
83
|
+
};
|
package/src/utils/date.ts
CHANGED
|
@@ -112,3 +112,11 @@ export const formatDateCetWithUtc = (
|
|
|
112
112
|
|
|
113
113
|
return `${formattedDateCET} (${formattedDateUTC})`;
|
|
114
114
|
};
|
|
115
|
+
|
|
116
|
+
export const getDate = (date: Date | string | null) => {
|
|
117
|
+
if (typeof date === 'string') {
|
|
118
|
+
return new Date(date);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return date;
|
|
122
|
+
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { EuiHorizontalRule, EuiPageHeader, EuiSpacer } from '@elastic/eui';
|
|
4
|
-
|
|
5
|
-
import { EngineStatus } from '@/types';
|
|
6
|
-
|
|
7
|
-
import { WfoFlushSettings } from './WfoFlushSettings';
|
|
8
|
-
import { WfoModifySettings } from './WfoModifySettings';
|
|
9
|
-
import { WfoStatus } from './WfoStatus';
|
|
10
|
-
|
|
11
|
-
interface WfoSettingsProps {
|
|
12
|
-
currentEngineStatus: EngineStatus | undefined;
|
|
13
|
-
currentRunningProcesses: number | undefined;
|
|
14
|
-
changeEngineStatus: () => void;
|
|
15
|
-
}
|
|
16
|
-
export const WfoSettings = ({
|
|
17
|
-
currentEngineStatus,
|
|
18
|
-
currentRunningProcesses,
|
|
19
|
-
changeEngineStatus,
|
|
20
|
-
}: WfoSettingsProps) => {
|
|
21
|
-
return (
|
|
22
|
-
<>
|
|
23
|
-
<EuiSpacer />
|
|
24
|
-
|
|
25
|
-
<EuiPageHeader pageTitle="Settings" />
|
|
26
|
-
<EuiHorizontalRule />
|
|
27
|
-
<WfoFlushSettings />
|
|
28
|
-
<EuiSpacer />
|
|
29
|
-
<WfoModifySettings
|
|
30
|
-
engineStatus={currentEngineStatus}
|
|
31
|
-
changeEngineStatus={changeEngineStatus}
|
|
32
|
-
/>
|
|
33
|
-
<EuiSpacer />
|
|
34
|
-
<WfoStatus
|
|
35
|
-
engineStatus={currentEngineStatus || EngineStatus.PAUSED}
|
|
36
|
-
runningProcesses={currentRunningProcesses}
|
|
37
|
-
/>
|
|
38
|
-
</>
|
|
39
|
-
);
|
|
40
|
-
};
|