Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staging' into flink-test-mechani…
Browse files Browse the repository at this point in the history
…sm-caching
  • Loading branch information
arkadius committed Jan 20, 2025
2 parents b14fbd2 + 53ff3f7 commit e63a246
Show file tree
Hide file tree
Showing 160 changed files with 3,677 additions and 1,657 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/
.idea/*
!.idea/icon.svg
target/
*.iml
.*orig
Expand Down
1 change: 1 addition & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 8 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ lazy val distribution: Project = sbt
},
devArtifacts := {
modelArtifacts.value ++ List(
(flinkDevModel / assembly).value -> "model/devModel.jar",
(flinkPeriodicDeploymentManager / assembly).value -> "managers/nussknacker-flink-periodic-manager.jar",
(flinkDevModel / assembly).value -> "model/devModel.jar",
)
},
Universal / packageName := ("nussknacker" + "-" + version.value),
Expand Down Expand Up @@ -611,8 +610,8 @@ lazy val flinkDeploymentManager = (project in flink("management"))
libraryDependencies ++= {
Seq(
"org.typelevel" %% "cats-core" % catsV % Provided,
"org.apache.flink" % "flink-streaming-java" % flinkV % flinkScope
excludeAll (
("org.apache.flink" % "flink-streaming-java" % flinkV % flinkScope)
.excludeAll(
ExclusionRule("log4j", "log4j"),
ExclusionRule("org.slf4j", "slf4j-log4j12"),
ExclusionRule("com.esotericsoftware", "kryo-shaded"),
Expand All @@ -637,37 +636,6 @@ lazy val flinkDeploymentManager = (project in flink("management"))
kafkaTestUtils % "it,test"
)

lazy val flinkPeriodicDeploymentManager = (project in flink("management/periodic"))
.settings(commonSettings)
.settings(assemblyNoScala("nussknacker-flink-periodic-manager.jar"): _*)
.settings(publishAssemblySettings: _*)
.settings(
name := "nussknacker-flink-periodic-manager",
libraryDependencies ++= {
Seq(
"org.typelevel" %% "cats-core" % catsV % Provided,
"com.typesafe.slick" %% "slick" % slickV % Provided,
"com.typesafe.slick" %% "slick-hikaricp" % slickV % "provided, test",
"com.github.tminglei" %% "slick-pg" % slickPgV,
"org.hsqldb" % "hsqldb" % hsqldbV % Test,
"org.flywaydb" % "flyway-core" % flywayV % Provided,
"com.cronutils" % "cron-utils" % cronParserV,
"com.typesafe.akka" %% "akka-actor" % akkaV,
"com.typesafe.akka" %% "akka-testkit" % akkaV % Test,
"com.dimafeng" %% "testcontainers-scala-scalatest" % testContainersScalaV % Test,
"com.dimafeng" %% "testcontainers-scala-postgresql" % testContainersScalaV % Test,
)
}
)
.dependsOn(
flinkDeploymentManager,
deploymentManagerApi % Provided,
scenarioCompiler % Provided,
componentsApi % Provided,
httpUtils % Provided,
testUtils % Test
)

lazy val flinkMetricsDeferredReporter = (project in flink("metrics-deferred-reporter"))
.settings(commonSettings)
.settings(
Expand Down Expand Up @@ -1816,10 +1784,10 @@ lazy val flinkBaseUnboundedComponents = (project in flink("components/base-unbou
.settings(
name := "nussknacker-flink-base-unbounded-components",
libraryDependencies ++= Seq(
"org.apache.flink" % "flink-streaming-java" % flinkV % Provided,
"com.clearspring.analytics" % "stream" % "2.9.8"
"org.apache.flink" % "flink-streaming-java" % flinkV % Provided,
// It is used only in QDigest which we don't use, while it's >20MB in size...
exclude ("it.unimi.dsi", "fastutil")
("com.clearspring.analytics" % "stream" % "2.9.8")
.exclude("it.unimi.dsi", "fastutil")
)
)
.dependsOn(
Expand Down Expand Up @@ -2009,6 +1977,7 @@ lazy val designer = (project in file("designer/server"))
"com.typesafe.akka" %% "akka-testkit" % akkaV % Test,
"de.heikoseeberger" %% "akka-http-circe" % akkaHttpCirceV,
"com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % sttpV,
"com.cronutils" % "cron-utils" % cronParserV,
"ch.qos.logback" % "logback-core" % logbackV,
"ch.qos.logback" % "logback-classic" % logbackV,
"ch.qos.logback.contrib" % "logback-json-classic" % logbackJsonV,
Expand All @@ -2031,6 +2000,7 @@ lazy val designer = (project in file("designer/server"))
"com.beachape" %% "enumeratum-circe" % enumeratumV,
"tf.tofu" %% "derevo-circe" % "0.13.0",
"com.softwaremill.sttp.apispec" %% "openapi-circe-yaml" % openapiCirceYamlV,
"com.github.tminglei" %% "slick-pg" % slickPgV,
"com.softwaremill.sttp.tapir" %% "tapir-akka-http-server" % tapirV,
"com.softwaremill.sttp.tapir" %% "tapir-core" % tapirV,
"com.softwaremill.sttp.tapir" %% "tapir-derevo" % tapirV,
Expand Down Expand Up @@ -2085,7 +2055,6 @@ lazy val designer = (project in file("designer/server"))
liteEmbeddedDeploymentManager % Provided,
liteK8sDeploymentManager % Provided,
developmentTestsDeploymentManager % Provided,
flinkPeriodicDeploymentManager % Provided,
schemedKafkaComponentsUtils % Provided,
)

Expand Down Expand Up @@ -2175,7 +2144,6 @@ lazy val modules = List[ProjectReference](
requestResponseRuntime,
liteEngineRuntimeApp,
flinkDeploymentManager,
flinkPeriodicDeploymentManager,
flinkDevModel,
flinkDevModelJava,
flinkTableApiComponents,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ object AssignabilityDeterminer {
def isAssignableStrict(from: TypingResult, to: TypingResult): ValidatedNel[String, Unit] =
isAssignable(from, to, StrictConversionChecker)

def isAssignableWithoutConversion(from: TypingResult, to: TypingResult): ValidatedNel[String, Unit] =
isAssignable(from, to, WithoutConversionChecker)

private def isAssignable(from: TypingResult, to: TypingResult, conversionChecker: ConversionChecker) = {
(from, to) match {
case (_, Unknown) => ().validNel
Expand Down Expand Up @@ -223,6 +226,19 @@ object AssignabilityDeterminer {

}

private object WithoutConversionChecker extends ConversionChecker {

override def isConvertable(
from: SingleTypingResult,
to: TypedClass
): ValidatedNel[String, Unit] = {
val errMsgPrefix =
s"${from.runtimeObjType.display} is not the same as ${to.display}"
condNel(from.withoutValue == to.withoutValue, (), errMsgPrefix)
}

}

private object StrictConversionChecker extends ConversionChecker {

override def isConvertable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ object typing {
final def canBeStrictlyConvertedTo(typingResult: TypingResult): Boolean =
AssignabilityDeterminer.isAssignableStrict(this, typingResult).isValid

/**
* Checks if the conversion to a given typingResult can be made without any conversion.
*/
final def canBeConvertedWithoutConversionTo(typingResult: TypingResult): Boolean =
AssignabilityDeterminer.isAssignableWithoutConversion(this, typingResult).isValid

