Skip to content

Commit

Permalink
Fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyakubanov committed Nov 20, 2024
1 parent 368e55e commit e892caa
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 49 deletions.
2 changes: 1 addition & 1 deletion data/translation/Zed/de_DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion data/translation/Zed/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down Expand Up @@ -191,7 +191,7 @@ protected function expandAnalyticsActions(
]),
));

if (!$this->quicksightAnalyticsRequestValidator->isResetAnalyticsEnabled($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) {
if (!$this->quicksightAnalyticsRequestValidator->isResetAnalyticsAllowed($quicksightAssetBundleImportJobTransfer, $quicksightUserTransfer)) {
return $analyticsCollectionTransfer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Expand All @@ -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),
);
Expand All @@ -91,7 +91,7 @@ public function validateResetQuicksightAnalyticsRequest(
*
* @return bool
*/
public function isResetAnalyticsEnabled(
public function isResetAnalyticsAllowed(
?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
?QuicksightUserTransfer $quicksightUserTransfer
): bool {
Expand All @@ -106,7 +106,7 @@ public function isResetAnalyticsEnabled(
*
* @return bool
*/
public function isEnableAnalyticsEnabled(
public function isEnableAnalyticsAllowed(
?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
?QuicksightUserTransfer $quicksightUserTransfer
): bool {
Expand All @@ -121,7 +121,7 @@ public function isEnableAnalyticsEnabled(
*
* @return bool
*/
public function isDisplayAnalyticsEnabled(
public function isDisplayAnalyticsAllowed(
?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
?QuicksightUserTransfer $quicksightUserTransfer
): bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function validateResetQuicksightAnalyticsRequest(
*
* @return bool
*/
public function isResetAnalyticsEnabled(
public function isResetAnalyticsAllowed(
?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
?QuicksightUserTransfer $quicksightUserTransfer
): bool;
Expand All @@ -55,7 +55,7 @@ public function isResetAnalyticsEnabled(
*
* @return bool
*/
public function isEnableAnalyticsEnabled(
public function isEnableAnalyticsAllowed(
?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
?QuicksightUserTransfer $quicksightUserTransfer
): bool;
Expand All @@ -66,7 +66,7 @@ public function isEnableAnalyticsEnabled(
*
* @return bool
*/
public function isDisplayAnalyticsEnabled(
public function isDisplayAnalyticsAllowed(
?QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
?QuicksightUserTransfer $quicksightUserTransfer
): bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% endfor %}
{% endif %}

{% if isEnableAnalyticsEnabled %}
{% if isEnableAnalyticsAllowed %}
<div class="analytics">
<div class="analytics__icon"><i class="fa fa-chart-bar"></i></div>

Expand All @@ -26,7 +26,7 @@
{{ viewActionButton(url('/amazon-quicksight/analytics/enable'), 'Enable Analytics' | trans) }}
</div>
</div>
{% elseif isDisplayAnalyticsEnabled %}
{% elseif isDisplayAnalyticsAllowed %}
{% if quicksightGenerateEmbedUrlResponse.errors | length %}
{% for error in quicksightGenerateEmbedUrlResponse.errors %}
<div class="alert alert-danger" role="alert">{{ error.message }}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
*
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -406,18 +406,18 @@ public function testExpandsCollectionWhenGenerateEmbedUrlApiRequestFails(bool $t
*/
public function testExpandsCollectionWhenQuicksightAssetBundleImportJobFinished(
bool $isInitializedInitially,
bool $isEnableAnalyticsEnabled,
bool $isDisplayAnalyticsEnabled,
bool $isEnableAnalyticsAllowed,
bool $isDisplayAnalyticsAllowed,
string $initialJobStatus,
QuicksightGenerateEmbedUrlResponseTransfer $quicksightGenerateEmbedUrlResponseTransfer,
QuicksightAssetBundleImportJobTransfer $quicksightAssetBundleImportJobTransfer,
array $errorTransfers
): void {
// Arrange
$this->tester->getContainer()->set(static::SERVICE_TWIG, $this->getTwigMock(
$isEnableAnalyticsEnabled,
$isEnableAnalyticsAllowed,
false,
$isDisplayAnalyticsEnabled,
$isDisplayAnalyticsAllowed,
$quicksightGenerateEmbedUrlResponseTransfer,
$quicksightAssetBundleImportJobTransfer,
));
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
]),
Expand Down

0 comments on commit e892caa

Please sign in to comment.