Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW UI] Post restore page #1101

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions _dev/src/ts/pages/RestorePagePostRestore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import StepPage from './StepPage';

export default class RestorePagePostRestore extends StepPage {
protected stepCode = 'post-restore';

constructor() {
super();
}

public mount() {
this.initStepper();
}
}
2 changes: 2 additions & 0 deletions _dev/src/ts/routing/ScriptHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import UpdatePagePostUpdate from '../pages/UpdatePagePostUpdate';

import RestorePageBackupSelection from '../pages/RestorePageBackupSelection';
import RestorePageRestore from '../pages/RestorePageRestore';
import RestorePagePostRestore from '../pages/RestorePagePostRestore';

import StartUpdateDialog from '../dialogs/StartUpdateDialog';
import SendErrorReportDialog from '../dialogs/SendErrorReportDialog';
Expand Down Expand Up @@ -35,6 +36,7 @@ export default class ScriptHandler {

'restore-page-backup-selection': RestorePageBackupSelection,
'restore-page-restore': RestorePageRestore,
'restore-page-post-restore': RestorePagePostRestore,

'start-update-dialog': StartUpdateDialog,
'send-error-report-dialog': SendErrorReportDialog
Expand Down
1 change: 1 addition & 0 deletions classes/DocumentationLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class DocumentationLinks
public const DEV_DOC_UPGRADE_CLI_URL = self::DEV_DOC_UPGRADE_URL . '/upgrade-cli';
public const DEV_DOC_UPGRADE_WEB_URL = self::DEV_DOC_UP_TO_DATE_URL . '/use-autoupgrade-module';
public const DEV_DOC_UPGRADE_POST_UPGRADE_URL = self:: DEV_DOC_UPGRADE_URL . '/post-update-checklist';
public const DEV_DOC_UPGRADE_POST_RESTORE_URL = self:: DEV_DOC_UPGRADE_URL . '/post-restore-checklist';
public const PRESTASHOP_PROJECT_URL = 'https://www.prestashop-project.org';
public const PRESTASHOP_PROJECT_DATA_TRANSPARENCY_URL = self::PRESTASHOP_PROJECT_URL . '/data-transparency';
}
17 changes: 9 additions & 8 deletions classes/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use PrestaShop\Module\AutoUpgrade\Controller\HomePageController;
use PrestaShop\Module\AutoUpgrade\Controller\LogsController;
use PrestaShop\Module\AutoUpgrade\Controller\RestorePageBackupSelectionController;
use PrestaShop\Module\AutoUpgrade\Controller\RestorePagePostRestoreController;
use PrestaShop\Module\AutoUpgrade\Controller\RestorePageRestoreController;
use PrestaShop\Module\AutoUpgrade\Controller\UpdatePageBackupController;
use PrestaShop\Module\AutoUpgrade\Controller\UpdatePageBackupOptionsController;
Expand Down Expand Up @@ -195,14 +196,14 @@ public function __construct(UpgradeContainer $upgradeContainer)
'method' => 'step',
],
/* step: post restore */
// Routes::RESTORE_PAGE_POST_RESTORE => [
// 'controller' => 'todo',
// 'method' => 'index',
// ],
// Routes::RESTORE_STEP_POST_RESTORE => [
// 'controller' => 'todo',
// 'method' => 'step',
// ],
Routes::RESTORE_PAGE_POST_RESTORE => [
'controller' => RestorePagePostRestoreController::class,
'method' => 'index',
],
Routes::RESTORE_STEP_POST_RESTORE => [
'controller' => RestorePagePostRestoreController::class,
'method' => 'step',
],
/* COMMON */
/* error reporting */
Routes::DISPLAY_ERROR_REPORT_MODAL => [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/

namespace PrestaShop\Module\AutoUpgrade\Controller;

use PrestaShop\Module\AutoUpgrade\DocumentationLinks;
use PrestaShop\Module\AutoUpgrade\Router\Routes;
use PrestaShop\Module\AutoUpgrade\Task\TaskType;
use PrestaShop\Module\AutoUpgrade\Twig\Steps\RestoreSteps;
use PrestaShop\Module\AutoUpgrade\Twig\Steps\Stepper;
use PrestaShop\Module\AutoUpgrade\UpgradeContainer;

class RestorePagePostRestoreController extends AbstractPageWithStepController
{
const CURRENT_STEP = RestoreSteps::STEP_POST_RESTORE;

protected function getPageTemplate(): string
{
return 'restore';
}

protected function getStepTemplate(): string
{
return self::CURRENT_STEP;
}

protected function displayRouteInUrl(): ?string
{
return Routes::RESTORE_PAGE_POST_RESTORE;
}

/**
* @return array<string, mixed>
*
* @throws \Exception
*/
protected function getParams(): array
{
$updateSteps = new Stepper($this->upgradeContainer->getTranslator(), TaskType::TASK_TYPE_RESTORE);

return array_merge(
$updateSteps->getStepParams($this::CURRENT_STEP),
[
'exit_link' => DIRECTORY_SEPARATOR . $this->upgradeContainer->getProperty(UpgradeContainer::PS_ADMIN_SUBDIR) . DIRECTORY_SEPARATOR . 'index.php',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As reported by @AureRita, this does not work on shops installed in a sub-folder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change this on #1107

'dev_doc_link' => DocumentationLinks::DEV_DOC_UPGRADE_POST_RESTORE_URL,
'download_logs' => $this->upgradeContainer->getLogsService()->getDownloadLogsData(TaskType::TASK_TYPE_RESTORE),
]
);
}
}
22 changes: 12 additions & 10 deletions views/templates/steps/post-restore.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,25 @@
</ul>
</div>

<div class="content__section">
<a class="link" href="{{ backlog_link }}" download>
{{ 'Download restore logs'|trans({}) }}
<i class="material-icons">file_upload</i>
</a>
</div>
{% if download_logs is defined %}
<div class="content__section">
<a class="link" href="{{ download_logs.download_path }}" download="{{ download_logs.filename }}">
{{ download_logs.button_label }}
<i class="material-icons">file_upload</i>
</a>
</div>
{% endif %}
</div>
{% endblock %}

{% block buttons_inner %}
<button class="btn btn-lg btn-default" type="button">
<a class="btn btn-lg btn-default" href="{{ exit_link }}">
<i class="material-icons">exit_to_app</i>
{{ 'Exit'|trans({}) }}
</button>
</a>

<button class="btn btn-lg btn-primary" type="button">
<a class="btn btn-lg btn-primary" type="button" href="{{ dev_doc_link }}" target="_blank">
<i class="material-icons">launch</i>
{{ 'Open developer documentation'|trans({}) }}
</button>
</a>
{% endblock %}
Loading