Skip to content

Commit

Permalink
Merge pull request #7152 from TouK/1.18-ports3
Browse files Browse the repository at this point in the history
1.18 ports3
  • Loading branch information
arkadius authored Nov 14, 2024
2 parents 0356376 + 3779aab commit e9d9436
Show file tree
Hide file tree
Showing 23 changed files with 1,841 additions and 1,807 deletions.
9 changes: 7 additions & 2 deletions designer/client/src/actions/nk/adhocTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ export interface TestAdhocValidationRequest {
}

export const validateAdhocTestParameters = debounce(
async (scenarioName: string, validationRequestData: TestAdhocValidationRequest, callback: (data: GenericValidationData) => void) => {
const { data } = await HttpService.validateAdhocTestParameters(scenarioName, validationRequestData);
async (
scenarioName: string,
sourceParameters: SourceWithParametersTest,
scenarioGraph: ScenarioGraph,
callback: (data: GenericValidationData) => void,
) => {
const { data } = await HttpService.validateAdhocTestParameters(scenarioName, sourceParameters, scenarioGraph);
callback(data);
},
500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ export function useAdhocTestingParametersValidation(
validateAdhocTestParameters(
scenarioName,
{
sourceParameters: {
sourceId,
parameterExpressions: parameters.reduce(
(obj, param) => ({
...obj,
[param.name]: value[param.name],
}),
{},
),
},
scenarioGraph: scenarioGraph,
sourceId,
parameterExpressions: parameters.reduce(
(obj, param) => ({
...obj,
[param.name]: value[param.name],
}),
{},
),
},
scenarioGraph,
({ validationErrors }) => setErrors(validationErrors),
);
},
Expand Down
7 changes: 6 additions & 1 deletion designer/client/src/http/HttpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,13 @@ class HttpService {

validateAdhocTestParameters(
scenarioName: string,
validationRequest: TestAdhocValidationRequest,
sourceParameters: SourceWithParametersTest,
scenarioGraph: ScenarioGraph,
): Promise<AxiosResponse<ValidationData>> {
const validationRequest: TestAdhocValidationRequest = {
sourceParameters,
scenarioGraph: this.#sanitizeScenarioGraph(scenarioGraph),
};
const promise = api.post(`/scenarioTesting/${encodeURIComponent(scenarioName)}/adhoc/validate`, validationRequest);
promise.catch((error) =>
this.#addError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import pl.touk.nussknacker.test.PatientScalaFutures
import pl.touk.nussknacker.ui.api.ExpressionSuggesterTestData._
import pl.touk.nussknacker.ui.suggester.ExpressionSuggester

import java.time.{Duration, LocalDateTime}
import java.nio.charset.Charset
import java.time.chrono.{ChronoLocalDate, ChronoLocalDateTime}
import java.time.{Duration, LocalDate, LocalDateTime, LocalTime, ZoneId, ZoneOffset}
import java.util.{Currency, Locale, UUID}
import scala.collection.immutable.ListMap
import scala.concurrent.ExecutionContext
import scala.jdk.CollectionConverters._
Expand Down Expand Up @@ -116,7 +119,7 @@ class ExpressionSuggesterSpec
),
ClassDefinition(
Unknown,
Map("is" -> List(StaticMethodDefinition(MethodTypeInfo(Nil, None, Typed[Boolean]), "is", None))),
Map("canBe" -> List(StaticMethodDefinition(MethodTypeInfo(Nil, None, Typed[Boolean]), "canBe", None))),
Map.empty
),
)
Expand Down Expand Up @@ -775,7 +778,7 @@ class ExpressionSuggesterSpec

test("should suggest methods for unknown") {
spelSuggestionsFor("#unknown.") shouldBe List(
suggestion("is", Typed[Boolean]),
suggestion("canBe", Typed[Boolean]),
)
}

Expand All @@ -801,6 +804,16 @@ class ExpressionSuggesterSpec
suggestion("String", Typed[java.lang.String]),
suggestion("List", Typed.genericTypeClass[java.util.List[_]](List(Unknown))),
suggestion("Map", Typed.genericTypeClass[java.util.Map[_, _]](List(Unknown, Unknown))),
suggestion("Charset", Typed[Charset]),
suggestion("ChronoLocalDate", Typed[ChronoLocalDate]),
suggestion("ChronoLocalDateTime", Typed[ChronoLocalDateTime[_]]),
suggestion("Currency", Typed[Currency]),
suggestion("LocalDate", Typed[LocalDate]),
suggestion("LocalTime", Typed[LocalTime]),
suggestion("Locale", Typed[Locale]),
suggestion("UUID", Typed[UUID]),
suggestion("ZoneId", Typed[ZoneId]),
suggestion("ZoneOffset", Typed[ZoneOffset]),
)
}

Expand All @@ -815,6 +828,17 @@ class ExpressionSuggesterSpec
suggestion("Integer", Typed[java.lang.Integer]),
suggestion("Short", Typed[java.lang.Short]),
suggestion("Byte", Typed[java.lang.Byte]),
suggestion("Charset", Typed[Charset]),
suggestion("ChronoLocalDate", Typed[ChronoLocalDate]),
suggestion("ChronoLocalDateTime", Typed[ChronoLocalDateTime[_]]),
suggestion("Currency", Typed[Currency]),
suggestion("LocalDate", Typed[LocalDate]),
suggestion("LocalDateTime", Typed[LocalDateTime]),
suggestion("LocalTime", Typed[LocalTime]),
suggestion("Locale", Typed[Locale]),
suggestion("UUID", Typed[UUID]),
suggestion("ZoneId", Typed[ZoneId]),
suggestion("ZoneOffset", Typed[ZoneOffset]),
)
}

Expand Down
14 changes: 7 additions & 7 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@
* [#7021](https://github.com/TouK/nussknacker/pull/7021) Definitions service can return definition without UI config
* [#7010](https://github.com/TouK/nussknacker/pull/7010) Dynamic access allowed via indexer operator (`[]`) on expressions typed as `Unknown`
* [#7063](https://github.com/TouK/nussknacker/pull/7063) Introduce conversion extension methods in SpeL:
* is(className)/to(className)/toOrNull(className)
* isBoolean/toBoolean/toBooleanOrNull
* isLong/toLong/toLongOrNull
* isDouble/toDouble/toDoubleOrNull
* isBigDecimal/toBigDecimal/toBigDecimalOrNull
* isList/toList/toListOrNull
* isMap/toMap/toMapOrNull - the list of key-value pairs or unknown map can be converted to a map.
* canBe(className)/to(className)/toOrNull(className)
* canBeBoolean/toBoolean/toBooleanOrNull
* canBeLong/toLong/toLongOrNull
* canBeDouble/toDouble/toDoubleOrNull
* canBeBigDecimal/toBigDecimal/toBigDecimalOrNull
* canBeList/toList/toListOrNull
* canBeMap/toMap/toMapOrNull - the list of key-value pairs or unknown map can be converted to a map.
* [#7106](https://github.com/TouK/nussknacker/pull/7106) Fix an issue where pressing the “Esc” key did not remove focus from input fields in dialogs, which prevented the dialog window from closing
* [#7002](https://github.com/TouK/nussknacker/pull/7002) Resolve an issue with union nodes output expression when nodes were copied and pasted
* [#6994](https://github.com/TouK/nussknacker/pull/6994) Fix styling issues for form checkboxes in Firefox
Expand Down
Loading

0 comments on commit e9d9436

Please sign in to comment.