@orchestrator-ui/orchestrator-ui-components 3.0.3 → 3.1.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.
Files changed (29) hide show
  1. package/.turbo/turbo-build.log +8 -8
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/.turbo/turbo-test.log +6 -6
  4. package/CHANGELOG.md +7 -0
  5. package/dist/index.d.ts +49 -8
  6. package/dist/index.js +488 -341
  7. package/dist/index.js.map +1 -1
  8. package/package.json +2 -12
  9. package/src/components/WfoBadges/WfoWebsocketStatusBadge/WfoWebsocketStatusBadge.tsx +14 -4
  10. package/src/components/WfoForms/formFields/utils.ts +2 -3
  11. package/src/components/WfoInlineNoteEdit/WfoInlineNoteEdit.tsx +70 -76
  12. package/src/components/WfoInlineNoteEdit/WfoSubscriptionDetailNoteEdit.tsx +55 -0
  13. package/src/components/WfoInlineNoteEdit/WfoSubscriptionNoteEdit.tsx +64 -0
  14. package/src/components/WfoInlineNoteEdit/index.ts +2 -0
  15. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +2 -0
  16. package/src/components/WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.tsx +7 -6
  17. package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +3 -4
  18. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +19 -9
  19. package/src/configuration/version.ts +1 -1
  20. package/src/messages/en-GB.json +1 -0
  21. package/src/messages/nl-NL.json +1 -0
  22. package/src/rtk/api.ts +31 -1
  23. package/src/rtk/endpoints/streamMessages.ts +1 -1
  24. package/src/rtk/endpoints/subscriptionListMutation.ts +90 -0
  25. package/src/utils/string.spec.ts +27 -0
  26. package/src/utils/strings.ts +6 -0
  27. package/.storybook/main.js +0 -28
  28. package/.storybook/preview.js +0 -14
  29. package/src/stories/colors.tsx +0 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Library of UI Components used to display the workflow orchestrator frontend",
6
6
  "author": {
@@ -31,9 +31,7 @@
31
31
  "build": "npm run generate-version && tsup src/index.ts",
32
32
  "tsc": "tsc --noEmit",
33
33
  "lint": "eslint \"src/**/*.ts*\"",
34
- "dev": "npm run build -- --watch",
35
- "storybook": "storybook dev -p 6006",
36
- "build-storybook": "storybook build"
34
+ "dev": "npm run build -- --watch"
37
35
  },
