diff options
author | Ben Burgess <88810029+bx80@users.noreply.github.com> | 2021-12-22 23:26:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-22 23:26:51 +0300 |
commit | d68dc6dd06606e8a7611c53d8ee63da8afbf99f7 (patch) | |
tree | b0363d254677ec77d42ff75352992405b41aef81 /plugins/CoreHome | |
parent | 10afd46db0e033e67127fb4e50eea986ed5296e6 (diff) |
Show a summary of new features (#18065)
* Added "What is new" notification display, populated by a new event
* Removed test example event hook
* Added support for applying a link attribute to menu items, fixes layout issue for mobile with html menu items
* Updated UI test screenshots
* Revert accidental edit
* Hide the "What's new" icon if there are no new features to show
* Changed to use changes.json, track user last viewed, added ui test
* Fix UserManager unit tests broken by new ts_changes_viewed user field
* Moved getChanges to separate helper class, added unit test, added user view access check
* Updated to add new changes table and populate only on plugin update/install
* Added missing fixture class, updated UI screenshots
* Updated matomo font to add ringing bell and new releases icons
* Fix for integration test
* Reworked class structure, removed unnecessary angular directive, merged templates, other tidy ups
* built vue files
* built vue files
* Added null user check, missing table exception handling, show plugin name in change title, better handling of missing change fields
* Added sample changes file, moved UserChanges db code to changes model, added return type hints, better db error code handling, various other improvements
* Revert accidental UI screenshot commit
* Fix for incorrect link name parameter in sample changes, switched back to using $db->query for INSERT IGNORE
* Integration test fix, UI screenshot updates
* Test fix
* Added link styling, show CoreHome changes without plugin prefix in title
* Update UI test screenshot
* Added styles to the popover, added event for filtering changes
* Test fix
* UI test screenshot updates
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
Diffstat (limited to 'plugins/CoreHome')
6 files changed, 88 insertions, 0 deletions
diff --git a/plugins/CoreHome/Controller.php b/plugins/CoreHome/Controller.php index a8f6fa09b0..ad1096e1e5 100644 --- a/plugins/CoreHome/Controller.php +++ b/plugins/CoreHome/Controller.php @@ -326,4 +326,5 @@ class Controller extends \Piwik\Plugin\Controller ViewDataTableManager::saveViewDataTableParameters($login, $reportId, $parameters, $containerId); } + } diff --git a/plugins/CoreHome/templates/_topBar.twig b/plugins/CoreHome/templates/_topBar.twig index febe664681..961c6d6b8a 100644 --- a/plugins/CoreHome/templates/_topBar.twig +++ b/plugins/CoreHome/templates/_topBar.twig @@ -13,6 +13,8 @@ {{ menu._html|raw }} {% else %} <a {% if menu._tooltip is defined %}title="{{ menu._tooltip }}"{% endif %} + {% if menu._attribute is defined %}{{ menu._attribute }}{% endif %} + {% if menu._onclick is defined %}onClick="{{ menu._onclick }}"{% endif %} {% if menu._url.module is defined %} id="topmenu-{{ menu._url.module|lower }}" href="index.php{{ menu._url|urlRewriteWithParameters }}" diff --git a/plugins/CoreHome/tests/Integration/ChangesTest.php b/plugins/CoreHome/tests/Integration/ChangesTest.php new file mode 100644 index 0000000000..3c22ad03f3 --- /dev/null +++ b/plugins/CoreHome/tests/Integration/ChangesTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +namespace Piwik\Plugins\CoreHome\tests\Integration; + +use Piwik\Tests\Fixtures\CreateChanges; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; +use Piwik\Changes\Model as ChangesModel; + +/** + * @group CoreHome + * @group CoreHomeTest + * @group CoreHomeChanges + */ +class ChangesTest extends IntegrationTestCase +{ + + /** + * @var CreateChanges + */ + public static $fixture; + + public function test_CoreHomeChanges_ShouldSortChangeListMostRecentFirst() + { + $json = '{"idchange":5,"plugin_name":"CoreHome","version":"4.6.0b5","title":"New feature x added","description":"Now you can do a with b like this","link_name":"For more information go here","link":"https:\/\/www.matomo.org"}'; + $changesModel = new ChangesModel(); + $changes = $changesModel->getChangeItems(); + $r = reset($changes); + unset($r['created_time']); + $this->assertEquals($json, json_encode($r, true)); + } + + public function test_CoreHomeChanges_ShouldAllowChangeItemAddWithoutLink() + { + $json = '{"idchange":4,"plugin_name":"CoreHome","version":"4.5.0","title":"New feature y added","description":"Now you can do c with d like this","link_name":null,"link":null}'; + $changesModel = new ChangesModel(); + $changes = $changesModel->getChangeItems(); + $r = $changes[1]; + unset($r['created_time']); + $this->assertEquals($json, json_encode($r, true)); + } + +} + +ChangesTest::$fixture = new CreateChanges(); diff --git a/plugins/CoreHome/tests/UI/Changes_spec.js b/plugins/CoreHome/tests/UI/Changes_spec.js new file mode 100644 index 0000000000..0ba2a77924 --- /dev/null +++ b/plugins/CoreHome/tests/UI/Changes_spec.js @@ -0,0 +1,29 @@ +/*! + * Matomo - free/libre analytics platform + * + * Dashboard screenshot tests. + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +describe('Changes', function () { + this.timeout(0); + + this.fixture = "Piwik\\Tests\\Fixtures\\CreateChanges"; + + var url = "?module=CoreAdminHome&action=home&idSite=1&period=day&date=yesterday"; + + it('should show changes', async function () { + await page.goto(url); + await page.waitForNetworkIdle(); + + await page.click('.right > li:nth-child(5) > a:nth-child(1)'); + await page.waitForNetworkIdle(); + + var elem = await page.waitForSelector('#Piwik_Popover'); + + expect(await elem.screenshot()).to.matchImage('show_popover'); + }); + +}); diff --git a/plugins/CoreHome/tests/UI/expected-screenshots/Changes_show_popover.png b/plugins/CoreHome/tests/UI/expected-screenshots/Changes_show_popover.png new file mode 100644 index 0000000000..bd5f69163c --- /dev/null +++ b/plugins/CoreHome/tests/UI/expected-screenshots/Changes_show_popover.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f844aa8ae955f79da1581be5763ba61d01774043be2b5856df5f3b7894dbc24c +size 72788 diff --git a/plugins/CoreHome/tests/UI/expected-screenshots/ShowChanges_view.png b/plugins/CoreHome/tests/UI/expected-screenshots/ShowChanges_view.png new file mode 100644 index 0000000000..7843fcffbc --- /dev/null +++ b/plugins/CoreHome/tests/UI/expected-screenshots/ShowChanges_view.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5391866af7ca6c0522d75dbbfcc1b798ad234728ab7d1f8dcb7b13d2040fbdbd +size 42705 |