@orchestrator-ui/orchestrator-ui-components 0.2.3 → 0.2.5
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/.storybook/main.js +1 -1
- package/.turbo/turbo-build.log +9 -7
- package/.turbo/turbo-lint.log +3 -6
- package/.turbo/turbo-test.log +17 -9
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +1116 -359
- package/dist/index.js +23126 -6279
- package/jest.config.cjs +0 -1
- package/package.json +24 -8
- package/src/api/axios.ts +34 -0
- package/src/api/index.ts +170 -0
- package/src/components/WfoAuth/WfoAuth.tsx +22 -0
- package/src/components/WfoAuth/index.ts +1 -0
- package/src/components/{WFOBadges/WFOBadge/WFOBadge.stories.tsx → WfoBadges/WfoBadge/WfoBadge.stories.tsx} +5 -4
- package/src/components/{WFOBadges/WFOBadge/WFOBadge.tsx → WfoBadges/WfoBadge/WfoBadge.tsx} +4 -3
- package/src/components/WfoBadges/WfoBadge/index.ts +1 -0
- package/src/components/{WFOBadges/WFOEngineStatusBadge/WFOEngineStatusBadge.stories.tsx → WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.stories.tsx} +6 -4
- package/src/components/{WFOBadges/WFOEngineStatusBadge/WFOEngineStatusBadge.tsx → WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.tsx} +13 -7
- package/src/components/WfoBadges/WfoEngineStatusBadge/index.ts +1 -0
- package/src/components/{WFOBadges/WFOEnvironmentBadge/WFOEnvironmentBadge.stories.tsx → WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.stories.tsx} +6 -4
- package/src/components/{WFOBadges/WFOEnvironmentBadge/WFOEnvironmentBadge.tsx → WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.tsx} +8 -7
- package/src/components/WfoBadges/WfoEnvironmentBadge/index.ts +1 -0
- package/src/components/WfoBadges/WfoFailedTasksBadge/WfoFailedTasksBadge.stories.tsx +13 -0
- package/src/components/WfoBadges/WfoFailedTasksBadge/WfoFailedTasksBadge.tsx +95 -0
- package/src/components/WfoBadges/WfoFailedTasksBadge/index.ts +1 -0
- package/src/components/{WFOBadges/WFOHeaderBadge/WFOHeaderBadge.stories.tsx → WfoBadges/WfoHeaderBadge/WfoHeaderBadge.stories.tsx} +6 -4
- package/src/components/{WFOBadges/WFOHeaderBadge/WFOHeaderBadge.tsx → WfoBadges/WfoHeaderBadge/WfoHeaderBadge.tsx} +6 -4
- package/src/components/WfoBadges/WfoHeaderBadge/index.ts +1 -0
- package/src/components/{WFOBadges/WFOProcessStatusBadge/WFOProcessStatusBadge.tsx → WfoBadges/WfoProcessStatusBadge/WfoProcessStatusBadge.tsx} +8 -6
- package/src/components/WfoBadges/WfoProcessStatusBadge/index.ts +1 -0
- package/src/components/WfoBadges/WfoProductBlockBadge/WfoProductBlockBadge.stories.tsx +16 -0
- package/src/components/WfoBadges/WfoProductBlockBadge/WfoProductBlockBadge.tsx +70 -0
- package/src/components/WfoBadges/WfoProductBlockBadge/index.ts +1 -0
- package/src/components/WfoBadges/WfoProductStatusBadge/WfoProductStatusBadge.stories.tsx +22 -0
- package/src/components/WfoBadges/WfoProductStatusBadge/WfoProductStatusBadge.tsx +53 -0
- package/src/components/WfoBadges/WfoProductStatusBadge/index.ts +1 -0
- package/src/components/{WFOBadges/WFOStatusBadge/WFOStatusBadge.stories.tsx → WfoBadges/WfoSubscriptionStatusBadge/WfoSubscriptionStatusBadge.stories.tsx} +5 -4
- package/src/components/{WFOBadges/WFOStatusBadge/WFOStatusBadge.tsx → WfoBadges/WfoSubscriptionStatusBadge/WfoSubscriptionStatusBadge.tsx} +14 -10
- package/src/components/WfoBadges/WfoSubscriptionStatusBadge/index.ts +1 -0
- package/src/components/WfoBadges/WfoWorkflowTargetBadge/WfoWorkflowTargetBadge.tsx +65 -0
- package/src/components/WfoBadges/WfoWorkflowTargetBadge/index.ts +1 -0
- package/src/components/WfoBadges/index.ts +9 -0
- package/src/components/WfoButtonComboBox/WfoButtonComboBox.tsx +76 -0
- package/src/components/WfoButtonComboBox/styles.ts +13 -0
- package/src/components/WfoDateTime/WfoDateTime.tsx +28 -0
- package/src/components/WfoDateTime/index.ts +1 -0
- package/src/components/WfoDropdownButton/WfoDropdownButton.tsx +67 -0
- package/src/components/WfoDropdownButton/index.ts +1 -0
- package/src/components/{WFOFilterTabs/WFOFilterTabs.tsx → WfoFilterTabs/WfoFilterTabs.tsx} +8 -6
- package/src/components/WfoFilterTabs/index.ts +1 -0
- package/src/components/WfoForms/AutoFieldLoader.tsx +110 -0
- package/src/components/WfoForms/AutoFields.tsx +49 -0
- package/src/components/WfoForms/CreateForm.tsx +71 -0
- package/src/components/WfoForms/UserInputForm.tsx +607 -0
- package/src/components/WfoForms/UserInputFormStyling.ts +80 -0
- package/src/components/WfoForms/UserInputFormWizard.tsx +120 -0
- package/src/components/WfoForms/formFields/AcceptField.tsx +239 -0
- package/src/components/WfoForms/formFields/AcceptFieldStyling.ts +29 -0
- package/src/components/WfoForms/formFields/BoolField.tsx +71 -0
- package/src/components/WfoForms/formFields/BoolFieldStyling.ts +68 -0
- package/src/components/WfoForms/formFields/ContactPersonAutocomplete.tsx +97 -0
- package/src/components/WfoForms/formFields/ContactPersonAutocompleteStyles.ts +40 -0
- package/src/components/WfoForms/formFields/ContactPersonNameField.tsx +253 -0
- package/src/components/WfoForms/formFields/DateField.tsx +72 -0
- package/src/components/WfoForms/formFields/DividerField.tsx +29 -0
- package/src/components/WfoForms/formFields/ErrorField.tsx +40 -0
- package/src/components/WfoForms/formFields/ErrorsField.tsx +34 -0
- package/src/components/WfoForms/formFields/ImsNodeIdField.tsx +110 -0
- package/src/components/WfoForms/formFields/IpNetworkField.tsx +128 -0
- package/src/components/WfoForms/formFields/IpPrefixTableField.tsx +454 -0
- package/src/components/WfoForms/formFields/IpPrefixTableFieldStyling.ts +117 -0
- package/src/components/WfoForms/formFields/LabelField.tsx +39 -0
- package/src/components/WfoForms/formFields/ListAddField.tsx +98 -0
- package/src/components/WfoForms/formFields/ListDelField.tsx +95 -0
- package/src/components/WfoForms/formFields/ListField.tsx +113 -0
- package/src/components/WfoForms/formFields/ListItemField.tsx +40 -0
- package/src/components/WfoForms/formFields/ListSelectField.tsx +92 -0
- package/src/components/WfoForms/formFields/LocationCodeField.tsx +66 -0
- package/src/components/WfoForms/formFields/LongTextField.tsx +68 -0
- package/src/components/WfoForms/formFields/NestField.tsx +107 -0
- package/src/components/WfoForms/formFields/NumField.tsx +75 -0
- package/src/components/WfoForms/formFields/OptGroupField.tsx +74 -0
- package/src/components/WfoForms/formFields/OrganisationField.tsx +57 -0
- package/src/components/WfoForms/formFields/ProductField.tsx +78 -0
- package/src/components/WfoForms/formFields/RadioField.tsx +87 -0
- package/src/components/WfoForms/formFields/SelectField.tsx +152 -0
- package/src/components/WfoForms/formFields/SplitPrefix.tsx +163 -0
- package/src/components/WfoForms/formFields/SplitPrefixStyling.ts +11 -0
- package/src/components/WfoForms/formFields/SubmitField.tsx +50 -0
- package/src/components/WfoForms/formFields/SubscriptionField.tsx +351 -0
- package/src/components/WfoForms/formFields/SubscriptionFieldStyling.ts +33 -0
- package/src/components/WfoForms/formFields/SubscriptionSummaryField.tsx +75 -0
- package/src/components/WfoForms/formFields/TextField.tsx +71 -0
- package/src/components/WfoForms/formFields/TimestampField.tsx +103 -0
- package/src/components/WfoForms/formFields/VlanField.tsx +297 -0
- package/src/components/WfoForms/formFields/index.ts +29 -0
- package/src/components/WfoForms/formFields/listFieldStyling.ts +86 -0
- package/src/components/WfoForms/formFields/reactSelectStyles.ts +45 -0
- package/src/components/WfoForms/formFields/surf/types.ts +53 -0
- package/src/components/WfoForms/formFields/surf/utils.ts +1 -0
- package/src/components/WfoForms/formFields/types.ts +50 -0
- package/src/components/WfoForms/formFields/utils.spec.ts +196 -0
- package/src/components/WfoForms/formFields/utils.ts +65 -0
- package/src/components/WfoForms/index.ts +5 -0
- package/src/components/WfoForms/useAxiosApiClient.ts +8 -0
- package/src/components/WfoInsyncIcon/WfoInsyncIcon.stories.tsx +21 -0
- package/src/components/WfoInsyncIcon/WfoInsyncIcon.tsx +26 -0
- package/src/components/WfoInsyncIcon/index.ts +1 -0
- package/src/components/WfoJsonCodeBlock/WfoJsonCodeBlock.tsx +27 -0
- package/src/components/WfoJsonCodeBlock/styles.ts +13 -0
- package/src/components/WfoKeyValueTable/WfoKeyCell.tsx +25 -0
- package/src/components/WfoKeyValueTable/WfoKeyValueTable.tsx +41 -0
- package/src/components/WfoKeyValueTable/WfoValueCell.tsx +53 -0
- package/src/components/WfoKeyValueTable/index.ts +3 -0
- package/src/components/WfoKeyValueTable/styles.ts +77 -0
- package/src/components/WfoLoading/WfoLoading.tsx +3 -0
- package/src/components/WfoLoading/index.ts +1 -0
- package/src/components/WfoNoResults/WfoNoResults.stories.tsx +19 -0
- package/src/components/WfoNoResults/WfoNoResults.tsx +22 -0
- package/src/components/WfoNoResults/index.ts +1 -0
- package/src/components/WfoNoResults/styles.ts +22 -0
- package/src/components/WfoPageHeader/WfoPageHeader.tsx +25 -0
- package/src/components/{WFOBreadcrumbs/WFOBreadcrumbs.tsx → WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx} +6 -3
- package/src/components/WfoPageTemplate/WfoBreadcrumbs/index.ts +1 -0
- package/src/components/{WFOPageTemplate/WFOPageHeader/WFOPageHeader.stories.tsx → WfoPageTemplate/WfoPageHeader/WfoPageHeader.stories.tsx} +7 -5
- package/src/components/{WFOPageTemplate/WFOPageHeader/WFOPageHeader.tsx → WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx} +26 -11
- package/src/components/WfoPageTemplate/WfoPageHeader/index.ts +1 -0
- package/src/components/{WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.stories.tsx → WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.stories.tsx} +8 -6
- package/src/components/{WFOPageTemplate/WFOPageTemplate/WFOPageTemplate.tsx → WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.tsx} +20 -8
- package/src/components/WfoPageTemplate/WfoPageTemplate/index.ts +1 -0
- package/src/components/{WFOPageTemplate/WFOSidebar/WFOSidebar.stories.tsx → WfoPageTemplate/WfoSidebar/WfoSidebar.stories.tsx} +6 -4
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +161 -0
- package/src/components/WfoPageTemplate/WfoSidebar/WfoStartCreateWorkflowButtonComboBox.tsx +58 -0
- package/src/components/WfoPageTemplate/WfoSidebar/index.ts +1 -0
- package/src/components/WfoPageTemplate/index.ts +4 -0
- package/src/components/WfoPageTemplate/paths.ts +11 -0
- package/src/components/WfoProcessesList/WfoProcessList.tsx +227 -0
- package/src/components/WfoProcessesList/processListObjectMappers.ts +79 -0
- package/src/components/{WFOSearchBar/WFOSearchField.tsx → WfoSearchBar/WfoSearchField.tsx} +4 -3
- package/src/components/WfoSearchBar/index.ts +1 -0
- package/src/components/WfoSettingsModal/WfoInformationModal.tsx +41 -0
- package/src/components/{WFOSettingsModal/WFOSettingsModal.tsx → WfoSettingsModal/WfoSettingsModal.tsx} +3 -2
- package/src/components/WfoSettingsModal/index.tsx +2 -0
- package/src/components/{WFOSettingsPage/WFOEngineStatusButton.tsx → WfoSettingsPage/WfoEngineStatusButton.tsx} +5 -3
- package/src/components/{WFOSettingsPage/WFOFlushSettings.tsx → WfoSettingsPage/WfoFlushSettings.tsx} +19 -30
- package/src/components/{WFOSettingsPage/WFOModifySettings.tsx → WfoSettingsPage/WfoModifySettings.tsx} +7 -5
- package/src/components/{WFOSettingsPage/WFOSettings.tsx → WfoSettingsPage/WfoSettings.tsx} +12 -8
- package/src/components/{WFOSettingsPage/WFOStatus.tsx → WfoSettingsPage/WfoStatus.tsx} +8 -6
- package/src/components/WfoSettingsPage/index.ts +1 -0
- package/src/components/{WFOStartPage/WFOFrequentlyUsed.stories.tsx → WfoStartPage/WfoFrequentlyUsed.stories.tsx} +5 -4
- package/src/components/{WFOStartPage/WFOFrequentlyUsed.tsx → WfoStartPage/WfoFrequentlyUsed.tsx} +4 -3
- package/src/components/{WFOStartPage/WFOListItemStartPage.stories.tsx → WfoStartPage/WfoListItemStartPage.stories.tsx} +6 -4
- package/src/components/{WFOStartPage/WFOListItemStartPage.tsx → WfoStartPage/WfoListItemStartPage.tsx} +9 -6
- package/src/components/{WFOStartPage/WFOListStartPage.stories.tsx → WfoStartPage/WfoListStartPage.stories.tsx} +6 -4
- package/src/components/{WFOStartPage/WFOListStartPage.tsx → WfoStartPage/WfoListStartPage.tsx} +7 -5
- package/src/components/{WFOStartPage/WFOMultiListSection.stories.tsx → WfoStartPage/WfoMultiListSection.stories.tsx} +5 -4
- package/src/components/{WFOStartPage/WFOMultiListSection.tsx → WfoStartPage/WfoMultiListSection.tsx} +7 -5
- package/src/components/WfoStartPage/WfoNewProcessPanel.stories.tsx +13 -0
- package/src/components/{WFOStartPage/WFONewProcessPanel.tsx → WfoStartPage/WfoNewProcessPanel.tsx} +5 -3
- package/src/components/WfoStartPage/WfoStatCards.stories.tsx +13 -0
- package/src/components/{WFOStartPage/WFOStatCards.tsx → WfoStartPage/WfoStatCards.tsx} +4 -2
- package/src/components/WfoStartPage/index.ts +6 -0
- package/src/components/WfoStartTaskButtonComboBox/WfoStartTaskButtonComboBox.tsx +51 -0
- package/src/components/WfoStartTaskButtonComboBox/index.ts +1 -0
- package/src/components/WfoSubscription/SubscriptionKeyValueBlock.tsx +46 -0
- package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +158 -0
- package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +192 -0
- package/src/components/WfoSubscription/WfoSubscription.tsx +145 -0
- package/src/components/WfoSubscription/WfoSubscriptionActions.tsx +236 -0
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +161 -0
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +147 -0
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock.tsx +207 -0
- package/src/components/WfoSubscription/index.ts +8 -0
- package/src/components/WfoSubscription/styles.ts +104 -0
- package/src/components/WfoSubscription/utils/index.ts +1 -0
- package/src/components/WfoSubscription/utils/utils.spec.ts +168 -0
- package/src/components/WfoSubscription/utils/utils.ts +76 -0
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +205 -0
- package/src/components/WfoSubscriptionsList/index.ts +3 -0
- package/src/components/WfoSubscriptionsList/mapGrapghQlSubscriptionsResultToSubscriptionListItems.ts +43 -0
- package/src/{pages/subscriptions → components/WfoSubscriptionsList}/subscriptionListTabs.ts +18 -18
- package/src/components/WfoTable/WfoBasicTable/WfoBasicTable.tsx +178 -0
- package/src/components/{WFOTable/WFOSortDirectionIcon.tsx → WfoTable/WfoBasicTable/WfoSortDirectionIcon.tsx} +8 -8
- package/src/components/WfoTable/WfoBasicTable/WfoStatusColorField.tsx +21 -0
- package/src/components/WfoTable/WfoBasicTable/WfoTableHeaderCell.tsx +120 -0
- package/src/components/WfoTable/WfoBasicTable/index.ts +4 -0
- package/src/components/WfoTable/WfoBasicTable/styles.ts +73 -0
- package/src/components/{WFOTable/WFODataGridTable/WFODataGridTable.stories.tsx → WfoTable/WfoDataGridTable/WfoDataGridTable.stories.tsx} +9 -7
- package/src/components/{WFOTable/WFODataGridTable/WFODataGridTable.tsx → WfoTable/WfoDataGridTable/WfoDataGridTable.tsx} +23 -21
- package/src/components/{WFOTable/WFODataGridTable/WFOdataGridColumns.spec.ts → WfoTable/WfoDataGridTable/WfodataGridColumns.spec.ts} +7 -7
- package/src/components/{WFOTable/WFODataGridTable/WFOdataGridColumns.ts → WfoTable/WfoDataGridTable/WfodataGridColumns.ts} +8 -7
- package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +11 -0
- package/src/components/WfoTable/WfoFirstPartUUID/index.ts +1 -0
- package/src/components/WfoTable/WfoSortButtons/WfoSortButton.tsx +31 -0
- package/src/components/WfoTable/WfoSortButtons/WfoSortButtons.tsx +33 -0
- package/src/components/WfoTable/WfoSortButtons/index.ts +2 -0
- package/src/components/WfoTable/WfoSortButtons/styles.ts +20 -0
- package/src/components/{WFOTable/WFOTableSettingsModal/WFOTableSettingsModal.tsx → WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.tsx} +5 -3
- package/src/components/WfoTable/WfoTableSettingsModal/index.ts +1 -0
- package/src/components/WfoTable/WfoTableWithFilter/WfoTableWithFilter.tsx +253 -0
- package/src/components/WfoTable/WfoTableWithFilter/index.ts +1 -0
- package/src/components/WfoTable/index.ts +15 -0
- package/src/components/{WFOTable → WfoTable}/utils/columns.ts +27 -16
- package/src/components/{WFOTable → WfoTable}/utils/constants.ts +5 -1
- package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.spec.ts +52 -0
- package/src/components/WfoTable/utils/mapSortableAndFilterableValuesToTableColumnConfig.ts +21 -0
- package/src/components/{WFOTable → WfoTable}/utils/tableConfigPersistence.spec.ts +4 -4
- package/src/components/{WFOTable → WfoTable}/utils/tableConfigPersistence.ts +12 -16
- package/src/components/{WFOTable → WfoTable}/utils/tableUtils.spec.ts +1 -1
- package/src/components/{WFOTable → WfoTable}/utils/tableUtils.ts +6 -25
- package/src/components/WfoTimeline/WfoTimeline.tsx +69 -0
- package/src/components/WfoTimeline/WfoTimelineStep.tsx +57 -0
- package/src/components/WfoTimeline/index.ts +1 -0
- package/src/components/WfoTimeline/mapProcessStepStatusToEuiStepStatus.ts +23 -0
- package/src/components/WfoTimeline/styles.ts +165 -0
- package/src/components/WfoTimeline/timelineUtils.ts +14 -0
- package/src/components/WfoToastsList/WfoToastsList.tsx +22 -0
- package/src/components/WfoToastsList/index.ts +1 -0
- package/src/components/WfoTree/WfoTree.tsx +27 -0
- package/src/components/{WFOTree/WFOTreeBranch.tsx → WfoTree/WfoTreeBranch.tsx} +7 -6
- package/src/components/{WFOTree/WFOTreeNode.tsx → WfoTree/WfoTreeNode.tsx} +28 -13
- package/src/components/WfoTree/index.ts +4 -0
- package/src/components/WfoTree/styles.ts +18 -0
- package/src/components/WfoTree/treeUtils.spec.ts +100 -0
- package/src/components/WfoTree/treeUtils.ts +21 -0
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.stories.tsx +13 -0
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +167 -0
- package/src/components/WfoWorkflowSteps/WfoStep/index.ts +1 -0
- package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +107 -0
- package/src/components/WfoWorkflowSteps/WfoStepList/index.ts +1 -0
- package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.stories.tsx +16 -0
- package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.tsx +114 -0
- package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/index.ts +1 -0
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +139 -0
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.stories.tsx +56 -0
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +121 -0
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/index.ts +2 -0
- package/src/components/WfoWorkflowSteps/index.ts +4 -0
- package/src/components/WfoWorkflowSteps/stepListUtils.spec.ts +26 -0
- package/src/components/WfoWorkflowSteps/stepListUtils.ts +56 -0
- package/src/components/WfoWorkflowSteps/styles.ts +121 -0
- package/src/components/confirmationDialog/ConfirmationDialogStyling.ts +12 -0
- package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +112 -0
- package/src/components/confirmationDialog/index.ts +1 -0
- package/src/components/index.ts +19 -11
- package/src/contexts/ApiClientContext.tsx +30 -0
- package/src/contexts/ConfirmationDialogProvider.tsx +99 -0
- package/src/contexts/OrchestratorConfigContext.tsx +8 -3
- package/src/contexts/ToastContext.tsx +136 -0
- package/src/contexts/TreeContext.tsx +53 -32
- package/src/contexts/index.ts +3 -1
- package/src/graphqlQueries/customersQuery.ts +19 -0
- package/src/graphqlQueries/index.ts +6 -1
- package/src/graphqlQueries/processDetailQuery.ts +45 -0
- package/src/graphqlQueries/processListQuery.ts +19 -12
- package/src/graphqlQueries/productBlocksQuery.ts +13 -1
- package/src/graphqlQueries/productsQuery.ts +7 -4
- package/src/graphqlQueries/relatedSubscriptionsQuery.ts +65 -0
- package/src/graphqlQueries/resourceTypesQuery.ts +13 -2
- package/src/graphqlQueries/subscriptionDetailQuery.ts +62 -0
- package/src/graphqlQueries/subscriptionsDropdownOptionsQuery.ts +47 -0
- package/src/graphqlQueries/subscriptionsListQuery.ts +59 -0
- package/src/graphqlQueries/{workflowsQuery.ts → workflows/workflowsQuery.ts} +10 -5
- package/src/graphqlQueries/workflows/workflowsQueryForDropdownList.ts +41 -0
- package/src/hooks/DataFetchHooks.ts +72 -49
- package/src/hooks/ProcessesHooks/useDeleteProcess.ts +37 -0
- package/src/hooks/index.ts +4 -1
- package/src/hooks/surf/useGetSubscriptionDropdownOptions.ts +47 -0
- package/src/hooks/surf/useIsTaggedPort.ts +29 -0
- package/src/hooks/useDataDisplayParams.ts +1 -1
- package/src/hooks/useEngineStatusQuery.ts +20 -10
- package/src/hooks/useOrchestratorConfig.ts +6 -2
- package/src/hooks/useProcessStatusCountsQuery.ts +8 -23
- package/src/hooks/useQueryWithFetch.ts +33 -0
- package/src/hooks/useQueryWithGraphql.ts +18 -13
- package/src/hooks/useSessionWithToken.ts +14 -0
- package/src/hooks/useStoredTableConfig.ts +43 -0
- package/src/hooks/useSubscriptionActions.ts +3 -3
- package/src/hooks/useToastMessage.ts +5 -0
- package/src/hooks/useWithOrchestratorTheme.ts +10 -0
- package/src/icons/WfoArrowNarrowDown.stories.tsx +13 -0
- package/src/icons/{WFOArrowNarrowDown.tsx → WfoArrowNarrowDown.tsx} +4 -2
- package/src/icons/WfoArrowNarrowUp.stories.tsx +13 -0
- package/src/icons/{WFOArrowNarrowUp.tsx → WfoArrowNarrowUp.tsx} +4 -2
- package/src/icons/WfoArrowsExpand.stories.tsx +13 -0
- package/src/icons/WfoArrowsExpand.tsx +33 -0
- package/src/icons/WfoCheckmarkCircleFill.stories.tsx +13 -0
- package/src/icons/{WFOCheckmarkCircleFill.tsx → WfoCheckmarkCircleFill.tsx} +3 -2
- package/src/icons/WfoChevronDown.stories.tsx +13 -0
- package/src/icons/{WFOChevronDown.tsx → WfoChevronDown.tsx} +3 -2
- package/src/icons/WfoChevronUp.stories.tsx +13 -0
- package/src/icons/WfoChevronUp.tsx +33 -0
- package/src/icons/WfoClipboardCopy.stories.tsx +13 -0
- package/src/icons/WfoClipboardCopy.tsx +33 -0
- package/src/icons/WfoCode.stories.tsx +13 -0
- package/src/icons/WfoCode.tsx +35 -0
- package/src/icons/WfoCogFill.stories.tsx +13 -0
- package/src/icons/WfoCogFill.tsx +35 -0
- package/src/icons/WfoEyeFill.stories.tsx +13 -0
- package/src/icons/WfoEyeFill.tsx +35 -0
- package/src/icons/{WFOIconProps.ts → WfoIconProps.ts} +1 -1
- package/src/icons/WfoLogoutIcon.stories.tsx +13 -0
- package/src/icons/{WFOLogoutIcon.tsx → WfoLogoutIcon.tsx} +3 -2
- package/src/icons/WfoMinusCircleFill.stories.tsx +13 -0
- package/src/icons/WfoMinusCircleFill.tsx +33 -0
- package/src/icons/WfoMinusCircleOutline.stories.tsx +13 -0
- package/src/icons/{WFOMinusCircleOutline.tsx → WfoMinusCircleOutline.tsx} +3 -2
- package/src/icons/WfoPencilAlt.stories.tsx +13 -0
- package/src/icons/WfoPencilAlt.tsx +33 -0
- package/src/icons/WfoPlayFill.stories.tsx +13 -0
- package/src/icons/WfoPlayFill.tsx +35 -0
- package/src/icons/WfoPlusCircleFill.stories.tsx +13 -0
- package/src/icons/{WFOPlusCircleFill.tsx → WfoPlusCircleFill.tsx} +3 -2
- package/src/icons/WfoRefresh.stories.tsx +13 -0
- package/src/icons/WfoRefresh.tsx +35 -0
- package/src/icons/WfoSearchStrikethrough.stories.tsx +13 -0
- package/src/icons/WfoSearchStrikethrough.tsx +33 -0
- package/src/icons/WfoSortAsc.stories.tsx +13 -0
- package/src/icons/WfoSortAsc.tsx +33 -0
- package/src/icons/WfoSortDesc.stories.tsx +13 -0
- package/src/icons/WfoSortDesc.tsx +33 -0
- package/src/icons/WfoStatistic.tsx +41 -0
- package/src/icons/WfoStatusDotIcon.stories.tsx +13 -0
- package/src/icons/{WFOStatusDotIcon.tsx → WfoStatusDotIcon.tsx} +3 -2
- package/src/icons/WfoXCircleFill.stories.tsx +13 -0
- package/src/icons/{WFOXCircleFill.tsx → WfoXCircleFill.tsx} +3 -2
- package/src/icons/index.ts +22 -10
- package/src/index.ts +2 -0
- package/src/messages/en-US.json +175 -21
- package/src/messages/getTranslationMessages.spec.ts +1 -1
- package/src/messages/getTranslationMessages.ts +1 -1
- package/src/messages/nl-NL.json +179 -23
- package/src/pages/index.ts +2 -0
- package/src/pages/metadata/{WFOMetadataPageLayout.tsx → WfoMetadataPageLayout.tsx} +5 -3
- package/src/pages/metadata/WfoProductBlocksPage.tsx +239 -0
- package/src/pages/metadata/{WFOProductsPage.tsx → WfoProductsPage.tsx} +96 -52
- package/src/pages/metadata/WfoResourceTypesPage.tsx +185 -0
- package/src/pages/metadata/WfoWorkflowsPage.tsx +194 -0
- package/src/pages/metadata/index.ts +4 -4
- package/src/pages/metadata/workflowListObjectMapper.ts +43 -0
- package/src/pages/processes/WfoProcessDetail.tsx +327 -0
- package/src/pages/processes/WfoProcessDetailPage.tsx +88 -0
- package/src/pages/processes/WfoProcessListPage.tsx +106 -0
- package/src/pages/processes/WfoProcessListSubscriptionsCell.tsx +72 -0
- package/src/pages/processes/getProcessListTabTypeFromString.ts +6 -6
- package/src/pages/processes/index.ts +3 -2
- package/src/pages/processes/tabConfig.ts +28 -10
- package/src/pages/processes/timelineUtils.spec.ts +202 -0
- package/src/pages/processes/timelineUtils.ts +113 -0
- package/src/pages/subscriptions/WfoSubscriptionDetailPage.tsx +19 -0
- package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +105 -0
- package/src/pages/subscriptions/index.ts +2 -2
- package/src/pages/tasks/WfoTaskListPage.tsx +120 -0
- package/src/pages/tasks/index.ts +1 -0
- package/src/pages/workflow/WfoStartWorkflowPage.tsx +176 -0
- package/src/pages/workflow/index.ts +1 -0
- package/src/stories/Button.jsx +45 -39
- package/src/stories/Configure.mdx +48 -43
- package/src/stories/Header.jsx +59 -45
- package/src/stories/Page.jsx +81 -60
- package/src/stories/Page.stories.js +2 -1
- package/src/stories/button.css +18 -18
- package/src/stories/colors.mdx +12 -0
- package/src/stories/colors.tsx +27 -0
- package/src/stories/header.css +18 -18
- package/src/stories/page.css +40 -40
- package/src/theme/defaultOrchestratorTheme.ts +16 -0
- package/src/types/forms.ts +40 -0
- package/src/types/index.ts +1 -0
- package/src/types/types.ts +457 -0
- package/src/utils/date.spec.ts +157 -5
- package/src/utils/date.ts +66 -5
- package/src/utils/environmentVariables.spec.ts +17 -0
- package/src/utils/environmentVariables.ts +12 -0
- package/src/utils/getDefaultTableConfig.ts +101 -0
- package/src/utils/getProductNamesFromProcess.spec.ts +133 -0
- package/src/utils/getProductNamesFromProcess.ts +16 -0
- package/src/utils/getTokenName.ts +2 -1
- package/src/utils/index.ts +2 -0
- package/src/utils/string.spec.ts +24 -1
- package/src/utils/strings.ts +5 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +4 -2
- package/src/components/WFOBadges/WFOBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOEngineStatusBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOEnvironmentBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOFailedTasksBadge/WFOFailedTasksBadge.stories.tsx +0 -12
- package/src/components/WFOBadges/WFOFailedTasksBadge/WFOFailedTasksBadge.tsx +0 -63
- package/src/components/WFOBadges/WFOFailedTasksBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOHeaderBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOProcessStatusBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOProductBlockBadge/WFOProductBlockBadge.stories.tsx +0 -15
- package/src/components/WFOBadges/WFOProductBlockBadge/WFOProductBlockBadge.tsx +0 -22
- package/src/components/WFOBadges/WFOProductBlockBadge/index.ts +0 -1
- package/src/components/WFOBadges/WFOStatusBadge/index.ts +0 -1
- package/src/components/WFOBadges/index.ts +0 -8
- package/src/components/WFOBreadcrumbs/index.ts +0 -1
- package/src/components/WFOFilterTabs/index.ts +0 -1
- package/src/components/WFOLoading/WFOLoading.tsx +0 -2
- package/src/components/WFOLoading/index.ts +0 -1
- package/src/components/WFOPageTemplate/WFOPageHeader/index.ts +0 -1
- package/src/components/WFOPageTemplate/WFOPageTemplate/index.ts +0 -1
- package/src/components/WFOPageTemplate/WFOSidebar/WFOSidebar.tsx +0 -159
- package/src/components/WFOPageTemplate/WFOSidebar/index.ts +0 -1
- package/src/components/WFOPageTemplate/index.ts +0 -3
- package/src/components/WFOSearchBar/index.ts +0 -1
- package/src/components/WFOSettingsModal/index.tsx +0 -1
- package/src/components/WFOSettingsPage/index.ts +0 -1
- package/src/components/WFOStartPage/WFONewProcessPanel.stories.tsx +0 -12
- package/src/components/WFOStartPage/WFOStatCards.stories.tsx +0 -12
- package/src/components/WFOStartPage/index.ts +0 -6
- package/src/components/WFOSubscription/WFOFixedInputBlock.tsx +0 -58
- package/src/components/WFOSubscription/WFOProcessesTimeline.tsx +0 -105
- package/src/components/WFOSubscription/WFOProductBlock.tsx +0 -186
- package/src/components/WFOSubscription/WFOSubscriptionActions.tsx +0 -138
- package/src/components/WFOSubscription/WFOSubscriptionBlock.tsx +0 -108
- package/src/components/WFOSubscription/WFOSubscriptionDetailTree.tsx +0 -184
- package/src/components/WFOSubscription/WFOSubscriptionGeneral.tsx +0 -53
- package/src/components/WFOSubscription/index.ts +0 -7
- package/src/components/WFOSubscription/styles.ts +0 -18
- package/src/components/WFOTable/WFOTable.tsx +0 -85
- package/src/components/WFOTable/WFOTableHeaderCell.tsx +0 -30
- package/src/components/WFOTable/WFOTableSettingsModal/index.ts +0 -1
- package/src/components/WFOTable/WFOTableWithFilter/WFOTableWithFilter.tsx +0 -174
- package/src/components/WFOTable/WFOTableWithFilter/index.ts +0 -1
- package/src/components/WFOTable/index.ts +0 -14
- package/src/components/WFOTree/WFOTree.tsx +0 -16
- package/src/contexts/SubscriptionContext.tsx +0 -72
- package/src/hooks/useSubscriptionProcesses.ts +0 -45
- package/src/icons/WFOCheckmarkCircleFill.stories.tsx +0 -12
- package/src/icons/WFOLogoutIcon.stories.tsx +0 -12
- package/src/icons/WFOMinusCircleOutline.stories.tsx +0 -12
- package/src/icons/WFOPlusCircleFill.stories.tsx +0 -12
- package/src/icons/WFOStatusDotIcon.stories.tsx +0 -12
- package/src/icons/WFOXCircleFill.stories.tsx +0 -12
- package/src/pages/metadata/WFOProductBlocksPage.tsx +0 -164
- package/src/pages/metadata/WFOResourceTypesPage.tsx +0 -120
- package/src/pages/metadata/WFOWorkflowsPage.tsx +0 -251
- package/src/pages/processes/WFOProcessListPage.tsx +0 -209
- package/src/pages/processes/WFOProcessesListSubscriptionsCell.tsx +0 -28
- package/src/pages/processes/tableConfig.ts +0 -22
- package/src/pages/subscriptions/types.ts +0 -13
- package/src/types.ts +0 -250
- package/src/components/{WFOTable → WfoTable}/utils/columns.spec.ts +1 -1
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2019-2023 SURF.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
import React, { useContext, useState } from 'react';
|
|
18
|
+
|
|
19
|
+
import axios from 'axios';
|
|
20
|
+
import invariant from 'invariant';
|
|
21
|
+
import { JSONSchema6 } from 'json-schema';
|
|
22
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
23
|
+
import get from 'lodash/get';
|
|
24
|
+
import { useTranslations } from 'next-intl';
|
|
25
|
+
import { NextRouter } from 'next/router';
|
|
26
|
+
import { filterDOMProps, joinName } from 'uniforms';
|
|
27
|
+
import { JSONSchemaBridge } from 'uniforms-bridge-json-schema';
|
|
28
|
+
import { AutoField, AutoForm } from 'uniforms-unstyled';
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
EuiButton,
|
|
32
|
+
EuiButtonColor,
|
|
33
|
+
EuiFlexGroup,
|
|
34
|
+
EuiHorizontalRule,
|
|
35
|
+
} from '@elastic/eui';
|
|
36
|
+
|
|
37
|
+
import ConfirmationDialogContext from '../../contexts/ConfirmationDialogProvider';
|
|
38
|
+
import { ConfirmDialogActions } from '../../contexts/ConfirmationDialogProvider';
|
|
39
|
+
import { useOrchestratorTheme } from '../../hooks';
|
|
40
|
+
import { WfoPlayFill } from '../../icons';
|
|
41
|
+
import { ValidationError } from '../../types/forms';
|
|
42
|
+
import { autoFieldFunction } from './AutoFieldLoader';
|
|
43
|
+
import AutoFields from './AutoFields';
|
|
44
|
+
import { userInputFormStyling } from './UserInputFormStyling';
|
|
45
|
+
|
|
46
|
+
type UniformJSONSchemaProperty = JSONSchema6 & {
|
|
47
|
+
uniforms: any;
|
|
48
|
+
defaultValue: any;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
interface IProps {
|
|
52
|
+
router: NextRouter;
|
|
53
|
+
stepUserInput: JSONSchema6;
|
|
54
|
+
validSubmit: (userInput: { [index: string]: unknown }) => Promise<unknown>;
|
|
55
|
+
cancel: ConfirmDialogActions['closeConfirmDialog'];
|
|
56
|
+
previous: ConfirmDialogActions['closeConfirmDialog'];
|
|
57
|
+
hasNext?: boolean;
|
|
58
|
+
hasPrev?: boolean;
|
|
59
|
+
userInput: object;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface Buttons {
|
|
63
|
+
previous: {
|
|
64
|
+
text?: string;
|
|
65
|
+
dialog?: string;
|
|
66
|
+
color?: EuiButtonColor;
|
|
67
|
+
};
|
|
68
|
+
next: {
|
|
69
|
+
text?: string;
|
|
70
|
+
dialog?: string;
|
|
71
|
+
color?: EuiButtonColor;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare module 'uniforms' {
|
|
76
|
+
interface FilterDOMProps {
|
|
77
|
+
customPropToFilter: never;
|
|
78
|
+
description: never;
|
|
79
|
+
const: never;
|
|
80
|
+
default: never;
|
|
81
|
+
required: never;
|
|
82
|
+
pattern: never;
|
|
83
|
+
examples: never;
|
|
84
|
+
allOf: never;
|
|
85
|
+
options: never;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
filterDOMProps.register('description');
|
|
89
|
+
filterDOMProps.register('const');
|
|
90
|
+
filterDOMProps.register('default');
|
|
91
|
+
filterDOMProps.register('required');
|
|
92
|
+
filterDOMProps.register('pattern');
|
|
93
|
+
filterDOMProps.register('examples');
|
|
94
|
+
filterDOMProps.register('allOf');
|
|
95
|
+
filterDOMProps.register('options');
|
|
96
|
+
|
|
97
|
+
function resolveRef(reference: string, schema: Record<string, any>) {
|
|
98
|
+
invariant(
|
|
99
|
+
reference.startsWith('#'),
|
|
100
|
+
'Reference is not an internal reference, and only such are allowed: "%s"',
|
|
101
|
+
reference,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const resolvedReference = reference
|
|
105
|
+
.split('/')
|
|
106
|
+
.filter((part) => part && part !== '#')
|
|
107
|
+
.reduce((definition, next) => definition[next], schema);
|
|
108
|
+
|
|
109
|
+
invariant(
|
|
110
|
+
resolvedReference,
|
|
111
|
+
'Reference not found in schema: "%s"',
|
|
112
|
+
reference,
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
return resolvedReference;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
class CustomTitleJSONSchemaBridge extends JSONSchemaBridge {
|
|
119
|
+
// This a copy of the super class function to provide a fix for https://github.com/vazco/uniforms/issues/863
|
|
120
|
+
getField(name: string) {
|
|
121
|
+
return joinName(null, name).reduce(
|
|
122
|
+
(definition, next, nextIndex, array) => {
|
|
123
|
+
const previous = joinName(array.slice(0, nextIndex));
|
|
124
|
+
const isRequired = get(
|
|
125
|
+
definition,
|
|
126
|
+
'required',
|
|
127
|
+
get(this._compiledSchema, [previous, 'required'], []),
|
|
128
|
+
).includes(next);
|
|
129
|
+
|
|
130
|
+
const _key = joinName(previous, next);
|
|
131
|
+
const _definition = this._compiledSchema[_key] || {};
|
|
132
|
+
|
|
133
|
+
if (next === '$' || next === '' + parseInt(next, 10)) {
|
|
134
|
+
invariant(
|
|
135
|
+
definition.type === 'array',
|
|
136
|
+
'Field not found in schema: "%s"',
|
|
137
|
+
name,
|
|
138
|
+
);
|
|
139
|
+
definition = Array.isArray(definition.items)
|
|
140
|
+
? definition.items[parseInt(next, 10)]
|
|
141
|
+
: definition.items;
|
|
142
|
+
} else if (definition.type === 'object') {
|
|
143
|
+
invariant(
|
|
144
|
+
definition.properties,
|
|
145
|
+
'Field properties not found in schema: "%s"',
|
|
146
|
+
name,
|
|
147
|
+
);
|
|
148
|
+
definition = definition.properties[next];
|
|
149
|
+
} else {
|
|
150
|
+
const [{ properties: combinedDefinition = {} } = {}] = [
|
|
151
|
+
'allOf',
|
|
152
|
+
'anyOf',
|
|
153
|
+
'oneOf',
|
|
154
|
+
]
|
|
155
|
+
.filter((key) => definition[key])
|
|
156
|
+
.map((key) => {
|
|
157
|
+
// FIXME: Correct type for `definition`.
|
|
158
|
+
const localDef = (definition[key] as any[]).map(
|
|
159
|
+
(subSchema) =>
|
|
160
|
+
subSchema.$ref
|
|
161
|
+
? resolveRef(
|
|
162
|
+
subSchema.$ref,
|
|
163
|
+
this.schema,
|
|
164
|
+
)
|
|
165
|
+
: subSchema,
|
|
166
|
+
);
|
|
167
|
+
return localDef.find(
|
|
168
|
+
({ properties = {} }) => properties[next],
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
definition = combinedDefinition[next];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
invariant(definition, 'Field not found in schema: "%s"', name);
|
|
176
|
+
|
|
177
|
+
if (definition.$ref) {
|
|
178
|
+
definition = resolveRef(definition.$ref, this.schema);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
['allOf', 'anyOf', 'oneOf'].forEach((key) => {
|
|
182
|
+
if (definition[key]) {
|
|
183
|
+
// FIXME: Correct type for `definition`.
|
|
184
|
+
_definition[key] = (definition[key] as any[]).map(
|
|
185
|
+
(def) =>
|
|
186
|
+
def.$ref
|
|
187
|
+
? resolveRef(def.$ref, this.schema)
|
|
188
|
+
: def,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Naive computation of combined type, properties and required
|
|
194
|
+
const combinedPartials: any[] = []
|
|
195
|
+
.concat(
|
|
196
|
+
_definition.allOf,
|
|
197
|
+
_definition.anyOf,
|
|
198
|
+
_definition.oneOf,
|
|
199
|
+
)
|
|
200
|
+
.filter(Boolean);
|
|
201
|
+
|
|
202
|
+
if (combinedPartials.length) {
|
|
203
|
+
const localProperties = definition.properties
|
|
204
|
+
? { ...definition.properties }
|
|
205
|
+
: {};
|
|
206
|
+
const localRequired = definition.required
|
|
207
|
+
? definition.required.slice()
|
|
208
|
+
: [];
|
|
209
|
+
|
|
210
|
+
combinedPartials.forEach((combinedPartial) => {
|
|
211
|
+
const { properties, required } = combinedPartial;
|
|
212
|
+
if (properties) {
|
|
213
|
+
Object.assign(localProperties, properties);
|
|
214
|
+
}
|
|
215
|
+
if (required) {
|
|
216
|
+
localRequired.push(...required);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Copy all properties instead of only type
|
|
220
|
+
for (const key in combinedPartial) {
|
|
221
|
+
if (combinedPartial[key] && !_definition[key]) {
|
|
222
|
+
_definition[key] = combinedPartial[key];
|
|
223
|
+
definition[key] = combinedPartial[key];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
if (Object.keys(localProperties).length > 0) {
|
|
229
|
+
_definition.properties = localProperties;
|
|
230
|
+
}
|
|
231
|
+
if (localRequired.length > 0) {
|
|
232
|
+
_definition.required = localRequired;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
this._compiledSchema[_key] = Object.assign(_definition, {
|
|
237
|
+
isRequired,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
return definition;
|
|
241
|
+
},
|
|
242
|
+
this.schema,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
getProps(name: string) {
|
|
247
|
+
const props = super.getProps(name);
|
|
248
|
+
|
|
249
|
+
// not translated labels for now
|
|
250
|
+
// const translation_key = name.replace(/\.\d+(.\d+)*/, "_fields");
|
|
251
|
+
// const translation_intl_key = `forms.fields.${translation_key}`;
|
|
252
|
+
// const translation = intl.formatMessage({ id: translation_intl_key, defaultMessage: translation_intl_key });
|
|
253
|
+
// let label = translation !== translation_intl_key ? translation : props.label;
|
|
254
|
+
let label = props.label;
|
|
255
|
+
|
|
256
|
+
// Mark required inputs. Might be delegated to the form components itself in the future.
|
|
257
|
+
if (
|
|
258
|
+
props.required &&
|
|
259
|
+
!props.readOnly &&
|
|
260
|
+
!props.isDisabled &&
|
|
261
|
+
!name.includes('.')
|
|
262
|
+
) {
|
|
263
|
+
label = `${label} *`;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
props.label = label;
|
|
267
|
+
// not translated labels for now
|
|
268
|
+
// props.description = intl.formatMessage({ id: `forms.fields.${translation_key}_info`, defaultMessage: " " }); // Default must contain a space as not to be Falsy
|
|
269
|
+
props.description = '';
|
|
270
|
+
|
|
271
|
+
props.id = `input-${name}`;
|
|
272
|
+
|
|
273
|
+
if (props.const) {
|
|
274
|
+
props.disabled = true;
|
|
275
|
+
props.default = props.const;
|
|
276
|
+
delete props['const'];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (props.initialCount === undefined) {
|
|
280
|
+
props.initialCount = props.minCount;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return props;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
getInitialValue(name: string, props: Record<string, any> = {}): any {
|
|
287
|
+
const {
|
|
288
|
+
default: _default,
|
|
289
|
+
const: _const,
|
|
290
|
+
type: _type,
|
|
291
|
+
} = this.getField(name);
|
|
292
|
+
let {
|
|
293
|
+
default: defaultValue = _default !== undefined
|
|
294
|
+
? _default
|
|
295
|
+
: get(this.schema.default, name),
|
|
296
|
+
} = this._compiledSchema[name];
|
|
297
|
+
const { const: constValue = _const, type = _type } =
|
|
298
|
+
this._compiledSchema[name];
|
|
299
|
+
|
|
300
|
+
// use const if present
|
|
301
|
+
if (defaultValue === undefined) defaultValue = constValue;
|
|
302
|
+
|
|
303
|
+
// See https://github.com/vazco/uniforms/issues/749
|
|
304
|
+
if (defaultValue === undefined) {
|
|
305
|
+
const nameArray = joinName(null, name);
|
|
306
|
+
const relativeName = nameArray.pop()!;
|
|
307
|
+
const parentName = joinName(nameArray);
|
|
308
|
+
if (parentName !== '') {
|
|
309
|
+
const model = this.getInitialValue(parentName, {
|
|
310
|
+
lookUpParent: true,
|
|
311
|
+
});
|
|
312
|
+
defaultValue = get(model, relativeName);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (defaultValue !== undefined) return cloneDeep(defaultValue);
|
|
317
|
+
|
|
318
|
+
if (type === 'array' && !props.lookUpParent && !name.endsWith('$')) {
|
|
319
|
+
const item = this.getInitialValue(joinName(name, '0'));
|
|
320
|
+
const items = props.initialCount || 0;
|
|
321
|
+
return Array(items).fill(item);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (type === 'object') {
|
|
325
|
+
return {};
|
|
326
|
+
}
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function fillPreselection(form: JSONSchema6, router: NextRouter) {
|
|
332
|
+
const queryParams = router.query;
|
|
333
|
+
|
|
334
|
+
if (form && form.properties) {
|
|
335
|
+
Object.keys(queryParams).forEach((param) => {
|
|
336
|
+
if (form && form.properties && form.properties[param]) {
|
|
337
|
+
const organisationInput = form.properties[
|
|
338
|
+
param
|
|
339
|
+
] as UniformJSONSchemaProperty;
|
|
340
|
+
if (!organisationInput.uniforms) {
|
|
341
|
+
organisationInput.uniforms = {};
|
|
342
|
+
}
|
|
343
|
+
organisationInput.uniforms.disabled = true;
|
|
344
|
+
organisationInput.default = queryParams[param];
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// ipvany preselect
|
|
349
|
+
if (queryParams.prefix && queryParams.prefixlen) {
|
|
350
|
+
if (form && form.properties.ip_prefix) {
|
|
351
|
+
const ipPrefixInput = form.properties
|
|
352
|
+
.ip_prefix as UniformJSONSchemaProperty;
|
|
353
|
+
if (!ipPrefixInput.uniforms) {
|
|
354
|
+
ipPrefixInput.uniforms = {};
|
|
355
|
+
}
|
|
356
|
+
ipPrefixInput.default = `${queryParams.prefix}/${queryParams.prefixlen}`;
|
|
357
|
+
ipPrefixInput.uniforms.prefixMin = parseInt(
|
|
358
|
+
(queryParams.prefix_min as string) ??
|
|
359
|
+
(queryParams.prefixlen as string),
|
|
360
|
+
10,
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return form;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function UserInputForm({
|
|
369
|
+
router,
|
|
370
|
+
stepUserInput,
|
|
371
|
+
validSubmit,
|
|
372
|
+
cancel,
|
|
373
|
+
previous = () => {},
|
|
374
|
+
hasNext = false,
|
|
375
|
+
hasPrev = false,
|
|
376
|
+
userInput,
|
|
377
|
+
}: IProps) {
|
|
378
|
+
const t = useTranslations('pydanticForms.userInputForm');
|
|
379
|
+
const { theme } = useOrchestratorTheme();
|
|
380
|
+
const { showConfirmDialog } = useContext(ConfirmationDialogContext);
|
|
381
|
+
const [processing, setProcessing] = useState<boolean>(false);
|
|
382
|
+
const [nrOfValidationErrors, setNrOfValidationErrors] = useState<number>(0);
|
|
383
|
+
const [rootErrors, setRootErrors] = useState<string[]>([]);
|
|
384
|
+
|
|
385
|
+
const openDialog = () => {
|
|
386
|
+
showConfirmDialog({
|
|
387
|
+
question: '',
|
|
388
|
+
confirmAction: () => {},
|
|
389
|
+
cancelAction: cancel,
|
|
390
|
+
leavePage: true,
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
const submit = async (userInput: any = {}) => {
|
|
395
|
+
if (!processing) {
|
|
396
|
+
setProcessing(true);
|
|
397
|
+
|
|
398
|
+
try {
|
|
399
|
+
await validSubmit(userInput);
|
|
400
|
+
setProcessing(false);
|
|
401
|
+
return null;
|
|
402
|
+
} catch (error: unknown) {
|
|
403
|
+
setProcessing(false);
|
|
404
|
+
|
|
405
|
+
if (
|
|
406
|
+
axios.isAxiosError(error) &&
|
|
407
|
+
error.response?.status === 400
|
|
408
|
+
) {
|
|
409
|
+
const json = error.response.data;
|
|
410
|
+
setNrOfValidationErrors(json.validation_errors.length);
|
|
411
|
+
setRootErrors(
|
|
412
|
+
json.validation_errors
|
|
413
|
+
.filter(
|
|
414
|
+
(e: ValidationError) => e.loc[0] === '__root__',
|
|
415
|
+
)
|
|
416
|
+
.map((e: ValidationError) => e.msg),
|
|
417
|
+
);
|
|
418
|
+
throw Object.assign(new Error(), {
|
|
419
|
+
details: json.validation_errors.map(
|
|
420
|
+
(e: ValidationError) => ({
|
|
421
|
+
message: e.msg,
|
|
422
|
+
params: e.ctx || {},
|
|
423
|
+
dataPath: '.' + e.loc.join('.'),
|
|
424
|
+
}),
|
|
425
|
+
),
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Let the error escape so it can be caught by our own onerror handler instead of being silenced by uniforms
|
|
430
|
+
setTimeout(() => {
|
|
431
|
+
throw error;
|
|
432
|
+
}, 0);
|
|
433
|
+
|
|
434
|
+
// The form will clear the errors so also remove the warning
|
|
435
|
+
setNrOfValidationErrors(0);
|
|
436
|
+
setRootErrors([]);
|
|
437
|
+
|
|
438
|
+
// The error we got contains no validation errors so don't send it to uniforms
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const onButtonClick = (
|
|
445
|
+
e:
|
|
446
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
447
|
+
| React.MouseEvent<HTMLDivElement, MouseEvent>,
|
|
448
|
+
question: string | undefined,
|
|
449
|
+
confirm: ConfirmDialogActions['closeConfirmDialog'],
|
|
450
|
+
) => {
|
|
451
|
+
console.log(e, question, confirm);
|
|
452
|
+
alert('TODO: Implement on buttonClick cancel with confirm modal');
|
|
453
|
+
// https://github.com/workfloworchestrator/orchestrator-ui/issues/325
|
|
454
|
+
|
|
455
|
+
/*
|
|
456
|
+
if (!question) {
|
|
457
|
+
return confirm(e);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
showConfirmDialog({
|
|
461
|
+
question: question,
|
|
462
|
+
confirmAction: confirm,
|
|
463
|
+
cancelAction: () => {},
|
|
464
|
+
leavePage: false,
|
|
465
|
+
});
|
|
466
|
+
*/
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
const renderButtons = (buttons: Buttons) => {
|
|
470
|
+
const prevButton = hasPrev ? (
|
|
471
|
+
<EuiButton
|
|
472
|
+
id="button-prev-form-submit"
|
|
473
|
+
fill
|
|
474
|
+
color={buttons.previous.color ?? 'primary'}
|
|
475
|
+
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
|
476
|
+
onButtonClick(e, buttons.previous.dialog, previous);
|
|
477
|
+
}}
|
|
478
|
+
>
|
|
479
|
+
{buttons.previous.text ?? t('previous')}
|
|
480
|
+
</EuiButton>
|
|
481
|
+
) : (
|
|
482
|
+
<div
|
|
483
|
+
onClick={(e) => {
|
|
484
|
+
onButtonClick(e, buttons.previous.dialog, openDialog);
|
|
485
|
+
}}
|
|
486
|
+
css={{
|
|
487
|
+
cursor: 'pointer',
|
|
488
|
+
color: theme.colors.link,
|
|
489
|
+
fontWeight: theme.font.weight.bold,
|
|
490
|
+
marginLeft: '8px',
|
|
491
|
+
display: 'flex',
|
|
492
|
+
alignItems: 'center',
|
|
493
|
+
}}
|
|
494
|
+
>
|
|
495
|
+
{buttons.previous.text ?? t('cancelProcess')}
|
|
496
|
+
</div>
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const nextButton = hasNext ? (
|
|
500
|
+
<EuiButton
|
|
501
|
+
id="button-next-form-submit"
|
|
502
|
+
tabIndex={0}
|
|
503
|
+
fill
|
|
504
|
+
color={buttons.next.color ?? 'primary'}
|
|
505
|
+
isLoading={processing}
|
|
506
|
+
type="submit"
|
|
507
|
+
>
|
|
508
|
+
{buttons.next.text ?? t('next')}
|
|
509
|
+
</EuiButton>
|
|
510
|
+
) : (
|
|
511
|
+
<EuiButton
|
|
512
|
+
id="button-submit-form-submit"
|
|
513
|
+
tabIndex={0}
|
|
514
|
+
fill
|
|
515
|
+
color={buttons.next.color ?? 'primary'}
|
|
516
|
+
isLoading={processing}
|
|
517
|
+
type="submit"
|
|
518
|
+
iconType={() => <WfoPlayFill color="#FFF" />}
|
|
519
|
+
iconSide="right"
|
|
520
|
+
>
|
|
521
|
+
{buttons.next.text ?? t('runProcess')}
|
|
522
|
+
</EuiButton>
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
return (
|
|
526
|
+
<>
|
|
527
|
+
<EuiHorizontalRule />
|
|
528
|
+
|
|
529
|
+
<EuiFlexGroup justifyContent="spaceBetween">
|
|
530
|
+
{prevButton}
|
|
531
|
+
{nextButton}
|
|
532
|
+
</EuiFlexGroup>
|
|
533
|
+
</>
|
|
534
|
+
);
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
//const prefilledForm = fillPreselection(stepUserInput, location.search);
|
|
538
|
+
const prefilledForm = fillPreselection(stepUserInput, router);
|
|
539
|
+
const bridge = new CustomTitleJSONSchemaBridge(prefilledForm, () => {});
|
|
540
|
+
const AutoFieldProvider = AutoField.componentDetectorContext.Provider;
|
|
541
|
+
|
|
542
|
+
// Get the Button config from the form default values, or default to empty config
|
|
543
|
+
const buttonsFromSchema = (prefilledForm.properties?.buttons &&
|
|
544
|
+
prefilledForm.properties?.buttons !== true &&
|
|
545
|
+
prefilledForm.properties?.buttons.default) || {
|
|
546
|
+
previous: {},
|
|
547
|
+
next: {},
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const buttons: Buttons = buttonsFromSchema as unknown as Buttons;
|
|
551
|
+
|
|
552
|
+
return (
|
|
553
|
+
<div css={userInputFormStyling}>
|
|
554
|
+
<div className="user-input-form">
|
|
555
|
+
<section className="form-fieldset">
|
|
556
|
+
{stepUserInput.title &&
|
|
557
|
+
stepUserInput.title !== 'unknown' && (
|
|
558
|
+
<h3>{stepUserInput.title}</h3>
|
|
559
|
+
)}
|
|
560
|
+
<AutoFieldProvider value={autoFieldFunction}>
|
|
561
|
+
<AutoForm
|
|
562
|
+
schema={bridge}
|
|
563
|
+
onSubmit={submit}
|
|
564
|
+
showInlineError={true}
|
|
565
|
+
validate="onSubmit"
|
|
566
|
+
model={userInput}
|
|
567
|
+
>
|
|
568
|
+
<AutoFields omitFields={['buttons']} />
|
|
569
|
+
{/* Show top level validation info about backend validation */}
|
|
570
|
+
{nrOfValidationErrors > 0 && (
|
|
571
|
+
<section className="form-errors">
|
|
572
|
+
<em className="error backend-validation-metadata">
|
|
573
|
+
{t(
|
|
574
|
+
'input_fields_have_validation_errors',
|
|
575
|
+
{
|
|
576
|
+
nrOfValidationErrors:
|
|
577
|
+
nrOfValidationErrors,
|
|
578
|
+
},
|
|
579
|
+
)}
|
|
580
|
+
</em>
|
|
581
|
+
</section>
|
|
582
|
+
)}
|
|
583
|
+
{rootErrors.length > 0 && (
|
|
584
|
+
<section className="form-errors">
|
|
585
|
+
<em className="error backend-validation-metadata">
|
|
586
|
+
{rootErrors.map((error, index) => (
|
|
587
|
+
<div
|
|
588
|
+
className="euiFormErrorText euiFormRow__text"
|
|
589
|
+
key={index}
|
|
590
|
+
>
|
|
591
|
+
{error}
|
|
592
|
+
</div>
|
|
593
|
+
))}
|
|
594
|
+
</em>
|
|
595
|
+
</section>
|
|
596
|
+
)}
|
|
597
|
+
|
|
598
|
+
{renderButtons(buttons)}
|
|
599
|
+
</AutoForm>
|
|
600
|
+
</AutoFieldProvider>
|
|
601
|
+
</section>
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
export default UserInputForm;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
// Todo: theme with decent colors from theme (style was copied from v1)
|
|
4
|
+
const PRIMARY_COLOR = '#0077cc';
|
|
5
|
+
|
|
6
|
+
export const userInputFormStyling = css`
|
|
7
|
+
.user-input-form {
|
|
8
|
+
h3 {
|
|
9
|
+
padding: 20px 0;
|
|
10
|
+
font-size: larger;
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
margin-bottom: 15px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.form-input {
|
|
16
|
+
margin: 20px 0;
|
|
17
|
+
|
|
18
|
+
padding-bottom: 20px;
|
|
19
|
+
|
|
20
|
+
em {
|
|
21
|
+
margin-bottom: 1px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.first_lightpath,
|
|
25
|
+
&.second_lightpath,
|
|
26
|
+
p.label {
|
|
27
|
+
text-transform: uppercase;
|
|
28
|
+
font-weight: bold;
|
|
29
|
+
color: ${PRIMARY_COLOR};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.downgrade_redundant_lp_choice,
|
|
33
|
+
&.service_ports_primary,
|
|
34
|
+
&.service_ports_secondary {
|
|
35
|
+
margin-left: 40px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
b {
|
|
39
|
+
// styles the arrows of numeric input
|
|
40
|
+
margin-top: 4px;
|
|
41
|
+
margin-left: 1px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
section.form-errors {
|
|
46
|
+
padding-bottom: 20px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.actions {
|
|
50
|
+
display: flex;
|
|
51
|
+
margin-top: 25px;
|
|
52
|
+
|
|
53
|
+
.notes {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
flex-grow: 2;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
label {
|
|
60
|
+
margin-right: 10px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* EUI specific styling for the forms */
|
|
66
|
+
|
|
67
|
+
.euiFormRow {
|
|
68
|
+
margin-bottom: 26px; // For service ports this add margin to the label??
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.euiFormRow__labelWrapper {
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
margin-top: -10px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.euiFormRow__label__large {
|
|
77
|
+
font-size: +1.1em;
|
|
78
|
+
margin-bottom: 0;
|
|
79
|
+
}
|
|
80
|
+
`;
|