def valueOpt: Option[Any]

def withoutValue: TypingResult
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions designer/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions designer/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@touk/window-manager": "1.9.1",
"ace-builds": "1.34.2",
"axios": "1.7.5",
"copy-to-clipboard": "3.3.1",
"d3-transition": "3.0.1",
"d3-zoom": "3.0.0",
"dagre": "0.8.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getProcessDefinitionData } from "../../../../reducers/selectors/setting
import { MapVariableProps } from "../MapVariable";
import { NodeCommonDetailsDefinition } from "../NodeCommonDetailsDefinition";
import { FieldsSelect } from "./FieldsSelect";
import { find, head, orderBy } from "lodash";
import { find, head } from "lodash";
import { getDefaultFields } from "./item/utils";
import { FragmentInputParameter } from "./item";

Expand All @@ -26,11 +26,9 @@ export function useFragmentInputDefinitionTypeOptions() {
[definitionData?.classes],
);

const orderedTypeOptions = useMemo(() => orderBy(typeOptions, (item) => [item.label, item.value], ["asc"]), [typeOptions]);

const defaultTypeOption = useMemo(() => find(typeOptions, { label: "String" }) || head(typeOptions), [typeOptions]);
return {
orderedTypeOptions,
typeOptions,
defaultTypeOption,
};
}
Expand All @@ -40,7 +38,7 @@ export default function FragmentInputDefinition(props: Props): JSX.Element {
const { node, setProperty, isEditMode, showValidation } = passProps;

const readOnly = !isEditMode;
const { orderedTypeOptions, defaultTypeOption } = useFragmentInputDefinitionTypeOptions();
const { typeOptions, defaultTypeOption } = useFragmentInputDefinitionTypeOptions();

const addField = useCallback(() => {
addElement("parameters", getDefaultFields(defaultTypeOption.value));
Expand All @@ -57,7 +55,7 @@ export default function FragmentInputDefinition(props: Props): JSX.Element {
removeField={removeElement}
namespace={"parameters"}
fields={fields}
options={orderedTypeOptions}
options={typeOptions}
showValidation={showValidation}
readOnly={readOnly}
variableTypes={variableTypes}
Expand Down
14 changes: 13 additions & 1 deletion designer/client/src/components/notifications/Notification.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { ReactElement } from "react";
import { Alert, AlertColor } from "@mui/material";
import CloseIcon from "@mui/icons-material/Close";
import { CopyTooltip } from "./copyTooltip";
import { useTranslation } from "react-i18next";

interface Props {
icon: ReactElement;
Expand All @@ -10,9 +12,19 @@ interface Props {
}

export default function Notification({ icon, message, type }: Props): JSX.Element {
return (
const { t } = useTranslation();

const alertContent = (
<Alert icon={icon} severity={type} action={<CloseIcon sx={{ fontSize: 12 }} />}>
{message}
</Alert>
);

return type === "error" ? (
<CopyTooltip text={message} title={t("error.copyMessage", "Copy message to clipboard")}>
{alertContent}
</CopyTooltip>
) : (
alertContent
);
}
78 changes: 78 additions & 0 deletions designer/client/src/components/notifications/copyTooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React, { PropsWithChildren, useEffect, useState } from "react";
import copy from "copy-to-clipboard";
import { Button, Tooltip } from "@mui/material";
import { CopyAll, Done } from "@mui/icons-material";

export function useCopyClipboard(): [boolean, (value: string) => void] {
const [isCopied, setIsCopied] = useState<boolean>();
const [text, setText] = useState<string>();

useEffect(() => {
if (isCopied) {
const id = setTimeout(() => {
setIsCopied(false);
}, 1000);

return () => {
clearTimeout(id);
};
}
}, [isCopied, text]);

return [
isCopied,
(value: string) => {
setText(value);
setIsCopied(copy(value));
},
];
}

export function CopyTooltip({
children,
text,
title,
}: PropsWithChildren<{
text: string;
title: string;
}>): JSX.Element {
const [isCopied, copy] = useCopyClipboard();
return (
<Tooltip
enterDelay={700}
leaveDelay={200}
title={
<Button
size="small"
variant="text"
color="inherit"
startIcon={isCopied ? <Done fontSize="small" /> : <CopyAll fontSize="small" />}
onClick={(e) => {
copy(text);
e.stopPropagation();
}}
>
{title}
</Button>
}
componentsProps={{
popper: {
sx: {
opacity: 0.8,
},
},
tooltip: {
sx: {
bgcolor: (t) => (t.palette.mode === "dark" ? t.palette.common.white : t.palette.common.black),
color: (t) => (t.palette.mode === "dark" ? t.palette.common.black : t.palette.common.white),
},
},
arrow: { sx: { color: (t) => (t.palette.mode === "dark" ? t.palette.common.white : t.palette.common.black) } },
}}
placement="bottom-start"
arrow
>
<span>{children}</span>
</Tooltip>
);
}
Loading

0 comments on commit e63a246

Please sign in to comment.