Skip to content

Commit

Permalink
Fix statistics configuration (#6126) - cherry pick
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Łukasz Bigorajski <[email protected]>
  • Loading branch information
2 people authored and Szymon Bogusz committed Jun 5, 2024
1 parent a200797 commit f2494ba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
1 change: 0 additions & 1 deletion designer/client/src/actions/nk/assignSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type MetricsType = {

export type UsageStatisticsReports = {
enabled: boolean;
url?: string;
};

export type SurveySettings = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import cats.data.Validated
import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport
import io.circe.{Decoder, Encoder}
import io.circe.generic.JsonCodec
import pl.touk.nussknacker.ui.config.{AnalyticsConfig, FeatureTogglesConfig}
import pl.touk.nussknacker.ui.config.{AnalyticsConfig, FeatureTogglesConfig, UsageStatisticsReportsConfig}
import pl.touk.nussknacker.engine.api.CirceUtil.codecs._

import java.net.URL
Expand All @@ -14,7 +14,8 @@ import scala.concurrent.ExecutionContext
class SettingsResources(
config: FeatureTogglesConfig,
authenticationMethod: String,
analyticsConfig: Option[AnalyticsConfig]
analyticsConfig: Option[AnalyticsConfig],
usageStatisticsReportsConfig: UsageStatisticsReportsConfig
)(implicit ec: ExecutionContext)
extends Directives
with FailFastCirceSupport
Expand All @@ -36,8 +37,7 @@ class SettingsResources(
intervalTimeSettings = config.intervalTimeSettings,
testDataSettings = config.testDataSettings,
redirectAfterArchive = config.redirectAfterArchive,
// TODO: It's disabled temporarily until we remove it on FE. We can remove it once it has been removed on FE.
usageStatisticsReports = UsageStatisticsReportsSettings(false, None)
usageStatisticsReports = UsageStatisticsReportsSettings(usageStatisticsReportsConfig.enabled)
)

val authenticationSettings = AuthenticationSettings(
Expand Down Expand Up @@ -145,4 +145,4 @@ object TopTabType extends Enumeration {
analytics: Option[AnalyticsSettings]
)

@JsonCodec final case class UsageStatisticsReportsSettings(enabled: Boolean, url: Option[String])
@JsonCodec final case class UsageStatisticsReportsSettings(enabled: Boolean)
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ class AkkaHttpBasedRouteProvider(
val settingsResources = new SettingsResources(
featureTogglesConfig,
authenticationResources.name,
analyticsConfig
analyticsConfig,
usageStatisticsReportsConfig
)
val apiResourcesWithoutAuthentication: List[Route] = List(
settingsResources.publicRoute(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
import pl.touk.nussknacker.test.PatientScalaFutures
import pl.touk.nussknacker.test.base.it.NuResourcesTest
import pl.touk.nussknacker.test.utils.domain.TestFactory.withoutPermissions
import pl.touk.nussknacker.ui.config.AnalyticsConfig
import pl.touk.nussknacker.ui.config.{AnalyticsConfig, UsageStatisticsReportsConfig}
import pl.touk.nussknacker.ui.security.basicauth.BasicAuthenticationConfiguration

class SettingsResourcesSpec
Expand All @@ -25,11 +25,14 @@ class SettingsResourcesSpec
private val authenticationConfig: BasicAuthenticationConfiguration =
BasicAuthenticationConfiguration.create(testConfig)
private val analyticsConfig: Option[AnalyticsConfig] = AnalyticsConfig(testConfig)
private val usageStatisticsReportsConfig: UsageStatisticsReportsConfig =
UsageStatisticsReportsConfig(true, None, None)

private val settingsRoute = new SettingsResources(
featureTogglesConfig,
authenticationConfig.name,
analyticsConfig
analyticsConfig,
usageStatisticsReportsConfig
)

// Values are exists at test/resources/application.conf
Expand All @@ -44,6 +47,7 @@ class SettingsResourcesSpec

data.intervalTimeSettings.processes shouldBe intervalTimeProcesses
data.intervalTimeSettings.healthCheck shouldBe intervalTimeHealthCheck
data.usageStatisticsReports.enabled shouldBe true
}
}

Expand Down
4 changes: 4 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

1.15.1 (4 June 2024)
-------------------------
* [#6126](https://github.com/TouK/nussknacker/pull/6126) Fix statistics configuration.

1.15.0 (17 May 2024)
-------------------------
* [#5620](https://github.com/TouK/nussknacker/pull/5620) Nodes Api OpenApi-based documentation (e.g. `https://demo.nussknacker.io/api/docs`)
Expand Down

0 comments on commit f2494ba

Please sign in to comment.