@orchestrator-ui/orchestrator-ui-components 0.2.7 → 0.3.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.
Files changed (210) hide show
  1. package/.turbo/turbo-build.log +10 -9
  2. package/.turbo/turbo-lint.log +2 -5
  3. package/.turbo/turbo-test.log +15 -10
  4. package/CHANGELOG.md +17 -0
  5. package/dist/index.d.ts +1464 -337
  6. package/dist/index.js +37266 -8348
  7. package/package.json +38 -31
  8. package/src/api/axios.ts +2 -8
  9. package/src/api/index.ts +59 -4
  10. package/src/components/WfoBadges/WfoBadge/WfoBadge.tsx +4 -1
  11. package/src/components/WfoBadges/index.ts +1 -0
  12. package/src/components/WfoDiff/WfoDiff.tsx +119 -0
  13. package/src/components/WfoDiff/index.ts +1 -0
  14. package/src/components/WfoDiff/unidiff.d.ts +1 -0
  15. package/src/components/WfoError/WfoError.stories.tsx +26 -0
  16. package/src/components/WfoError/WfoError.tsx +19 -0
  17. package/src/components/WfoError/index.ts +1 -0
  18. package/src/components/WfoFilterTabs/WfoFilterTabs.tsx +4 -2
  19. package/src/components/WfoForms/AutoFieldLoader.tsx +5 -1
  20. package/src/components/WfoForms/CreateForm.tsx +1 -0
  21. package/src/components/WfoForms/UserInputForm.tsx +88 -45
  22. package/src/components/WfoForms/UserInputFormWizard.tsx +11 -4
  23. package/src/components/WfoForms/formFields/AcceptField.tsx +8 -5
  24. package/src/components/WfoForms/formFields/BoolField.tsx +1 -1
  25. package/src/components/WfoForms/formFields/ImsNodeIdField.tsx +2 -2
  26. package/src/components/WfoForms/formFields/ImsPortIdField.tsx +238 -0
  27. package/src/components/WfoForms/formFields/ImsPortIdFieldStyling.ts +17 -0
  28. package/src/components/WfoForms/formFields/ListAddField.tsx +1 -1
  29. package/src/components/WfoForms/formFields/ListDelField.tsx +1 -1
  30. package/src/components/WfoForms/formFields/OptGroupField.tsx +1 -1
  31. package/src/components/WfoForms/formFields/SplitPrefix.tsx +2 -1
  32. package/src/components/WfoForms/formFields/SubscriptionField.tsx +10 -4
  33. package/src/components/WfoForms/formFields/SummaryField.tsx +103 -0
  34. package/src/components/WfoForms/formFields/SummaryFieldStyling.ts +46 -0
  35. package/src/components/WfoForms/formFields/VlanField.tsx +10 -10
  36. package/src/components/WfoForms/formFields/index.ts +2 -0
  37. package/src/components/WfoForms/formFields/surf/types.ts +26 -0
  38. package/src/components/WfoForms/formFields/utils.spec.ts +89 -9
  39. package/src/components/WfoJsonCodeBlock/index.ts +1 -0
  40. package/src/components/WfoKeyValueTable/WfoValueCell.tsx +2 -2
  41. package/src/components/WfoOptionalLink/WfoOptionalLink.tsx +20 -0
  42. package/src/components/WfoOptionalLink/index.ts +1 -0
  43. package/src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx +5 -2
  44. package/src/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo.tsx +28 -0
  45. package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +23 -19
  46. package/src/components/WfoPageTemplate/WfoPageHeader/styles.ts +29 -0
  47. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts +12 -0
  48. package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.ts +5 -0
  49. package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +14 -14
  50. package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +15 -12
  51. package/src/components/WfoPageTemplate/paths.ts +3 -2
  52. package/src/components/{WfoProcessesList/WfoProcessList.tsx → WfoProcessList/WfoProcessesList.tsx} +46 -38
  53. package/src/components/WfoProcessList/index.ts +1 -0
  54. package/src/components/{WfoProcessesList → WfoProcessList}/processListObjectMappers.ts +5 -3
  55. package/src/components/WfoSearchBar/WfoSearchField.tsx +27 -37
  56. package/src/components/{WfoSettingsPage → WfoSettings}/WfoEngineStatusButton.tsx +7 -4
  57. package/src/components/{WfoSettingsPage → WfoSettings}/WfoFlushSettings.tsx +29 -18
  58. package/src/components/WfoSettings/WfoModifySettings.tsx +38 -0
  59. package/src/components/WfoSettings/WfoSettings.tsx +40 -0
  60. package/src/components/{WfoSettingsPage → WfoSettings}/WfoStatus.tsx +21 -14
  61. package/src/components/WfoSettingsModal/WfoSubmitModal.tsx +61 -0
  62. package/src/components/WfoSettingsModal/index.tsx +1 -0
  63. package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +14 -11
  64. package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +11 -18
  65. package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +4 -1
  66. package/src/components/WfoSubscription/WfoSubscription.tsx +38 -66
  67. package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +41 -33
  68. package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +34 -28
  69. package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +96 -91
  70. package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +26 -0
  71. package/src/components/WfoSubscription/subscriptionDetailTabs.tsx +29 -0
  72. package/src/components/WfoSubscription/utils/utils.spec.ts +24 -0
  73. package/src/components/WfoSubscription/utils/utils.ts +21 -5
  74. package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +42 -48
  75. package/src/components/WfoSubscriptionsList/index.ts +1 -1
  76. package/src/components/WfoSubscriptionsList/{mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts → mapGraphQlSubscriptionsResultToSubscriptionListItems.ts} +8 -1
  77. package/src/components/WfoSubscriptionsList/subscriptionListTabs.ts +8 -30
  78. package/src/components/WfoSummary/WfoSummaryCardHeader/WfoSummaryCardHeader.tsx +55 -0
  79. package/src/components/WfoSummary/WfoSummaryCardHeader/index.ts +1 -0
  80. package/src/components/WfoSummary/WfoSummaryCardHeader/styles.ts +26 -0
  81. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardList.tsx +86 -0
  82. package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardListItem.tsx +59 -0
  83. package/src/components/WfoSummary/WfoSummaryCardList/index.ts +2 -0
  84. package/src/components/WfoSummary/WfoSummaryCardList/styles.ts +52 -0
  85. package/src/components/WfoSummary/WfoSummaryCards.tsx +111 -0
  86. package/src/components/WfoSummary/getNumberOfColumns.ts +14 -0
  87. package/src/components/WfoSummary/index.ts +4 -0
  88. package/src/components/WfoSummary/styles.ts +13 -0
  89. package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +18 -16
  90. package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +2 -2
  91. package/src/components/WfoTable/WfoBasicTable/index.ts +1 -0
  92. package/src/components/WfoTable/WfoBasicTable/styles.ts +28 -2
  93. package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +12 -3
  94. package/src/components/WfoTable/WfoFirstPartUUID/styles.ts +12 -0
  95. package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +32 -23
  96. package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +95 -0
  97. package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +60 -0
  98. package/src/components/WfoTable/index.ts +2 -0
  99. package/src/components/WfoTable/utils/columns.ts +21 -15
  100. package/src/components/WfoTable/utils/constants.ts +4 -2
  101. package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +5 -3
  102. package/src/components/WfoTable/utils/tableUtils.ts +3 -3
  103. package/src/components/WfoTextAnchor/WfoTextAnchor.stories.tsx +18 -0
  104. package/src/components/WfoTextAnchor/WfoTextAnchor.tsx +22 -0
  105. package/src/components/WfoTextAnchor/index.ts +1 -0
  106. package/src/components/WfoTextAnchor/styles.ts +17 -0
  107. package/src/components/WfoTimeline/styles.ts +10 -4
  108. package/src/components/WfoTree/WfoTreeNode.tsx +1 -4
  109. package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +42 -26
  110. package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +48 -0
  111. package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +10 -10
  112. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +22 -23
  113. package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +97 -17
  114. package/src/components/WfoWorkflowSteps/index.ts +1 -0
  115. package/src/components/WfoWorkflowSteps/stepListUtils.ts +1 -28
  116. package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +3 -3
  117. package/src/components/index.ts +9 -2
  118. package/src/contexts/ApiClientContext.tsx +5 -1
  119. package/src/contexts/ConfirmationDialogProvider.tsx +2 -2
  120. package/src/contexts/OrchestratorConfigContext.tsx +0 -3
  121. package/src/contexts/ToastContext.tsx +1 -1
  122. package/src/contexts/TreeContext.tsx +6 -1
  123. package/src/graphqlQueries/customersQuery.ts +2 -1
  124. package/src/graphqlQueries/index.ts +1 -0
  125. package/src/graphqlQueries/processDetailQuery.ts +8 -0
  126. package/src/graphqlQueries/processListQuery.ts +48 -7
  127. package/src/graphqlQueries/processStepsQuery.ts +22 -0
  128. package/src/graphqlQueries/productBlocksQuery.ts +11 -5
  129. package/src/graphqlQueries/productsQuery.ts +42 -7
  130. package/src/graphqlQueries/relatedSubscriptionsQuery.ts +2 -2
  131. package/src/graphqlQueries/resourceTypesQuery.ts +10 -4
  132. package/src/graphqlQueries/subscriptionDetailQuery.ts +5 -1
  133. package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +2 -1
  134. package/src/graphqlQueries/subscriptionsListQuery.ts +46 -7
  135. package/src/graphqlQueries/workflows/workflowsQuery.ts +10 -4
  136. package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +3 -6
  137. package/src/hooks/DataFetchHooks.ts +20 -61
  138. package/src/hooks/index.ts +3 -0
  139. package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +1 -0
  140. package/src/hooks/surf/useIsTaggedPort.ts +1 -2
  141. package/src/hooks/useCheckEngineStatus.ts +30 -0
  142. package/src/hooks/useDataDisplayParams.ts +3 -3
  143. package/src/hooks/useEngineStatusQuery.ts +9 -7
  144. package/src/hooks/useMutateProcess.ts +96 -0
  145. package/src/hooks/useOrchestratorConfig.ts +0 -3
  146. package/src/hooks/useQueryWithGraphql.ts +25 -13
  147. package/src/hooks/useSessionWithToken.ts +3 -5
  148. package/src/hooks/useSubscriptionActions.ts +8 -2
  149. package/src/icons/WfoBell.tsx +34 -0
  150. package/src/icons/WfoContactEnvelopeFill.tsx +29 -0
  151. package/src/icons/WfoPencil.tsx +21 -0
  152. package/src/icons/WfoSideMenu.stories.tsx +13 -0
  153. package/src/icons/WfoSideMenu.tsx +39 -0
  154. package/src/icons/WfoStatistic.tsx +3 -3
  155. package/src/icons/WfoViewList.tsx +24 -0
  156. package/src/icons/index.ts +6 -0
  157. package/src/messages/{en-US.json → en-GB.json} +117 -39
  158. package/src/messages/getTranslationMessages.spec.ts +25 -40
  159. package/src/messages/index.ts +1 -1
  160. package/src/messages/nl-NL.json +126 -49
  161. package/src/messages/useGetTranslationMessages.ts +51 -0
  162. package/src/pages/index.ts +2 -1
  163. package/src/pages/metadata/WfoProductBlocksPage.tsx +17 -19
  164. package/src/pages/metadata/WfoProductsPage.tsx +30 -34
  165. package/src/pages/metadata/WfoResourceTypesPage.tsx +16 -18
  166. package/src/pages/metadata/WfoWorkflowsPage.tsx +18 -19
  167. package/src/pages/processes/WfoProcessDetail.tsx +101 -80
  168. package/src/pages/processes/WfoProcessDetailPage.tsx +35 -17
  169. package/src/pages/processes/WfoStartProcessPage.tsx +251 -0
  170. package/src/pages/processes/index.ts +1 -3
  171. package/src/pages/settings/WfoSettingsPage.tsx +30 -0
  172. package/src/pages/settings/index.ts +1 -0
  173. package/src/pages/startPage/WfoStartPage.tsx +239 -0
  174. package/src/pages/startPage/index.ts +1 -0
  175. package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +22 -26
  176. package/src/pages/tasks/WfoTasksListPage.tsx +169 -0
  177. package/src/pages/tasks/getTasksListTabTypeFromString.ts +19 -0
  178. package/src/pages/tasks/index.ts +3 -1
  179. package/src/pages/tasks/tabConfig.ts +51 -0
  180. package/src/pages/{processes/WfoProcessListPage.tsx → workflows/WfoWorkflowsListPage.tsx} +30 -32
  181. package/src/pages/workflows/getWorkflowsListTabTypeFromString.ts +19 -0
  182. package/src/pages/workflows/index.ts +1 -0
  183. package/src/pages/{processes → workflows}/tabConfig.ts +9 -9
  184. package/src/theme/defaultOrchestratorTheme.ts +8 -0
  185. package/src/types/types.ts +38 -53
  186. package/src/utils/date.ts +39 -0
  187. package/src/utils/getDefaultTableConfig.ts +19 -9
  188. package/tsconfig.json +4 -4
  189. package/src/components/WfoSettingsPage/WfoModifySettings.tsx +0 -33
  190. package/src/components/WfoSettingsPage/WfoSettings.tsx +0 -40
  191. package/src/components/WfoStartPage/WfoFrequentlyUsed.stories.tsx +0 -16
  192. package/src/components/WfoStartPage/WfoFrequentlyUsed.tsx +0 -21
  193. package/src/components/WfoStartPage/WfoListItemStartPage.stories.tsx +0 -40
  194. package/src/components/WfoStartPage/WfoListItemStartPage.tsx +0 -95
  195. package/src/components/WfoStartPage/WfoListStartPage.stories.tsx +0 -98
  196. package/src/components/WfoStartPage/WfoListStartPage.tsx +0 -45
  197. package/src/components/WfoStartPage/WfoMultiListSection.stories.tsx +0 -90
  198. package/src/components/WfoStartPage/WfoMultiListSection.tsx +0 -25
  199. package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +0 -13
  200. package/src/components/WfoStartPage/WfoNewProcessPanel.tsx +0 -45
  201. package/src/components/WfoStartPage/WfoStatCards.stories.tsx +0 -13
  202. package/src/components/WfoStartPage/WfoStatCards.tsx +0 -75
  203. package/src/components/WfoStartPage/index.ts +0 -6
  204. package/src/hooks/ProcessesHooks/useDeleteProcess.ts +0 -37
  205. package/src/messages/getTranslationMessages.ts +0 -26
  206. package/src/pages/processes/getProcessListTabTypeFromString.ts +0 -19
  207. package/src/pages/tasks/WfoTaskListPage.tsx +0 -120
  208. package/src/pages/workflow/WfoStartWorkflowPage.tsx +0 -177
  209. package/src/pages/workflow/index.ts +0 -1
  210. /package/src/components/{WfoSettingsPage → WfoSettings}/index.ts +0 -0
