-
Notifications
You must be signed in to change notification settings - Fork 124
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] program update notifications #1179
base: 7.1.x
Are you sure you want to change the base?
[NEW UI] program update notifications #1179
Conversation
ga-devfront
commented
Feb 20, 2025
Questions | Answers |
---|---|
Description? | Add program update notification to only check new version each 30 days and make |
Type? | new feature |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | N/A |
Sponsor company | @PrestaShopCorp |
How to test? | see internal ticket |
d4aefa9
to
d5ff1a3
Compare
if (!Tab::getIdFromClassName('AdminAutoupgradeAjax')) { | ||
$ajaxTab = new Tab(); | ||
$ajaxTab->class_name = 'AdminAutoupgradeAjax'; | ||
$ajaxTab->module = 'autoupgrade'; | ||
$ajaxTab->id_parent = -1; | ||
|
||
foreach (Language::getLanguages(false) as $lang) { | ||
$ajaxTab->name[(int) $lang['id_lang']] = 'Update assistant'; | ||
} | ||
if (!$ajaxTab->save()) { | ||
return $this->_abortInstall($this->trans('Unable to create the "AdminAutoupgradeAjax" tab')); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part must be added in an upgrade file as well, for merchants upgrading from v7 and below.
autoupgrade.php
Outdated
} | ||
} | ||
|
||
return parent::install() && $this->registerHook('actionAdminControllerSetMedia') && $this->registerHook('displayBackOfficeHeader'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hooks to be added in a migration file upgrade-7.1.0.php
autoupgrade.php
Outdated
require_once $autoloadPath; | ||
} | ||
|
||
require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/Hooks/DisplayBackOfficeHeader.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary, the autoloader has been called and should be able to get your class DisplayBackOfficeHeader
.
} | ||
} | ||
|
||
private function isDefaultController(): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private function isDefaultController(): bool | |
private function isEmployeeDefaultController(): bool |
$this->updateNotificationConfiguration->setReleaseNote($releaseNote); | ||
} | ||
|
||
(new UpdateNotificationService())->saveUpdateNotificationConfiguration($this->updateNotificationConfiguration); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuse the instance that would be loaded from the container?
require_once _PS_ROOT_DIR_ . '/modules/autoupgrade/classes/VersionUtils.php'; | ||
|
||
if (!\PrestaShop\Module\AutoUpgrade\VersionUtils::isActualPHPVersionCompatible()) { | ||
$this->isActualPHPVersionCompatible = false; | ||
|
||
return; | ||
} | ||
|
||
$autoloadPath = __DIR__ . '/../../vendor/autoload.php'; | ||
if (file_exists($autoloadPath)) { | ||
require_once $autoloadPath; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen this code several times. Shall we merge all the occurrences in a common method?
$updateNotificationService = new UpdateNotificationService(); | ||
$updateNotificationConfiguration = $updateNotificationService->getUpdateNotificationConfiguration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be moved in the container?
storybook/.storybook/preview.ts
Outdated
@@ -41,6 +42,7 @@ const preview: Preview = { | |||
backgrounds: { | |||
disable: true, | |||
}, | |||
internalWrapper: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer something like?
internalWrapper: false, | |
storyContext: 'MODULE_UI' as 'MODULE_UI' | 'STANDALONE', |
…rnal ui and storybook
b396980
to
3410d21
Compare
|
Hello @ga-devfront, I tested your PR but I found some bugs :/ PR-2025-03-06_14.54.16.mp4 |