diff --git a/data/translation/Zed/de_DE.csv b/data/translation/Zed/de_DE.csv index 79b13f7..0cbbb35 100644 --- a/data/translation/Zed/de_DE.csv +++ b/data/translation/Zed/de_DE.csv @@ -3,7 +3,7 @@ Analytics,Analytics "The user role for Analytics could not be reset. Please contact your Spryker Success Manager.","Die Benutzerrolle für Analytics konnte nicht zurückgesetzt werden. Bitte kontaktieren Sie Ihren Spryker Success Manager." "Please be aware that you will be the owner of all default assets (dashboards, analyses, datasets and data sources).","Bitte beachten Sie, dass Sie als Eigentümer aller Standard-Assets (Dashboards, Analysen, Datensätzen und Datenquellen) eingetragen werden." -"Please be aware that all default dashboards and analyses, including your changes, will be reset and replaced with the default data. Also, all users will be detached from assets upon the reset process. The owner of default assets will be replaced with the user who initiated the reset process.","Bitte beachten Sie, dass alle Standard-Dashboards und -Analysen, einschließlich Ihrer Änderungen, zurückgesetzt und durch die Standarddaten ersetzt werden. Außerdem werden alle Benutzer beim Zurücksetzen von den Assets getrennt. Der Besitzer der Standard-Assets wird durch den Benutzer ersetzt, der den Zurücksetzungsvorgang initiiert hat." +"Please be aware that all default Analytics assets (dashboards, analyses, datasets), including your changes in those, will be reset to the default state. Upon the reset process, all users will be detached from these assets, and the owner of default Analytics assets will be replaced with the user who initiated the reset process.","Bitte beachten Sie, dass alle Standard-Analytics-Assets (Dashboards, Analysen, Datensätze), einschließlich Ihrer Änderungen, auf den Standardzustand zurückgesetzt werden. Beim Zurücksetzen werden alle Benutzer von diesen Assets getrennt und der Besitzer der Standard-Analytics-Assets wird durch den Benutzer ersetzt, der den Zurücksetzungsprozess initiiert hat." "An error occurred during the Analytics activation. Please try again by clicking the ""Enable Analytics"" button.","Bei der Aktivierung von Analytics ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut, indem Sie auf die Taste ""Analytics aktivieren"" klicken." "An error occurred during the Analytics reset. Please try again by clicking the ""Reset Analytics"" button.","Beim Zurücksetzen von Analytics ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut, indem Sie auf die Taste ""Analytics zurücksetzen"" klicken." "Analytics is not enabled yet","Analytics ist noch nicht eingeschaltet" diff --git a/data/translation/Zed/en_US.csv b/data/translation/Zed/en_US.csv index d74b2a5..66ffee4 100644 --- a/data/translation/Zed/en_US.csv +++ b/data/translation/Zed/en_US.csv @@ -3,7 +3,7 @@ Analytics,Analytics "The user role for Analytics could not be reset. Please contact your Spryker Success Manager.","The user role for Analytics could not be reset. Please contact your Spryker Success Manager." "Please be aware that you will be the owner of all default assets (dashboards, analyses, datasets and data sources).","Please be aware that you will be the owner of all default assets (dashboards, analyses, datasets and data sources)." -"Please be aware that all default dashboards and analyses, including your changes, will be reset and replaced with the default data. Also, all users will be detached from assets upon the reset process. The owner of default assets will be replaced with the user who initiated the reset process.","Please be aware that all default dashboards and analyses, including your changes, will be reset and replaced with the default data. Also, all users will be detached from assets upon the reset process. The owner of default assets will be replaced with the user who initiated the reset process." +"Please be aware that all default Analytics assets (dashboards, analyses, datasets), including your changes in those, will be reset to the default state. Upon the reset process, all users will be detached from these assets, and the owner of default Analytics assets will be replaced with the user who initiated the reset process.","Please be aware that all default Analytics assets (dashboards, analyses, datasets), including your changes in those, will be reset to the default state. Upon the reset process, all users will be detached from these assets, and the owner of default Analytics assets will be replaced with the user who initiated the reset process." "An error occurred during the Analytics activation. Please try again by clicking the ""Enable Analytics"" button.","An error occurred during the Analytics activation. Please try again by clicking the ""Enable Analytics"" button." "An error occurred during the Analytics reset. Please try again by clicking the ""Reset Analytics"" button.","An error occurred during the Analytics reset. Please try again by clicking the ""Reset Analytics"" button." "Analytics is not enabled yet","Analytics is not enabled yet" diff --git a/src/SprykerEco/Zed/AmazonQuicksight/Business/Expander/AnalyticsExpander.php b/src/SprykerEco/Zed/AmazonQuicksight/Business/Expander/AnalyticsExpander.php index 71945fb..e6a7778 100644 --- a/src/SprykerEco/Zed/AmazonQuicksight/Business/Expander/AnalyticsExpander.php +++ b/src/SprykerEco/Zed/AmazonQuicksight/Business/Expander/AnalyticsExpander.php @@ -156,11 +156,11 @@ protected function expandAnalytics( 'quicksightAssetBundleImportJob' => $quicksightAssetBundleImportJobTransfer, 'isAssetBundleInitializationInProgress' => $this->quicksightAnalyticsRequestValidator ->isAssetBundleInitializationInProgress($quicksightAssetBundleImportJobTransfer), - 'isEnableAnalyticsEnabled' => $this->quicksightAnalyticsRequestValidator->isEnableAnalyticsEnabled( + 'isEnableAnalyticsAllowed' => $this->quicksightAnalyticsRequestValidator->isEnableAnalyticsAllowed( $quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer, ), - 'isDisplayAnalyticsEnabled' => $this->quicksightAnalyticsRequestValidator->isDisplayAnalyticsEnabled( + 'isDisplayAnalyticsAllowed' => $this->quicksightAnalyticsRequestValidator->isDisplayAnalyticsAllowed( $quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer, ), @@ -191,7 +191,7 @@ protected function expandAnalyticsActions( ]), )); - if (!$this->quicksightAnalyticsRequestValidator->isResetAnalyticsEnabled($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) { + if (!$this->quicksightAnalyticsRequestValidator->isResetAnalyticsAllowed($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) { return $analyticsCollectionTransfer; } diff --git a/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidator.php b/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidator.php index b9fcfaf..24c7d94 100644 --- a/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidator.php +++ b/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidator.php @@ -54,7 +54,7 @@ public function validateEnableQuicksightAnalyticsRequest( $quicksightAssetBundleImportJobTransfer = $enableQuicksightAnalyticsRequestTransfer->getQuicksightAssetBundleImportJob(); $quicksightUserTransfer = $enableQuicksightAnalyticsRequestTransfer->getUserOrFail()->getQuicksightUser(); - if (!$this->isEnableAnalyticsEnabled($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) { + if (!$this->isEnableAnalyticsAllowed($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) { $enableQuicksightAnalyticsResponseTransfer->addError( (new ErrorTransfer())->setMessage(static::ERROR_MESSAGE_ENABLE_ANALYTICS_FAILED), ); @@ -76,7 +76,7 @@ public function validateResetQuicksightAnalyticsRequest( $quicksightAssetBundleImportJobTransfer = $resetQuicksightAnalyticsRequestTransfer->getQuicksightAssetBundleImportJob(); $quicksightUserTransfer = $resetQuicksightAnalyticsRequestTransfer->getUserOrFail()->getQuicksightUser(); - if (!$this->isResetAnalyticsEnabled($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) { + if (!$this->isResetAnalyticsAllowed($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) { $resetQuicksightAnalyticsResponseTransfer->addError( (new ErrorTransfer())->setMessage(static::ERROR_MESSAGE_RESET_ANALYTICS_FAILED), ); @@ -91,7 +91,7 @@ public function validateResetQuicksightAnalyticsRequest( * * @return bool */ - public function isResetAnalyticsEnabled( + public function isResetAnalyticsAllowed( ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, ?QuicksightUserTransfer $quicksightUserTransfer ): bool { @@ -106,7 +106,7 @@ public function isResetAnalyticsEnabled( * * @return bool */ - public function isEnableAnalyticsEnabled( + public function isEnableAnalyticsAllowed( ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, ?QuicksightUserTransfer $quicksightUserTransfer ): bool { @@ -121,7 +121,7 @@ public function isEnableAnalyticsEnabled( * * @return bool */ - public function isDisplayAnalyticsEnabled( + public function isDisplayAnalyticsAllowed( ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, ?QuicksightUserTransfer $quicksightUserTransfer ): bool { diff --git a/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidatorInterface.php b/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidatorInterface.php index 01496bc..15ecef3 100644 --- a/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidatorInterface.php +++ b/src/SprykerEco/Zed/AmazonQuicksight/Business/Validator/QuicksightAnalyticsRequestValidatorInterface.php @@ -44,7 +44,7 @@ public function validateResetQuicksightAnalyticsRequest( * * @return bool */ - public function isResetAnalyticsEnabled( + public function isResetAnalyticsAllowed( ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, ?QuicksightUserTransfer $quicksightUserTransfer ): bool; @@ -55,7 +55,7 @@ public function isResetAnalyticsEnabled( * * @return bool */ - public function isEnableAnalyticsEnabled( + public function isEnableAnalyticsAllowed( ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, ?QuicksightUserTransfer $quicksightUserTransfer ): bool; @@ -66,7 +66,7 @@ public function isEnableAnalyticsEnabled( * * @return bool */ - public function isDisplayAnalyticsEnabled( + public function isDisplayAnalyticsAllowed( ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, ?QuicksightUserTransfer $quicksightUserTransfer ): bool; diff --git a/src/SprykerEco/Zed/AmazonQuicksight/Communication/Controller/AnalyticsController.php b/src/SprykerEco/Zed/AmazonQuicksight/Communication/Controller/AnalyticsController.php index c220ac1..23466e3 100644 --- a/src/SprykerEco/Zed/AmazonQuicksight/Communication/Controller/AnalyticsController.php +++ b/src/SprykerEco/Zed/AmazonQuicksight/Communication/Controller/AnalyticsController.php @@ -24,9 +24,11 @@ class AnalyticsController extends AbstractController { /** + * @uses \Spryker\Zed\AnalyticsGui\Communication\Controller\AnalyticsController::indexAction() + * * @var string */ - protected const PARAM_REFERER = 'referer'; + protected const URL_ANALYTICS = '/analytics-gui/analytics'; /** * @var string @@ -63,7 +65,7 @@ public function enableAction(Request $request): RedirectResponse|array $this->addErrorMessage($errorTransfer->getMessageOrFail()); } - return $this->getRedirectResponseReferer($request); + return $this->redirectResponse(static::URL_ANALYTICS); } /** @@ -96,7 +98,7 @@ public function resetAction(Request $request): RedirectResponse|array $this->addErrorMessage($errorTransfer->getMessageOrFail()); } - return $this->getRedirectResponseReferer($request); + return $this->redirectResponse(static::URL_ANALYTICS); } /** @@ -114,14 +116,4 @@ protected function findCurrentUser(): ?UserTransfer return $userCollectionTransfer->getUsers()->getIterator()->current(); } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ - protected function getRedirectResponseReferer(Request $request): RedirectResponse - { - return $this->redirectResponse($request->headers->get(static::PARAM_REFERER)); - } } diff --git a/src/SprykerEco/Zed/AmazonQuicksight/Presentation/_partials/quicksight-analytics.twig b/src/SprykerEco/Zed/AmazonQuicksight/Presentation/_partials/quicksight-analytics.twig index 6780baf..d4c2edb 100644 --- a/src/SprykerEco/Zed/AmazonQuicksight/Presentation/_partials/quicksight-analytics.twig +++ b/src/SprykerEco/Zed/AmazonQuicksight/Presentation/_partials/quicksight-analytics.twig @@ -13,7 +13,7 @@ {% endfor %} {% endif %} -{% if isEnableAnalyticsEnabled %} +{% if isEnableAnalyticsAllowed %}
@@ -26,7 +26,7 @@ {{ viewActionButton(url('/amazon-quicksight/analytics/enable'), 'Enable Analytics' | trans) }}
-{% elseif isDisplayAnalyticsEnabled %} +{% elseif isDisplayAnalyticsAllowed %} {% if quicksightGenerateEmbedUrlResponse.errors | length %} {% for error in quicksightGenerateEmbedUrlResponse.errors %} diff --git a/tests/SprykerEcoTest/Zed/AmazonQuicksight/Business/Facade/ExpandAnalyticsCollectionWithQuicksightAnalyticsTest.php b/tests/SprykerEcoTest/Zed/AmazonQuicksight/Business/Facade/ExpandAnalyticsCollectionWithQuicksightAnalyticsTest.php index 062cb63..f1b264e 100644 --- a/tests/SprykerEcoTest/Zed/AmazonQuicksight/Business/Facade/ExpandAnalyticsCollectionWithQuicksightAnalyticsTest.php +++ b/tests/SprykerEcoTest/Zed/AmazonQuicksight/Business/Facade/ExpandAnalyticsCollectionWithQuicksightAnalyticsTest.php @@ -216,15 +216,15 @@ public function testExpandsCollectionWhenQuicksightUserExistsWithoutRole(): void * @dataProvider expandsCollectionWhenQuicksightUserExistsWithRoleDataProvider * * @param string $role - * @param bool $isEnableAnalyticsEnabled + * @param bool $isEnableAnalyticsAllowed * * @return void */ - public function testExpandsCollectionWhenQuicksightUserExistsWithRole(string $role, bool $isEnableAnalyticsEnabled): void + public function testExpandsCollectionWhenQuicksightUserExistsWithRole(string $role, bool $isEnableAnalyticsAllowed): void { // Arrange $this->tester->getContainer()->set(static::SERVICE_TWIG, $this->getTwigMock( - $isEnableAnalyticsEnabled, + $isEnableAnalyticsAllowed, false, false, new QuicksightGenerateEmbedUrlResponseTransfer(), @@ -250,8 +250,8 @@ public function testExpandsCollectionWhenQuicksightUserExistsWithRole(string $ro * @param bool $isInitializedInitially * @param bool $isInitializedAfterSync * @param bool $isInitializationInProgress - * @param bool $isEnableAnalyticsEnabled - * @param bool $isDisplayAnalyticsEnabled + * @param bool $isEnableAnalyticsAllowed + * @param bool $isDisplayAnalyticsAllowed * @param string $jobStatusAfterSync * @param \Generated\Shared\Transfer\QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer * @@ -261,16 +261,16 @@ public function testExpandsCollectionWhenQuicksightAssetBundleImportJobIsInProgr bool $isInitializedInitially, bool $isInitializedAfterSync, bool $isInitializationInProgress, - bool $isEnableAnalyticsEnabled, - bool $isDisplayAnalyticsEnabled, + bool $isEnableAnalyticsAllowed, + bool $isDisplayAnalyticsAllowed, string $jobStatusAfterSync, QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer ): void { // Arrange $this->tester->getContainer()->set(static::SERVICE_TWIG, $this->getTwigMock( - $isEnableAnalyticsEnabled, + $isEnableAnalyticsAllowed, $isInitializationInProgress, - $isDisplayAnalyticsEnabled, + $isDisplayAnalyticsAllowed, $quicksightGenerateEmbedUrlResponseTransfer, (new QuicksightAssetBundleImportJobTransfer()) ->setIsInitialized($isInitializedAfterSync) @@ -395,8 +395,8 @@ public function testExpandsCollectionWhenGenerateEmbedUrlApiRequestFails(bool $t * @dataProvider expandsCollectionWhenQuicksightAssetBundleImportJobFinishedDataProvider * * @param bool $isInitializedInitially - * @param bool $isEnableAnalyticsEnabled - * @param bool $isDisplayAnalyticsEnabled + * @param bool $isEnableAnalyticsAllowed + * @param bool $isDisplayAnalyticsAllowed * @param string $initialJobStatus * @param \Generated\Shared\Transfer\QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer * @param \Generated\Shared\Transfer\QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer @@ -406,8 +406,8 @@ public function testExpandsCollectionWhenGenerateEmbedUrlApiRequestFails(bool $t */ public function testExpandsCollectionWhenQuicksightAssetBundleImportJobFinished( bool $isInitializedInitially, - bool $isEnableAnalyticsEnabled, - bool $isDisplayAnalyticsEnabled, + bool $isEnableAnalyticsAllowed, + bool $isDisplayAnalyticsAllowed, string $initialJobStatus, QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer, QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer, @@ -415,9 +415,9 @@ public function testExpandsCollectionWhenQuicksightAssetBundleImportJobFinished( ): void { // Arrange $this->tester->getContainer()->set(static::SERVICE_TWIG, $this->getTwigMock( - $isEnableAnalyticsEnabled, + $isEnableAnalyticsAllowed, false, - $isDisplayAnalyticsEnabled, + $isDisplayAnalyticsAllowed, $quicksightGenerateEmbedUrlResponseTransfer, $quicksightAssetBundleImportJobTransfer, )); @@ -615,18 +615,18 @@ protected function expandsCollectionWhenQuicksightAssetBundleImportJobFinishedDa } /** - * @param bool $isEnableAnalyticsEnabled + * @param bool $isEnableAnalyticsAllowed * @param bool $isAssetBundleInitializationInProgress - * @param bool $isDisplayAnalyticsEnabled + * @param bool $isDisplayAnalyticsAllowed * @param \Generated\Shared\Transfer\QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer * @param \Generated\Shared\Transfer\QuicksightAssetBundleImportJobTransfer|null $quicksightAssetBundleImportJobTransfer * * @return \PHPUnit\Framework\MockObject\MockObject|\Twig\Environment */ protected function getTwigMock( - bool $isEnableAnalyticsEnabled, + bool $isEnableAnalyticsAllowed, bool $isAssetBundleInitializationInProgress, - bool $isDisplayAnalyticsEnabled, + bool $isDisplayAnalyticsAllowed, QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer, ?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer = null ): Environment { @@ -639,9 +639,9 @@ protected function getTwigMock( [ $this->equalTo(static::TEMPLATE_PATH_QUICKSIGHT_ANALYTICS), $this->equalTo([ - 'isEnableAnalyticsEnabled' => $isEnableAnalyticsEnabled, + 'isEnableAnalyticsAllowed' => $isEnableAnalyticsAllowed, 'isAssetBundleInitializationInProgress' => $isAssetBundleInitializationInProgress, - 'isDisplayAnalyticsEnabled' => $isDisplayAnalyticsEnabled, + 'isDisplayAnalyticsAllowed' => $isDisplayAnalyticsAllowed, 'quicksightGenerateEmbedUrlResponse' => $quicksightGenerateEmbedUrlResponseTransfer, 'quicksightAssetBundleImportJob' => $quicksightAssetBundleImportJobTransfer, ]),