@@ -166,8 +166,9 @@ function SubscriptionFieldDefinition({
166
166
  ].includes(subscription.product.tag as ProductTag)
167
167
  ) {
168
168
  const portMode = getPortMode(subscription.productBlockInstances);
169
- return `${subscriptionSubstring} ${portMode?.toUpperCase()} ${description.trim()} ${subscription
170
- .customer?.fullname}`;
169
+ return `${subscriptionSubstring} ${portMode?.toUpperCase()} ${description.trim()} ${
170
+ subscription.customer?.fullname
171
+ }`;
171
172
  } else {
172
173
  return description.trim();
173
174
  }
@@ -234,7 +235,10 @@ function SubscriptionFieldDefinition({
234
235
  )
235
236
  ) {
236
237
  return false;
237
- } else if (portMode !== visiblePortMode) {
238
+ } else if (
239
+ portMode !== visiblePortMode &&
240
+ visiblePortMode !== 'normal'
241
+ ) {
238
242
  return false;
239
243
  }
240
244
  }
@@ -250,7 +254,8 @@ function SubscriptionFieldDefinition({
250
254
  if (parentName !== name) {
251
255
  if (
252
256
  parent.fieldType === Array &&
253
- // @ts-ignore
257
+ // @ts-expect-error Parent field can have the uniqueItems boolean property but this is not part of JSONSchema6 type
258
+ // TODO: Figure out why this is so
254
259
  parent.uniqueItems
255
260
  ) {
256
261
  const allValues: string[] = get(model, parentName, []);
@@ -277,6 +282,7 @@ function SubscriptionFieldDefinition({
277
282
  };
278
283
 
279
284
  const options = getSubscriptionOptions();
285
+
280
286
  const selectedValue = options.find(
281
287
  (option: Option) => option.value === value,
282
288
  );
@@ -0,0 +1,103 @@
1
+ /*
2
+ * Copyright 2019-2023 SURF.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ *
14
+ */
15
+ import React from 'react';
16
+
17
+ import { FieldProps, connectField, filterDOMProps } from 'uniforms';
18
+
19
+ import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
20
+
21
+ import { getStyles } from '@/components/WfoForms/formFields/SummaryFieldStyling';
22
+ import { useWithOrchestratorTheme } from '@/hooks';
23
+
24
+ export type SummaryFieldProps = FieldProps<
25
+ null,
26
+ {
27
+ description?: string;
28
+ data?: { headers: string[]; labels: string[]; columns: string[][] };
29
+ }
30
+ >;
31
+
32
+ // onChange not used on purpose
33
+ function Summary({
34
+ id,
35
+ label,
36
+ description,
37
+ data,
38
+ ...props
39
+ }: SummaryFieldProps) {
40
+ const { summaryFieldStyle } = useWithOrchestratorTheme(getStyles);
41
+
42
+ if (!data) {
43
+ return null;
44
+ }
45
+
46
+ const { headers, labels, columns } = data;
47
+
48
+ const extraColumnsData = columns.filter((_, index) => index !== 0);
49
+
50
+ const rows = columns[0].map((row, index) => (
51
+ <tr key={index}>
52
+ {labels && <td className={`label`}>{labels[index]}</td>}
53
+ <td className={`value`}>
54
+ {row.includes('<!doctype html>') ? (
55
+ <div
56
+ className="emailMessage"
57
+ dangerouslySetInnerHTML={{ __html: row }}
58
+ ></div>
59
+ ) : (
60
+ row
61
+ )}
62
+ </td>
63
+ {extraColumnsData &&
64
+ extraColumnsData.map((_, idx) => (
65
+ <td className={`value`} key={idx}>
66
+ {extraColumnsData[idx][index]}
67
+ </td>
68
+ ))}
69
+ </tr>
70
+ ));
71
+
72
+ const tableHeader =
73
+ !headers || headers.length === 0 ? null : (
74
+ <tr>
75
+ {labels && <th />}
76
+ {headers.map((header, idx) => (
77
+ <th key={idx}>{header}</th>
78
+ ))}
79
+ </tr>
80
+ );
81
+
82
+ return (
83
+ <EuiFlexItem css={summaryFieldStyle}>
84
+ <section {...filterDOMProps(props)}>
85
+ <EuiFormRow
86
+ label={label}
87
+ labelAppend={<EuiText size="m">{description}</EuiText>}
88
+ id={id}
89
+ fullWidth
90
+ >
91
+ <section className="table-summary">
92
+ <table id={`${id}-table`}>
93
+ <thead>{tableHeader}</thead>
94
+ <tbody>{rows}</tbody>
95
+ </table>
96
+ </section>
97
+ </EuiFormRow>
98
+ </section>
99
+ </EuiFlexItem>
100
+ );
101
+ }
102
+
103
+ export const SummaryField = connectField(Summary, { kind: 'leaf' });
@@ -0,0 +1,46 @@
1
+ import { tint } from '@elastic/eui';
2
+ import { EuiThemeComputed } from '@elastic/eui/src/services/theme/types';
3
+ import { css } from '@emotion/react';
4
+
5
+ export const getStyles = (theme: EuiThemeComputed) => {
6
+ const toShadeColor = (color: string) => tint(color, 0.9);
7
+
8
+ const summaryFieldStyle = css({
9
+ 'div.emailMessage': {
10
+ td: {
11
+ color: theme.colors.text,
12
+ },
13
+ p: {
14
+ color: theme.colors.text,
15
+ },
16
+ html: {
17
+ marginLeft: '-10px',
18
+ },
19
+ },
20
+ 'section.table-summary': {
21
+ marginTop: '20px',
22
+ width: '100%',
23
+ td: {
24
+ padding: '10px',
25
+ verticalAlign: 'top',
26
+ },
27
+ 'td:not(:first-child):not(:last-child)': {
28
+ borderRight: `1px solid ${theme.colors.lightestShade}`,
29
+ },
30
+ '.label': {
31
+ fontWeight: 'bold',
32
+ color: theme.colors.lightestShade,
33
+ backgroundColor: theme.colors.primary,
34
+ borderRight: `2px solid ${theme.colors.lightestShade}`,
35
+ borderBottom: `1px solid ${theme.colors.lightestShade}`,
36
+ },
37
+ '.value': {
38
+ backgroundColor: toShadeColor(theme.colors.primary),
39
+ borderBottom: `1px solid ${theme.colors.lightestShade}`,
40
+ },
41
+ },
42
+ });
43
+ return {
44
+ summaryFieldStyle: summaryFieldStyle,
45
+ };
46
+ };
@@ -210,20 +210,20 @@ function Vlan({
210
210
  const placeholder = imsIsLoading
211
211
  ? t('widgets.vlan.loadingIms')
212
212
  : subscriptionId
213
- ? t('widgets.vlan.placeholder')
214
- : t('widgets.vlan.placeholderNoServicePort');
213
+ ? t('widgets.vlan.placeholder')
214
+ : t('widgets.vlan.placeholderNoServicePort');
215
215
 
216
216
  const errorMessageExtra = missingInIms
217
217
  ? t('widgets.vlan.missingInIms')
218
218
  : !validFormat
219
- ? t('widgets.vlan.invalidVlan')
220
- : vlansInUse.length
221
- ? vlansInUse.length >= 1 && vlansInUse[0] === 0
222
- ? t('widgets.vlan.untaggedPortInUse')
223
- : t('widgets.vlan.vlansInUseError', {
224
- vlans: vlanRangeFromNumbers(vlansInUse),
225
- })
226
- : undefined;
219
+ ? t('widgets.vlan.invalidVlan')
220
+ : vlansInUse.length
221
+ ? vlansInUse.length >= 1 && vlansInUse[0] === 0
222
+ ? t('widgets.vlan.untaggedPortInUse')
223
+ : t('widgets.vlan.vlansInUseError', {
224
+ vlans: vlanRangeFromNumbers(vlansInUse),
225
+ })
226
+ : undefined;
227
227
 
228
228
  let message = '';
229
229
  if (!imsIsLoading) {
@@ -21,9 +21,11 @@ export * from './TimestampField';
21
21
  export * from './OrganisationField';
22
22
  export * from './ContactPersonNameField';
23
23
  export * from './ImsNodeIdField';
24
+ export * from './ImsPortIdField';
24
25
  export * from './LocationCodeField';
25
26
  export * from './VlanField';
26
27
  export * from './NestField';
27
28
  export * from './OptGroupField';
28
29
  export * from './SubscriptionField';
29
30
  export * from './IpNetworkField';
31
+ export * from './SummaryField';
@@ -1,3 +1,19 @@
1
+ import { ProductDefinition } from '../../../../types';
2
+
3
+ export interface NodeSubscription {
4
+ name: string;
5
+ subscription_id: string;
6
+ description: string;
7
+ product: ProductDefinition;
8
+ product_id: string;
9
+ status: string;
10
+ insync: boolean;
11
+ customer_id: string;
12
+ start_date: number;
13
+ end_date: number;
14
+ note: string;
15
+ }
16
+
1
17
  export interface ServicePort {
2
18
  subscription_id?: string;
3
19
  vlan?: string;
@@ -22,6 +38,16 @@ export enum ProductTag {
22
38
  AGGSPNL = 'AGGSPNL',
23
39
  }
24
40
 
41
+ export interface ImsPort {
42
+ id: number;
43
+ line_name: string;
44
+ node: string;
45
+ port: string;
46
+ iface_type: string;
47
+ patchposition: string;
48
+ status: string;
49
+ }
50
+
25
51
  export interface ImsNode {
26
52
  id: number;
27
53
  name: string;
@@ -1,4 +1,5 @@
1
- import type { ProductBlockInstance, SubscriptionDetail } from '../../../types';
1
+ import type { ProductBlockInstance, SubscriptionDetail } from '@/types';
2
+
2
3
  import {
3
4
  ProcessStatus,
4
5
  ProductLifecycleStatus,
@@ -7,19 +8,25 @@ import {
7
8
  } from '../../../types';
8
9
  import { ProductTag } from './surf/types';
9
10
  import {
11
+ getPortMode,
10
12
  subscriptionHasTaggedPortModeInstanceValue,
11
13
  subscriptionHasTaggedProduct,
12
14
  } from './utils';
13
15
 
16
+ const getProductBlockInstance = (
17
+ instanceProperties: Partial<ProductBlockInstance> = {},
18
+ ): ProductBlockInstance => ({
19
+ id: 1,
20
+ ownerSubscriptionId: 'ProductBlockInstanceId 1',
21
+ parent: 0,
22
+ productBlockInstanceValues: [],
23
+ subscriptionInstanceId: 'testId',
24
+ inUseByRelations: [],
25
+ ...instanceProperties,
26
+ });
27
+
14
28
  const testProductBlockInstances: ProductBlockInstance[] = [
15
- {
16
- id: 1,
17
- ownerSubscriptionId: 'ProductBlockInstanceId 1',
18
- parent: 0,
19
- productBlockInstanceValues: [],
20
- subscriptionInstanceId: 'testId',
21
- inUseByRelations: [],
22
- },
29
+ getProductBlockInstance(),
23
30
  ];
24
31
 
25
32
  const testSubscriptionDetail: SubscriptionDetail = {
@@ -51,12 +58,85 @@ const testSubscriptionDetail: SubscriptionDetail = {
51
58
  createdBy: 'Test',
52
59
  workflowTarget: WorkflowTarget.CREATE,
53
60
  workflowName: 'Test workflow name',
61
+ isTask: false,
54
62
  },
55
63
  ],
56
64
  },
57
65
  };
58
66
 
59
67
  describe('formField utils', () => {
68
+ describe('getPortMode()', () => {
69
+ it('returns undefined if the productBlockInstances is an empty array', () => {
70
+ const result = getPortMode([]);
71
+ expect(result).toEqual(undefined);
72
+ });
73
+
74
+ it('returns undefined if the productBlockInstances dont contain a productBlockInstanceValues', () => {
75
+ const result = getPortMode([
76
+ getProductBlockInstance({
77
+ productBlockInstanceValues: [
78
+ {
79
+ field: 'key1',
80
+ value: 'value1',
81
+ },
82
+ ],
83
+ }),
84
+ ]);
85
+ expect(result).toEqual(undefined);
86
+ });
87
+
88
+ it('returns undefined if the productBlockInstances dont contain productBlockInstanceValues but none with portMode', () => {
89
+ const result = getPortMode([
90
+ getProductBlockInstance({
91
+ productBlockInstanceValues: [
92
+ {
93
+ field: 'portMode',
94
+ value: 'NOTTAGGED',
95
+ },
96
+ ],
97
+ }),
98
+ ]);
99
+ expect(result).toEqual('NOTTAGGED');
100
+ });
101
+
102
+ it('returns undefined if the last portMode if there are more than one productBlockInstanceValue with portmode', () => {
103
+ const result = getPortMode([
104
+ getProductBlockInstance({
105
+ productBlockInstanceValues: [
106
+ {
107
+ field: 'portMode',
108
+ value: 'FIRST',
109
+ },
110
+ ],
111
+ }),
112
+ getProductBlockInstance({
113
+ productBlockInstanceValues: [
114
+ {
115
+ field: 'portMode',
116
+ value: 'SECOND',
117
+ },
118
+ ],
119
+ }),
120
+ ]);
121
+ expect(result).toEqual('SECOND');
122
+ });
123
+
124
+ it('returns undefined if the productBlockInstances dont contain a portMode field', () => {
125
+ const result = getPortMode([
126
+ ...testProductBlockInstances,
127
+ {
128
+ id: 1,
129
+ ownerSubscriptionId: 'ProductBlockInstanceId 1',
130
+ parent: 0,
131
+ productBlockInstanceValues: [],
132
+ subscriptionInstanceId: 'testId',
133
+ inUseByRelations: [],
134
+ },
135
+ ]);
136
+ expect(result).toEqual(undefined);
137
+ });
138
+ });
139
+
60
140
  describe('subscriptionHasPortModeInstanceValue()', () => {
61
141
  it('returns false if the subscriptionDetail has no productBlockInstances', () => {
62
142
  const result = subscriptionHasTaggedPortModeInstanceValue(
@@ -0,0 +1 @@
1
+ export * from './WfoJsonCodeBlock';
@@ -21,11 +21,11 @@ export const WfoValueCell: FC<WfoValueCellProps> = ({
21
21
  }) => {
22
22
  const { theme } = useOrchestratorTheme();
23
23
  const {
24
- valueColumnStyle,
25
- valueCellStyle,
26
24
  clipboardIconStyle,
27
25
  clickable,
28
26
  getBackgroundColorStyleForRow,
27
+ valueColumnStyle,
28
+ valueCellStyle,
29
29
  } = getStyles(theme);
30
30
 
31
31
  const shouldRenderCopyColumn = enableCopyIcon && textToCopy;
@@ -0,0 +1,20 @@
1
+ import React, { FC, ReactNode } from 'react';
2
+
3
+ import Link from 'next/link';
4
+ import type { UrlObject } from 'url';
5
+
6
+ export type WfoOptionalLinkProps = {
7
+ children: ReactNode;
8
+ href?: UrlObject | string;
9
+ };
10
+
11
+ export const WfoOptionalLink: FC<WfoOptionalLinkProps> = ({
12
+ children,
13
+ href,
14
+ }) => {
15
+ if (!href) {
16
+ return <span>{children}</span>;
17
+ }
18
+
19
+ return <Link href={href}>{children}</Link>;
20
+ };
@@ -0,0 +1 @@
1
+ export * from './WfoOptionalLink';
@@ -25,8 +25,11 @@ export const WfoBreadcrumbs = () => {
25
25
  parts.forEach((p, index) => {
26
26
  if (index > 0) {
27
27
  const link = removeSuffix(parts.slice(0, index + 1).join('/'));
28
- // Handle UUID's: so you can have breadcrumb like: `Start / Subscriptions / 12312aa-cbc ...`
29
- const text = isUuid4(p) ? p : removeSuffix(upperCaseFirstChar(p));
28
+ // Handle UUID's: so you can have breadcrumb like: `Start / Subscriptions / b2312aa-cbc ...`
29
+ // first remove the suffix, like ?activeTab=....
30
+ const _p = removeSuffix(p);
31
+ const text = isUuid4(_p) ? _p : upperCaseFirstChar(_p);
32
+ // eslint-disable-next-line no-console
30
33
 
31
34
  breadcrumbs.push({
32
35
  text: text,
@@ -0,0 +1,28 @@
1
+ import React, { FC } from 'react';
2
+
3
+ export const WfoAppLogo: FC = () => (
4
+ <svg
5
+ width="64"
6
+ height="64"
7
+ viewBox="0 0 640 640"
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ >
11
+ <path
12
+ d="M354.832 276.683L360.538 287.948L359.342 289.144L350.731 280.784L354.832 276.683Z"
13
+ fill="#76B5E0"
14
+ />
15
+ <path
16
+ fillRule="evenodd"
17
+ clipRule="evenodd"
18
+ d="M314 128H326V144.077L346.283 151.332C369.967 159.802 392.949 170.121 415.016 182.193L437.191 194.324L457.599 173.916L466.084 182.401L444.445 204.041L447.319 212.963C458.702 248.31 474.148 282.216 493.347 314H512V326H494.455L479.094 369.434L455.768 455.642L435.097 460.957C396.477 470.887 359.666 486.806 326 508.123V512H314V507.22C278.543 479.763 236.412 462.268 191.965 456.521L177.181 471.305L168.696 462.82L182.781 448.735L178.858 430.061C170.982 392.571 155.435 357.146 133.225 326H128V314H133.231C160.297 276.391 177.89 232.762 184.461 186.82L184.848 184.112L189.665 183.666C233.34 179.627 275.675 166.567 314 145.341V128ZM202.539 445.947C242.755 452.568 280.91 468.411 314 492.244V473.216L290.911 456.231C282.445 450.003 272.889 445.414 262.735 442.701L217.795 430.692L202.539 445.947ZM223.816 419.218L220.283 411.232L220.205 411.31L203.692 365.949L182.106 324.487L209.836 263.925L220.609 229.096L250.516 259.003L247.951 276.471L259.312 281.643C259.366 281.313 259.417 280.983 259.466 280.652L261.092 269.578L280.603 289.089L289.027 280.543L272.597 264.113C290.854 263.844 308.123 255.788 320.058 241.986L320.416 242.326C326.029 247.645 334.392 254.783 343.006 258.57C346.645 260.171 350.671 261.323 354.722 262.155L365.634 251.672C359.394 251.031 352.909 249.816 347.836 247.585C340.856 244.516 333.312 238.102 327.751 232.737C327.142 232.15 326.558 231.575 326 231.019V192.603L349.031 206.751C357.495 211.95 366.707 215.817 376.346 218.216L414.942 227.823L416.766 231.72L417.01 231.476L428.441 264.125L454.962 322.358L435.039 366.132L418.078 409.592L417.67 409.185L413.333 419.221L370.63 430.485C358.819 433.601 347.703 438.922 337.869 446.167L326 454.912V413.269L369.867 395.097L360.505 385.986L326 400.28L326 352.404L319.555 346.132L314 351.776L314 397.517L303.919 390.42C298.125 386.34 291.71 383.263 284.945 381.296L275.035 391.364C282.944 392.589 290.464 395.623 297.01 400.232L314 412.193V457.525L298.401 446.05C288.665 438.888 277.675 433.611 265.998 430.49L223.816 419.218ZM326 470.61V494.005C358.966 474.008 394.715 458.95 432.109 449.335L439.062 447.547L421.62 430.106L373.853 442.706C363.583 445.415 353.917 450.042 345.366 456.342L326 470.61ZM427.836 419.351L447.764 439.279L467.629 365.861L481.727 326H467.19L446.687 371.051L427.836 419.351ZM465.043 314H479.389C461.412 283.226 446.827 250.582 435.896 216.641L434.909 213.576L426.928 221.558L440.181 259.408L465.043 314ZM416.363 215.152L428.349 203.166L409.257 192.721C387.741 180.95 365.334 170.889 342.242 162.631L326 156.822V177.77L355.647 195.982C363.006 200.503 371.017 203.865 379.399 205.952L416.363 215.152ZM314 175.391V158.982C279.328 177.284 241.657 189.241 202.767 194.283L222.749 214.264L255.145 205.567C261.978 203.732 268.553 201.044 274.715 197.566L314 175.391ZM314 189.904L280.928 208.572C273.842 212.572 266.28 215.663 258.422 217.773L233.065 224.581L260.604 252.12H271.652C287.114 252.12 301.774 245.239 311.653 233.345L314 230.516V189.904ZM210.505 218.991L194.003 202.49C186.351 242.412 170.649 280.354 147.865 314H173.007L198.004 259.408L210.505 218.991ZM168.644 326L192.099 371.051L210.345 421.171L192.914 438.602L190.601 427.593C182.967 391.252 168.422 356.769 147.811 326H168.644Z"
19
+ fill="#76B5E0"
20
+ />
21
+ <path
22
+ fillRule="evenodd"
23
+ clipRule="evenodd"
24
+ d="M217.061 279.988L198.893 323.312L236.306 407.902L319.312 323.568L402.325 404.358L439.577 318.177L402.325 238.609L369.47 270.173L392.538 315.708L385.493 336.836L319.327 272.592L252.74 340.151L245.423 323.568L252.74 296.229L217.061 279.988Z"
25
+ fill="white"
26
+ />
27
+ </svg>
28
+ );
@@ -9,11 +9,15 @@ import {
9
9
  EuiHeaderSectionItem,
10
10
  } from '@elastic/eui';
11
11
 
12
- import { useOrchestratorTheme } from '../../../hooks/useOrchestratorTheme';
13
- import { WfoLogoutIcon } from '../../../icons/WfoLogoutIcon';
14
- import { WfoEngineStatusBadge } from '../../WfoBadges/WfoEngineStatusBadge';
15
- import { WfoEnvironmentBadge } from '../../WfoBadges/WfoEnvironmentBadge';
16
- import { WfoFailedTasksBadge } from '../../WfoBadges/WfoFailedTasksBadge';
12
+ import {
13
+ WfoEngineStatusBadge,
14
+ WfoEnvironmentBadge,
15
+ WfoFailedTasksBadge,
16
+ } from '@/components';
17
+ import { WfoAppLogo } from '@/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo';
18
+ import { getWfoPageHeaderStyles } from '@/components/WfoPageTemplate/WfoPageHeader/styles';
19
+ import { useOrchestratorTheme, useWithOrchestratorTheme } from '@/hooks';
20
+ import { WfoLogoutIcon, WfoSideMenu } from '@/icons';
17
21
 
18
22
  export interface WfoPageHeaderProps {
19
23
  // todo: should be part of theme!
@@ -30,31 +34,29 @@ export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
30
34
  handleLogoutClick,
31
35
  }) => {
32
36
  const { theme, multiplyByBaseUnit } = useOrchestratorTheme();
37
+ const { getHeaderStyle, appNameStyle } = useWithOrchestratorTheme(
38
+ getWfoPageHeaderStyles,
39
+ );
40
+
33
41
  return (
34
- <EuiHeader
35
- css={{
36
- backgroundColor: theme.colors.primary,
37
- height: navigationHeight,
38
- }}
39
- >
42
+ <EuiHeader css={getHeaderStyle(navigationHeight)}>
40
43
  <EuiHeaderSection>
41
44
  <EuiHeaderSectionItem>
42
- <EuiHeaderLogo
43
- iconType={() => getAppLogo(navigationHeight)}
44
- />
45
+ <EuiHeaderLogo iconType={() => <WfoAppLogo />} />
46
+ <div css={appNameStyle}>{getAppLogo(navigationHeight)}</div>
45
47
  </EuiHeaderSectionItem>
48
+
46
49
  <EuiHeaderSectionItem>
47
50
  <WfoEnvironmentBadge />
48
51
  </EuiHeaderSectionItem>
49
52
 
50
53
  <EuiButtonIcon
51
- aria-label="Logout"
54
+ aria-label="Show/Hide side menu"
52
55
  display="empty"
53
56
  iconType={() => (
54
- <WfoLogoutIcon color={theme.colors.emptyShade} />
57
+ <WfoSideMenu color={theme.colors.emptyShade} />
55
58
  )}
56
59
  css={{ width: 48, height: 48, marginLeft: 10 }}
57
- color="ghost"
58
60
  onClick={handleSideMenuClick}
59
61
  />
60
62
  </EuiHeaderSection>
@@ -72,8 +74,10 @@ export const WfoPageHeader: FC<WfoPageHeaderProps> = ({
72
74
  iconType={() => (
73
75
  <WfoLogoutIcon color={theme.colors.emptyShade} />
74
76
  )}
75
- css={{ width: 48, height: 48 }}
76
- color="ghost"
77
+ css={{
78
+ width: 48,
79
+ height: 48,
80
+ }}
77
81
  onClick={handleLogoutClick}
78
82
  />
79
83
  </EuiHeaderSectionItem>
@@ -0,0 +1,29 @@
1
+ import { EuiThemeComputed } from '@elastic/eui/src/services/theme/types';
2
+ import { css } from '@emotion/react';
3
+
4
+ import { toHexColorWithOpacity } from './utils/toHexColorWithOpacity';
5
+
6
+ export const getWfoPageHeaderStyles = (theme: EuiThemeComputed) => {
7
+ const navigationBackgroundColor = '#04385F';
8
+
9
+ const appNameStyle = css({
10
+ paddingRight: theme.base,
11
+ marginRight: theme.base,
12
+ borderRight: `${theme.border.width.thick} solid ${toHexColorWithOpacity(
13
+ theme.colors.emptyShade,
14
+ 0.3,
15
+ )}`,
16
+ });
17
+
18
+ const getHeaderStyle = (navigationHeight: number) => {
19
+ return css({
20
+ backgroundColor: navigationBackgroundColor,
21
+ height: navigationHeight,
22
+ });
23
+ };
24
+
25
+ return {
26
+ appNameStyle,
27
+ getHeaderStyle,
28
+ };
29
+ };
@@ -0,0 +1,12 @@
1
+ import { toHexColorWithOpacity } from './toHexColorWithOpacity';
2
+
3
+ describe('toHexColorWithOpacity', () => {
4
+ it('returns hex color with opacity', () => {
5
+ const hexColor = '#ffffff';
6
+ const opacity = 0.3;
7
+
8
+ const result = toHexColorWithOpacity(hexColor, opacity);
9
+
10
+ expect(result).toEqual('#ffffff4d');
11
+ });
12
+ });
@@ -0,0 +1,5 @@
1
+ export const toHexColorWithOpacity = (hexColor: string, opacity: number) => {
2
+ const opacityHex = Math.round(opacity * 255).toString(16);
3
+
4
+ return `${hexColor}${opacityHex}`;
5
+ };