From 56d83fe650f24699c7a93661f9f42b6ad650f97f Mon Sep 17 00:00:00 2001 From: ZbyszekMM Date: Fri, 25 Oct 2024 17:05:22 +0200 Subject: [PATCH 1/5] better name and intro text --- docs/configuration/Common.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/configuration/Common.md b/docs/configuration/Common.md index 5b15a993121..8e60f327f4f 100644 --- a/docs/configuration/Common.md +++ b/docs/configuration/Common.md @@ -1,19 +1,16 @@ --- -title: Miscellaneous +title: Environment Variables sidebar_position: 4 --- -# Common -## Environment variables +# Environment variables -All configuration options are described in [Configuration](./DesignerConfiguration.md). - -Some of them can be configured using already predefined environment variables, which is mostly useful in the Docker setup. +Some of the configuration options can be set using already predefined environment variables, which is mostly useful in the Docker setup. The table below shows all the predefined environment variables used in the Nussknacker image. `$NUSSKNACKER_DIR` is a placeholder pointing to the Nussknacker installation directory. Because we use [HOCON](../#conventions), you can set (or override) any configuration value used by Nussknacker even if the already predefined environment variable does not exist. This is achieved by setting the JVM property `-Dconfig.override_with_env_vars=true` and setting environment variables following conventions described [here](https://github.com/lightbend/config?tab=readme-ov-file#optional-system-or-env-variable-overrides). -### Basic environment variables +## Basic environment variables | Variable name | Type | Default value | Description | |-------------------------------|---------|--------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -48,7 +45,7 @@ Because we use [HOCON](../#conventions), you can set (or override) any configura | PROMETHEUS_AGENT_CONFIG_FILE | int | $NUSSKNACKER_DIR/conf/jmx_prometheus.yaml | Default configuration for JMX Prometheus agent. Used only when agent is enabled. See `PROMETHEUS_METRICS_PORT` | | TABLES_DEFINITION_FILE | string | $NUSSKNACKER_DIR/conf/dev-tables-definition.sql | Location of file containing definitions of tables for Flink Table API components in Flink Sql | -### OAuth2 environment variables +## OAuth2 environment variables | Variable name | Type | Default value | |-------------------------------------------------|-----------------|-------------------| From 2107c78d8dfa9624ff9e1af465de0943d668a462 Mon Sep 17 00:00:00 2001 From: Dawid Poliszak Date: Mon, 28 Oct 2024 14:04:25 +0100 Subject: [PATCH 2/5] [NU-1845] add activities statistic (#7091) * NU-1845 add activities statistic --- .../client/src/actions/nk/assignSettings.ts | 2 +- .../activities/ActivitiesPanelFooter.tsx | 13 +- .../ActivityItemComment.tsx | 4 +- .../ActivityItemCommentModify.tsx | 4 +- .../ActivityItemHeader.tsx | 6 + .../use-register-tracking-events.ts | 9 + .../description/StatisticsApiEndpoints.scala | 157 ++++++++++-------- ...DesignerApiAvailableToExposeYamlSpec.scala | 9 + docs-internal/api/nu-designer-openapi.yaml | 9 + 9 files changed, 135 insertions(+), 78 deletions(-) diff --git a/designer/client/src/actions/nk/assignSettings.ts b/designer/client/src/actions/nk/assignSettings.ts index 8e7c4ecbb26..fb54a22f52b 100644 --- a/designer/client/src/actions/nk/assignSettings.ts +++ b/designer/client/src/actions/nk/assignSettings.ts @@ -32,7 +32,7 @@ export type FeaturesSettings = { remoteEnvironment: { targetEnvironmentId: string }; environmentAlert: EnvironmentTagSettings; commentSettings: { substitutionPattern: string; substitutionLink: string }; - deploymentCommentSettings?: { exampleComment: string }; + deploymentCommentSettings?: { exampleComment: string } | null; intervalTimeSettings: { processes: number; healthCheck: number }; // TODO: verify usage tabs: DynamicTabData[]; testDataSettings?: TestDataSettings; diff --git a/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx b/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx index c90c57d1cc0..8fa759011ed 100644 --- a/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx +++ b/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx @@ -2,6 +2,7 @@ import React, { useCallback } from "react"; import { Box, Button, lighten, styled } from "@mui/material"; import { useWindows, WindowKind } from "../../../windowManager"; import { useTranslation } from "react-i18next"; +import { EventTrackingSelector, getEventTrackingProps } from "../../../containers/event-tracking"; const StyledFooterButton = styled(Button)(({ theme }) => ({ textTransform: "none", @@ -39,10 +40,18 @@ export const ActivitiesPanelFooter = () => { return ( - + {t("activities.footer.addComment", "Add comment")} - + {t("activities.footer.addAttachment", "Add attachment")} diff --git a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx index f43d1772e09..3b37c9d7662 100644 --- a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx +++ b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx @@ -14,6 +14,7 @@ import { useWindows } from "../../../../windowManager"; import { getProcessName } from "../../../../reducers/selectors/graph"; import { getScenarioActivities } from "../../../../actions/nk/scenarioActivities"; import { ActivityItemCommentModify } from "./ActivityItemCommentModify"; +import { EventTrackingSelector, getEventTrackingProps } from "../../../../containers/event-tracking"; const getCommentSettings = createSelector(getFeatureSettings, (f) => f.commentSettings || {}); @@ -61,7 +62,7 @@ const CommentActivity = ({ key={activityAction.id} src={activityAction.icon} title={activityAction.displayableName} - delete-testid={`delete-comment-icon`} + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesDeleteComment })} /> ); } @@ -78,6 +79,7 @@ const CommentActivity = ({ commentContent={activityComment.content} data-testid={`edit-comment-icon`} key={activityAction.id} + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesEditComment })} /> ); } diff --git a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx index 1526a6c51e9..ab31e2f1778 100644 --- a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx +++ b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemCommentModify.tsx @@ -27,11 +27,11 @@ export const ActivityItemCommentModify = ({ commentContent, scenarioActivityId, existingComment: commentContent.value, scenarioActivityId, placeholder: permittedModifyCommentTypes.includes(activityType) - ? featuresSettings.deploymentCommentSettings.exampleComment + ? featuresSettings?.deploymentCommentSettings?.exampleComment : undefined, }, }); - }, [activityType, commentContent.value, featuresSettings.deploymentCommentSettings.exampleComment, open, scenarioActivityId]); + }, [activityType, commentContent.value, featuresSettings?.deploymentCommentSettings?.exampleComment, open, scenarioActivityId]); return ( ({ width: "16px", @@ -77,6 +78,7 @@ const HeaderActivity = ({ onClick={() => open(handleOpenCompareVersionDialog(scenarioVersionId.toString()))} key={activityAction.id} src={activityAction.icon} + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesCompare })} /> ); } @@ -97,6 +99,7 @@ const HeaderActivity = ({ key={attachmentId} src={activityAction.icon} title={activityAction.displayableName} + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesDownloadAttachment })} /> ); } @@ -128,6 +131,7 @@ const HeaderActivity = ({ denyText: t("panels.actions.process-unarchive.no", "No"), }) } + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesDeleteAttachment })} /> ); } @@ -143,6 +147,7 @@ const HeaderActivity = ({ scenarioActivityId={scenarioActivityId} activityType={activityType} activityAction={activityAction} + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesAddCommentToActivity })} /> ); } @@ -210,6 +215,7 @@ const WithOpenVersion = ({ onClick={() => { changeVersion(scenarioVersion); }} + {...getEventTrackingProps({ selector: EventTrackingSelector.ScenarioActivitiesOpenVersion })} > {children} diff --git a/designer/client/src/containers/event-tracking/use-register-tracking-events.ts b/designer/client/src/containers/event-tracking/use-register-tracking-events.ts index 6c2556e8b5a..4961763f791 100644 --- a/designer/client/src/containers/event-tracking/use-register-tracking-events.ts +++ b/designer/client/src/containers/event-tracking/use-register-tracking-events.ts @@ -55,6 +55,15 @@ enum ClickEventsSelector { ScenarioUnarchive = "SCENARIO_UNARCHIVE", ScenarioCustomAction = "SCENARIO_CUSTOM_ACTION", ScenarioCustomLink = "SCENARIO_CUSTOM_LINK", + ScenarioActivitiesAddAttachment = "SCENARIO_ACTIVITIES_ADD_ATTACHMENT", + ScenarioActivitiesAddComment = "SCENARIO_ACTIVITIES_ADD_COMMENT", + ScenarioActivitiesAddCommentToActivity = "SCENARIO_ACTIVITIES_ADD_COMMENT_TO_ACTIVITY", + ScenarioActivitiesCompare = "SCENARIO_ACTIVITIES_COMPARE", + ScenarioActivitiesDownloadAttachment = "SCENARIO_ACTIVITIES_DOWNLOAD_ATTACHMENT", + ScenarioActivitiesDeleteAttachment = "SCENARIO_ACTIVITIES_DELETE_ATTACHMENT", + ScenarioActivitiesDeleteComment = "SCENARIO_ACTIVITIES_DELETE_COMMENT", + ScenarioActivitiesEditComment = "SCENARIO_ACTIVITIES_EDIT_COMMENT", + ScenarioActivitiesOpenVersion = "SCENARIO_ACTIVITIES_OPEN_VERSION", } enum SearchEventsSelector { diff --git a/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/StatisticsApiEndpoints.scala b/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/StatisticsApiEndpoints.scala index d70f8fbb1a5..5d28674d2cd 100644 --- a/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/StatisticsApiEndpoints.scala +++ b/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/StatisticsApiEndpoints.scala @@ -96,78 +96,91 @@ object StatisticsApiEndpoints { object StatisticName extends Enum[StatisticName] with CirceEnum[StatisticName] { - case object SearchScenariosByName extends StatisticName { override val shortName = "f_ssbn" } - case object FilterScenariosByStatus extends StatisticName { override val shortName = "f_fsbs" } - case object FilterScenariosByProcessingMode extends StatisticName { override val shortName = "f_fsbpm" } - case object FilterScenariosByCategory extends StatisticName { override val shortName = "f_fsbc" } - case object FilterScenariosByAuthor extends StatisticName { override val shortName = "f_fsba" } - case object FilterScenariosByOther extends StatisticName { override val shortName = "f_fsbo" } - case object SortScenariosBySortOption extends StatisticName { override val shortName = "f_ssbso" } - case object SearchComponentsByName extends StatisticName { override val shortName = "f_scbn" } - case object FilterComponentsByGroup extends StatisticName { override val shortName = "f_fcbg" } - case object FilterComponentsByProcessingMode extends StatisticName { override val shortName = "f_fcbpm" } - case object FilterComponentsByCategory extends StatisticName { override val shortName = "f_fcbc" } - case object FilterComponentsByMultipleCategories extends StatisticName { override val shortName = "f_fcbmc" } - case object FilterComponentsByUsages extends StatisticName { override val shortName = "f_fcbu" } - case object ClickComponentUsages extends StatisticName { override val shortName = "f_ccu" } - case object SearchComponentUsagesByName extends StatisticName { override val shortName = "f_scubn" } - case object FilterComponentUsagesByStatus extends StatisticName { override val shortName = "f_fcubs" } - case object FilterComponentUsagesByCategory extends StatisticName { override val shortName = "f_fcubc" } - case object FilterComponentUsagesByAuthor extends StatisticName { override val shortName = "f_fcuba" } - case object FilterComponentUsagesByOther extends StatisticName { override val shortName = "f_fcubo" } - case object ClickScenarioFromComponentUsages extends StatisticName { override val shortName = "f_csfcu" } - case object ClickGlobalMetricsTab extends StatisticName { override val shortName = "f_cgmt" } - case object ClickActionDeploy extends StatisticName { override val shortName = "f_cad" } - case object ClickActionMetrics extends StatisticName { override val shortName = "f_cam" } - case object ClickViewZoomIn extends StatisticName { override val shortName = "f_cvzi" } - case object ClickViewZoomOut extends StatisticName { override val shortName = "f_cvzo" } - case object ClickViewReset extends StatisticName { override val shortName = "f_cvr" } - case object ClickEditUndo extends StatisticName { override val shortName = "f_ceu" } - case object ClickEditRedo extends StatisticName { override val shortName = "f_cer" } - case object ClickEditCopy extends StatisticName { override val shortName = "f_cec" } - case object ClickEditPaste extends StatisticName { override val shortName = "f_cep" } - case object ClickEditDelete extends StatisticName { override val shortName = "f_ced" } - case object ClickEditLayout extends StatisticName { override val shortName = "f_cel" } - case object ClickScenarioProperties extends StatisticName { override val shortName = "f_csp" } - case object ClickScenarioCompare extends StatisticName { override val shortName = "f_csco" } - case object ClickScenarioMigrate extends StatisticName { override val shortName = "f_csm" } - case object ClickScenarioImport extends StatisticName { override val shortName = "f_csi" } - case object ClickScenarioJson extends StatisticName { override val shortName = "f_csj" } - case object ClickScenarioPdf extends StatisticName { override val shortName = "f_cspd" } - case object ClickScenarioArchive extends StatisticName { override val shortName = "f_csa" } - case object ClickTestGenerated extends StatisticName { override val shortName = "f_ctg" } - case object ClickTestAdhoc extends StatisticName { override val shortName = "f_cta" } - case object ClickTestFromFile extends StatisticName { override val shortName = "f_ctff" } - case object ClickTestGenerateFile extends StatisticName { override val shortName = "f_ctgt" } - case object ClickTestHide extends StatisticName { override val shortName = "f_cth" } - case object ClickMoreScenarioDetails extends StatisticName { override val shortName = "f_cmsd" } - case object ClickExpandPanel extends StatisticName { override val shortName = "f_cexp" } - case object ClickCollapsePanel extends StatisticName { override val shortName = "f_ccp" } - case object MoveToolbarPanel extends StatisticName { override val shortName = "f_mtp" } - case object SearchNodesInScenario extends StatisticName { override val shortName = "f_snis" } - case object SearchComponentsInScenario extends StatisticName { override val shortName = "f_scis" } - case object ClickOlderVersion extends StatisticName { override val shortName = "f_cov" } - case object ClickNewerVersion extends StatisticName { override val shortName = "f_cnv" } - case object ClickNodeDocumentation extends StatisticName { override val shortName = "f_cnd" } - case object ClickComponentsTab extends StatisticName { override val shortName = "f_cct" } - case object ClickScenarioSave extends StatisticName { override val shortName = "f_css" } - case object ClickTestCounts extends StatisticName { override val shortName = "f_ctc" } - case object ClickScenarioCancel extends StatisticName { override val shortName = "f_csc" } - case object ClickScenarioArchiveToggle extends StatisticName { override val shortName = "f_csat" } - case object ClickScenarioUnarchive extends StatisticName { override val shortName = "f_csu" } - case object ClickScenarioCustomAction extends StatisticName { override val shortName = "f_csca" } - case object ClickScenarioCustomLink extends StatisticName { override val shortName = "f_cscl" } - case object DoubleClickRangeSelectNodes extends StatisticName { override val shortName = "f_dcrsn" } - case object KeyboardAndClickRangeSelectNodes extends StatisticName { override val shortName = "f_kacrsn" } - case object KeyboardCopyNode extends StatisticName { override val shortName = "f_kcon" } - case object KeyboardPasteNode extends StatisticName { override val shortName = "f_kpn" } - case object KeyboardCutNode extends StatisticName { override val shortName = "f_kcn" } - case object KeyboardSelectAllNodes extends StatisticName { override val shortName = "f_ksan" } - case object KeyboardRedoScenarioChanges extends StatisticName { override val shortName = "f_krsc" } - case object KeyboardUndoScenarioChanges extends StatisticName { override val shortName = "f_kusc" } - case object KeyboardDeleteNodes extends StatisticName { override val shortName = "f_kdn" } - case object KeyboardDeselectAllNodes extends StatisticName { override val shortName = "f_kdan" } - case object KeyboardFocusSearchNodeField extends StatisticName { override val shortName = "f_kfsnf" } + case object SearchScenariosByName extends StatisticName { override val shortName = "f_ssbn" } + case object FilterScenariosByStatus extends StatisticName { override val shortName = "f_fsbs" } + case object FilterScenariosByProcessingMode extends StatisticName { override val shortName = "f_fsbpm" } + case object FilterScenariosByCategory extends StatisticName { override val shortName = "f_fsbc" } + case object FilterScenariosByAuthor extends StatisticName { override val shortName = "f_fsba" } + case object FilterScenariosByOther extends StatisticName { override val shortName = "f_fsbo" } + case object SortScenariosBySortOption extends StatisticName { override val shortName = "f_ssbso" } + case object SearchComponentsByName extends StatisticName { override val shortName = "f_scbn" } + case object FilterComponentsByGroup extends StatisticName { override val shortName = "f_fcbg" } + case object FilterComponentsByProcessingMode extends StatisticName { override val shortName = "f_fcbpm" } + case object FilterComponentsByCategory extends StatisticName { override val shortName = "f_fcbc" } + case object FilterComponentsByMultipleCategories extends StatisticName { override val shortName = "f_fcbmc" } + case object FilterComponentsByUsages extends StatisticName { override val shortName = "f_fcbu" } + case object ClickComponentUsages extends StatisticName { override val shortName = "f_ccu" } + case object SearchComponentUsagesByName extends StatisticName { override val shortName = "f_scubn" } + case object FilterComponentUsagesByStatus extends StatisticName { override val shortName = "f_fcubs" } + case object FilterComponentUsagesByCategory extends StatisticName { override val shortName = "f_fcubc" } + case object FilterComponentUsagesByAuthor extends StatisticName { override val shortName = "f_fcuba" } + case object FilterComponentUsagesByOther extends StatisticName { override val shortName = "f_fcubo" } + case object ClickScenarioFromComponentUsages extends StatisticName { override val shortName = "f_csfcu" } + case object ClickGlobalMetricsTab extends StatisticName { override val shortName = "f_cgmt" } + case object ClickActionDeploy extends StatisticName { override val shortName = "f_cad" } + case object ClickActionMetrics extends StatisticName { override val shortName = "f_cam" } + case object ClickViewZoomIn extends StatisticName { override val shortName = "f_cvzi" } + case object ClickViewZoomOut extends StatisticName { override val shortName = "f_cvzo" } + case object ClickViewReset extends StatisticName { override val shortName = "f_cvr" } + case object ClickEditUndo extends StatisticName { override val shortName = "f_ceu" } + case object ClickEditRedo extends StatisticName { override val shortName = "f_cer" } + case object ClickEditCopy extends StatisticName { override val shortName = "f_cec" } + case object ClickEditPaste extends StatisticName { override val shortName = "f_cep" } + case object ClickEditDelete extends StatisticName { override val shortName = "f_ced" } + case object ClickEditLayout extends StatisticName { override val shortName = "f_cel" } + case object ClickScenarioProperties extends StatisticName { override val shortName = "f_csp" } + case object ClickScenarioCompare extends StatisticName { override val shortName = "f_csco" } + case object ClickScenarioMigrate extends StatisticName { override val shortName = "f_csm" } + case object ClickScenarioImport extends StatisticName { override val shortName = "f_csi" } + case object ClickScenarioJson extends StatisticName { override val shortName = "f_csj" } + case object ClickScenarioPdf extends StatisticName { override val shortName = "f_cspd" } + case object ClickScenarioArchive extends StatisticName { override val shortName = "f_csa" } + case object ClickTestGenerated extends StatisticName { override val shortName = "f_ctg" } + case object ClickTestAdhoc extends StatisticName { override val shortName = "f_cta" } + case object ClickTestFromFile extends StatisticName { override val shortName = "f_ctff" } + case object ClickTestGenerateFile extends StatisticName { override val shortName = "f_ctgt" } + case object ClickTestHide extends StatisticName { override val shortName = "f_cth" } + case object ClickMoreScenarioDetails extends StatisticName { override val shortName = "f_cmsd" } + case object ClickExpandPanel extends StatisticName { override val shortName = "f_cexp" } + case object ClickCollapsePanel extends StatisticName { override val shortName = "f_ccp" } + case object ClickScenarioActivitiesAddAttachment extends StatisticName { override val shortName = "f_csaaa" } + case object ClickScenarioActivitiesAddComment extends StatisticName { override val shortName = "f_csaac" } + + case object ClickScenarioActivitiesAddCommentToActivity extends StatisticName { + override val shortName = "f_csaacta" + } + + case object ClickScenarioActivitiesCompare extends StatisticName { override val shortName = "f_csac" } + case object ClickScenarioActivitiesDownloadAttachment extends StatisticName { override val shortName = "f_csada" } + case object ClickScenarioActivitiesDeleteAttachment extends StatisticName { override val shortName = "f_csadat" } + case object ClickScenarioActivitiesDeleteComment extends StatisticName { override val shortName = "f_csadc" } + case object ClickScenarioActivitiesEditComment extends StatisticName { override val shortName = "f_csaec" } + case object ClickScenarioActivitiesOpenVersion extends StatisticName { override val shortName = "f_csaov" } + case object MoveToolbarPanel extends StatisticName { override val shortName = "f_mtp" } + case object SearchNodesInScenario extends StatisticName { override val shortName = "f_snis" } + case object SearchComponentsInScenario extends StatisticName { override val shortName = "f_scis" } + case object ClickOlderVersion extends StatisticName { override val shortName = "f_cov" } + case object ClickNewerVersion extends StatisticName { override val shortName = "f_cnv" } + case object ClickNodeDocumentation extends StatisticName { override val shortName = "f_cnd" } + case object ClickComponentsTab extends StatisticName { override val shortName = "f_cct" } + case object ClickScenarioSave extends StatisticName { override val shortName = "f_css" } + case object ClickTestCounts extends StatisticName { override val shortName = "f_ctc" } + case object ClickScenarioCancel extends StatisticName { override val shortName = "f_csc" } + case object ClickScenarioArchiveToggle extends StatisticName { override val shortName = "f_csat" } + case object ClickScenarioUnarchive extends StatisticName { override val shortName = "f_csu" } + case object ClickScenarioCustomAction extends StatisticName { override val shortName = "f_csca" } + case object ClickScenarioCustomLink extends StatisticName { override val shortName = "f_cscl" } + case object DoubleClickRangeSelectNodes extends StatisticName { override val shortName = "f_dcrsn" } + case object KeyboardAndClickRangeSelectNodes extends StatisticName { override val shortName = "f_kacrsn" } + case object KeyboardCopyNode extends StatisticName { override val shortName = "f_kcon" } + case object KeyboardPasteNode extends StatisticName { override val shortName = "f_kpn" } + case object KeyboardCutNode extends StatisticName { override val shortName = "f_kcn" } + case object KeyboardSelectAllNodes extends StatisticName { override val shortName = "f_ksan" } + case object KeyboardRedoScenarioChanges extends StatisticName { override val shortName = "f_krsc" } + case object KeyboardUndoScenarioChanges extends StatisticName { override val shortName = "f_kusc" } + case object KeyboardDeleteNodes extends StatisticName { override val shortName = "f_kdn" } + case object KeyboardDeselectAllNodes extends StatisticName { override val shortName = "f_kdan" } + case object KeyboardFocusSearchNodeField extends StatisticName { override val shortName = "f_kfsnf" } override def values = findValues } diff --git a/designer/server/src/test/scala/pl/touk/nussknacker/ui/api/NuDesignerApiAvailableToExposeYamlSpec.scala b/designer/server/src/test/scala/pl/touk/nussknacker/ui/api/NuDesignerApiAvailableToExposeYamlSpec.scala index 08aa06e2fc9..3580f463aba 100644 --- a/designer/server/src/test/scala/pl/touk/nussknacker/ui/api/NuDesignerApiAvailableToExposeYamlSpec.scala +++ b/designer/server/src/test/scala/pl/touk/nussknacker/ui/api/NuDesignerApiAvailableToExposeYamlSpec.scala @@ -130,6 +130,15 @@ class NuDesignerApiAvailableToExposeYamlSpec extends AnyFunSuite with Matchers { "CLICK_SCENARIO_UNARCHIVE", "CLICK_SCENARIO_CUSTOM_ACTION", "CLICK_SCENARIO_CUSTOM_LINK", + "CLICK_SCENARIO_ACTIVITIES_ADD_ATTACHMENT", + "CLICK_SCENARIO_ACTIVITIES_ADD_COMMENT", + "CLICK_SCENARIO_ACTIVITIES_ADD_COMMENT_TO_ACTIVITY", + "CLICK_SCENARIO_ACTIVITIES_COMPARE", + "CLICK_SCENARIO_ACTIVITIES_DOWNLOAD_ATTACHMENT", + "CLICK_SCENARIO_ACTIVITIES_DELETE_ATTACHMENT", + "CLICK_SCENARIO_ACTIVITIES_DELETE_COMMENT", + "CLICK_SCENARIO_ACTIVITIES_EDIT_COMMENT", + "CLICK_SCENARIO_ACTIVITIES_OPEN_VERSION", "DOUBLE_CLICK_RANGE_SELECT_NODES", "KEYBOARD_AND_CLICK_RANGE_SELECT_NODES", "KEYBOARD_COPY_NODE", diff --git a/docs-internal/api/nu-designer-openapi.yaml b/docs-internal/api/nu-designer-openapi.yaml index e2d1dd772f7..083550efc86 100644 --- a/docs-internal/api/nu-designer-openapi.yaml +++ b/docs-internal/api/nu-designer-openapi.yaml @@ -6718,6 +6718,15 @@ components: - CLICK_MORE_SCENARIO_DETAILS - CLICK_EXPAND_PANEL - CLICK_COLLAPSE_PANEL + - CLICK_SCENARIO_ACTIVITIES_ADD_ATTACHMENT + - CLICK_SCENARIO_ACTIVITIES_ADD_COMMENT + - CLICK_SCENARIO_ACTIVITIES_ADD_COMMENT_TO_ACTIVITY + - CLICK_SCENARIO_ACTIVITIES_COMPARE + - CLICK_SCENARIO_ACTIVITIES_DOWNLOAD_ATTACHMENT + - CLICK_SCENARIO_ACTIVITIES_DELETE_ATTACHMENT + - CLICK_SCENARIO_ACTIVITIES_DELETE_COMMENT + - CLICK_SCENARIO_ACTIVITIES_EDIT_COMMENT + - CLICK_SCENARIO_ACTIVITIES_OPEN_VERSION - MOVE_TOOLBAR_PANEL - SEARCH_NODES_IN_SCENARIO - SEARCH_COMPONENTS_IN_SCENARIO From 309f511e1c840b8aad6f50945497919fe146f5ff Mon Sep 17 00:00:00 2001 From: mgoworko <37329559+mgoworko@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:13:12 +0100 Subject: [PATCH 3/5] [NU-1772] Scenario activities changes and refactors (#7094) --- .../deployment/BaseDeploymentManager.scala | 3 -- .../api/deployment/DeploymentManager.scala | 11 ++++-- .../deployment/ScenarioActivityHandling.scala | 21 ----------- ...CachingProcessStateDeploymentManager.scala | 2 -- .../testing/DeploymentManagerStub.scala | 1 - .../api/ScenarioActivityApiHttpService.scala | 15 ++------ .../description/scenarioActivity/Dtos.scala | 12 ++++--- .../scenariotoolbar/ToolbarPanelConfig.scala | 3 -- .../InvalidDeploymentManagerStub.scala | 4 --- ...riesScenarioToolbarsConfigParserSpec.scala | 4 +-- .../ConfigScenarioToolbarServiceSpec.scala | 36 ++++++++----------- docs-internal/api/nu-designer-openapi.yaml | 10 ++++-- docs/MigrationGuide.md | 13 +++---- ...DevelopmentDeploymentManagerProvider.scala | 4 --- .../MockableDeploymentManagerProvider.scala | 19 +++++----- .../periodic/PeriodicDeploymentManager.scala | 14 +++----- .../PeriodicDeploymentManagerTest.scala | 16 ++++++--- .../management/FlinkDeploymentManager.scala | 4 --- .../lite/manager/LiteDeploymentManager.scala | 7 +--- 19 files changed, 72 insertions(+), 127 deletions(-) delete mode 100644 designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/ScenarioActivityHandling.scala diff --git a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/BaseDeploymentManager.scala b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/BaseDeploymentManager.scala index 6da947d7ffc..6bcd3567380 100644 --- a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/BaseDeploymentManager.scala +++ b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/BaseDeploymentManager.scala @@ -1,6 +1,5 @@ package pl.touk.nussknacker.engine.api.deployment -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker import pl.touk.nussknacker.engine.api.deployment.simple.SimpleProcessStateDefinitionManager import pl.touk.nussknacker.engine.deployment.CustomActionDefinition @@ -12,6 +11,4 @@ trait BaseDeploymentManager extends DeploymentManager { override def customActionsDefinitions: List[CustomActionDefinition] = List.empty - override def scenarioActivityHandling: ScenarioActivityHandling = AllScenarioActivitiesStoredByNussknacker - } diff --git a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/DeploymentManager.scala b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/DeploymentManager.scala index 8af6a255f1a..c56c9b7ea74 100644 --- a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/DeploymentManager.scala +++ b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/DeploymentManager.scala @@ -70,14 +70,19 @@ trait DeploymentManager extends AutoCloseable { def customActionsDefinitions: List[CustomActionDefinition] - def scenarioActivityHandling: ScenarioActivityHandling = - ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker - protected final def notImplemented: Future[Nothing] = Future.failed(new NotImplementedError()) } +trait ManagerSpecificScenarioActivitiesStoredByManager { self: DeploymentManager => + + def managerSpecificScenarioActivities( + processIdWithName: ProcessIdWithName + ): Future[List[ScenarioActivity]] + +} + sealed trait DeploymentSynchronisationSupport trait DeploymentSynchronisationSupported extends DeploymentSynchronisationSupport { diff --git a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/ScenarioActivityHandling.scala b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/ScenarioActivityHandling.scala deleted file mode 100644 index 932e9c31f26..00000000000 --- a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/ScenarioActivityHandling.scala +++ /dev/null @@ -1,21 +0,0 @@ -package pl.touk.nussknacker.engine.api.deployment - -import pl.touk.nussknacker.engine.api.process.ProcessIdWithName - -import scala.concurrent.Future - -sealed trait ScenarioActivityHandling - -object ScenarioActivityHandling { - - case object AllScenarioActivitiesStoredByNussknacker extends ScenarioActivityHandling - - trait ManagerSpecificScenarioActivitiesStoredByManager extends ScenarioActivityHandling { - - def managerSpecificScenarioActivities( - processIdWithName: ProcessIdWithName - ): Future[List[ScenarioActivity]] - - } - -} diff --git a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/cache/CachingProcessStateDeploymentManager.scala b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/cache/CachingProcessStateDeploymentManager.scala index 6c6915fe5b1..be4135f3cab 100644 --- a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/cache/CachingProcessStateDeploymentManager.scala +++ b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/api/deployment/cache/CachingProcessStateDeploymentManager.scala @@ -58,8 +58,6 @@ class CachingProcessStateDeploymentManager( override def customActionsDefinitions: List[CustomActionDefinition] = delegate.customActionsDefinitions - override def scenarioActivityHandling: ScenarioActivityHandling = delegate.scenarioActivityHandling - override def close(): Unit = delegate.close() } diff --git a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/testing/DeploymentManagerStub.scala b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/testing/DeploymentManagerStub.scala index d7f65f529ef..7a52b24eca2 100644 --- a/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/testing/DeploymentManagerStub.scala +++ b/designer/deployment-manager-api/src/main/scala/pl/touk/nussknacker/engine/testing/DeploymentManagerStub.scala @@ -5,7 +5,6 @@ import com.typesafe.config.Config import pl.touk.nussknacker.engine.api.StreamMetaData import pl.touk.nussknacker.engine.api.component.ScenarioPropertyConfig import pl.touk.nussknacker.engine.api.definition._ -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker import pl.touk.nussknacker.engine.api.deployment._ import pl.touk.nussknacker.engine.api.deployment.simple.{SimpleProcessStateDefinitionManager, SimpleStateStatus} import pl.touk.nussknacker.engine.api.process.{ProcessIdWithName, ProcessName} diff --git a/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/ScenarioActivityApiHttpService.scala b/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/ScenarioActivityApiHttpService.scala index f5039748c27..ff2e663f036 100644 --- a/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/ScenarioActivityApiHttpService.scala +++ b/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/ScenarioActivityApiHttpService.scala @@ -3,10 +3,6 @@ package pl.touk.nussknacker.ui.api import cats.data.EitherT import com.typesafe.scalalogging.LazyLogging import pl.touk.nussknacker.engine.api.Comment -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.{ - AllScenarioActivitiesStoredByNussknacker, - ManagerSpecificScenarioActivitiesStoredByManager -} import pl.touk.nussknacker.engine.api.deployment.{ScenarioActivity, _} import pl.touk.nussknacker.engine.api.process.{ProcessId, ProcessIdWithName, ProcessName} import pl.touk.nussknacker.security.Permission @@ -250,14 +246,9 @@ class ScenarioActivityApiHttpService( generalActivities <- dbioActionRunner.run(scenarioActivityRepository.findActivities(processIdWithName.id)) deploymentManager <- deploymentManagerDispatcher.deploymentManager(processIdWithName) deploymentManagerSpecificActivities <- deploymentManager match { - case Some(manager) => - manager.scenarioActivityHandling match { - case AllScenarioActivitiesStoredByNussknacker => - Future.successful(List.empty) - case handling: ManagerSpecificScenarioActivitiesStoredByManager => - handling.managerSpecificScenarioActivities(processIdWithName) - } - case None => + case Some(manager: ManagerSpecificScenarioActivitiesStoredByManager) => + manager.managerSpecificScenarioActivities(processIdWithName) + case Some(_) | None => Future.successful(List.empty) } combinedActivities = generalActivities ++ deploymentManagerSpecificActivities diff --git a/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/scenarioActivity/Dtos.scala b/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/scenarioActivity/Dtos.scala index 9e9654cd714..2d43ec65e15 100644 --- a/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/scenarioActivity/Dtos.scala +++ b/designer/server/src/main/scala/pl/touk/nussknacker/ui/api/description/scenarioActivity/Dtos.scala @@ -721,11 +721,15 @@ object Dtos { user = user, date = date, scenarioVersionId = scenarioVersionId, - comment = None, - attachment = None, - additionalFields = List( - AdditionalField("changes", changes), + comment = Some( + ScenarioActivityComment( + content = ScenarioActivityCommentContent.Available(changes), + lastModifiedBy = user, + lastModifiedAt = date + ) ), + attachment = None, + additionalFields = List.empty, ) def forCustomAction( diff --git a/designer/server/src/main/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/ToolbarPanelConfig.scala b/designer/server/src/main/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/ToolbarPanelConfig.scala index b3ee3960b9c..fe0f8b3b614 100644 --- a/designer/server/src/main/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/ToolbarPanelConfig.scala +++ b/designer/server/src/main/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/ToolbarPanelConfig.scala @@ -32,9 +32,6 @@ object ToolbarPanelTypeConfig extends Enumeration { val SearchPanel: Value = Value("search-panel") val TipsPanel: Value = Value("tips-panel") val CreatorPanel: Value = Value("creator-panel") - val VersionsPanel: Value = Value("versions-panel") - val CommentsPanel: Value = Value("comments-panel") - val AttachmentsPanel: Value = Value("attachments-panel") val ProcessInfoPanel: Value = Value("process-info-panel") val ProcessActionsPanel: Value = Value("process-actions-panel") val ButtonsPanel: Value = Value("buttons-panel") diff --git a/designer/server/src/main/scala/pl/touk/nussknacker/ui/process/processingtype/InvalidDeploymentManagerStub.scala b/designer/server/src/main/scala/pl/touk/nussknacker/ui/process/processingtype/InvalidDeploymentManagerStub.scala index d19fba00397..501dd6ba3ca 100644 --- a/designer/server/src/main/scala/pl/touk/nussknacker/ui/process/processingtype/InvalidDeploymentManagerStub.scala +++ b/designer/server/src/main/scala/pl/touk/nussknacker/ui/process/processingtype/InvalidDeploymentManagerStub.scala @@ -1,6 +1,5 @@ package pl.touk.nussknacker.ui.process.processingtype -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker import pl.touk.nussknacker.engine.api.deployment._ import pl.touk.nussknacker.engine.api.deployment.simple.SimpleProcessStateDefinitionManager import pl.touk.nussknacker.engine.api.deployment.simple.SimpleStateStatus.ProblemStateStatus @@ -46,8 +45,5 @@ object InvalidDeploymentManagerStub extends DeploymentManager { override def deploymentSynchronisationSupport: DeploymentSynchronisationSupport = NoDeploymentSynchronisationSupport - override def scenarioActivityHandling: ScenarioActivityHandling = - AllScenarioActivitiesStoredByNussknacker - override def close(): Unit = () } diff --git a/designer/server/src/test/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/CategoriesScenarioToolbarsConfigParserSpec.scala b/designer/server/src/test/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/CategoriesScenarioToolbarsConfigParserSpec.scala index 7019694f44b..1f2e04a6304 100644 --- a/designer/server/src/test/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/CategoriesScenarioToolbarsConfigParserSpec.scala +++ b/designer/server/src/test/scala/pl/touk/nussknacker/ui/config/scenariotoolbar/CategoriesScenarioToolbarsConfigParserSpec.scala @@ -45,7 +45,7 @@ class CategoriesScenarioToolbarsConfigParserSpec extends AnyFlatSpec with Matche | } | ] | bottomRight: [ - | { type: "versions-panel" } + | { type: "activities-panel" } | ] | } | } @@ -119,7 +119,7 @@ class CategoriesScenarioToolbarsConfigParserSpec extends AnyFlatSpec with Matche None ) ), - List(ToolbarPanelConfig(VersionsPanel, None, None, None, None, None)) + List(ToolbarPanelConfig(ActivitiesPanel, None, None, None, None, None)) ) val testingConfigs = Table( diff --git a/designer/server/src/test/scala/pl/touk/nussknacker/ui/process/ConfigScenarioToolbarServiceSpec.scala b/designer/server/src/test/scala/pl/touk/nussknacker/ui/process/ConfigScenarioToolbarServiceSpec.scala index fcd8ddf639c..2aefd305ba4 100644 --- a/designer/server/src/test/scala/pl/touk/nussknacker/ui/process/ConfigScenarioToolbarServiceSpec.scala +++ b/designer/server/src/test/scala/pl/touk/nussknacker/ui/process/ConfigScenarioToolbarServiceSpec.scala @@ -54,23 +54,17 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { | "Category1" { | topLeft: [ | { type: "creator-panel", hidden: {fragment: true, archived: false, type: "allof"} } - | { type: "attachments-panel", hidden: {fragment: true, archived: true, type: "allof"} } - | { type: "comments-panel", hidden: {fragment: false, archived: true, type: "allof"} } - | ] - | bottomRight: [ - | { type: "versions-panel" } + | { type: "activities-panel" } | ] + | bottomRight: [] | }, | "Category3" { | uuid: "68013242-2007-462b-9526-7a9f8684227c" | topLeft: [ | { type: "creator-panel", hidden: {fragment: true, archived: false} } - | { type: "attachments-panel", hidden: {fragment: true, archived: true } } - | { type: "comments-panel", hidden: {fragment: false, archived: true } } - | ] - | bottomRight: [ - | { type: "versions-panel" } + | { type: "activities-panel" } | ] + | bottomRight: [] | } | } | } @@ -205,8 +199,7 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { id, List( ToolbarPanel(CreatorPanel, None, None, None), - ToolbarPanel(AttachmentsPanel, None, None, None), - ToolbarPanel(CommentsPanel, None, None, None) + ToolbarPanel(ActivitiesPanel, None, None, None), ), Nil, List( @@ -254,14 +247,14 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { ) ) ), - List(ToolbarPanel(VersionsPanel, None, None, None)) + List.empty, ) case (false, true, "Category1") => ScenarioToolbarSettings( id, List( ToolbarPanel(CreatorPanel, None, None, None), - ToolbarPanel(AttachmentsPanel, None, None, None) + ToolbarPanel(ActivitiesPanel, None, None, None) ), Nil, List( @@ -299,14 +292,13 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { ) ) ), - List(ToolbarPanel(VersionsPanel, None, None, None)) + List.empty, ) case (true, false, "Category1") => ScenarioToolbarSettings( id, List( - ToolbarPanel(AttachmentsPanel, None, None, None), - ToolbarPanel(CommentsPanel, None, None, None) + ToolbarPanel(ActivitiesPanel, None, None, None), ), Nil, List( @@ -365,14 +357,14 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { ) ) ), - List(ToolbarPanel(VersionsPanel, None, None, None)) + List.empty, ) case (true, true, "Category1") => ScenarioToolbarSettings( id, List( ToolbarPanel(CreatorPanel, None, None, None), - ToolbarPanel(CommentsPanel, None, None, None) + ToolbarPanel(ActivitiesPanel, None, None, None) ), Nil, List( @@ -420,7 +412,7 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { ) ) ), - List(ToolbarPanel(VersionsPanel, None, None, None)) + List.empty, ) case (false, false, "Category2") => ScenarioToolbarSettings( @@ -480,7 +472,7 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { ScenarioToolbarSettings( id, List( - ToolbarPanel(AttachmentsPanel, None, None, None) + ToolbarPanel(ActivitiesPanel, None, None, None) ), Nil, List( @@ -528,7 +520,7 @@ class ConfigScenarioToolbarServiceSpec extends AnyFlatSpec with Matchers { ) ) ), - List(ToolbarPanel(VersionsPanel, None, None, None)) + List.empty, ) case (_, _, _) => ScenarioToolbarSettings("not-exist", Nil, Nil, Nil, Nil) diff --git a/docs-internal/api/nu-designer-openapi.yaml b/docs-internal/api/nu-designer-openapi.yaml index 083550efc86..06d065c8f01 100644 --- a/docs-internal/api/nu-designer-openapi.yaml +++ b/docs-internal/api/nu-designer-openapi.yaml @@ -4282,9 +4282,13 @@ paths: user: some user date: '2024-01-17T14:21:17Z' scenarioVersionId: 1 - additionalFields: - - name: changes - value: JIRA-12345, JIRA-32146 + comment: + content: + value: JIRA-12345, JIRA-32146 + status: AVAILABLE + lastModifiedBy: some user + lastModifiedAt: '2024-01-17T14:21:17Z' + additionalFields: [] type: AUTOMATIC_UPDATE - id: 33509d37-7657-4229-940f-b5736c82fb13 user: some user diff --git a/docs/MigrationGuide.md b/docs/MigrationGuide.md index 723bf8ba9c1..fede53a6e09 100644 --- a/docs/MigrationGuide.md +++ b/docs/MigrationGuide.md @@ -32,14 +32,9 @@ To see the biggest differences please consult the [changelog](Changelog.md). * Added field `scenarioActivityManager: ScenarioActivityManager` * `scenarioActivityManager` can be used by any `DeploymentManager` to save scenario activities in the Nu database * there is `NoOpScenarioActivityManager` implementation available (if needed for tests etc.) -* [#6971](https://github.com/TouK/nussknacker/pull/6971) `DeploymentManager` API changes: - * Added method `scenarioActivityHandling: ScenarioActivityHandling` - * `ScenarioActivityHandling` has two variants: - * `AllScenarioActivitiesStoredByNussknacker` - * `DeploymentManager` does not handle any custom ScenarioActivities outside the core Nussknacker mechanism - * `ManagerSpecificScenarioActivitiesStoredByManager` - * `DeploymentManager` handles custom ScenarioActivities and may be queried about those custom activities for scenario - * default value of `scenarioActivityHandling` is `ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker` +* [#6971](https://github.com/TouK/nussknacker/pull/6971) `DeploymentManager` compatible API changes: + * `DeploymentManager` may now optionally extend `ManagerSpecificScenarioActivitiesStoredByManager` + * managers extending that trait may internally handle some manager-specific ScenarioActivities and may be queried about those custom activities * [#6695](https://github.com/TouK/nussknacker/pull/6695) `SingleTypingResult` API changes: * Renamed `objType` to `runtimeObjType` which indicates a current object in a runtime. * [#6766](https://github.com/TouK/nussknacker/pull/6766) @@ -81,7 +76,7 @@ To see the biggest differences please consult the [changelog](Changelog.md). * `FlinkCustomNodeContext.forCustomContext` has been removed, please use `TypeInformationDetection.instance.forValueWithContext` instead ### Configuration changes -* [#6979](https://github.com/TouK/nussknacker/pull/6979) Add `type: "activities-panel"` to The `processToolbarConfig` which replace deprecated `{ type: "versions-panel" }` `{ type: "comments-panel" }` and `{ type: "attachments-panel" }` +* [#6979](https://github.com/TouK/nussknacker/pull/6979) Add `type: "activities-panel"` to the `processToolbarConfig` which replaces removed `{ type: "versions-panel" }` `{ type: "comments-panel" }` and `{ type: "attachments-panel" }` ## In version 1.17.0 diff --git a/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/DevelopmentDeploymentManagerProvider.scala b/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/DevelopmentDeploymentManagerProvider.scala index 2459e9ef47c..967fe9c3c01 100644 --- a/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/DevelopmentDeploymentManagerProvider.scala +++ b/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/DevelopmentDeploymentManagerProvider.scala @@ -14,7 +14,6 @@ import pl.touk.nussknacker.engine.api.definition.{ MandatoryParameterValidator, StringParameterEditor } -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker import pl.touk.nussknacker.engine.api.deployment._ import pl.touk.nussknacker.engine.api.deployment.simple.{SimpleProcessStateDefinitionManager, SimpleStateStatus} import pl.touk.nussknacker.engine.api.process.ProcessName @@ -183,9 +182,6 @@ class DevelopmentDeploymentManager(actorSystem: ActorSystem, modelData: BaseMode } } - override def scenarioActivityHandling: ScenarioActivityHandling = - AllScenarioActivitiesStoredByNussknacker - override def close(): Unit = {} private def changeState(name: ProcessName, stateStatus: StateStatus): Unit = diff --git a/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/MockableDeploymentManagerProvider.scala b/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/MockableDeploymentManagerProvider.scala index 360ea87ff55..dc2233e024c 100644 --- a/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/MockableDeploymentManagerProvider.scala +++ b/engine/development/deploymentManager/src/main/scala/pl/touk/nussknacker/development/manager/MockableDeploymentManagerProvider.scala @@ -9,7 +9,6 @@ import pl.touk.nussknacker.engine.ModelData.BaseModelDataExt import pl.touk.nussknacker.engine._ import pl.touk.nussknacker.engine.api.component.ScenarioPropertyConfig import pl.touk.nussknacker.engine.api.definition.{NotBlankParameterValidator, StringParameterEditor} -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.ManagerSpecificScenarioActivitiesStoredByManager import pl.touk.nussknacker.engine.api.deployment._ import pl.touk.nussknacker.engine.api.deployment.simple.{SimpleProcessStateDefinitionManager, SimpleStateStatus} import pl.touk.nussknacker.engine.api.process.{ProcessIdWithName, ProcessName} @@ -53,7 +52,10 @@ object MockableDeploymentManagerProvider { type ScenarioName = String - class MockableDeploymentManager(modelDataOpt: Option[BaseModelData]) extends DeploymentManager with StubbingCommands { + class MockableDeploymentManager(modelDataOpt: Option[BaseModelData]) + extends DeploymentManager + with ManagerSpecificScenarioActivitiesStoredByManager + with StubbingCommands { private lazy val testRunnerOpt = modelDataOpt.map(modelData => new FlinkProcessTestRunner(modelData.asInvokableModelData)) @@ -131,15 +133,10 @@ object MockableDeploymentManagerProvider { override def deploymentSynchronisationSupport: DeploymentSynchronisationSupport = NoDeploymentSynchronisationSupport - override def scenarioActivityHandling: ScenarioActivityHandling = - new ManagerSpecificScenarioActivitiesStoredByManager { - - override def managerSpecificScenarioActivities( - processIdWithName: ProcessIdWithName - ): Future[List[ScenarioActivity]] = - Future.successful(MockableDeploymentManager.managerSpecificScenarioActivities.get()) - - } + override def managerSpecificScenarioActivities( + processIdWithName: ProcessIdWithName + ): Future[List[ScenarioActivity]] = + Future.successful(MockableDeploymentManager.managerSpecificScenarioActivities.get()) override def close(): Unit = {} } diff --git a/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManager.scala b/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManager.scala index 0b76f2e6a74..02e47fe9eaa 100644 --- a/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManager.scala +++ b/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManager.scala @@ -2,7 +2,6 @@ package pl.touk.nussknacker.engine.management.periodic import com.typesafe.config.Config import com.typesafe.scalalogging.LazyLogging -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.ManagerSpecificScenarioActivitiesStoredByManager import pl.touk.nussknacker.engine.api.deployment._ import pl.touk.nussknacker.engine.api.process.{ProcessIdWithName, ProcessName} import pl.touk.nussknacker.engine.canonicalgraph.CanonicalProcess @@ -104,6 +103,7 @@ class PeriodicDeploymentManager private[periodic] ( toClose: () => Unit )(implicit val ec: ExecutionContext) extends DeploymentManager + with ManagerSpecificScenarioActivitiesStoredByManager with LazyLogging { override def processCommand[Result](command: DMScenarioCommand[Result]): Future[Result] = @@ -237,14 +237,10 @@ class PeriodicDeploymentManager private[periodic] ( // - we have to migrate information about old periodic deployments, or decide that we don't need it // - we have to modify the logic of the PeriodicDeploymentManager // - we may need to refactor PeriodicDeploymentManager data source first - override val scenarioActivityHandling: ManagerSpecificScenarioActivitiesStoredByManager = - new ManagerSpecificScenarioActivitiesStoredByManager { - override def managerSpecificScenarioActivities( - processIdWithName: ProcessIdWithName - ): Future[List[ScenarioActivity]] = - service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName) - - } + override def managerSpecificScenarioActivities( + processIdWithName: ProcessIdWithName + ): Future[List[ScenarioActivity]] = + service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName) } diff --git a/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManagerTest.scala b/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManagerTest.scala index bd4e22b7b81..e57623b43d1 100644 --- a/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManagerTest.scala +++ b/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicDeploymentManagerTest.scala @@ -379,8 +379,12 @@ class PeriodicDeploymentManagerTest PeriodicProcessDeploymentStatus.Scheduled ) - val activities = - f.periodicDeploymentManager.scenarioActivityHandling.managerSpecificScenarioActivities(idWithName).futureValue + val activities = f.periodicDeploymentManager match { + case manager: ManagerSpecificScenarioActivitiesStoredByManager => + manager.managerSpecificScenarioActivities(idWithName).futureValue + case _ => + List.empty + } val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] activities shouldBe List( ScenarioActivity.PerformedScheduledExecution( @@ -418,8 +422,12 @@ class PeriodicDeploymentManagerTest f.getMergedStatusDetails.status shouldEqual SimpleStateStatus.Canceled - val activities = - f.periodicDeploymentManager.scenarioActivityHandling.managerSpecificScenarioActivities(idWithName).futureValue + val activities = f.periodicDeploymentManager match { + case manager: ManagerSpecificScenarioActivitiesStoredByManager => + manager.managerSpecificScenarioActivities(idWithName).futureValue + case _ => + List.empty + } val headActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] activities shouldBe List( ScenarioActivity.PerformedScheduledExecution( diff --git a/engine/flink/management/src/main/scala/pl/touk/nussknacker/engine/management/FlinkDeploymentManager.scala b/engine/flink/management/src/main/scala/pl/touk/nussknacker/engine/management/FlinkDeploymentManager.scala index e61be722b14..b991cd32cba 100644 --- a/engine/flink/management/src/main/scala/pl/touk/nussknacker/engine/management/FlinkDeploymentManager.scala +++ b/engine/flink/management/src/main/scala/pl/touk/nussknacker/engine/management/FlinkDeploymentManager.scala @@ -5,7 +5,6 @@ import com.typesafe.scalalogging.LazyLogging import io.circe.syntax.EncoderOps import pl.touk.nussknacker.engine.ModelData._ import pl.touk.nussknacker.engine.api.ProcessVersion -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker import pl.touk.nussknacker.engine.api.deployment.DeploymentUpdateStrategy.StateRestoringStrategy import pl.touk.nussknacker.engine.api.deployment._ import pl.touk.nussknacker.engine.api.deployment.inconsistency.InconsistentStateDetector @@ -264,9 +263,6 @@ abstract class FlinkDeploymentManager( override def processStateDefinitionManager: ProcessStateDefinitionManager = FlinkProcessStateDefinitionManager - override def scenarioActivityHandling: ScenarioActivityHandling = - AllScenarioActivitiesStoredByNussknacker - } object FlinkDeploymentManager { diff --git a/engine/lite/deploymentManager/src/main/scala/pl/touk/nussknacker/lite/manager/LiteDeploymentManager.scala b/engine/lite/deploymentManager/src/main/scala/pl/touk/nussknacker/lite/manager/LiteDeploymentManager.scala index ab3a035a197..cce5a79778f 100644 --- a/engine/lite/deploymentManager/src/main/scala/pl/touk/nussknacker/lite/manager/LiteDeploymentManager.scala +++ b/engine/lite/deploymentManager/src/main/scala/pl/touk/nussknacker/lite/manager/LiteDeploymentManager.scala @@ -4,12 +4,7 @@ import io.circe.Json import pl.touk.nussknacker.engine.BaseModelData import pl.touk.nussknacker.engine.ModelData.BaseModelDataExt import pl.touk.nussknacker.engine.api.JobData -import pl.touk.nussknacker.engine.api.deployment.ScenarioActivityHandling.AllScenarioActivitiesStoredByNussknacker -import pl.touk.nussknacker.engine.api.deployment.{ - BaseDeploymentManager, - DMTestScenarioCommand, - ScenarioActivityHandling -} +import pl.touk.nussknacker.engine.api.deployment.{BaseDeploymentManager, DMTestScenarioCommand} import pl.touk.nussknacker.engine.lite.kafka.KafkaTransactionalScenarioInterpreter import pl.touk.nussknacker.engine.testmode.TestProcess From d88bc8b8effa21bb4f0a9f4dd5930a72eb20a7a9 Mon Sep 17 00:00:00 2001 From: Dawid Poliszak Date: Mon, 28 Oct 2024 17:21:16 +0100 Subject: [PATCH 4/5] [NU-1772] clean toolbar from redundant panels (#7095) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * NU-1772 clean toolbar from redundant panelsź --- designer/client/cypress/support/process.ts | 3 +- designer/client/src/actions/actionTypes.ts | 1 - designer/client/src/actions/nk/comment.ts | 20 ----- .../src/actions/nk/displayProcessActivity.ts | 21 ----- .../src/actions/nk/fetchVisualizationData.ts | 2 - designer/client/src/actions/nk/index.ts | 2 - .../src/actions/nk/loadProcessVersions.ts | 22 ----- designer/client/src/actions/nk/process.ts | 6 -- designer/client/src/actions/reduxTypes.ts | 6 +- .../client/src/components/button/NkButton.tsx | 16 ---- .../src/components/comment/CommentsList.tsx | 43 ---------- .../src/components/comment/CommentsPanel.tsx | 15 ---- .../components/comment/ProcessComments.tsx | 64 -------------- .../src/components/comment/StyledComment.tsx | 59 +------------ .../src/components/history/HistoryItem.tsx | 66 -------------- .../src/components/history/ProcessHistory.tsx | 81 ------------------ .../src/components/history/StyledHistory.tsx | 85 ------------------- .../components/modals/SaveProcessDialog.tsx | 3 +- .../AddAttachment_deprecated.tsx | 40 --------- .../processAttach/AttachmentEl_deprecated.tsx | 27 ------ .../processAttach/ProcessAttachments.tsx | 27 ------ .../components/processAttach/StyledAttach.tsx | 38 --------- .../toolbarSettings/TOOLBAR_COMPONENTS_MAP.ts | 6 -- .../toolbarSettings/defaultToolbarsConfig.ts | 9 +- .../components/toolbars/AttachmentsPanel.tsx | 15 ---- .../src/components/toolbars/VersionsPanel.tsx | 18 ---- .../activities/ActivitiesPanelFooter.tsx | 35 +++++--- .../ActivityItemComment.tsx | 6 +- .../ActivityItemHeader.tsx | 6 +- .../client/src/containers/Notifications.tsx | 8 +- designer/client/src/http/HttpService.ts | 14 --- designer/client/src/reducers/graph/reducer.ts | 2 +- .../client/src/reducers/processActivity.ts | 11 --- .../client/test/ProcessAttachments-test.js | 48 ----------- designer/client/test/ProcessHistory-test.js | 69 --------------- 35 files changed, 39 insertions(+), 855 deletions(-) delete mode 100644 designer/client/src/actions/nk/comment.ts delete mode 100644 designer/client/src/actions/nk/displayProcessActivity.ts delete mode 100644 designer/client/src/actions/nk/loadProcessVersions.ts delete mode 100644 designer/client/src/components/button/NkButton.tsx delete mode 100644 designer/client/src/components/comment/CommentsList.tsx delete mode 100644 designer/client/src/components/comment/CommentsPanel.tsx delete mode 100644 designer/client/src/components/comment/ProcessComments.tsx delete mode 100644 designer/client/src/components/history/HistoryItem.tsx delete mode 100644 designer/client/src/components/history/ProcessHistory.tsx delete mode 100644 designer/client/src/components/history/StyledHistory.tsx delete mode 100644 designer/client/src/components/processAttach/AddAttachment_deprecated.tsx delete mode 100644 designer/client/src/components/processAttach/AttachmentEl_deprecated.tsx delete mode 100644 designer/client/src/components/processAttach/ProcessAttachments.tsx delete mode 100644 designer/client/src/components/toolbars/AttachmentsPanel.tsx delete mode 100644 designer/client/src/components/toolbars/VersionsPanel.tsx delete mode 100644 designer/client/test/ProcessAttachments-test.js delete mode 100644 designer/client/test/ProcessHistory-test.js diff --git a/designer/client/cypress/support/process.ts b/designer/client/cypress/support/process.ts index 4aa5fdfdc71..b493106f56a 100644 --- a/designer/client/cypress/support/process.ts +++ b/designer/client/cypress/support/process.ts @@ -310,12 +310,13 @@ function layoutScenario(waitTime = 600) { function deployScenario(comment = "issues/123", withScreenshot?: boolean) { cy.contains(/^deploy$/i).click(); cy.intercept("POST", "/api/processManagement/deploy/*").as("deploy"); + cy.intercept("GET", "/api/processes/*/activity/activities").as("activities"); if (withScreenshot) { cy.get("[data-testid=window]").matchImage(); } cy.get("[data-testid=window] textarea").click().type(comment); cy.contains(/^ok$/i).should("be.enabled").click(); - cy.wait(["@deploy", "@fetch"], { + cy.wait(["@deploy", "@activities"], { timeout: 20000, log: true, }).each((res) => { diff --git a/designer/client/src/actions/actionTypes.ts b/designer/client/src/actions/actionTypes.ts index a6cae1509af..98eb8dc62f9 100644 --- a/designer/client/src/actions/actionTypes.ts +++ b/designer/client/src/actions/actionTypes.ts @@ -26,7 +26,6 @@ export type ActionTypes = | "UPDATE_TEST_CAPABILITIES" | "UPDATE_TEST_FORM_PARAMETERS" | "DISPLAY_PROCESS" - | "DISPLAY_PROCESS_ACTIVITY" | "GET_SCENARIO_ACTIVITIES" | "UPDATE_SCENARIO_ACTIVITIES" | "PROCESS_FETCH" diff --git a/designer/client/src/actions/nk/comment.ts b/designer/client/src/actions/nk/comment.ts deleted file mode 100644 index 9b1d4302c70..00000000000 --- a/designer/client/src/actions/nk/comment.ts +++ /dev/null @@ -1,20 +0,0 @@ -import HttpService from "../../http/HttpService"; -import { displayProcessActivity } from "./displayProcessActivity"; -import { ThunkAction } from "../reduxTypes"; -import { ProcessName } from "../../components/Process/types"; - -export function addComment(processName: ProcessName, processVersionId, comment): ThunkAction { - return (dispatch) => { - return HttpService.addComment(processName, processVersionId, comment).then(() => { - return dispatch(displayProcessActivity(processName)); - }); - }; -} - -export function deleteComment(processName: ProcessName, commentId): ThunkAction { - return (dispatch) => { - return HttpService.deleteComment(processName, commentId).then(() => { - return dispatch(displayProcessActivity(processName)); - }); - }; -} diff --git a/designer/client/src/actions/nk/displayProcessActivity.ts b/designer/client/src/actions/nk/displayProcessActivity.ts deleted file mode 100644 index 60c2ad06ac4..00000000000 --- a/designer/client/src/actions/nk/displayProcessActivity.ts +++ /dev/null @@ -1,21 +0,0 @@ -import HttpService from "../../http/HttpService"; -import { Attachment } from "../../reducers/processActivity"; -import { ThunkAction } from "../reduxTypes"; - -export type DisplayProcessActivityAction = { - type: "DISPLAY_PROCESS_ACTIVITY"; - comments: Comment[]; - attachments: Attachment[]; -}; - -export function displayProcessActivity(processName: string): ThunkAction { - return (dispatch) => { - return HttpService.fetchProcessActivity(processName).then((response) => { - return dispatch({ - type: "DISPLAY_PROCESS_ACTIVITY", - comments: response.data.comments, - attachments: response.data.attachments, - }); - }); - }; -} diff --git a/designer/client/src/actions/nk/fetchVisualizationData.ts b/designer/client/src/actions/nk/fetchVisualizationData.ts index b7da8b8df03..c73139b8d16 100644 --- a/designer/client/src/actions/nk/fetchVisualizationData.ts +++ b/designer/client/src/actions/nk/fetchVisualizationData.ts @@ -1,6 +1,5 @@ import { ThunkAction } from "../reduxTypes"; import { displayCurrentProcessVersion } from "./process"; -import { displayProcessActivity } from "./displayProcessActivity"; import { fetchProcessDefinition } from "./processDefinitionData"; import { loadProcessToolbarsConfiguration } from "./loadProcessToolbarsConfiguration"; import { ProcessName } from "../../components/Process/types"; @@ -11,7 +10,6 @@ export function fetchVisualizationData(processName: ProcessName, onSuccess: () = const scenario = await dispatch(displayCurrentProcessVersion(processName)); const { name, isFragment, processingType } = scenario; await dispatch(loadProcessToolbarsConfiguration(name)); - dispatch(displayProcessActivity(name)); const processDefinitionData = await dispatch(fetchProcessDefinition(processingType, isFragment)); dispatch({ type: "CORRECT_INVALID_SCENARIO", processDefinitionData }); onSuccess(); diff --git a/designer/client/src/actions/nk/index.ts b/designer/client/src/actions/nk/index.ts index 9815a32b9c6..a4d340942a7 100644 --- a/designer/client/src/actions/nk/index.ts +++ b/designer/client/src/actions/nk/index.ts @@ -1,7 +1,5 @@ export * from "./assignSettings"; export * from "./assignUser"; -export * from "./comment"; -export * from "./displayProcessActivity"; export * from "./displayProcessCounts"; export * from "./editNode"; export * from "./importExport"; diff --git a/designer/client/src/actions/nk/loadProcessVersions.ts b/designer/client/src/actions/nk/loadProcessVersions.ts deleted file mode 100644 index cb487858120..00000000000 --- a/designer/client/src/actions/nk/loadProcessVersions.ts +++ /dev/null @@ -1,22 +0,0 @@ -import HttpService from "../../http/HttpService"; -import { ProcessActionType, ProcessName, ProcessVersionType } from "../../components/Process/types"; -import { ThunkAction } from "../reduxTypes"; - -export type LoadProcessVersionsAction = { - type: "PROCESS_VERSIONS_LOADED"; - history: ProcessVersionType[]; - lastAction: ProcessActionType; - lastDeployedAction: ProcessActionType; -}; - -export function loadProcessVersions(processName: ProcessName): ThunkAction> { - return (dispatch) => - HttpService.fetchProcessDetails(processName).then((response) => { - return dispatch({ - type: "PROCESS_VERSIONS_LOADED", - history: response.data.history, - lastDeployedAction: response.data.lastDeployedAction, - lastAction: response.data.lastAction, - }); - }); -} diff --git a/designer/client/src/actions/nk/process.ts b/designer/client/src/actions/nk/process.ts index 6ac7d7e5b67..8c6572086b9 100644 --- a/designer/client/src/actions/nk/process.ts +++ b/designer/client/src/actions/nk/process.ts @@ -6,7 +6,6 @@ import { getProcessDefinitionData } from "../../reducers/selectors/settings"; import { ProcessDefinitionData, ScenarioGraph } from "../../types"; import { ThunkAction } from "../reduxTypes"; import HttpService from "./../../http/HttpService"; -import { displayProcessActivity } from "./displayProcessActivity"; export type ScenarioActions = | { type: "CORRECT_INVALID_SCENARIO"; processDefinitionData: ProcessDefinitionData } @@ -80,8 +79,3 @@ export function hideRunProcessDetails() { replaceSearchQuery(omit(["from", "to", "refresh"])); return { type: "HIDE_RUN_PROCESS_DETAILS" }; } - -export function addAttachment(processName: ProcessName, processVersionId: ProcessVersionId, file: File) { - return (dispatch) => - HttpService.addAttachment(processName, processVersionId, file).then(() => dispatch(displayProcessActivity(processName))); -} diff --git a/designer/client/src/actions/reduxTypes.ts b/designer/client/src/actions/reduxTypes.ts index dd5108f511a..070a73798fc 100644 --- a/designer/client/src/actions/reduxTypes.ts +++ b/designer/client/src/actions/reduxTypes.ts @@ -2,22 +2,19 @@ import { AnyAction, Reducer as ReduxReducer } from "redux"; import { ThunkAction as TA, ThunkDispatch as TD } from "redux-thunk"; import { ActionTypes } from "./actionTypes"; -import { CountsActions, DisplayProcessActivityAction, NodeActions, ScenarioActions, SelectionActions } from "./nk"; +import { CountsActions, NodeActions, ScenarioActions, SelectionActions, NodeDetailsActions } from "./nk"; import { UserSettingsActions } from "./nk/userSettings"; import { UiActions } from "./nk/ui/uiActions"; import { SettingsActions } from "./settingsActions"; import { ToolbarActions } from "./nk/toolbars"; import { RootState } from "../reducers"; -import { NodeDetailsActions } from "./nk/nodeDetails"; import { NotificationActions } from "./nk/notifications"; import { DisplayTestResultsDetailsAction } from "./nk/displayTestResults"; -import { LoadProcessVersionsAction } from "./nk/loadProcessVersions"; import { GetScenarioActivitiesAction, UpdateScenarioActivitiesAction } from "./nk/scenarioActivities"; type TypedAction = | UiActions | SettingsActions - | DisplayProcessActivityAction | GetScenarioActivitiesAction | UpdateScenarioActivitiesAction | NodeActions @@ -28,7 +25,6 @@ type TypedAction = | NotificationActions | DisplayTestResultsDetailsAction | CountsActions - | LoadProcessVersionsAction | ScenarioActions; interface UntypedAction extends AnyAction { diff --git a/designer/client/src/components/button/NkButton.tsx b/designer/client/src/components/button/NkButton.tsx deleted file mode 100644 index 316374860e6..00000000000 --- a/designer/client/src/components/button/NkButton.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; -import { ButtonProps, Button } from "../FormElements"; -import { styled } from "@mui/material"; -import { buttonBaseStyle } from "./ButtonBaseStyle"; - -const NkButtonStyled = styled(Button)(({ theme }) => ({ - ...buttonBaseStyle(theme), - width: "180px", - height: "44px", - fontWeight: 600, - fontSize: "18px", -})); - -export function NkButton({ ...props }: ButtonProps) { - return ; -} diff --git a/designer/client/src/components/comment/CommentsList.tsx b/designer/client/src/components/comment/CommentsList.tsx deleted file mode 100644 index 1e72192921c..00000000000 --- a/designer/client/src/components/comment/CommentsList.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import React, { useCallback } from "react"; -import { createSelector } from "reselect"; -import { useSelector } from "react-redux"; -import CommentContent from "./CommentContent"; -import Date from "../common/Date"; -import { ProcessCommentsList, RemoveButton } from "./StyledComment"; -import { getFeatureSettings, getLoggedUser } from "../../reducers/selectors/settings"; -import { Divider, Typography } from "@mui/material"; - -const getComments = (state) => state.processActivity?.comments || []; -const getCommentSettings = createSelector(getFeatureSettings, (f) => f.commentSettings || {}); - -interface CommentsListProps { - deleteComment: (comment) => void; -} - -export default function CommentsList({ deleteComment }: CommentsListProps) { - const loggedUser = useSelector(getLoggedUser); - const comments = useSelector(getComments); - const commentSettings = useSelector(getCommentSettings); - - const isLastComment = useCallback((index) => index + 1 === comments.length, [comments.length]); - - return ( - - {comments.map((comment, index) => ( -
-
- - {`| v${comment.processVersionId} | ${comment.user}`} - {comment.user != loggedUser.id ? null : deleteComment(comment)} />} -
- - {!isLastComment(index) && } -
- ))} -
- ); -} diff --git a/designer/client/src/components/comment/CommentsPanel.tsx b/designer/client/src/components/comment/CommentsPanel.tsx deleted file mode 100644 index db15c12f533..00000000000 --- a/designer/client/src/components/comment/CommentsPanel.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { ToolbarPanelProps } from "../toolbarComponents/DefaultToolbarPanel"; -import { ToolbarWrapper } from "../toolbarComponents/toolbarWrapper/ToolbarWrapper"; -import ProcessComments from "./ProcessComments"; - -export function CommentsPanel(props: ToolbarPanelProps) { - const { t } = useTranslation(); - - return ( - - - - ); -} diff --git a/designer/client/src/components/comment/ProcessComments.tsx b/designer/client/src/components/comment/ProcessComments.tsx deleted file mode 100644 index cbca4be89e8..00000000000 --- a/designer/client/src/components/comment/ProcessComments.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import React, { useCallback, useState } from "react"; -import { useDispatch, useSelector } from "react-redux"; -import { addComment, deleteComment } from "../../actions/nk"; -import { getProcessName, getProcessVersionId } from "../../reducers/selectors/graph"; -import CommentInput from "./CommentInput"; -import { useWindows } from "../../windowManager"; -import * as DialogMessages from "../../common/DialogMessages"; -import { getCapabilities } from "../../reducers/selectors/other"; -import { AddCommentPanel, CommentButton, ProcessCommentsWrapper } from "./StyledComment"; -import CommentsList from "./CommentsList"; - -function ProcessComments(): JSX.Element { - const [comment, setComment] = useState(""); - const [pending, setPending] = useState(false); - const dispatch = useDispatch(); - const { confirm } = useWindows(); - - const processName = useSelector(getProcessName); - const processVersionId = useSelector(getProcessVersionId); - const capabilities = useSelector(getCapabilities); - - const _deleteComment = useCallback( - (comment) => { - setPending(true); - confirm({ - text: DialogMessages.deleteComment(), - confirmText: "DELETE", - denyText: "NO", - onConfirmCallback: async (confirmed) => { - if (confirmed) { - await dispatch(deleteComment(processName, comment.id)); - } - setPending(false); - }, - }); - }, - [confirm, dispatch, processName], - ); - - const _addComment = useCallback(async () => { - setPending(true); - await dispatch(addComment(processName, processVersionId, comment)); - setPending(false); - setComment(""); - }, [dispatch, processName, processVersionId, comment]); - - const onInputChange = useCallback((e) => setComment(e.target.value), []); - - return ( - - - {capabilities.write ? ( - - - - Add - - - ) : null} - - ); -} - -export default ProcessComments; diff --git a/designer/client/src/components/comment/StyledComment.tsx b/designer/client/src/components/comment/StyledComment.tsx index 2affaa3bae9..fddf6b9128e 100644 --- a/designer/client/src/components/comment/StyledComment.tsx +++ b/designer/client/src/components/comment/StyledComment.tsx @@ -1,61 +1,4 @@ -import { lighten, styled } from "@mui/material"; -import { NkButton } from "../button/NkButton"; -import { StyledCloseIcon } from "../toolbarComponents/toolbarWrapper/ToolbarStyled"; - -export const ProcessCommentsWrapper = styled("div")` - padding: 0 13px 10px; -`; - -export const ProcessCommentsList = styled("div")` - font-size: 10px; - margin: 15px 0; - padding: 0; -`; - -export const RemoveButton = styled(StyledCloseIcon)` - float: right; - &:hover { - cursor: pointer; - opacity: 0.5; - } -`; - -export const AddCommentPanel = styled("div")( - ({ theme }) => ` - font-size: 12px !important; - display: flex; - flex-direction: column !important; - textarea { - width: 100% !important; - height: ${theme.custom.spacing.controlHeight} !important; - font-size: 12px; - font-weight: 400; - border-radius: 3px; - border: none; - background-color: ${lighten(theme.palette.background.paper, 0.1)}; - padding: 4px 6px; - resize: none; - } -`, -); - -export const CommentButton = styled(NkButton)( - ({ theme }) => ` - font-size: 12px !important; - background-color: ${lighten(theme.palette.background.paper, 0.2)} !important; - border: none !important; - width: 20% !important; - height: 30px !important; - align-self: flex-end !important; - margin: 5px 0 10px !important; - padding: 3px 0 !important; - border-radius: 3px !important; - cursor: pointer; - &:hover { - background-color: ${theme.palette.action.hover} !important; - } -`, -); +import { styled } from "@mui/material"; export const PanelComment = styled("div")(({ theme }) => ({ marginTop: "1px", diff --git a/designer/client/src/components/history/HistoryItem.tsx b/designer/client/src/components/history/HistoryItem.tsx deleted file mode 100644 index ad0175379d4..00000000000 --- a/designer/client/src/components/history/HistoryItem.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import Date from "../common/Date"; -import { PredefinedActionName, ProcessVersionType } from "../Process/types"; -import { HistoryItemStyled, StyledBadge } from "./StyledHistory"; -import WarningAmber from "@mui/icons-material/WarningAmber"; -import { Box, Typography } from "@mui/material"; - -type HistoryItemProps = { - isLatest?: boolean; - isDeployed?: boolean; - version: ProcessVersionType; - onClick: (version: ProcessVersionType) => void; - type: VersionType; -}; - -export enum VersionType { - current, - past, - future, -} - -const mapVersionToClassName = (v: VersionType): string => { - switch (v) { - case VersionType.current: - return "current"; - case VersionType.past: - return "past"; - case VersionType.future: - return "future"; - } -}; - -const HDate = ({ date }: { date: string }) => ( - - - - - -); - -export function HistoryItem({ onClick, version, type, isLatest, isDeployed }: HistoryItemProps): JSX.Element { - const { t } = useTranslation(); - const { user, createDate, processVersionId, actions } = version; - - return ( - onClick(version)}> - - {`v${processVersionId}`} | {user} - {isLatest && !isDeployed && ( - - - - )} -
- -
- {isDeployed && a.actionName === PredefinedActionName.Deploy)?.performedAt} />} -
- {isDeployed && } -
- ); -} diff --git a/designer/client/src/components/history/ProcessHistory.tsx b/designer/client/src/components/history/ProcessHistory.tsx deleted file mode 100644 index e07a771f8c7..00000000000 --- a/designer/client/src/components/history/ProcessHistory.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import React, { useCallback, useMemo } from "react"; -import { Scrollbars } from "react-custom-scrollbars"; -import { useDispatch, useSelector } from "react-redux"; -import { displayScenarioVersion } from "../../actions/nk"; -import { unsavedProcessChanges } from "../../common/DialogMessages"; -import { getScenario, isSaveDisabled } from "../../reducers/selectors/graph"; -import { useWindows } from "../../windowManager"; -import { HistoryItem, VersionType } from "./HistoryItem"; -import { ProcessVersionType } from "../Process/types"; -import { ProcessHistoryWrapper, TrackVertical } from "./StyledHistory"; -import { EventTrackingSelector, getEventTrackingProps } from "../../containers/event-tracking"; - -export function ProcessHistoryComponent(props: { isReadOnly?: boolean }): JSX.Element { - const scenario = useSelector(getScenario); - const { history = [], lastDeployedAction, name, processVersionId } = scenario || {}; - const nothingToSave = useSelector(isSaveDisabled); - const selectedVersion = useMemo(() => history.find((v) => v.processVersionId === processVersionId), [history, processVersionId]); - - const dispatch = useDispatch(); - - const doChangeVersion = useCallback( - (version: ProcessVersionType) => { - dispatch(displayScenarioVersion(name, version.processVersionId)); - }, - [dispatch, name], - ); - - const { confirm } = useWindows(); - - const changeVersion = useCallback( - (version: ProcessVersionType) => - props.isReadOnly || nothingToSave - ? doChangeVersion(version) - : confirm({ - text: unsavedProcessChanges(), - onConfirmCallback: (confirmed) => confirmed && doChangeVersion(version), - confirmText: "DISCARD", - denyText: "CANCEL", - }), - [confirm, doChangeVersion, nothingToSave, props.isReadOnly], - ); - - return ( - } - renderTrackHorizontal={() =>
} - autoHeight - autoHeightMax={300} - hideTracksWhenNotNeeded={true} - > - - {history.map((version, index) => { - const isLatest = index === 0; - const { createDate, processVersionId } = version; - const type = - selectedVersion?.createDate < createDate - ? VersionType.future - : selectedVersion?.createDate === createDate || isLatest - ? VersionType.current - : VersionType.past; - - return ( - - ); - })} - - - ); -} - -export default ProcessHistoryComponent; diff --git a/designer/client/src/components/history/StyledHistory.tsx b/designer/client/src/components/history/StyledHistory.tsx deleted file mode 100644 index 9ebd741108f..00000000000 --- a/designer/client/src/components/history/StyledHistory.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { styled } from "@mui/material"; -import { VersionType } from "./HistoryItem"; -import Badge from "../deployed.svg"; -import { blendDarken, blendLighten } from "../../containers/theme/helpers"; - -export const HistoryItemStyled = styled("li")<{ type: VersionType }>(({ theme, type }) => ({ - cursor: "pointer", - overflow: "hidden", - position: "relative", - padding: "5px 0 5px 42px", - display: "flex", - justifyContent: "space-between", - alignItems: "flex-start", - ".date": { - pointerEvents: "none", - }, - "&::before": { - content: "''", - position: "absolute", - left: "20px", - top: 0, - width: "20px", - height: "999px", - border: `1px solid ${theme.palette.primary.main}`, - borderWidth: "0px 0 0 1px", - paddingLeft: "10px", - "&:last-of-type::before": { - height: "14px", - }, - }, - "&:first-of-type::before": { - top: "14px", - }, - "&:last-of-type::before": { - height: "14px", - }, - "&::after": { - content: "''", - position: "absolute", - left: "13px", - top: "14px", - width: "16px", - height: "16px", - background: type === VersionType.current ? theme.palette.primary.main : theme.palette.background.paper, - border: `2px solid ${theme.palette.primary.main}`, - borderRadius: "50%", - paddingLeft: "10px", - }, - "&:hover::after": { - backgroundColor: type === VersionType.current ? blendLighten(theme.palette.primary.main, 0.05) : "none", - }, - "&:hover": { - backgroundColor: theme.palette.action.hover, - boxSizing: "border-box", - "&::after": { - backgroundColor: blendDarken(theme.palette.primary.main, 0.2), - }, - }, -})); - -export const TrackVertical = styled("div")` - width: 8px !important; - position: absolute; - right: 2px; - bottom: 2px; - top: 2px; - border-radius: 6px !important; - visibility: visible; -`; - -export const ProcessHistoryWrapper = styled("ul")` - font-size: 12px; - padding: 5px 0; - list-style: none; - margin: 0; -`; - -export const StyledBadge = styled(Badge)(({ theme }) => ({ - color: theme.palette.getContrastText(theme.palette.primary.main), - height: "1.2em", - margin: "0 1.2em", - "path:first-of-type": { - fill: theme.palette.primary.main, - }, -})); diff --git a/designer/client/src/components/modals/SaveProcessDialog.tsx b/designer/client/src/components/modals/SaveProcessDialog.tsx index e281d3a2b76..de9299dd49e 100644 --- a/designer/client/src/components/modals/SaveProcessDialog.tsx +++ b/designer/client/src/components/modals/SaveProcessDialog.tsx @@ -3,7 +3,7 @@ import { WindowButtonProps, WindowContentProps } from "@touk/window-manager"; import React, { useCallback, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useDispatch } from "react-redux"; -import { displayCurrentProcessVersion, displayProcessActivity, loadProcessToolbarsConfiguration } from "../../actions/nk"; +import { displayCurrentProcessVersion, loadProcessToolbarsConfiguration } from "../../actions/nk"; import { PromptContent } from "../../windowManager"; import { CommentInput } from "../comment/CommentInput"; import { ThunkAction } from "../../actions/reduxTypes"; @@ -42,7 +42,6 @@ export function SaveProcessDialog(props: WindowContentProps): JSX.Element { await dispatch(UndoActionCreators.clearHistory()); await dispatch(displayCurrentProcessVersion(processName)); - await dispatch(displayProcessActivity(processName)); await dispatch(await getScenarioActivities(processName)); if (isRenamed) { diff --git a/designer/client/src/components/processAttach/AddAttachment_deprecated.tsx b/designer/client/src/components/processAttach/AddAttachment_deprecated.tsx deleted file mode 100644 index 1c3dda5abe2..00000000000 --- a/designer/client/src/components/processAttach/AddAttachment_deprecated.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useCallback } from "react"; -import Dropzone from "react-dropzone"; -import { useTranslation } from "react-i18next"; -import { addAttachment } from "../../actions/nk"; -import { useDispatch, useSelector } from "react-redux"; -import { getProcessName, getProcessVersionId } from "../../reducers/selectors/graph"; -import ButtonUpload from "../../assets/img/icons/buttonUpload.svg"; -import { NodeInput } from "../FormElements"; -import { AddAttachmentsWrapper, AttachmentButton, AttachmentDropZone, AttachmentsContainer } from "./StyledAttach"; -import { Typography } from "@mui/material"; - -export function AddAttachment() { - const { t } = useTranslation(); - const dispatch = useDispatch(); - const processName = useSelector(getProcessName); - const processVersionId = useSelector(getProcessVersionId); - - const addFiles = useCallback( - (files) => files.forEach((file) => dispatch(addAttachment(processName, processVersionId, file))), - [dispatch, processName, processVersionId], - ); - - return ( - - - {({ getRootProps, getInputProps }) => ( - - - - - - {t("attachments.buttonText", "drop or choose a file")} - - - - )} - - - ); -} diff --git a/designer/client/src/components/processAttach/AttachmentEl_deprecated.tsx b/designer/client/src/components/processAttach/AttachmentEl_deprecated.tsx deleted file mode 100644 index 5196c23b272..00000000000 --- a/designer/client/src/components/processAttach/AttachmentEl_deprecated.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import DownloadIcon from "@mui/icons-material/Download"; -import { Attachment } from "../../reducers/processActivity"; -import HttpService from "../../http/HttpService"; -import Date from "../common/Date"; -import { AttachmentDetails, DownloadAttachment, DownloadButton, AttachHeader } from "./StyledAttach"; -import { ProcessName } from "../Process/types"; -import { Typography } from "@mui/material"; - -export function AttachmentEl({ data, processName }: { data: Attachment; processName: ProcessName }) { - return ( -
  • - - HttpService.downloadAttachment(processName, data.id, data.fileName)}> - - - - - - - {` | v${data.processVersionId} | ${data.user}`} - - {data.fileName} - -
  • - ); -} diff --git a/designer/client/src/components/processAttach/ProcessAttachments.tsx b/designer/client/src/components/processAttach/ProcessAttachments.tsx deleted file mode 100644 index fff13feadbc..00000000000 --- a/designer/client/src/components/processAttach/ProcessAttachments.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react"; -import { useSelector } from "react-redux"; -import { RootState } from "../../reducers"; -import { getCapabilities } from "../../reducers/selectors/other"; -import { AttachmentEl } from "./AttachmentEl_deprecated"; -import { AddAttachment } from "./AddAttachment_deprecated"; -import { ProcessAttachmentsList, ProcessAttachmentsStyled } from "./StyledAttach"; -import { getProcessName } from "../../reducers/selectors/graph"; - -export function ProcessAttachments() { - const { write } = useSelector(getCapabilities); - const processName = useSelector(getProcessName); - const attachments = useSelector((s: RootState) => s.processActivity.attachments); - - return ( - - - {attachments.map((a) => ( - - ))} - - {write && } - - ); -} - -export default ProcessAttachments; diff --git a/designer/client/src/components/processAttach/StyledAttach.tsx b/designer/client/src/components/processAttach/StyledAttach.tsx index 3b0af0d5e0c..206ae524942 100644 --- a/designer/client/src/components/processAttach/StyledAttach.tsx +++ b/designer/client/src/components/processAttach/StyledAttach.tsx @@ -1,5 +1,4 @@ import { lighten, styled } from "@mui/material"; -import { NkButton } from "../button/NkButton"; export const AddAttachmentsWrapper = styled("div")` font-size: 12px; @@ -48,22 +47,6 @@ export const AttachmentDetails = styled("div")` word-break: break-word; `; -export const DownloadAttachment = styled("div")({ - display: "flex", - alignItems: "center", - marginRight: "5px", - cursor: "pointer", - fontSize: "25px", -}); - -export const DownloadButton = styled(NkButton)(() => ({ - display: "flex", - alignItems: "center", - justifyContent: "center", - width: "27px !important", - height: "27px !important", -})); - export const AttachHeader = styled("div")( () => ` span { @@ -76,24 +59,3 @@ export const AttachHeader = styled("div")( } `, ); - -export const ProcessAttachmentsStyled = styled("div")` - cursor: default; - padding: 0 13px; - display: grid; -`; - -export const ProcessAttachmentsList = styled("div")` - font-size: 10px; - margin: 15px 0; - padding: 0; - .footer { - font-style: italic; - p { - margin-bottom: 0; - } - } - p { - font-size: 12px; - } -`; diff --git a/designer/client/src/components/toolbarSettings/TOOLBAR_COMPONENTS_MAP.ts b/designer/client/src/components/toolbarSettings/TOOLBAR_COMPONENTS_MAP.ts index b6b326342db..7353cf8ab68 100644 --- a/designer/client/src/components/toolbarSettings/TOOLBAR_COMPONENTS_MAP.ts +++ b/designer/client/src/components/toolbarSettings/TOOLBAR_COMPONENTS_MAP.ts @@ -1,13 +1,10 @@ /* eslint-disable quote-props */ import { ComponentType, lazy } from "react"; import TipsPanel from "../tips/Tips"; -import { AttachmentsPanel } from "../toolbars/AttachmentsPanel"; -import { CommentsPanel } from "../comment/CommentsPanel"; import { CreatorPanel } from "../toolbars/creator/CreatorPanel"; import { DefaultToolbarPanel, ToolbarPanelProps } from "../toolbarComponents/DefaultToolbarPanel"; import ScenarioDetails from "../toolbars/scenarioDetails/ScenarioDetails"; import { UserSettingsPanel } from "../toolbars/UserSettingsPanel"; -import { VersionsPanel } from "../toolbars/VersionsPanel"; import ProcessActions from "../toolbars/scenarioActions/ProcessActions"; import { SearchPanel } from "../toolbars/search/SearchPanel"; import { ActivitiesPanel } from "../toolbars/activities"; @@ -22,9 +19,6 @@ export const TOOLBAR_COMPONENTS_MAP: Record import("../toolbars/Survey")), "activities-panel": ActivitiesPanel, diff --git a/designer/client/src/components/toolbarSettings/defaultToolbarsConfig.ts b/designer/client/src/components/toolbarSettings/defaultToolbarsConfig.ts index e25c39d1111..b608cd27836 100644 --- a/designer/client/src/components/toolbarSettings/defaultToolbarsConfig.ts +++ b/designer/client/src/components/toolbarSettings/defaultToolbarsConfig.ts @@ -71,14 +71,7 @@ export function defaultToolbarsConfig(isFragment: boolean, isArchived: boolean): ], }, ], - [ToolbarsSide.TopLeft]: [ - { id: "survey-panel" }, - { id: "tips-panel" }, - { id: "creator-panel" }, - { id: "versions-panel" }, - { id: "comments-panel" }, - { id: "attachments-panel" }, - ], + [ToolbarsSide.TopLeft]: [{ id: "survey-panel" }, { id: "tips-panel" }, { id: "creator-panel" }, { id: "activities-panel" }], [ToolbarsSide.BottomRight]: DEV_TOOLBARS, }; } diff --git a/designer/client/src/components/toolbars/AttachmentsPanel.tsx b/designer/client/src/components/toolbars/AttachmentsPanel.tsx deleted file mode 100644 index 2a78860001c..00000000000 --- a/designer/client/src/components/toolbars/AttachmentsPanel.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import ProcessAttachments from "../processAttach/ProcessAttachments"; -import { ToolbarPanelProps } from "../toolbarComponents/DefaultToolbarPanel"; -import { ToolbarWrapper } from "../toolbarComponents/toolbarWrapper/ToolbarWrapper"; - -export function AttachmentsPanel(props: ToolbarPanelProps) { - const { t } = useTranslation(); - - return ( - - - - ); -} diff --git a/designer/client/src/components/toolbars/VersionsPanel.tsx b/designer/client/src/components/toolbars/VersionsPanel.tsx deleted file mode 100644 index 4ee20c94dbb..00000000000 --- a/designer/client/src/components/toolbars/VersionsPanel.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { useSelector } from "react-redux"; -import { getCapabilities } from "../../reducers/selectors/other"; -import ProcessHistory from "../history/ProcessHistory"; -import { ToolbarPanelProps } from "../toolbarComponents/DefaultToolbarPanel"; -import { ToolbarWrapper } from "../toolbarComponents/toolbarWrapper/ToolbarWrapper"; - -export function VersionsPanel(props: ToolbarPanelProps): JSX.Element { - const { t } = useTranslation(); - const capabilities = useSelector(getCapabilities); - - return ( - - - - ); -} diff --git a/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx b/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx index 8fa759011ed..a866851536a 100644 --- a/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx +++ b/designer/client/src/components/toolbars/activities/ActivitiesPanelFooter.tsx @@ -3,6 +3,8 @@ import { Box, Button, lighten, styled } from "@mui/material"; import { useWindows, WindowKind } from "../../../windowManager"; import { useTranslation } from "react-i18next"; import { EventTrackingSelector, getEventTrackingProps } from "../../../containers/event-tracking"; +import { useSelector } from "react-redux"; +import { getCapabilities } from "../../../reducers/selectors/other"; const StyledFooterButton = styled(Button)(({ theme }) => ({ textTransform: "none", @@ -19,6 +21,7 @@ const StyledFooterButton = styled(Button)(({ theme }) => ({ export const ActivitiesPanelFooter = () => { const { t } = useTranslation(); const { open } = useWindows(); + const { write } = useSelector(getCapabilities); const handleOpenAddComment = useCallback(() => { open({ @@ -40,20 +43,24 @@ export const ActivitiesPanelFooter = () => { return ( - - {t("activities.footer.addComment", "Add comment")} - - - {t("activities.footer.addAttachment", "Add attachment")} - + {write && ( + <> + + {t("activities.footer.addComment", "Add comment")} + + + {t("activities.footer.addAttachment", "Add attachment")} + + + )} ); }; diff --git a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx index 3b37c9d7662..3d65c1006e9 100644 --- a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx +++ b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemComment.tsx @@ -15,6 +15,7 @@ import { getProcessName } from "../../../../reducers/selectors/graph"; import { getScenarioActivities } from "../../../../actions/nk/scenarioActivities"; import { ActivityItemCommentModify } from "./ActivityItemCommentModify"; import { EventTrackingSelector, getEventTrackingProps } from "../../../../containers/event-tracking"; +import { getCapabilities } from "../../../../reducers/selectors/other"; const getCommentSettings = createSelector(getFeatureSettings, (f) => f.commentSettings || {}); @@ -34,10 +35,11 @@ const CommentActivity = ({ const processName = useSelector(getProcessName); const dispatch = useDispatch(); const loggedUser = useSelector(getLoggedUser); + const { write } = useSelector(getCapabilities); switch (activityAction.id) { case "delete_comment": { - if (activityComment.lastModifiedBy !== loggedUser.id) { + if (activityComment.lastModifiedBy !== loggedUser.id || !write) { return null; } @@ -67,7 +69,7 @@ const CommentActivity = ({ ); } case "edit_comment": { - if (activityComment.lastModifiedBy !== loggedUser.id) { + if (activityComment.lastModifiedBy !== loggedUser.id || !write) { return null; } diff --git a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx index a74a5162690..48601aec898 100644 --- a/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx +++ b/designer/client/src/components/toolbars/activities/ActivityPanelRowItem/ActivityItemHeader.tsx @@ -18,6 +18,7 @@ import { StyledActionIcon } from "./StyledActionIcon"; import { getScenarioActivities } from "../../../../actions/nk/scenarioActivities"; import { ActivityItemCommentModify } from "./ActivityItemCommentModify"; import { getLoggedUser } from "../../../../reducers/selectors/settings"; +import { getCapabilities } from "../../../../reducers/selectors/other"; import { EventTrackingSelector, getEventTrackingProps } from "../../../../containers/event-tracking"; const StyledHeaderIcon = styled(UrlIcon)(({ theme }) => ({ @@ -63,6 +64,7 @@ const HeaderActivity = ({ const { t } = useTranslation(); const dispatch = useDispatch(); const loggedUser = useSelector(getLoggedUser); + const { write } = useSelector(getCapabilities); switch (activityAction.id) { case "compare": { @@ -106,7 +108,7 @@ const HeaderActivity = ({ case "delete_attachment": { const attachmentStatus = activityAttachment.file.status; - if (attachmentStatus === "DELETED" || activityAttachment.lastModifiedBy !== loggedUser.id) { + if (attachmentStatus === "DELETED" || activityAttachment.lastModifiedBy !== loggedUser.id || !write) { return null; } @@ -137,7 +139,7 @@ const HeaderActivity = ({ } case "add_comment": { - if (activityComment.content.status === "AVAILABLE" || activityComment.lastModifiedBy !== loggedUser.id) { + if (activityComment.content.status === "AVAILABLE" || activityComment.lastModifiedBy !== loggedUser.id || !write) { return null; } diff --git a/designer/client/src/containers/Notifications.tsx b/designer/client/src/containers/Notifications.tsx index 9e4719527de..da56f81c8ad 100644 --- a/designer/client/src/containers/Notifications.tsx +++ b/designer/client/src/containers/Notifications.tsx @@ -10,9 +10,8 @@ import Notification from "../components/notifications/Notification"; import CheckCircleOutlinedIcon from "@mui/icons-material/CheckCircleOutlined"; import DangerousOutlinedIcon from "@mui/icons-material/DangerousOutlined"; import { markBackendNotificationRead, updateBackendNotifications } from "../actions/nk/notifications"; -import { displayProcessActivity, loadProcessState } from "../actions/nk"; +import { loadProcessState } from "../actions/nk"; import { getProcessName } from "../reducers/selectors/graph"; -import { loadProcessVersions } from "../actions/nk/loadProcessVersions"; import { useChangeConnectionError } from "./connectionErrorProvider"; import i18next from "i18next"; import { ThunkAction } from "../actions/reduxTypes"; @@ -53,10 +52,9 @@ const handleRefresh = toRefresh.forEach((data) => { switch (data) { case "versions": - return dispatch(loadProcessVersions(scenarioName)); + return dispatch(getScenarioActivities(scenarioName)); case "activity": - dispatch(getScenarioActivities(scenarioName)); - return dispatch(displayProcessActivity(scenarioName)); + return dispatch(getScenarioActivities(scenarioName)); case "state": return dispatch(loadProcessState(scenarioName)); } diff --git a/designer/client/src/http/HttpService.ts b/designer/client/src/http/HttpService.ts index 399789dae45..bf18bb82174 100644 --- a/designer/client/src/http/HttpService.ts +++ b/designer/client/src/http/HttpService.ts @@ -371,10 +371,6 @@ class HttpService { }); } - fetchProcessActivity(processName) { - return api.get(`/processes/${encodeURIComponent(processName)}/activity`); - } - async addComment(processName: string, versionId: number, comment: string): Promise { try { await api.post(`/processes/${encodeURIComponent(processName)}/${versionId}/activity/comment`, comment); @@ -399,16 +395,6 @@ class HttpService { } } - /** - * @deprecated The method will be deleted - */ - deleteComment(processName, commentId) { - return api - .delete(`/processes/${encodeURIComponent(processName)}/activity/comments/${commentId}`) - .then(() => this.#addInfo(i18next.t("notification.info.commendDeleted", "Comment deleted"))) - .catch((error) => this.#addError(i18next.t("notification.error.failedToDeleteComment", "Failed to delete comment"), error)); - } - async deleteActivityComment(processName: string, scenarioActivityId: string): Promise { try { await api.delete(`/processes/${encodeURIComponent(processName)}/activity/comment/${scenarioActivityId}`); diff --git a/designer/client/src/reducers/graph/reducer.ts b/designer/client/src/reducers/graph/reducer.ts index 3f3d28aad87..0e9e1de8aa5 100644 --- a/designer/client/src/reducers/graph/reducer.ts +++ b/designer/client/src/reducers/graph/reducer.ts @@ -356,7 +356,7 @@ const undoableReducer = undoable(reducer, { groupBy: batchGroupBy.init(), filter: combineFilters((action, nextState, prevState) => { return !isEqual(getUndoableState(nextState), getUndoableState(prevState._latestUnfiltered)); - }, excludeAction(["VALIDATION_RESULT", "UPDATE_IMPORTED_PROCESS", "PROCESS_STATE_LOADED", "UPDATE_TEST_CAPABILITIES", "UPDATE_BACKEND_NOTIFICATIONS", "PROCESS_DEFINITION_DATA", "PROCESS_TOOLBARS_CONFIGURATION_LOADED", "CORRECT_INVALID_SCENARIO", "DISPLAY_PROCESS_ACTIVITY", "LOGGED_USER", "REGISTER_TOOLBARS", "UI_SETTINGS"])), + }, excludeAction(["VALIDATION_RESULT", "UPDATE_IMPORTED_PROCESS", "PROCESS_STATE_LOADED", "UPDATE_TEST_CAPABILITIES", "UPDATE_BACKEND_NOTIFICATIONS", "PROCESS_DEFINITION_DATA", "PROCESS_TOOLBARS_CONFIGURATION_LOADED", "CORRECT_INVALID_SCENARIO", "GET_SCENARIO_ACTIVITIES", "LOGGED_USER", "REGISTER_TOOLBARS", "UI_SETTINGS"])), }); // apply only undoable changes for undo actions diff --git a/designer/client/src/reducers/processActivity.ts b/designer/client/src/reducers/processActivity.ts index 5a48155210a..ea6d14a2392 100644 --- a/designer/client/src/reducers/processActivity.ts +++ b/designer/client/src/reducers/processActivity.ts @@ -22,26 +22,15 @@ export type Comment = { }; export type ProcessActivityState = { - comments: $TodoType[]; - attachments: Attachment[]; activities: UIActivity[]; }; const emptyProcessActivity: ProcessActivityState = { - comments: [], - attachments: [], activities: [], }; export function reducer(state: ProcessActivityState = emptyProcessActivity, action: Action): ProcessActivityState { switch (action.type) { - case "DISPLAY_PROCESS_ACTIVITY": { - return { - ...state, - comments: action.comments, - attachments: action.attachments || [], - }; - } case "GET_SCENARIO_ACTIVITIES": { return { ...state, diff --git a/designer/client/test/ProcessAttachments-test.js b/designer/client/test/ProcessAttachments-test.js deleted file mode 100644 index 3f33b9c0367..00000000000 --- a/designer/client/test/ProcessAttachments-test.js +++ /dev/null @@ -1,48 +0,0 @@ -import React from "react"; -import { ProcessAttachments } from "../src/components/processAttach/ProcessAttachments"; //import redux-independent component -import configureMockStore from "redux-mock-store"; -import thunk from "redux-thunk"; -import { Provider } from "react-redux"; -import * as selectors from "../src/reducers/selectors/other"; -import { render } from "@testing-library/react"; -import { NuThemeProvider } from "../src/containers/theme/nuThemeProvider"; - -const mockStore = configureMockStore([thunk]); - -jest.spyOn(selectors, "getCapabilities").mockReturnValue({ write: true }); - -jest.mock("react-i18next", () => ({ - useTranslation: () => ({ - t: (key) => key, - i18n: { - changeLanguage: () => {}, - }, - }), -})); - -const processAttachment = (id) => ({ - id: `${id}`, - processVersionId: 1, - createDate: "2016-10-10T12:39:44.092", - user: "TouK", - fileName: `file ${id}`, -}); - -describe("ProcessAttachments suite", () => { - it("should render with no problems", () => { - const store = mockStore({ - graphReducer: { history: { present: { scenario: { name: "proc1", processVersionId: 1 } } } }, - processActivity: { attachments: [processAttachment(3), processAttachment(2), processAttachment(1)] }, - }); - - const { container } = render( - - - - - , - ); - - expect(container.getElementsByClassName("download-attachment").length).toBe(3); - }); -}); diff --git a/designer/client/test/ProcessHistory-test.js b/designer/client/test/ProcessHistory-test.js deleted file mode 100644 index 71903f8db6e..00000000000 --- a/designer/client/test/ProcessHistory-test.js +++ /dev/null @@ -1,69 +0,0 @@ -import React from "react"; -import { Provider } from "react-redux"; -import configureMockStore from "redux-mock-store"; -import { ProcessHistoryComponent } from "../src/components/history/ProcessHistory"; -import { render, within } from "@testing-library/react"; -import { NuThemeProvider } from "../src/containers/theme/nuThemeProvider"; - -const mockStore = configureMockStore(); -jest.mock("../src/windowManager", () => ({ - useWindows: jest.fn(() => ({ - confirm: jest.fn(), - })), -})); - -jest.mock("react-i18next", () => ({ - useTranslation: () => ({ - t: (key) => key, - i18n: { changeLanguage: () => {} }, - }), -})); - -describe("ProcessHistory suite", () => { - it("should mark latest history entry as current and other as past", () => { - //given - const store = mockStore({ - graphReducer: { - history: { - past: { - scenario: { - scenarioGraph: {}, - history: [processEntry(3), processEntry(2), processEntry(1)], - }, - }, - present: { - scenario: { - scenarioGraph: {}, - history: [processEntry(3), processEntry(2), processEntry(1)], - }, - }, - }, - }, - }); - //when - const { container } = render( - - - , - - , - ); - //then - const currentProcessHistoryEntry = container.getElementsByClassName("current"); - const pastHistoryEntries = container.getElementsByClassName("past"); - expect(currentProcessHistoryEntry.length).toBe(1); - expect(pastHistoryEntries.length).toBe(2); - expect(within(currentProcessHistoryEntry[0]).getByText(/v3/)).toBeInTheDocument(); - expect(within(pastHistoryEntries[0]).getByText(/v2/)).toBeInTheDocument(); - expect(within(pastHistoryEntries[1]).getByText(/v1/)).toBeInTheDocument(); - }); - - const processEntry = (processVersionId) => { - return { - processVersionId: processVersionId, - createDate: "2016-10-10T12:39:44.092", - user: "TouK", - actions: [], - }; - }; -}); From c3904d2eae7607048379034b701c6d0cfb62b875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20S=C5=82abek?= Date: Mon, 28 Oct 2024 23:00:38 +0100 Subject: [PATCH 5/5] update docs after Flink 1.19 bump (#7006) --- docs/Changelog.md | 2 +- docs/MigrationGuide.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index b23e21eeaf2..0d5cb549075 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -55,13 +55,13 @@ - shorter message in logs * [#6766](https://github.com/TouK/nussknacker/pull/6766) Scenario labels support - you can assign labels to scenarios and use them to filter the scenario list * [#6176](https://github.com/TouK/nussknacker/pull/6176) [#6996](https://github.com/TouK/nussknacker/pull/6996) [7012](https://github.com/TouK/nussknacker/pull/7012) [7014](https://github.com/TouK/nussknacker/pull/7014) Update most dependencies to latest versions, most important ones: + * Flink 1.18.1 -> 1.19.1 * Jackson 2.15.4 -> 2.17.2 * cats 2.10 -> 2.12 * Avro 1.11.3 -> 1.11.4 * swagger-parser 2.1.15 -> 2.1.22 * Tapir -> 1.11.7 * openapi-circe-yaml -> 0.11.3 -* [#6805](https://github.com/TouK/nussknacker/pull/6805) Support for Flink 1.19.1 * Scenario activities mechanism replacing old process actions: * [#6822](https://github.com/TouK/nussknacker/pull/6822), [#6929](https://github.com/TouK/nussknacker/pull/6929) * Scenario Activity API contract (without BE implementation) diff --git a/docs/MigrationGuide.md b/docs/MigrationGuide.md index fede53a6e09..18e00b7c811 100644 --- a/docs/MigrationGuide.md +++ b/docs/MigrationGuide.md @@ -70,6 +70,11 @@ To see the biggest differences please consult the [changelog](Changelog.md). * [#6952](https://github.com/TouK/nussknacker/pull/6952) Improvement: TypeInformation support for scala.Option: If you used CaseClassTypeInfoFactory with case classes that contain the Option type, the state won't be restored after the upgrade. +* [#6805](https://github.com/TouK/nussknacker/pull/6805) Updated Flink 1.18.1 -> 1.19.1. Due to backwards incompatible + changes in this Flink version update, Nussknacker 1.18 will not work with Flink versions pre-1.19 right away. If you + want to keep using Flink pre-1.19 with current Nussknacker, please refer to compatibility providing plugins in + https://github.com/TouK/nussknacker-flink-compatibility. + * [#7058](https://github.com/TouK/nussknacker/pull/7058) Performance optimization: Add missing Flink TypeInformation for better serialization * In case of using base (bounded and unbounded) Flink components state will be probably not compatible * `FlinkCustomNodeContext.typeInformationDetection` has been removed, please use `TypeInformationDetection.instance` instead