38
36
  "dependencies": {
39
37
  "@elastic/eui": "^97.0.0",
@@ -66,13 +64,6 @@
66
64
  "@orchestrator-ui/eslint-config-custom": "*",
67
65
  "@orchestrator-ui/jest-config": "*",
68
66
  "@reduxjs/toolkit": "^2.0.1",
69
- "@storybook/addon-essentials": "^8.1.10",
70
- "@storybook/addon-interactions": "^8.1.10",
71
- "@storybook/addon-links": "^8.1.10",
72
- "@storybook/addon-onboarding": "^8.1.10",
73
- "@storybook/blocks": "^8.1.10",
74
- "@storybook/nextjs": "^8.1.10",
75
- "@storybook/react": "^8.3.6",
76
67
  "@testing-library/jest-dom": "^6.6.2",
77
68
  "@testing-library/react": "^16.0.1",
78
69
  "@testing-library/user-event": "^14.5.2",
@@ -84,7 +75,6 @@
84
75
  "jest": "^29.7.0",
85
76
  "jest-environment-jsdom": "^29.7.0",
86
77
  "jest-watch-typeahead": "^2.2.2",
87
- "storybook": "^8.1.10",
88
78
  "tsup": "^8.0.1",
89
79
  "typescript": "^5.5.2",
90
80
  "uniforms-bridge-simple-schema-2": "^3.8.1"
@@ -1,20 +1,26 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import React, { FC, useCallback, useEffect } from 'react';
2
2
  import { useDispatch } from 'react-redux';
3
3
 
4
4
  import { useTranslations } from 'next-intl';
5
5
 
6
6
  import { EuiToolTip } from '@elastic/eui';
7
7
 
8
+ import { WfoHeaderBadge } from '@/components';
8
9
  import { useWithOrchestratorTheme } from '@/hooks';
9
10
  import { useOrchestratorTheme } from '@/hooks/useOrchestratorTheme';
10
11
  import { WfoBoltFill, WfoBoltSlashFill } from '@/icons';
11
12
  import { orchestratorApi } from '@/rtk';
12
13
  import { useStreamMessagesQuery } from '@/rtk/endpoints/streamMessages';
13
14
 
14
- import { WfoHeaderBadge } from '../WfoHeaderBadge';
15
15
  import { getStyles } from './styles';
16
16
 
17
- export const WfoWebsocketStatusBadge = () => {
17
+ interface WfoWebsocketStatusBadgeProps {
18
+ hideWhenConnected?: boolean;
19
+ }
20
+
21
+ export const WfoWebsocketStatusBadge: FC<WfoWebsocketStatusBadgeProps> = ({
22
+ hideWhenConnected = false,
23
+ }) => {
18
24
  const dispatch = useDispatch();
19
25
  const { connectedStyle, disconnectedStyle } =
20
26
  useWithOrchestratorTheme(getStyles);
@@ -23,6 +29,8 @@ export const WfoWebsocketStatusBadge = () => {
23
29
  const { theme } = useOrchestratorTheme();
24
30
  const { data: websocketConnected } = useStreamMessagesQuery();
25
31
 
32
+ const showBadge = !(websocketConnected && hideWhenConnected);
33
+
26
34
  const reconnect = useCallback(() => {
27
35
  dispatch(orchestratorApi.util.resetApiState());
28
36
  }, [dispatch]);
@@ -56,7 +64,7 @@ export const WfoWebsocketStatusBadge = () => {
56
64
  };
57
65
  }, [reconnect, websocketConnected]);
58
66
 
59
- return (
67
+ return showBadge ? (
60
68
  <EuiToolTip
61
69
  position="bottom"
62
70
  content={
@@ -85,5 +93,7 @@ export const WfoWebsocketStatusBadge = () => {
85
93
  iconOnClickAriaLabel={undefined}
86
94
  />
87
95
  </EuiToolTip>
96
+ ) : (
97
+ <></>
88
98
  );
89
99
  };
@@ -1,9 +1,8 @@
1
- import { isDate } from 'moment';
1
+ import { isDate } from 'moment/moment';
2
2
 
3
+ import { PortMode, ProductTag } from '@/components';
3
4
  import { ProductBlockInstance, SubscriptionDetail } from '@/types';
4
5
 
5
- import { PortMode, ProductTag } from './deprecated/types';
6
-
7
6
  // NOTE: There might potentially (?) be more productBlockInstances with portMod but we get the last one here
8
7
  export const getPortMode = (
9
8
  productBlockInstances: ProductBlockInstance[],
@@ -5,50 +5,37 @@ import { EuiInlineEditText } from '@elastic/eui';
5
5
 
6
6
  import { WfoToolTip } from '@/components';
7
7
  import { useOrchestratorTheme } from '@/hooks';
8
- import { useStartProcessMutation } from '@/rtk/endpoints/forms';
9
- import type { Subscription } from '@/types';
8
+ import { INVISIBLE_CHARACTER } from '@/utils';
10
9
 
11
10
  interface WfoInlineNoteEditProps {
12
- value: Subscription['note'];
13
- subscriptionId?: Subscription['subscriptionId'];
11
+ value: string;
14
12
  onlyShowOnHover?: boolean;
13
+ triggerNoteModifyWorkflow?: (note: string) => void;
15
14
  }
16
15
 
17
16
  export const WfoInlineNoteEdit: FC<WfoInlineNoteEditProps> = ({
18
17
  value,
19
- subscriptionId,
20
18
  onlyShowOnHover = false,
19
+ triggerNoteModifyWorkflow = () => {},
21
20
  }) => {
22
21
  const { theme } = useOrchestratorTheme();
23
- const [note, setNote] = useState<string>(value ?? '');
22
+ const [note, setNote] = useState<string>(value);
24
23
  const [isTooltipVisible, setIsTooltipVisible] = useState<boolean>(true);
25
24
 
26
- const [startProcess] = useStartProcessMutation();
27
- const triggerNoteModifyWorkflow = () => {
28
- const noteModifyPayload = [
29
- { subscription_id: subscriptionId },
30
- { note },
31
- ];
32
- startProcess({
33
- workflowName: 'modify_note',
34
- userInputs: noteModifyPayload,
35
- });
36
- };
37
-
38
25
  const handleSave = () => {
39
- triggerNoteModifyWorkflow();
26
+ triggerNoteModifyWorkflow(note);
40
27
  setIsTooltipVisible(true);
41
28
  };
42
29
 
43
30
  const handleCancel = () => {
44
- setNote(value ?? '');
31
+ setNote(value);
45
32
  setIsTooltipVisible(true);
46
33
  };
47
34
 
48
35
  // This useEffect makes sure the note is updated when a new value property is passed in
49
36
  // for example by a parent component that is update through a websocket event
50
37
  useEffect(() => {
51
- setNote(value ?? '');
38
+ setNote(value);
52
39
  }, [value]);
53
40
 
54
41
  return (
@@ -63,72 +50,79 @@ export const WfoInlineNoteEdit: FC<WfoInlineNoteEditProps> = ({
63
50
  }}
64
51
  >
65
52
  <WfoToolTip
66
- css={{ visibility: isTooltipVisible ? 'visible' : 'hidden' }}
53
+ css={{
54
+ visibility:
55
+ isTooltipVisible && note !== INVISIBLE_CHARACTER
56
+ ? 'visible'
57
+ : 'hidden',
58
+ }}
67
59
  tooltipContent={note}
68
60
  >
69
- <EuiInlineEditText
70
- inputAriaLabel="Edit note"
71
- value={note}
72
- onChange={(e: ChangeEvent<HTMLInputElement>) => {
73
- setNote(e.target.value);
74
- }}
75
- onCancel={handleCancel}
76
- onSave={handleSave}
77
- size={'s'}
78
- css={{
79
- width: theme.base * 16,
80
- '.euiFlexItem:nth-of-type(2)': {
81
- justifyContent: 'center',
82
- },
83
- '.euiButtonEmpty__content': {
84
- justifyContent: 'left',
85
- },
86
- }}
87
- readModeProps={{
88
- onClick: () => setIsTooltipVisible(false),
89
- title: '',
90
- css: {
91
- minWidth: '100%',
92
- '.euiIcon': {
93
- visibility: onlyShowOnHover
94
- ? 'hidden'
95
- : 'visible',
61
+ <span>
62
+ <EuiInlineEditText
63
+ inputAriaLabel="Edit note"
64
+ value={note}
65
+ onChange={(e: ChangeEvent<HTMLInputElement>) => {
66
+ setNote(e.target.value);
67
+ }}
68
+ onCancel={handleCancel}
69
+ onSave={handleSave}
70
+ size={'s'}
71
+ css={{
72
+ width: theme.base * 16,
73
+ '.euiFlexItem:nth-of-type(2)': {
74
+ justifyContent: 'center',
96
75
  },
97
- },
98
- }}
99
- editModeProps={{
100
- saveButtonProps: {
101
- color: 'primary',
102
- size: 'xs',
103
- },
104
- cancelButtonProps: {
105
- color: 'danger',
106
- size: 'xs',
107
- },
108
- inputProps: {
109
- css: {
76
+ '.euiButtonEmpty__content': {
110
77
  justifyContent: 'left',
111
- height: '32px',
112
- paddingLeft: '4px',
113
- margin: '0',
114
- width: '98%',
115
78
  },
116
- },
117
- formRowProps: {
79
+ }}
80
+ readModeProps={{
81
+ onClick: () => setIsTooltipVisible(false),
82
+ title: '',
118
83
  css: {
119
- padding: 0,
120
- margin: 0,
121
- height: '32px',
122
- '.euiFormRow__fieldWrapper': {
123
- minHeight: '32px',
84
+ minWidth: '100%',
85
+ '.euiIcon': {
86
+ visibility: onlyShowOnHover
87
+ ? 'hidden'
88
+ : 'visible',
89
+ },
90
+ },
91
+ }}
92
+ editModeProps={{
93
+ saveButtonProps: {
94
+ color: 'primary',
95
+ size: 'xs',
96
+ },
97
+ cancelButtonProps: {
98
+ color: 'danger',
99
+ size: 'xs',
100
+ },
101
+ inputProps: {
102
+ css: {
103
+ justifyContent: 'left',
124
104
  height: '32px',
105
+ paddingLeft: '4px',
106
+ margin: '0',
107
+ width: '98%',
108
+ },
109
+ },
110
+ formRowProps: {
111
+ css: {
125
112
  padding: 0,
126
113
  margin: 0,
114
+ height: '32px',
115
+ '.euiFormRow__fieldWrapper': {
116
+ minHeight: '32px',
117
+ height: '32px',
118
+ padding: 0,
119
+ margin: 0,
120
+ },
127
121
  },
128
122
  },
129
- },
130
- }}
131
- />
123
+ }}
124
+ />
125
+ </span>
132
126
  </WfoToolTip>
133
127
  </div>
134
128
  );
@@ -0,0 +1,55 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+
4
+ import { WfoInlineNoteEdit } from '@/components';
5
+ import { useGetSubscriptionDetailQuery } from '@/rtk';
6
+ import { useStartProcessMutation } from '@/rtk/endpoints/forms';
7
+ import { useUpdateSubscriptionDetailNoteOptimisticMutation } from '@/rtk/endpoints/subscriptionListMutation';
8
+ import { SubscriptionDetail } from '@/types';
9
+ import { INVISIBLE_CHARACTER } from '@/utils';
10
+
11
+ interface WfoSubscriptionDetailNoteEditProps {
12
+ subscriptionId: SubscriptionDetail['subscriptionId'];
13
+ onlyShowOnHover?: boolean;
14
+ }
15
+
16
+ export const WfoSubscriptionDetailNoteEdit: FC<
17
+ WfoSubscriptionDetailNoteEditProps
18
+ > = ({ subscriptionId, onlyShowOnHover = false }) => {
19
+ const { data, endpointName } = useGetSubscriptionDetailQuery({
20
+ subscriptionId,
21
+ });
22
+
23
+ const selectedItem = data?.subscription ?? { note: '' };
24
+ const [startProcess] = useStartProcessMutation();
25
+ const [updateSub] = useUpdateSubscriptionDetailNoteOptimisticMutation();
26
+
27
+ const triggerNoteModifyWorkflow = (note: string) => {
28
+ const noteModifyPayload = [
29
+ { subscription_id: subscriptionId },
30
+ { note: note === INVISIBLE_CHARACTER ? '' : note },
31
+ ];
32
+ startProcess({
33
+ workflowName: 'modify_note',
34
+ userInputs: noteModifyPayload,
35
+ });
36
+
37
+ updateSub({
38
+ queryName: endpointName ?? '',
39
+ subscriptionId: subscriptionId,
40
+ note: note,
41
+ });
42
+ };
43
+
44
+ return (
45
+ <WfoInlineNoteEdit
46
+ value={
47
+ selectedItem?.note?.trim()
48
+ ? selectedItem.note
49
+ : INVISIBLE_CHARACTER
50
+ }
51
+ onlyShowOnHover={onlyShowOnHover}
52
+ triggerNoteModifyWorkflow={triggerNoteModifyWorkflow}
53
+ />
54
+ );
55
+ };
@@ -0,0 +1,64 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+
4
+ import { WfoInlineNoteEdit } from '@/components';
5
+ import { ApiResult, SubscriptionListResponse, UseQuery } from '@/rtk';
6
+ import { useStartProcessMutation } from '@/rtk/endpoints/forms';
7
+ import { useUpdateSubscriptionNoteOptimisticMutation } from '@/rtk/endpoints/subscriptionListMutation';
8
+ import { Subscription } from '@/types';
9
+ import { INVISIBLE_CHARACTER } from '@/utils';
10
+
11
+ interface WfoSubscriptionNoteEditProps {
12
+ subscriptionId: Subscription['subscriptionId'];
13
+ onlyShowOnHover?: boolean;
14
+ queryVariables: Record<string, unknown>;
15
+ useQuery: UseQuery<SubscriptionListResponse, Subscription>;
16
+ }
17
+
18
+ export const WfoSubscriptionNoteEdit: FC<WfoSubscriptionNoteEditProps> = ({
19
+ subscriptionId,
20
+ onlyShowOnHover = false,
21
+ queryVariables,
22
+ useQuery,
23
+ }) => {
24
+ const { selectedItem } = useQuery(queryVariables, {
25
+ selectFromResult: (result: ApiResult<SubscriptionListResponse>) => ({
26
+ selectedItem: result?.data?.subscriptions?.find(
27
+ (sub) => sub.subscriptionId === subscriptionId,
28
+ ),
29
+ }),
30
+ });
31
+ const endpointName = useQuery().endpointName;
32
+ const [startProcess] = useStartProcessMutation();
33
+ const [updateSub] = useUpdateSubscriptionNoteOptimisticMutation();
34
+
35
+ const triggerNoteModifyWorkflow = (note: string) => {
36
+ const noteModifyPayload = [
37
+ { subscription_id: subscriptionId },
38
+ { note: note === INVISIBLE_CHARACTER ? '' : note },
39
+ ];
40
+ startProcess({
41
+ workflowName: 'modify_note',
42
+ userInputs: noteModifyPayload,
43
+ });
44
+
45
+ updateSub({
46
+ queryName: endpointName ?? '',
47
+ subscriptionId: subscriptionId,
48
+ graphQlQueryVariables: queryVariables,
49
+ note: note,
50
+ });
51
+ };
52
+
53
+ return (
54
+ <WfoInlineNoteEdit
55
+ value={
56
+ selectedItem?.note?.trim()
57
+ ? selectedItem.note
58
+ : INVISIBLE_CHARACTER
59
+ }
60
+ onlyShowOnHover={onlyShowOnHover}
61
+ triggerNoteModifyWorkflow={triggerNoteModifyWorkflow}
62
+ />
63
+ );
64
+ };
@@ -1 +1,3 @@
1
1
  export * from './WfoInlineNoteEdit';
2
+ export * from './WfoSubscriptionNoteEdit';
3
+ export * from './WfoSubscriptionDetailNoteEdit';
@@ -17,6 +17,7 @@ import {
17
17
  WfoEngineStatusBadge,
18
18
  WfoEnvironmentBadge,
19
19
  WfoFailedTasksBadge,
20
+ WfoWebsocketStatusBadge,
20
21
  } from '@/components';
21
22
  import { WfoAppLogo } from '@/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo';
22
23
  import { getWfoPageHeaderStyles } from '@/components/WfoPageTemplate/WfoPageHeader/styles';
@@ -70,6 +71,7 @@ export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
70
71
  <EuiHeaderSection>
71
72
  <EuiHeaderSectionItem>
72
73
  <EuiBadgeGroup css={{ marginRight: multiplyByBaseUnit(1) }}>
74
+ <WfoWebsocketStatusBadge hideWhenConnected={true} />
73
75
  <WfoEngineStatusBadge />
74
76
  <WfoFailedTasksBadge />
75
77
  </EuiBadgeGroup>
@@ -1,13 +1,11 @@
1
1
  import React, { FC, ReactElement, ReactNode, useState } from 'react';
2
2
 
3
- import { EuiPageTemplate } from '@elastic/eui';
4
3
  import type { EuiThemeColorMode } from '@elastic/eui';
4
+ import { EuiPageTemplate } from '@elastic/eui';
5
5
  import { EuiSideNavItemType } from '@elastic/eui/src/components/side_nav/side_nav_types';
6
6
 
7
- import { useOrchestratorTheme } from '../../../hooks/useOrchestratorTheme';
8
- import { WfoBreadcrumbs } from '../WfoBreadcrumbs';
9
- import { WfoPageHeader } from '../WfoPageHeader';
10
- import { WfoSidebar } from '../WfoSidebar';
7
+ import { WfoBreadcrumbs, WfoPageHeader, WfoSidebar } from '@/components';
8
+ import { useOrchestratorTheme } from '@/hooks';
11
9
 
12
10
  export interface WfoPageTemplateProps {
13
11
  getAppLogo: (navigationHeight: number) => ReactElement;
@@ -35,7 +33,6 @@ export const WfoPageTemplate: FC<WfoPageTemplateProps> = ({
35
33
  navigationHeight={navigationHeight}
36
34
  onThemeSwitch={onThemeSwitch}
37
35
  />
38
-
39
36
  {/* Sidebar and content area */}
40
37
  <EuiPageTemplate
41
38
  panelled={false}
@@ -48,6 +45,8 @@ export const WfoPageTemplate: FC<WfoPageTemplateProps> = ({
48
45
  <EuiPageTemplate.Sidebar
49
46
  css={{
50
47
  backgroundColor: theme.colors.body,
48
+ overflowY: 'auto',
49
+ maxHeight: `calc(100vh - ${navigationHeight}px)`,
51
50
  }}
52
51
  >
53
52
  <WfoSidebar overrideMenuItems={overrideMenuItems} />
@@ -56,6 +55,8 @@ export const WfoPageTemplate: FC<WfoPageTemplateProps> = ({
56
55
  <EuiPageTemplate.Section
57
56
  css={{
58
57
  backgroundColor: theme.colors.emptyShade,
58
+ overflowY: 'auto',
59
+ maxHeight: `calc(100vh - ${navigationHeight}px)`,
59
60
  }}
60
61
  >
61
62
  <WfoBreadcrumbs
@@ -6,7 +6,7 @@ import {
6
6
  SubscriptionKeyValueBlock,
7
7
  WfoCustomerDescriptionsField,
8
8
  WfoInSyncField,
9
- WfoInlineNoteEdit,
9
+ WfoSubscriptionDetailNoteEdit,
10
10
  WfoSubscriptionStatusBadge,
11
11
  } from '@/components';
12
12
  import { SubscriptionDetail } from '@/types';
@@ -35,7 +35,6 @@ export const WfoSubscriptionDetailSection = ({
35
35
  status,
36
36
  customer,
37
37
  customerDescriptions,
38
- note,
39
38
  } = subscriptionDetail;
40
39
 
41
40
  const subscriptionDetailBlockData = [
@@ -102,9 +101,9 @@ export const WfoSubscriptionDetailSection = ({
102
101
  {
103
102
  key: t('note'),
104
103
  value: (
105
- <WfoInlineNoteEdit
104
+ <WfoSubscriptionDetailNoteEdit
106
105
  subscriptionId={subscriptionId}
107
- value={note}
106
+ onlyShowOnHover={true}
108
107
  />
109
108
  ),
110
109
  },
@@ -10,24 +10,26 @@ import {
10
10
  Pagination,
11
11
  WfoDateTime,
12
12
  WfoInlineJson,
13
- WfoInlineNoteEdit,
14
13
  WfoInsyncIcon,
15
14
  WfoJsonCodeBlock,
16
15
  WfoSubscriptionStatusBadge,
17
16
  getPageIndexChangeHandler,
18
17
  getPageSizeChangeHandler,
19
18
  } from '@/components';
19
+ import { WfoSubscriptionNoteEdit } from '@/components/WfoInlineNoteEdit/WfoSubscriptionNoteEdit';
20
20
  import { WfoAdvancedTable } from '@/components/WfoTable/WfoAdvancedTable';
21
21
  import { WfoAdvancedTableColumnConfig } from '@/components/WfoTable/WfoAdvancedTable/types';
22
22
  import { ColumnType } from '@/components/WfoTable/WfoTable';
23
23
  import { mapSortableAndFilterableValuesToTableColumnConfig } from '@/components/WfoTable/WfoTable/utils';
24
24
  import { DataDisplayParams, useShowToastMessage } from '@/hooks';
25
+ import { UseQuery } from '@/rtk';
25
26
  import {
27
+ SubscriptionListResponse,
26
28
  useGetSubscriptionListQuery,
27
29
  useLazyGetSubscriptionListQuery,
28
30
  } from '@/rtk/endpoints/subscriptionList';
29
31
  import { mapRtkErrorToWfoError } from '@/rtk/utils';
30
- import { GraphqlQueryVariables, SortOrder } from '@/types';
32
+ import { GraphqlQueryVariables, SortOrder, Subscription } from '@/types';
31
33
  import {
32
34
  getQueryVariablesForExport,
33
35
  getTypedFieldFromObject,
@@ -150,13 +152,21 @@ export const WfoSubscriptionsList: FC<WfoSubscriptionsListProps> = ({
150
152
  note: {
151
153
  columnType: ColumnType.DATA,
152
154
  label: t('note'),
153
- renderData: (cellValue, row) => (
154
- <WfoInlineNoteEdit
155
- subscriptionId={row.subscriptionId}
156
- value={cellValue}
157
- onlyShowOnHover={true}
158
- />
159
- ),
155
+ renderData: (cellValue, row) => {
156
+ return (
157
+ <WfoSubscriptionNoteEdit
158
+ queryVariables={graphqlQueryVariables}
159
+ subscriptionId={row.subscriptionId}
160
+ onlyShowOnHover={true}
161
+ useQuery={
162
+ useGetSubscriptionListQuery as UseQuery<
163
+ SubscriptionListResponse,
164
+ Subscription
165
+ >
166
+ }
167
+ />
168
+ );
169
+ },
160
170
  },
161
171
  metadata: {
162
172
  columnType: ColumnType.DATA,
@@ -1 +1 @@
1
- export const ORCHESTRATOR_UI_LIBRARY_VERSION = '3.0.3';
1
+ export const ORCHESTRATOR_UI_LIBRARY_VERSION = '3.1.0';
@@ -20,6 +20,7 @@
20
20
  "lightMode": "Light mode",
21
21
  "websocketConnected": "This page receives live updates from the server",
22
22
  "websocketDisconnected": "The connection to the server is lost, click the icon or refresh the page",
23
+ "websocketDisconnectedShort": "WebSocket disconnected, click the icon to reconnect",
23
24
  "resetToDefault": "Reset to default",
24
25
  "savePreferences": "Save preferences",
25
26
  "numberOfRows": "Number of rows",
@@ -20,6 +20,7 @@
20
20
  "lightMode": "Light mode",
21
21
  "websocketConnected": "De pagina ontvangt live updates van de server",
22
22
  "websocketDisconnected": "De websocket verbinding is verbroken, klik op het icoon of ververs de pagina.",
23
+ "websocketDisconnectedShort": "WebSocket verbroken, klik op het icoon om opnieuw te verbinden.",
23
24
  "resetToDefault": "Reset naar standaard",
24
25
  "savePreferences": "Voorkeuren opslaan",
25
26
  "numberOfRows": "Aantal rijen",
package/src/rtk/api.ts CHANGED
@@ -3,10 +3,12 @@ import { GraphQLErrorExtensions } from 'graphql/error/GraphQLError';
3
3
  import { getSession, signOut } from 'next-auth/react';
4
4
 
5
5
  import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
6
+ import { ErrorResponse } from '@rtk-query/graphql-request-base-query/dist/GraphqlBaseQueryTypes';
6
7
 
8
+ import { SubscriptionListItem } from '@/components';
7
9
  import type { WfoSession } from '@/hooks';
8
10
  import { wfoGraphqlRequestBaseQuery } from '@/rtk/wfoGraphqlRequestBaseQuery';
9
- import { CacheTagType } from '@/types';
11
+ import { CacheTagType, GraphqlQueryVariables } from '@/types';
10
12
 
11
13
  import type { RootState } from './store';
12
14
 
@@ -28,6 +30,34 @@ export enum HttpStatus {
28
30
  MultipleChoices = 300,
29
31
  }
30
32
 
33
+ export interface ApiResult<T> {
34
+ data?: T;
35
+ error?: ErrorResponse;
36
+ isLoading: boolean;
37
+ isFetching: boolean;
38
+ isError: boolean;
39
+ refetch?: () => void;
40
+ selectFromResult?: (result: T) => T;
41
+ endpointName?: string;
42
+ }
43
+
44
+ interface UseQueryOptions<T, U> {
45
+ selectFromResult?: (
46
+ result: ApiResult<T>,
47
+ ) => Partial<ApiResult<T>> & { selectedItem?: U };
48
+ subscriptionId?: string;
49
+ }
50
+
51
+ interface UseQueryReturn<T, U> extends ApiResult<T> {
52
+ selectedItem?: U;
53
+ endpointName?: string;
54
+ }
55
+
56
+ export type UseQuery<T, U> = (
57
+ queryVariables?: GraphqlQueryVariables<SubscriptionListItem>,
58
+ options?: UseQueryOptions<T, U>,
59
+ ) => UseQueryReturn<T, U>;
60
+
31
61
  type ExtraOptions = {
32
62
  baseQueryType?: BaseQueryTypes;
33
63
  apiName?: string;
@@ -50,7 +50,7 @@ const streamMessagesApi = orchestratorApi.injectEndpoints({
50
50
  endpoints: (build) => ({
51
51
  streamMessages: build.query<boolean, void>({
52
52
  queryFn: () => {
53
- return { data: false };
53
+ return { data: true };
54
54
  },
55
55
  async onCacheEntryAdded(
56
56
  _,