@orchestrator-ui/orchestrator-ui-components 7.4.1 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/.turbo/turbo-lint.log +1 -13
- package/.turbo/turbo-test.log +12 -12
- package/CHANGELOG.md +427 -416
- package/__mocks__/@copilotkit/react-core.js +6 -6
- package/__mocks__/@copilotkit/react-ui.js +1 -6
- package/dist/index.d.ts +283 -176
- package/dist/index.js +3272 -7599
- package/dist/index.js.map +1 -1
- package/package.json +93 -93
- package/src/api/types.ts +36 -36
- package/src/components/WfoAgent/ExportButton/ExportButton.tsx +59 -63
- package/src/components/WfoAgent/ExportButton/styles.ts +56 -56
- package/src/components/WfoAgent/ToolProgress/DiscoverFilterPathsDisplay.tsx +79 -94
- package/src/components/WfoAgent/ToolProgress/RunSearchDisplay.tsx +22 -22
- package/src/components/WfoAgent/ToolProgress/SetFilterTreeDisplay.styles.ts +56 -56
- package/src/components/WfoAgent/ToolProgress/SetFilterTreeDisplay.tsx +76 -104
- package/src/components/WfoAgent/ToolProgress/StartNewSearchDisplay.tsx +49 -51
- package/src/components/WfoAgent/ToolProgress/ToolProgress.tsx +65 -115
- package/src/components/WfoAgent/ToolProgress/styles.ts +46 -46
- package/src/components/WfoAgent/WfoAgent/WfoAgent.tsx +69 -110
- package/src/components/WfoAgent/WfoAgentChart/WfoAgentLineChart.tsx +36 -46
- package/src/components/WfoAgent/WfoAgentChart/WfoAgentPieChart.tsx +40 -53
- package/src/components/WfoAgent/WfoAgentChart/styles.ts +2 -2
- package/src/components/WfoAgent/WfoAgentTable/WfoAgentTable.tsx +45 -55
- package/src/components/WfoAgent/WfoAgentVisualization/WfoAgentVisualization.tsx +37 -42
- package/src/components/WfoAuth/WfoAuth.tsx +11 -18
- package/src/components/WfoAuth/WfoIsAllowedToRender.tsx +5 -8
- package/src/components/WfoAuth/WfoPageUnauthorized.tsx +2 -2
- package/src/components/WfoAuth/WfoPolicyRenderPageFallback.tsx +5 -8
- package/src/components/WfoAvailabilityCheck/WfoAvailabilityCheck.tsx +8 -17
- package/src/components/WfoBackendUnavailable/WfoBackendUnavailable.tsx +71 -94
- package/src/components/WfoBadges/WfoBadge/WfoBadge.stories.tsx +9 -9
- package/src/components/WfoBadges/WfoBadge/WfoBadge.tsx +11 -14
- package/src/components/WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.stories.tsx +17 -17
- package/src/components/WfoBadges/WfoEngineStatusBadge/WfoEngineStatusBadge.tsx +19 -25
- package/src/components/WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.stories.tsx +7 -7
- package/src/components/WfoBadges/WfoEnvironmentBadge/WfoEnvironmentBadge.tsx +13 -16
- package/src/components/WfoBadges/WfoFailedTasksBadge/WfoFailedTasksBadge.stories.tsx +3 -3
- package/src/components/WfoBadges/WfoFailedTasksBadge/WfoFailedTasksBadge.tsx +66 -83
- package/src/components/WfoBadges/WfoFailedTasksBadge/styles.ts +5 -5
- package/src/components/WfoBadges/WfoHeaderBadge/WfoHeaderBadge.stories.tsx +9 -9
- package/src/components/WfoBadges/WfoHeaderBadge/WfoHeaderBadge.tsx +19 -21
- package/src/components/WfoBadges/WfoProcessStatusBadge/WfoProcessStatusBadge.tsx +56 -59
- package/src/components/WfoBadges/WfoProductBlockBadge/WfoProductBlockBadge.stories.tsx +5 -5
- package/src/components/WfoBadges/WfoProductBlockBadge/WfoProductBlockBadge.tsx +60 -66
- package/src/components/WfoBadges/WfoProductStatusBadge/WfoProductStatusBadge.stories.tsx +8 -8
- package/src/components/WfoBadges/WfoProductStatusBadge/WfoProductStatusBadge.tsx +34 -43
- package/src/components/WfoBadges/WfoScheduledTasksBadges/WfoScheduledTasksBadges.tsx +19 -29
- package/src/components/WfoBadges/WfoScheduledTasksBadges/WfoScheduledTasksBadgesContainer.tsx +10 -11
- package/src/components/WfoBadges/WfoSubscriptionStatusBadge/WfoSubscriptionStatusBadge.stories.tsx +11 -11
- package/src/components/WfoBadges/WfoSubscriptionStatusBadge/WfoSubscriptionStatusBadge.tsx +35 -44
- package/src/components/WfoBadges/WfoSubscriptionSyncStatusBadge/WfoSubscriptionSyncStatusBadge.stories.tsx +12 -12
- package/src/components/WfoBadges/WfoSubscriptionSyncStatusBadge/WfoSubscriptionSyncStatusBadge.tsx +31 -34
- package/src/components/WfoBadges/WfoVersionIncompatibleBadge/WfoVersionIncompatibleBadge.stories.tsx +7 -7
- package/src/components/WfoBadges/WfoVersionIncompatibleBadge/WfoVersionIncompatibleBadge.tsx +44 -47
- package/src/components/WfoBadges/WfoWebsocketStatusBadge/WfoWebsocketStatusBadge.stories.tsx +3 -3
- package/src/components/WfoBadges/WfoWebsocketStatusBadge/WfoWebsocketStatusBadge.tsx +48 -71
- package/src/components/WfoBadges/WfoWebsocketStatusBadge/styles.ts +14 -16
- package/src/components/WfoBadges/WfoWorkflowTargetBadge/WfoWorkflowTargetBadge.tsx +51 -63
- package/src/components/WfoButtonComboBox/WfoButtonComboBox.tsx +55 -64
- package/src/components/WfoButtonComboBox/styles.ts +19 -19
- package/src/components/WfoButtonWithConfirm/WfoButtonWithConfirm.tsx +21 -21
- package/src/components/WfoContentHeader/WfoContentHeader.tsx +28 -48
- package/src/components/WfoDateTime/WfoDateTime.tsx +3 -3
- package/src/components/WfoDiff/WfoDiff.tsx +82 -100
- package/src/components/WfoDiff/styles.ts +28 -35
- package/src/components/WfoDropdownButton/WfoDropdownButton.tsx +54 -58
- package/src/components/WfoError/WfoError.stories.tsx +9 -12
- package/src/components/WfoError/WfoError.tsx +22 -25
- package/src/components/WfoErrorBoundary/WfoErrorBoundary.tsx +30 -34
- package/src/components/WfoExpandableField/WfoExpandableField.tsx +24 -31
- package/src/components/WfoExpandableField/styles.ts +11 -11
- package/src/components/WfoFilterTabs/WfoFilterTabs.tsx +33 -35
- package/src/components/WfoFilterTabs/styles.ts +7 -7
- package/src/components/WfoInlineEdit/WfoInlineEdit.tsx +99 -112
- package/src/components/WfoInlineNoteEdit/WfoSubscriptionDetailNoteEdit.tsx +33 -39
- package/src/components/WfoInlineNoteEdit/WfoSubscriptionNoteEdit.tsx +32 -35
- package/src/components/WfoInsyncIcon/WfoInsyncIcon.stories.tsx +8 -8
- package/src/components/WfoInsyncIcon/WfoInsyncIcon.tsx +5 -15
- package/src/components/WfoJsonCodeBlock/WfoJsonCodeBlock.tsx +15 -19
- package/src/components/WfoJsonCodeBlock/styles.ts +19 -19
- package/src/components/WfoKeyValueTable/WfoKeyCell.tsx +10 -11
- package/src/components/WfoKeyValueTable/WfoKeyValueTable.tsx +22 -25
- package/src/components/WfoKeyValueTable/WfoValueCell.tsx +44 -54
- package/src/components/WfoKeyValueTable/WfoValueOnlyTable.tsx +19 -22
- package/src/components/WfoKeyValueTable/styles.ts +77 -78
- package/src/components/WfoLogoSpinner/WfoLogoSpinner.tsx +22 -29
- package/src/components/WfoLogoSpinner/styles.ts +33 -36
- package/src/components/WfoMetadata/WfoMetadataDescriptionField.tsx +8 -14
- package/src/components/WfoMonacoCodeBlock/WfoMonacoCodeBlock.tsx +56 -63
- package/src/components/WfoMonacoCodeBlock/styles.ts +9 -11
- package/src/components/WfoNoResults/WfoNoResults.stories.tsx +6 -6
- package/src/components/WfoNoResults/WfoNoResults.tsx +8 -8
- package/src/components/WfoNoResults/styles.ts +16 -16
- package/src/components/WfoOptionalLink/WfoOptionalLink.tsx +7 -10
- package/src/components/WfoPageTemplate/WfoBreadcrumbs/WfoBreadcrumbs.tsx +61 -87
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoAppLogo.tsx +15 -24
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoHamburgerMenu.tsx +115 -140
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.stories.tsx +43 -43
- package/src/components/WfoPageTemplate/WfoPageHeader/WfoPageHeader.tsx +67 -101
- package/src/components/WfoPageTemplate/WfoPageHeader/styles.ts +16 -16
- package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.spec.ts +6 -6
- package/src/components/WfoPageTemplate/WfoPageHeader/utils/toHexColorWithOpacity.ts +2 -2
- package/src/components/WfoPageTemplate/WfoPageTemplate/ContentContext.tsx +10 -16
- package/src/components/WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.stories.tsx +10 -10
- package/src/components/WfoPageTemplate/WfoPageTemplate/WfoPageTemplate.tsx +62 -94
- package/src/components/WfoPageTemplate/WfoPageTemplate/styles.ts +19 -22
- package/src/components/WfoPageTemplate/WfoSidebar/WfoCopyright.tsx +13 -13
- package/src/components/WfoPageTemplate/WfoSidebar/WfoMenuLink.tsx +40 -42
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.stories.tsx +7 -7
- package/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx +205 -240
- package/src/components/WfoPageTemplate/WfoSidebar/styles.ts +117 -99
- package/src/components/WfoPageTemplate/WfoSidebar/utils/menuItemIsAllowed.spec.ts +31 -40
- package/src/components/WfoPageTemplate/WfoSidebar/utils/menuItemIsAllowed.ts +8 -8
- package/src/components/WfoPageTemplate/paths.ts +1 -2
- package/src/components/WfoPopover/WfoPopover.tsx +26 -36
- package/src/components/WfoProcessList/WfoProcessesList.tsx +212 -247
- package/src/components/WfoProcessList/processListObjectMappers.ts +95 -100
- package/src/components/WfoPydanticForm/Footer.tsx +139 -157
- package/src/components/WfoPydanticForm/Header.tsx +9 -10
- package/src/components/WfoPydanticForm/RenderFormErrors.tsx +18 -20
- package/src/components/WfoPydanticForm/Row.tsx +22 -31
- package/src/components/WfoPydanticForm/WfoPydanticForm.tsx +77 -93
- package/src/components/WfoPydanticForm/fields/WfoArrayField/WfoArrayField.tsx +85 -120
- package/src/components/WfoPydanticForm/fields/WfoArrayField/styles.ts +28 -28
- package/src/components/WfoPydanticForm/fields/WfoCallout.tsx +9 -12
- package/src/components/WfoPydanticForm/fields/WfoCheckbox.tsx +11 -16
- package/src/components/WfoPydanticForm/fields/WfoDivider.tsx +4 -8
- package/src/components/WfoPydanticForm/fields/WfoDropdown.tsx +6 -17
- package/src/components/WfoPydanticForm/fields/WfoInteger.tsx +29 -43
- package/src/components/WfoPydanticForm/fields/WfoLabel.tsx +14 -14
- package/src/components/WfoPydanticForm/fields/WfoMultiCheckboxField.tsx +40 -51
- package/src/components/WfoPydanticForm/fields/WfoObjectField/WfoObjectField.tsx +22 -35
- package/src/components/WfoPydanticForm/fields/WfoObjectField/styles.ts +9 -9
- package/src/components/WfoPydanticForm/fields/WfoRadio.tsx +15 -20
- package/src/components/WfoPydanticForm/fields/WfoReactSelect/WfoReactSelect.tsx +84 -97
- package/src/components/WfoPydanticForm/fields/WfoReactSelect/styles.ts +68 -85
- package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +58 -67
- package/src/components/WfoPydanticForm/fields/WfoText.tsx +16 -26
- package/src/components/WfoPydanticForm/fields/WfoTextArea.tsx +12 -17
- package/src/components/WfoPydanticForm/fields/WfoTimestampField.tsx +42 -48
- package/src/components/WfoPydanticForm/fields/styles.ts +71 -71
- package/src/components/WfoPydanticForm/fields/wfoPydanticFormUtils.spec.ts +24 -24
- package/src/components/WfoPydanticForm/fields/wfoPydanticFormUtils.ts +11 -18
- package/src/components/WfoRadioDropdown/WfoRadioDropdown.tsx +55 -74
- package/src/components/WfoRenderElementOrString/WfoRenderElementOrString.tsx +8 -8
- package/src/components/WfoSearchBar/WfoSearchField.tsx +35 -47
- package/src/components/WfoSearchPage/WfoConditionRow/WfoConditionRow.tsx +290 -354
- package/src/components/WfoSearchPage/WfoConditionRow/WfoFieldSelector.tsx +30 -30
- package/src/components/WfoSearchPage/WfoConditionRow/WfoOperatorSelector.tsx +56 -85
- package/src/components/WfoSearchPage/WfoConditionRow/WfoPathChips.tsx +143 -171
- package/src/components/WfoSearchPage/WfoConditionRow/WfoPathSelector.tsx +40 -42
- package/src/components/WfoSearchPage/WfoConditionRow/WfoRenderFunctions.tsx +50 -86
- package/src/components/WfoSearchPage/WfoConditionRow/WfoSelectedPathDisplay.tsx +48 -65
- package/src/components/WfoSearchPage/WfoConditionRow/index.ts +1 -4
- package/src/components/WfoSearchPage/WfoConditionRow/types.ts +56 -61
- package/src/components/WfoSearchPage/WfoConditionRow/utils.ts +36 -48
- package/src/components/WfoSearchPage/WfoFilterGroup/WfoFilterGroup.tsx +158 -213
- package/src/components/WfoSearchPage/WfoSearch/WfoSearch.tsx +327 -411
- package/src/components/WfoSearchPage/WfoSearchResults/WfoHighlightedText.tsx +46 -53
- package/src/components/WfoSearchPage/WfoSearchResults/WfoPathBreadcrumb.tsx +50 -67
- package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchEmptyState.tsx +13 -13
- package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchLoadingState.tsx +13 -13
- package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchMetadataHeader.tsx +13 -15
- package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchPaginationInfo.tsx +76 -86
- package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchResultItem.tsx +112 -133
- package/src/components/WfoSearchPage/WfoSearchResults/WfoSearchResults.tsx +31 -31
- package/src/components/WfoSearchPage/WfoValueControl/WfoValueControl.tsx +181 -215
- package/src/components/WfoSearchPage/constants.ts +3 -8
- package/src/components/WfoSearchPage/utils.ts +83 -112
- package/src/components/WfoSettings/WfoAoStackStatus.tsx +19 -28
- package/src/components/WfoSettings/WfoEngineStatus.tsx +31 -37
- package/src/components/WfoSettings/WfoEngineStatusButton.tsx +17 -30
- package/src/components/WfoSettings/WfoFlushSettings.tsx +54 -72
- package/src/components/WfoSettings/WfoModifySettings.tsx +23 -29
- package/src/components/WfoSettings/WfoResetTextSearchIndexButton.tsx +7 -10
- package/src/components/WfoSettings/WfoWorkerStatus.tsx +35 -42
- package/src/components/WfoSettings/styles.ts +17 -17
- package/src/components/WfoSettingsModal/WfoInformationModal.tsx +25 -29
- package/src/components/WfoSettingsModal/WfoSettingsModal.tsx +43 -43
- package/src/components/WfoSettingsModal/WfoSubmitModal.tsx +45 -50
- package/src/components/WfoStartButton/WfoStartButtonComboBox.tsx +98 -121
- package/src/components/WfoStartButton/WfoStartTaskComboBox.tsx +35 -35
- package/src/components/WfoStartButton/WfoStartWorkflowComboBox.tsx +42 -44
- package/src/components/WfoStartButton/styles.ts +15 -15
- package/src/components/WfoSubscription/SubscriptionKeyValueBlock.tsx +23 -35
- package/src/components/WfoSubscription/WfoCustomerDescriptionsField.tsx +85 -99
- package/src/components/WfoSubscription/WfoInSyncField/WfoInSyncErrorToastMessage.tsx +15 -17
- package/src/components/WfoSubscription/WfoInSyncField/WfoInSyncField.tsx +147 -192
- package/src/components/WfoSubscription/WfoInUseByRelations.tsx +50 -74
- package/src/components/WfoSubscription/WfoProcessesTimeline.tsx +113 -173
- package/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx +140 -172
- package/src/components/WfoSubscription/WfoSubscription.tsx +67 -102
- package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActionExpandableMenuItem.tsx +47 -53
- package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActions.tsx +173 -223
- package/src/components/WfoSubscription/WfoSubscriptionActions/WfoSubscriptionActionsMenuItem.tsx +67 -87
- package/src/components/WfoSubscription/WfoSubscriptionActions/styles.ts +70 -70
- package/src/components/WfoSubscription/WfoSubscriptionDetailTree.tsx +190 -242
- package/src/components/WfoSubscription/WfoSubscriptionGeneral.tsx +48 -60
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionDetailSection.tsx +67 -91
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionFixedInputSection.tsx +8 -15
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionMetadataSection.tsx +8 -15
- package/src/components/WfoSubscription/WfoSubscriptionGeneralSections/WfoSubscriptionProductInfoSection.tsx +34 -41
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock/WfoProductBlockKeyValueRow.tsx +36 -36
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock/WfoSubscriptionProductBlock.tsx +156 -233
- package/src/components/WfoSubscription/WfoSubscriptionProductBlock/styles.ts +60 -62
- package/src/components/WfoSubscription/WfoTargetTypeIcon.tsx +39 -50
- package/src/components/WfoSubscription/overrides/useSubscriptionDetailGeneralSectionConfigurationOverride.ts +6 -8
- package/src/components/WfoSubscription/overrides/useSubscriptionDetailValueOverride.ts +20 -23
- package/src/components/WfoSubscription/styles.ts +57 -62
- package/src/components/WfoSubscription/subscriptionDetailTabs.tsx +44 -48
- package/src/components/WfoSubscription/utils/relatedSubscriptionsListItemsObjectMappers.ts +30 -42
- package/src/components/WfoSubscription/utils/utils.spec.ts +405 -452
- package/src/components/WfoSubscription/utils/utils.ts +139 -159
- package/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx +214 -258
- package/src/components/WfoSubscriptionsList/subscriptionListTabs.ts +39 -42
- package/src/components/WfoSubscriptionsList/subscriptionResultMappers.ts +33 -45
- package/src/components/WfoSummary/WfoActiveWorkflowsSummaryCard.tsx +19 -28
- package/src/components/WfoSummary/WfoFailedTasksSummaryCard.tsx +18 -21
- package/src/components/WfoSummary/WfoLatestActiveSubscriptionsSummaryCard.tsx +22 -28
- package/src/components/WfoSummary/WfoLatestOutOfSyncSubscriptionSummaryCard.tsx +30 -40
- package/src/components/WfoSummary/WfoMyWorkflowsSummaryCard.tsx +30 -44
- package/src/components/WfoSummary/WfoProductsSummaryCard.tsx +37 -45
- package/src/components/WfoSummary/WfoSummaryCard.tsx +68 -99
- package/src/components/WfoSummary/WfoSummaryCardHeader/WfoSummaryCardHeader.tsx +38 -50
- package/src/components/WfoSummary/WfoSummaryCardHeader/styles.ts +18 -18
- package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardList.tsx +44 -67
- package/src/components/WfoSummary/WfoSummaryCardList/WfoSummaryCardListItem.tsx +25 -44
- package/src/components/WfoSummary/WfoSummaryCardList/styles.ts +49 -49
- package/src/components/WfoSummary/WfoSummaryCards.tsx +7 -11
- package/src/components/WfoSummary/getNumberOfColumns.ts +12 -12
- package/src/components/WfoSummary/styles.ts +7 -7
- package/src/components/WfoTable/WfoAdvancedTable/WfoAdvancedTable.tsx +181 -229
- package/src/components/WfoTable/WfoAdvancedTable/getRowDetailData.tsx +31 -42
- package/src/components/WfoTable/WfoAdvancedTable/toSortedTableColumnConfig.ts +8 -8
- package/src/components/WfoTable/WfoAdvancedTable/types.ts +9 -11
- package/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx +19 -30
- package/src/components/WfoTable/WfoFirstPartUUID/styles.ts +19 -19
- package/src/components/WfoTable/WfoInlineJson/WfoInlineJson.tsx +6 -6
- package/src/components/WfoTable/WfoRowContextMenu/WfoRowContextMenu.tsx +30 -46
- package/src/components/WfoTable/WfoSortButtons/WfoSortButton.tsx +11 -24
- package/src/components/WfoTable/WfoSortButtons/WfoSortButtons.tsx +18 -21
- package/src/components/WfoTable/WfoSortButtons/styles.ts +14 -14
- package/src/components/WfoTable/WfoStatusColorField/WfoStatusColorField.tsx +3 -5
- package/src/components/WfoTable/WfoStatusColorField/styles.ts +10 -10
- package/src/components/WfoTable/WfoTable/WfoDataCell.tsx +8 -14
- package/src/components/WfoTable/WfoTable/WfoDragHandler.tsx +49 -61
- package/src/components/WfoTable/WfoTable/WfoExpandedRow.tsx +12 -33
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandableRow.tsx +28 -32
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoExpandedGroupRow.tsx +34 -52
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTable.tsx +63 -78
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/WfoGroupedTableGroups.tsx +40 -54
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/styles.ts +28 -28
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/useGroupedTableConfig.tsx +147 -168
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.spec.ts +133 -140
- package/src/components/WfoTable/WfoTable/WfoGroupedTable/utils.ts +21 -33
- package/src/components/WfoTable/WfoTable/WfoMultilineCell.tsx +5 -5
- package/src/components/WfoTable/WfoTable/WfoTable.tsx +213 -251
- package/src/components/WfoTable/WfoTable/WfoTableDataRows.tsx +63 -107
- package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/WfoPopoverContent.tsx +34 -40
- package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/WfoSortDirectionIcon.tsx +17 -21
- package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/WfoTableHeaderCell.tsx +68 -83
- package/src/components/WfoTable/WfoTable/WfoTableHeaderCell/styles.ts +118 -118
- package/src/components/WfoTable/WfoTable/WfoTableHeaderRow.tsx +91 -118
- package/src/components/WfoTable/WfoTable/WfoToolTip.tsx +17 -21
- package/src/components/WfoTable/WfoTable/WfoTruncateCell.tsx +15 -15
- package/src/components/WfoTable/WfoTable/WfoVirtualizedTableBody.tsx +42 -49
- package/src/components/WfoTable/WfoTable/styles.ts +168 -176
- package/src/components/WfoTable/WfoTable/utils.spec.ts +71 -89
- package/src/components/WfoTable/WfoTable/utils.ts +61 -80
- package/src/components/WfoTable/WfoTableSettingsModal/WfoTableSettingsModal.tsx +77 -100
- package/src/components/WfoTable/WfoTableSettingsModal/styles.ts +12 -14
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.spec.ts +63 -65
- package/src/components/WfoTable/WfoTableWithFilter/updateQueryString.ts +33 -44
- package/src/components/WfoTable/utils/columns.spec.ts +17 -17
- package/src/components/WfoTable/utils/columns.ts +16 -18
- package/src/components/WfoTable/utils/constants.ts +6 -12
- package/src/components/WfoTable/utils/tableConfigPersistence.spec.ts +61 -61
- package/src/components/WfoTable/utils/tableConfigPersistence.ts +21 -30
- package/src/components/WfoTable/utils/tableUtils.spec.ts +100 -117
- package/src/components/WfoTable/utils/tableUtils.ts +33 -50
- package/src/components/WfoTableCodeBlock/WfoTableCodeBlock.tsx +20 -27
- package/src/components/WfoTableCodeBlock/styles.ts +8 -8
- package/src/components/WfoTextAnchor/WfoTextAnchor.stories.tsx +6 -6
- package/src/components/WfoTextAnchor/WfoTextAnchor.tsx +8 -8
- package/src/components/WfoTextAnchor/styles.ts +11 -11
- package/src/components/WfoTimeline/WfoTimeline.tsx +28 -43
- package/src/components/WfoTimeline/WfoTimelineStep.tsx +38 -40
- package/src/components/WfoTimeline/mapProcessStepStatusToEuiStepStatus.ts +16 -18
- package/src/components/WfoTimeline/styles.ts +151 -168
- package/src/components/WfoTimeline/timelineUtils.ts +5 -10
- package/src/components/WfoTitleWithWebsocketBadge/WfoTitleWithWebsocketBadge.tsx +10 -13
- package/src/components/WfoToastsList/WfoToastsList.tsx +11 -13
- package/src/components/WfoTree/WfoTree.tsx +14 -14
- package/src/components/WfoTree/WfoTreeBranch.tsx +27 -39
- package/src/components/WfoTree/WfoTreeNode.tsx +29 -41
- package/src/components/WfoTree/WfoTreeNodeListItem.tsx +34 -48
- package/src/components/WfoTree/styles.ts +35 -38
- package/src/components/WfoTree/treeUtils.spec.ts +141 -146
- package/src/components/WfoTree/treeUtils.ts +52 -58
- package/src/components/WfoWorkflowSteps/WfoStep/WfoCodeViewSelector.tsx +75 -106
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.stories.tsx +3 -3
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStep.tsx +128 -191
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepForm.tsx +42 -58
- package/src/components/WfoWorkflowSteps/WfoStep/WfoStepFormFooter.tsx +31 -42
- package/src/components/WfoWorkflowSteps/WfoStepList/WfoStepList.tsx +79 -101
- package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.stories.tsx +6 -6
- package/src/components/WfoWorkflowSteps/WfoStepStatusIcon/WfoStepStatusIcon.tsx +64 -103
- package/src/components/WfoWorkflowSteps/WfoTraceback/WfoTraceback.tsx +11 -11
- package/src/components/WfoWorkflowSteps/WfoTraceback/styles.ts +8 -8
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoStepListHeader.tsx +97 -140
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.stories.tsx +40 -40
- package/src/components/WfoWorkflowSteps/WfoWorkflowStepList/WfoWorkflowStepList.tsx +146 -198
- package/src/components/WfoWorkflowSteps/stepListUtils.spec.ts +18 -18
- package/src/components/WfoWorkflowSteps/stepListUtils.ts +14 -25
- package/src/components/WfoWorkflowSteps/styles.ts +116 -122
- package/src/components/confirmationDialog/ConfirmationDialogStyling.ts +7 -7
- package/src/components/confirmationDialog/WfoConfirmationDialog.tsx +58 -72
- package/src/configuration/constants.ts +2 -4
- package/src/configuration/policy-resources.ts +21 -21
- package/src/configuration/version.ts +1 -1
- package/src/contexts/ConfirmationDialogProvider.tsx +54 -72
- package/src/contexts/OrchestratorConfigContext.tsx +23 -30
- package/src/contexts/PolicyContext.tsx +6 -11
- package/src/contexts/TreeContext.tsx +83 -97
- package/src/contexts/WfoErrorMonitoringProvider.tsx +16 -19
- package/src/hooks/useBackendAvailability.ts +39 -44
- package/src/hooks/useCheckEngineStatus.ts +19 -19
- package/src/hooks/useContentRef.ts +1 -1
- package/src/hooks/useDataDisplayParams.ts +35 -47
- package/src/hooks/useDebounce.ts +14 -14
- package/src/hooks/useGetOrchestratorConfig.ts +1 -1
- package/src/hooks/useGetPydanticFormsConfig.tsx +249 -286
- package/src/hooks/useGetSchedulesForWorkflow.tsx +19 -20
- package/src/hooks/useGetWorkflowNameById.tsx +8 -13
- package/src/hooks/useOrchestratorConfig.ts +2 -4
- package/src/hooks/useOrchestratorTheme.ts +20 -24
- package/src/hooks/usePathAutoComplete.ts +105 -117
- package/src/hooks/usePolicy.ts +5 -6
- package/src/hooks/useSearch.ts +60 -75
- package/src/hooks/useSearchPagination.ts +124 -134
- package/src/hooks/useShowToastMessage.ts +12 -12
- package/src/hooks/useStoredTableConfig.ts +22 -29
- package/src/hooks/useUrlParams.ts +90 -108
- package/src/hooks/useWfoErrorMonitoring.ts +1 -2
- package/src/hooks/useWfoSession.ts +15 -17
- package/src/hooks/useWithOrchestratorTheme.ts +3 -5
- package/src/icons/WfoActualWork.tsx +8 -17
- package/src/icons/WfoArrowsExpand.stories.tsx +3 -3
- package/src/icons/WfoArrowsExpand.tsx +12 -28
- package/src/icons/WfoBell.tsx +12 -28
- package/src/icons/WfoBoltFill.tsx +15 -31
- package/src/icons/WfoBoltSlashFill.tsx +15 -31
- package/src/icons/WfoChartBar.tsx +22 -26
- package/src/icons/WfoCheckmarkCircleFill.stories.tsx +3 -3
- package/src/icons/WfoCheckmarkCircleFill.tsx +11 -27
- package/src/icons/WfoChevronDown.stories.tsx +3 -3
- package/src/icons/WfoChevronDown.tsx +12 -28
- package/src/icons/WfoChevronUp.stories.tsx +3 -3
- package/src/icons/WfoChevronUp.tsx +12 -28
- package/src/icons/WfoClipboardCopy.stories.tsx +3 -3
- package/src/icons/WfoClipboardCopy.tsx +12 -28
- package/src/icons/WfoCode.stories.tsx +3 -3
- package/src/icons/WfoCode.tsx +14 -30
- package/src/icons/WfoCogFill.stories.tsx +3 -3
- package/src/icons/WfoCogFill.tsx +18 -28
- package/src/icons/WfoContactEnvelopeFill.tsx +9 -24
- package/src/icons/WfoCubeFill.tsx +14 -35
- package/src/icons/WfoCubeSolid.tsx +12 -28
- package/src/icons/WfoDotsHorizontal.tsx +12 -28
- package/src/icons/WfoExclamationTriangle.tsx +13 -24
- package/src/icons/WfoExternalLink.tsx +9 -25
- package/src/icons/WfoEyeFill.stories.tsx +3 -3
- package/src/icons/WfoEyeFill.tsx +14 -30
- package/src/icons/WfoIconProps.ts +3 -3
- package/src/icons/WfoLogoutIcon.stories.tsx +3 -3
- package/src/icons/WfoLogoutIcon.tsx +12 -28
- package/src/icons/WfoMalfunction.tsx +8 -17
- package/src/icons/WfoMinusCircleFill.stories.tsx +3 -3
- package/src/icons/WfoMinusCircleFill.tsx +12 -28
- package/src/icons/WfoMinusCircleOutline.stories.tsx +3 -3
- package/src/icons/WfoMinusCircleOutline.tsx +11 -27
- package/src/icons/WfoPencil.tsx +12 -30
- package/src/icons/WfoPencilAlt.stories.tsx +3 -3
- package/src/icons/WfoPencilAlt.tsx +12 -28
- package/src/icons/WfoPlannedWork.tsx +9 -18
- package/src/icons/WfoPlayCircle.tsx +14 -30
- package/src/icons/WfoPlayFill.stories.tsx +3 -3
- package/src/icons/WfoPlayFill.tsx +14 -30
- package/src/icons/WfoPlusCircleFill.stories.tsx +3 -3
- package/src/icons/WfoPlusCircleFill.tsx +12 -28
- package/src/icons/WfoPort.tsx +9 -18
- package/src/icons/WfoQuestionCircle.tsx +13 -29
- package/src/icons/WfoRefresh.stories.tsx +3 -3
- package/src/icons/WfoRefresh.tsx +14 -30
- package/src/icons/WfoSearchStrikethrough.stories.tsx +3 -3
- package/src/icons/WfoSearchStrikethrough.tsx +12 -28
- package/src/icons/WfoShare.tsx +14 -30
- package/src/icons/WfoSideMenu.stories.tsx +3 -3
- package/src/icons/WfoSideMenu.tsx +10 -34
- package/src/icons/WfoSortAsc.stories.tsx +3 -3
- package/src/icons/WfoSortAsc.tsx +12 -28
- package/src/icons/WfoSortDesc.stories.tsx +3 -3
- package/src/icons/WfoSortDesc.tsx +12 -28
- package/src/icons/WfoStatistic.tsx +32 -36
- package/src/icons/WfoStatusDotIcon.stories.tsx +3 -3
- package/src/icons/WfoStatusDotIcon.tsx +10 -26
- package/src/icons/WfoTrash.tsx +13 -23
- package/src/icons/WfoViewList.tsx +9 -19
- package/src/icons/WfoWarningTriangle.tsx +13 -23
- package/src/icons/WfoXCircleFill.stories.tsx +3 -3
- package/src/icons/WfoXCircleFill.tsx +12 -28
- package/src/icons/WfoXMarkSmall.tsx +9 -24
- package/src/icons/heroicons/WfoArrowDown.tsx +8 -18
- package/src/icons/heroicons/WfoArrowUp.tsx +8 -18
- package/src/icons/heroicons/WfoArrowsUpDown.tsx +8 -18
- package/src/icons/heroicons/WfoBracketSquare.tsx +16 -20
- package/src/icons/heroicons/WfoCommandLine.tsx +16 -20
- package/src/icons/heroicons/WfoHeroIconsWrapper.tsx +23 -26
- package/src/icons/heroicons/WfoScheduledTaskOnce.tsx +14 -24
- package/src/icons/heroicons/WfoScheduledTaskRecurring.tsx +18 -24
- package/src/icons/heroicons/WfoSquareStack3dStack.tsx +7 -19
- package/src/icons/heroicons/WfoTableCells.tsx +16 -20
- package/src/icons/heroicons/WfoWrench.tsx +8 -18
- package/src/messages/en-GB.json +623 -623
- package/src/messages/getTranslationMessages.spec.ts +3 -3
- package/src/messages/nl-NL.json +492 -492
- package/src/messages/useGetTranslationMessages.ts +20 -20
- package/src/pages/metadata/WfoMetadataPageLayout.tsx +53 -60
- package/src/pages/metadata/WfoProductBlocksPage.tsx +229 -283
- package/src/pages/metadata/WfoProductsPage.tsx +217 -282
- package/src/pages/metadata/WfoResourceTypesPage.tsx +178 -230
- package/src/pages/metadata/WfoScheduleTaskFormPage.tsx +365 -407
- package/src/pages/metadata/WfoScheduledTasksPage.tsx +173 -226
- package/src/pages/metadata/WfoTasksPage.tsx +247 -337
- package/src/pages/metadata/WfoWorkflowsPage.tsx +213 -282
- package/src/pages/metadata/taskListObjectMapper.ts +26 -34
- package/src/pages/metadata/workflowListObjectMapper.ts +23 -31
- package/src/pages/processes/WfoProcessDetail.tsx +247 -346
- package/src/pages/processes/WfoProcessDetailPage.tsx +53 -76
- package/src/pages/processes/WfoProcessListSubscriptionsCell.tsx +55 -64
- package/src/pages/processes/WfoProductInformationWithLink.tsx +18 -26
- package/src/pages/processes/WfoStartProcessPage.tsx +121 -153
- package/src/pages/processes/timelineUtils.spec.ts +167 -179
- package/src/pages/processes/timelineUtils.ts +63 -87
- package/src/pages/settings/WfoSettingsPage.tsx +131 -161
- package/src/pages/startPage/WfoStartPage.tsx +36 -45
- package/src/pages/startPage/mappers.ts +8 -10
- package/src/pages/startPage/queryVariables.ts +84 -93
- package/src/pages/startPage/useStartPageSummaryCardConfigurationOverride.ts +6 -8
- package/src/pages/subscriptions/WfoSubscriptionDetailPage.tsx +9 -9
- package/src/pages/subscriptions/WfoSubscriptionsListPage.tsx +66 -85
- package/src/pages/tasks/WfoTasksListPage.tsx +129 -156
- package/src/pages/tasks/getTasksListTabTypeFromString.ts +12 -14
- package/src/pages/tasks/tabConfig.ts +41 -44
- package/src/pages/workflows/WfoWorkflowsListPage.tsx +73 -88
- package/src/pages/workflows/getWorkflowsListTabTypeFromString.ts +12 -14
- package/src/pages/workflows/tabConfig.ts +41 -44
- package/src/rtk/api.ts +113 -132
- package/src/rtk/endpoints/agentExport.ts +12 -12
- package/src/rtk/endpoints/availability.ts +29 -32
- package/src/rtk/endpoints/customerDescriptions.ts +40 -46
- package/src/rtk/endpoints/customers.ts +26 -40
- package/src/rtk/endpoints/fileUpload.ts +20 -20
- package/src/rtk/endpoints/forms.ts +41 -54
- package/src/rtk/endpoints/inSync.ts +16 -19
- package/src/rtk/endpoints/metadata/productBlocks.ts +37 -43
- package/src/rtk/endpoints/metadata/products.ts +37 -42
- package/src/rtk/endpoints/metadata/resourceTypes.ts +38 -44
- package/src/rtk/endpoints/metadata/scheduledTasks.ts +88 -99
- package/src/rtk/endpoints/metadata/tasks.ts +21 -32
- package/src/rtk/endpoints/metadata/workflows.ts +65 -86
- package/src/rtk/endpoints/processDetail.ts +87 -103
- package/src/rtk/endpoints/processList.ts +20 -29
- package/src/rtk/endpoints/processListSummary.ts +18 -34
- package/src/rtk/endpoints/processStatusCounts.ts +16 -16
- package/src/rtk/endpoints/processSteps.ts +17 -27
- package/src/rtk/endpoints/productsSummary.ts +21 -26
- package/src/rtk/endpoints/relatedSubscriptions.ts +27 -38
- package/src/rtk/endpoints/search.ts +63 -82
- package/src/rtk/endpoints/settings.ts +110 -119
- package/src/rtk/endpoints/startOptions.ts +64 -80
- package/src/rtk/endpoints/streamMessages.ts +102 -125
- package/src/rtk/endpoints/subscriptionActions.ts +14 -24
- package/src/rtk/endpoints/subscriptionDetail.ts +23 -35
- package/src/rtk/endpoints/subscriptionInUseByRelationsList.ts +22 -32
- package/src/rtk/endpoints/subscriptionList.ts +19 -31
- package/src/rtk/endpoints/subscriptionListMutation.ts +65 -81
- package/src/rtk/endpoints/subscriptionListSummary.ts +23 -29
- package/src/rtk/endpoints/translations.ts +16 -19
- package/src/rtk/endpoints/versions.ts +9 -9
- package/src/rtk/slices/customApis.ts +8 -10
- package/src/rtk/slices/orchestratorComponentOverride.ts +20 -22
- package/src/rtk/slices/orchestratorConfig.ts +7 -10
- package/src/rtk/slices/pydanticForm.ts +7 -9
- package/src/rtk/slices/toastMessages.ts +26 -36
- package/src/rtk/store.ts +35 -44
- package/src/rtk/storeProvider.tsx +20 -21
- package/src/rtk/utils.spec.ts +68 -68
- package/src/rtk/utils.ts +72 -80
- package/src/rtk/wfoGraphqlRequestBaseQuery.ts +44 -63
- package/src/theme/baseStyles/formFieldsBaseStyle.ts +12 -12
- package/src/theme/wfoThemeModifications.ts +92 -95
- package/src/types/forms.ts +20 -20
- package/src/types/search.ts +89 -94
- package/src/types/types.ts +378 -403
- package/src/utils/cacheTag.spec.ts +8 -8
- package/src/utils/cacheTag.ts +7 -7
- package/src/utils/compareVersions.spec.ts +38 -116
- package/src/utils/compareVersions.ts +28 -48
- package/src/utils/csvDownload.ts +68 -83
- package/src/utils/date.spec.ts +142 -179
- package/src/utils/date.ts +64 -84
- package/src/utils/environmentVariables.spec.ts +12 -12
- package/src/utils/environmentVariables.ts +7 -7
- package/src/utils/filterData.spec.ts +18 -20
- package/src/utils/filterData.ts +7 -10
- package/src/utils/getDefaultTableConfig.ts +91 -113
- package/src/utils/getEnvironmentVariables.spec.ts +30 -32
- package/src/utils/getEnvironmentVariables.ts +19 -22
- package/src/utils/getObjectKeys.ts +2 -3
- package/src/utils/getProductNamesFromProcess.spec.ts +125 -127
- package/src/utils/getProductNamesFromProcess.ts +7 -9
- package/src/utils/getQueryParams.spec.ts +31 -34
- package/src/utils/getQueryParams.ts +9 -12
- package/src/utils/getQueryUrl.spec.ts +4 -4
- package/src/utils/getQueryUrl.ts +3 -3
- package/src/utils/getQueryVariablesForExport.spec.ts +12 -12
- package/src/utils/getQueryVariablesForExport.ts +4 -6
- package/src/utils/getStatusBadgeColor.ts +13 -13
- package/src/utils/getToastMessage.spec.ts +20 -20
- package/src/utils/getToastMessage.ts +24 -28
- package/src/utils/getTokenName.spec.ts +16 -16
- package/src/utils/getTokenName.ts +10 -10
- package/src/utils/getTypedFieldFromObject.spec.ts +13 -13
- package/src/utils/getTypedFieldFromObject.ts +5 -8
- package/src/utils/onlyUnique.spec.ts +15 -15
- package/src/utils/onlyUnique.ts +1 -1
- package/src/utils/optionalArray.spec.ts +65 -78
- package/src/utils/optionalArray.ts +10 -16
- package/src/utils/resultFlattener.spec.ts +40 -43
- package/src/utils/resultFlattener.ts +10 -21
- package/src/utils/string.spec.ts +133 -133
- package/src/utils/strings.ts +11 -11
- package/src/utils/toObjectWithSerializedValues.spec.ts +24 -24
- package/src/utils/toObjectWithSerializedValues.ts +9 -15
- package/src/utils/toObjectWithSortedKeys.ts +21 -24
- package/src/utils/toSortedObjectKeys.spec.ts +25 -29
- package/src/utils/uuid.spec.ts +16 -16
- package/src/utils/uuid.ts +2 -5
- package/tsconfig.build.json +10 -16
- package/tsconfig.json +10 -16
- package/tsup.config.ts +10 -10
|
@@ -2,13 +2,7 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useTranslations } from 'next-intl';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
EuiButtonIcon,
|
|
7
|
-
EuiFlexGroup,
|
|
8
|
-
EuiFlexItem,
|
|
9
|
-
EuiText,
|
|
10
|
-
EuiTextTruncate,
|
|
11
|
-
} from '@elastic/eui';
|
|
5
|
+
import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiText, EuiTextTruncate } from '@elastic/eui';
|
|
12
6
|
|
|
13
7
|
import { getStyles } from '@/components/WfoTree/styles';
|
|
14
8
|
import { TreeContext, TreeContextType } from '@/contexts';
|
|
@@ -17,49 +11,41 @@ import { WfoXMarkSmall } from '@/icons/WfoXMarkSmall';
|
|
|
17
11
|
import { TreeBlock } from '@/types';
|
|
18
12
|
|
|
19
13
|
interface WfoTreeNodeListItemProps {
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
item: TreeBlock;
|
|
15
|
+
selected: boolean;
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
export const WfoTreeNodeListItem = ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const { toggleSelectedId } = useContext(TreeContext) as TreeContextType;
|
|
30
|
-
const { theme } = useOrchestratorTheme();
|
|
31
|
-
const { selectedTreeItemStyle, treeItemStyle } =
|
|
32
|
-
useWithOrchestratorTheme(getStyles);
|
|
18
|
+
export const WfoTreeNodeListItem = ({ item, selected }: WfoTreeNodeListItemProps) => {
|
|
19
|
+
const t = useTranslations('common');
|
|
20
|
+
const { toggleSelectedId } = useContext(TreeContext) as TreeContextType;
|
|
21
|
+
const { theme } = useOrchestratorTheme();
|
|
22
|
+
const { selectedTreeItemStyle, treeItemStyle } = useWithOrchestratorTheme(getStyles);
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
const { isOutsideCurrentSubscription, id, label } = item;
|
|
25
|
+
const textLabel = label.toString();
|
|
36
26
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/>
|
|
62
|
-
</EuiFlexItem>
|
|
63
|
-
</EuiFlexGroup>
|
|
64
|
-
);
|
|
27
|
+
return (
|
|
28
|
+
<EuiFlexGroup
|
|
29
|
+
alignItems="center"
|
|
30
|
+
css={selected ? selectedTreeItemStyle(isOutsideCurrentSubscription) : treeItemStyle(isOutsideCurrentSubscription)}
|
|
31
|
+
onClick={() => toggleSelectedId(id)}
|
|
32
|
+
gutterSize="xs"
|
|
33
|
+
justifyContent="spaceBetween"
|
|
34
|
+
>
|
|
35
|
+
<EuiFlexItem>
|
|
36
|
+
<EuiText title={textLabel}>
|
|
37
|
+
<EuiTextTruncate text={textLabel} />
|
|
38
|
+
</EuiText>
|
|
39
|
+
</EuiFlexItem>
|
|
40
|
+
<EuiFlexItem css={{ maxWidth: theme.size.l }}>
|
|
41
|
+
<EuiButtonIcon
|
|
42
|
+
color="primary"
|
|
43
|
+
iconType={() => <WfoXMarkSmall color="currentColor" />}
|
|
44
|
+
size="xs"
|
|
45
|
+
aria-label={t('deselect')}
|
|
46
|
+
css={{ display: selected ? 'block' : 'none' }}
|
|
47
|
+
/>
|
|
48
|
+
</EuiFlexItem>
|
|
49
|
+
</EuiFlexGroup>
|
|
50
|
+
);
|
|
65
51
|
};
|
|
@@ -1,48 +1,45 @@
|
|
|
1
1
|
import type { WfoThemeHelpers } from '@/hooks';
|
|
2
2
|
|
|
3
3
|
export const getStyles = ({ theme, toSecondaryColor }: WfoThemeHelpers) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const treeContainerStyle = {
|
|
9
|
-
width: 0,
|
|
10
|
-
marginTop: theme.size.s,
|
|
11
|
-
marginRight: `-${theme.size.s}`,
|
|
12
|
-
};
|
|
4
|
+
const expandIconContainerStyle = {
|
|
5
|
+
cursor: 'pointer',
|
|
6
|
+
};
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
borderRadius: theme.base - 10,
|
|
20
|
-
textDecoration: 'none',
|
|
21
|
-
backgroundColor: 'transparent',
|
|
22
|
-
transition: 'background-color 0.2s ease, text-decoration 0.3s ease', // Smooth transition for background
|
|
23
|
-
'&:hover': {
|
|
24
|
-
textDecoration: 'underline',
|
|
25
|
-
},
|
|
26
|
-
border: isOutsideCurrentSubscription
|
|
27
|
-
? `1px dashed ${theme.colors.borderBaseSubdued}`
|
|
28
|
-
: 'none',
|
|
29
|
-
};
|
|
30
|
-
};
|
|
8
|
+
const treeContainerStyle = {
|
|
9
|
+
width: theme.size.m,
|
|
10
|
+
marginTop: theme.size.s,
|
|
11
|
+
marginRight: `-${theme.size.s}`,
|
|
12
|
+
};
|
|
31
13
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
14
|
+
const treeItemStyle = (isOutsideCurrentSubscription: boolean) => {
|
|
15
|
+
return {
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
paddingBlock: theme.size.xs,
|
|
18
|
+
paddingInline: theme.size.s,
|
|
19
|
+
borderRadius: theme.base - 10,
|
|
20
|
+
textDecoration: 'none',
|
|
21
|
+
backgroundColor: 'transparent',
|
|
22
|
+
transition: 'background-color 0.2s ease, text-decoration 0.3s ease', // Smooth transition for background
|
|
23
|
+
'&:hover': {
|
|
24
|
+
textDecoration: 'underline',
|
|
25
|
+
},
|
|
26
|
+
border: isOutsideCurrentSubscription ? `1px dashed ${theme.colors.borderBaseSubdued}` : 'none',
|
|
40
27
|
};
|
|
28
|
+
};
|
|
41
29
|
|
|
30
|
+
const selectedTreeItemStyle = (isOutsideCurrentSubscription: boolean) => {
|
|
42
31
|
return {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
...treeItemStyle(isOutsideCurrentSubscription),
|
|
33
|
+
backgroundColor:
|
|
34
|
+
isOutsideCurrentSubscription ? theme.colors.borderBaseSubdued : toSecondaryColor(theme.colors.primary),
|
|
35
|
+
color: theme.colors.textPrimary,
|
|
47
36
|
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
expandIconContainerStyle: expandIconContainerStyle,
|
|
41
|
+
treeContainerStyle: treeContainerStyle,
|
|
42
|
+
selectedTreeItemStyle,
|
|
43
|
+
treeItemStyle,
|
|
44
|
+
};
|
|
48
45
|
};
|
|
@@ -3,126 +3,121 @@ import { FieldValue, TreeBlock, WfoTreeNodeMap } from '@/types';
|
|
|
3
3
|
import { getPositionInTree, getWfoTreeNodeDepth } from './treeUtils';
|
|
4
4
|
|
|
5
5
|
describe('getWfoTreeNodeDepth', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const field: FieldValue = { field: 'test', value: 'test' };
|
|
7
|
+
const sampleTree: TreeBlock = {
|
|
8
|
+
id: 1,
|
|
9
|
+
subscriptionInstanceId: 'subscription-1',
|
|
10
|
+
parent: null,
|
|
11
|
+
icon: 'folder',
|
|
12
|
+
label: 'Root',
|
|
13
|
+
callback: jest.fn(),
|
|
14
|
+
productBlockInstanceValues: [field],
|
|
15
|
+
inUseByRelations: [],
|
|
16
|
+
isOutsideCurrentSubscription: false,
|
|
17
|
+
subscription: {
|
|
18
|
+
subscriptionId: 'subscription-1',
|
|
19
|
+
description: 'Subscription 1',
|
|
20
|
+
},
|
|
21
|
+
children: [
|
|
22
|
+
{
|
|
23
|
+
id: 2,
|
|
24
|
+
subscriptionInstanceId: 'subscription-2',
|
|
25
|
+
parent: 1,
|
|
26
|
+
icon: 'file',
|
|
27
|
+
label: 'File 1',
|
|
13
28
|
callback: jest.fn(),
|
|
14
29
|
productBlockInstanceValues: [field],
|
|
15
30
|
inUseByRelations: [],
|
|
31
|
+
children: [],
|
|
16
32
|
isOutsideCurrentSubscription: false,
|
|
17
33
|
subscription: {
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
subscriptionId: 'subscription-2',
|
|
35
|
+
description: 'Subscription 2',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 3,
|
|
40
|
+
subscriptionInstanceId: 'subscription-3',
|
|
41
|
+
parent: 1,
|
|
42
|
+
icon: 'file',
|
|
43
|
+
label: 'File 2',
|
|
44
|
+
callback: jest.fn(),
|
|
45
|
+
productBlockInstanceValues: [field],
|
|
46
|
+
inUseByRelations: [],
|
|
47
|
+
isOutsideCurrentSubscription: false,
|
|
48
|
+
subscription: {
|
|
49
|
+
subscriptionId: 'subscription-3',
|
|
50
|
+
description: 'Subscription 3',
|
|
20
51
|
},
|
|
21
52
|
children: [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
icon: 'file',
|
|
27
|
-
label: 'File 1',
|
|
28
|
-
callback: jest.fn(),
|
|
29
|
-
productBlockInstanceValues: [field],
|
|
30
|
-
inUseByRelations: [],
|
|
31
|
-
children: [],
|
|
32
|
-
isOutsideCurrentSubscription: false,
|
|
33
|
-
subscription: {
|
|
34
|
-
subscriptionId: 'subscription-2',
|
|
35
|
-
description: 'Subscription 2',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 3,
|
|
40
|
-
subscriptionInstanceId: 'subscription-3',
|
|
41
|
-
parent: 1,
|
|
42
|
-
icon: 'file',
|
|
43
|
-
label: 'File 2',
|
|
44
|
-
callback: jest.fn(),
|
|
45
|
-
productBlockInstanceValues: [field],
|
|
46
|
-
inUseByRelations: [],
|
|
47
|
-
isOutsideCurrentSubscription: false,
|
|
48
|
-
subscription: {
|
|
49
|
-
subscriptionId: 'subscription-3',
|
|
50
|
-
description: 'Subscription 3',
|
|
51
|
-
},
|
|
52
|
-
children: [
|
|
53
|
-
{
|
|
54
|
-
id: 4,
|
|
55
|
-
subscriptionInstanceId: 'subscription-4',
|
|
56
|
-
parent: 3,
|
|
57
|
-
icon: 'file',
|
|
58
|
-
label: 'File 2.1',
|
|
59
|
-
callback: jest.fn(),
|
|
60
|
-
productBlockInstanceValues: [field],
|
|
61
|
-
inUseByRelations: [],
|
|
62
|
-
children: [],
|
|
63
|
-
isOutsideCurrentSubscription: false,
|
|
64
|
-
subscription: {
|
|
65
|
-
subscriptionId: 'subscription-4',
|
|
66
|
-
description: 'Subscription 4',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const idToNodeMap: WfoTreeNodeMap = {
|
|
75
|
-
1: sampleTree,
|
|
76
|
-
2: sampleTree.children[0],
|
|
77
|
-
3: sampleTree.children[1],
|
|
78
|
-
4: sampleTree.children[1].children[0],
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
it('should return 0 for the root node', () => {
|
|
82
|
-
const rootDepth = getWfoTreeNodeDepth(sampleTree, idToNodeMap);
|
|
83
|
-
expect(rootDepth).toBe(0);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should return the correct depth for a child node', () => {
|
|
87
|
-
const depth2 = getWfoTreeNodeDepth(sampleTree.children[0], idToNodeMap);
|
|
88
|
-
const depth3 = getWfoTreeNodeDepth(sampleTree.children[1], idToNodeMap);
|
|
89
|
-
const depth4 = getWfoTreeNodeDepth(
|
|
90
|
-
sampleTree.children[1].children[0],
|
|
91
|
-
idToNodeMap,
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
expect(depth2).toBe(1);
|
|
95
|
-
expect(depth3).toBe(1);
|
|
96
|
-
expect(depth4).toBe(2);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should throw an error if the parent node is not found', () => {
|
|
100
|
-
const invalidNode = {
|
|
101
|
-
id: 1,
|
|
102
|
-
ownerSubscriptionId: 'subscription-1',
|
|
103
|
-
subscriptionInstanceId: 'subscription-1',
|
|
104
|
-
parent: 99, // Parent ID that does not exist
|
|
53
|
+
{
|
|
54
|
+
id: 4,
|
|
55
|
+
subscriptionInstanceId: 'subscription-4',
|
|
56
|
+
parent: 3,
|
|
105
57
|
icon: 'file',
|
|
106
|
-
label: '
|
|
58
|
+
label: 'File 2.1',
|
|
107
59
|
callback: jest.fn(),
|
|
108
60
|
productBlockInstanceValues: [field],
|
|
109
61
|
inUseByRelations: [],
|
|
110
62
|
children: [],
|
|
111
63
|
isOutsideCurrentSubscription: false,
|
|
112
64
|
subscription: {
|
|
113
|
-
|
|
114
|
-
|
|
65
|
+
subscriptionId: 'subscription-4',
|
|
66
|
+
description: 'Subscription 4',
|
|
115
67
|
},
|
|
116
|
-
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const idToNodeMap: WfoTreeNodeMap = {
|
|
75
|
+
1: sampleTree,
|
|
76
|
+
2: sampleTree.children[0],
|
|
77
|
+
3: sampleTree.children[1],
|
|
78
|
+
4: sampleTree.children[1].children[0],
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
it('should return 0 for the root node', () => {
|
|
82
|
+
const rootDepth = getWfoTreeNodeDepth(sampleTree, idToNodeMap);
|
|
83
|
+
expect(rootDepth).toBe(0);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should return the correct depth for a child node', () => {
|
|
87
|
+
const depth2 = getWfoTreeNodeDepth(sampleTree.children[0], idToNodeMap);
|
|
88
|
+
const depth3 = getWfoTreeNodeDepth(sampleTree.children[1], idToNodeMap);
|
|
89
|
+
const depth4 = getWfoTreeNodeDepth(sampleTree.children[1].children[0], idToNodeMap);
|
|
90
|
+
|
|
91
|
+
expect(depth2).toBe(1);
|
|
92
|
+
expect(depth3).toBe(1);
|
|
93
|
+
expect(depth4).toBe(2);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('should throw an error if the parent node is not found', () => {
|
|
97
|
+
const invalidNode = {
|
|
98
|
+
id: 1,
|
|
99
|
+
ownerSubscriptionId: 'subscription-1',
|
|
100
|
+
subscriptionInstanceId: 'subscription-1',
|
|
101
|
+
parent: 99, // Parent ID that does not exist
|
|
102
|
+
icon: 'file',
|
|
103
|
+
label: 'Invalid Node',
|
|
104
|
+
callback: jest.fn(),
|
|
105
|
+
productBlockInstanceValues: [field],
|
|
106
|
+
inUseByRelations: [],
|
|
107
|
+
children: [],
|
|
108
|
+
isOutsideCurrentSubscription: false,
|
|
109
|
+
subscription: {
|
|
110
|
+
subscriptionId: 'subscription-1',
|
|
111
|
+
description: 'Subscription 1',
|
|
112
|
+
},
|
|
113
|
+
};
|
|
117
114
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
);
|
|
121
|
-
});
|
|
115
|
+
expect(() => getWfoTreeNodeDepth(invalidNode, idToNodeMap)).toThrow('Parent node for 1 not found.');
|
|
116
|
+
});
|
|
122
117
|
});
|
|
123
118
|
|
|
124
119
|
describe('getPositionInTree', () => {
|
|
125
|
-
|
|
120
|
+
const json = `{
|
|
126
121
|
"id": 0,
|
|
127
122
|
"subscription": {
|
|
128
123
|
"subscriptionId": "556facd3-6399-4c76-aeb1-114849da2f96",
|
|
@@ -299,60 +294,60 @@ describe('getPositionInTree', () => {
|
|
|
299
294
|
"isOutsideCurrentSubscription": false
|
|
300
295
|
}`;
|
|
301
296
|
|
|
302
|
-
|
|
297
|
+
const tree = JSON.parse(json) as TreeBlock;
|
|
303
298
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
299
|
+
it('should return 1 for the root node', () => {
|
|
300
|
+
const rootDepth = getPositionInTree(tree, 0);
|
|
301
|
+
expect(rootDepth).toBe(1);
|
|
302
|
+
});
|
|
308
303
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
304
|
+
it('should return 2 for the first node', () => {
|
|
305
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 2);
|
|
306
|
+
expect(positionOfFirstLevelChild).toBe(2);
|
|
307
|
+
});
|
|
313
308
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
309
|
+
it('should return correct node at position 3', () => {
|
|
310
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 3);
|
|
311
|
+
expect(positionOfFirstLevelChild).toBe(3);
|
|
312
|
+
});
|
|
318
313
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
314
|
+
it('should return correct node at position 4', () => {
|
|
315
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 4);
|
|
316
|
+
expect(positionOfFirstLevelChild).toBe(4);
|
|
317
|
+
});
|
|
323
318
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
319
|
+
it('should return correct node at position 5', () => {
|
|
320
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 5);
|
|
321
|
+
expect(positionOfFirstLevelChild).toBe(5);
|
|
322
|
+
});
|
|
328
323
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
324
|
+
it('should return correct node at position 6', () => {
|
|
325
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 6);
|
|
326
|
+
expect(positionOfFirstLevelChild).toBe(6);
|
|
327
|
+
});
|
|
333
328
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
329
|
+
it('should return correct node at position 7', () => {
|
|
330
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 7);
|
|
331
|
+
expect(positionOfFirstLevelChild).toBe(7);
|
|
332
|
+
});
|
|
338
333
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
334
|
+
it('should return correct node at position 8', () => {
|
|
335
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 8);
|
|
336
|
+
expect(positionOfFirstLevelChild).toBe(8);
|
|
337
|
+
});
|
|
343
338
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
339
|
+
it('should return correct node at position 9', () => {
|
|
340
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 9);
|
|
341
|
+
expect(positionOfFirstLevelChild).toBe(9);
|
|
342
|
+
});
|
|
348
343
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
344
|
+
it('should return correct node at position 10', () => {
|
|
345
|
+
const positionOfFirstLevelChild = getPositionInTree(tree, 1);
|
|
346
|
+
expect(positionOfFirstLevelChild).toBe(10);
|
|
347
|
+
});
|
|
353
348
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
349
|
+
it('should return undefined if the id is not found', () => {
|
|
350
|
+
const positionOfUndefined = getPositionInTree(tree, 9999);
|
|
351
|
+
expect(positionOfUndefined).toBeUndefined();
|
|
352
|
+
});
|
|
358
353
|
});
|
|
@@ -1,53 +1,50 @@
|
|
|
1
1
|
import { TreeBlock, WfoTreeNodeMap } from '@/types';
|
|
2
2
|
|
|
3
|
-
export function getWfoTreeNodeDepth(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export function getWfoTreeNodeDepth(node: TreeBlock, idToNodeMap: WfoTreeNodeMap): number {
|
|
4
|
+
if (node.parent === null) {
|
|
5
|
+
// This is the root node, so its depth is 0.
|
|
6
|
+
return 0;
|
|
7
|
+
} else {
|
|
8
|
+
// Find the parent node.
|
|
9
|
+
const parent = idToNodeMap[node.parent];
|
|
10
|
+
if (parent) {
|
|
11
|
+
// Recursively calculate the parent's depth and add 1.
|
|
12
|
+
return getWfoTreeNodeDepth(parent, idToNodeMap) + 1;
|
|
10
13
|
} else {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (parent) {
|
|
14
|
-
// Recursively calculate the parent's depth and add 1.
|
|
15
|
-
return getWfoTreeNodeDepth(parent, idToNodeMap) + 1;
|
|
16
|
-
} else {
|
|
17
|
-
// Parent not found, something might be wrong with the tree structure.
|
|
18
|
-
throw new Error(`Parent node for ${node.id} not found.`);
|
|
19
|
-
}
|
|
14
|
+
// Parent not found, something might be wrong with the tree structure.
|
|
15
|
+
throw new Error(`Parent node for ${node.id} not found.`);
|
|
20
16
|
}
|
|
17
|
+
}
|
|
21
18
|
}
|
|
22
19
|
|
|
23
20
|
export const sortTreeBlockByLabel = (
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
{ label: labelA, id: idA }: TreeBlock,
|
|
22
|
+
{ label: labelB, id: idB }: TreeBlock,
|
|
26
23
|
): number => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
if (idA > idB) {
|
|
32
|
-
return 1;
|
|
33
|
-
}
|
|
34
|
-
return 0;
|
|
35
|
-
}
|
|
36
|
-
if (labelA < labelB) {
|
|
37
|
-
return -1;
|
|
24
|
+
if (labelA === labelB) {
|
|
25
|
+
if (idA < idB) {
|
|
26
|
+
return -1;
|
|
38
27
|
}
|
|
39
|
-
if (
|
|
40
|
-
|
|
28
|
+
if (idA > idB) {
|
|
29
|
+
return 1;
|
|
41
30
|
}
|
|
42
31
|
return 0;
|
|
32
|
+
}
|
|
33
|
+
if (labelA < labelB) {
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
if (labelA > labelB) {
|
|
37
|
+
return 1;
|
|
38
|
+
}
|
|
39
|
+
return 0;
|
|
43
40
|
};
|
|
44
41
|
|
|
45
42
|
const countDescendantNodes = (node: TreeBlock): number => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
let count = 0;
|
|
44
|
+
for (const child of node.children) {
|
|
45
|
+
count += 1 + countDescendantNodes(child);
|
|
46
|
+
}
|
|
47
|
+
return count;
|
|
51
48
|
};
|
|
52
49
|
|
|
53
50
|
/**
|
|
@@ -60,29 +57,26 @@ const countDescendantNodes = (node: TreeBlock): number => {
|
|
|
60
57
|
* @param id
|
|
61
58
|
* @returns number
|
|
62
59
|
*/
|
|
63
|
-
export const getPositionInTree = (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (tree.id === id) {
|
|
69
|
-
return startPosition;
|
|
70
|
-
}
|
|
60
|
+
export const getPositionInTree = (tree: TreeBlock, id: number): number | undefined => {
|
|
61
|
+
let startPosition = 1;
|
|
62
|
+
if (tree.id === id) {
|
|
63
|
+
return startPosition;
|
|
64
|
+
}
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
66
|
+
for (const child of tree.children) {
|
|
67
|
+
startPosition += 1;
|
|
68
|
+
if (child.id === id) {
|
|
69
|
+
return startPosition;
|
|
70
|
+
}
|
|
71
|
+
if (child.children.length > 0) {
|
|
72
|
+
const childPosition = getPositionInTree(child, id);
|
|
73
|
+
if (childPosition) {
|
|
74
|
+
return startPosition + childPosition - 1;
|
|
75
|
+
} else {
|
|
76
|
+
startPosition += countDescendantNodes(child);
|
|
77
|
+
}
|
|
85
78
|
}
|
|
79
|
+
}
|
|
86
80
|
|
|
87
|
-
|
|
81
|
+
return undefined;
|
|
88
82
|
};
|