8000 [Vue] migrate the plugin-settings directive by diosmosis · Pull Request #18432 · matomo-org/matomo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Vue] migrate the plugin-settings directive #18432

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

Merged
merged 537 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
537 commits
Select commit Hold shift + click to select a range
17688b9
Merge branch 'vue-period-selector' into vue-reporting-menu
diosmosis Nov 26, 2021
5143778
tweak
diosmosis Nov 26, 2021
ee69978
add return type
diosmosis Nov 26, 2021
f4d315f
Merge branch 'vue-period-selector' into vue-reporting-menu
diosmosis Nov 26, 2021
d23ad76
finish converting side-nav directive
diosmosis Nov 26, 2021
11d9ade
starting on reporting menu conversion
diosmosis Nov 27, 2021
f13688a
remove unused properties
diosmosis Nov 27, 2021
d225a28
convert reporting pages service
diosmosis Nov 27, 2021
1f83857
migrate report metadata store
diosmosis Nov 27, 2021
bffd281
remove angularjs files
diosmosis Nov 27, 2021
433e008
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Nov 27, 2021
6e02d0f
migrating reporting pages store
diosmosis Nov 27, 2021
78908f7
make store adapters more immutable
diosmosis Nov 27, 2021
a21f6c1
get service adapters to work
diosmosis Nov 27, 2021
693e3ae
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Nov 27, 2021
ac9db4a
fix a UI test
diosmosis Nov 27, 2021
c43551c
another html fix
diosmosis Nov 27, 2021
15c9025
Merge branch 'vue-period-selector' into vue-reporting-menu
diosmosis Nov 27, 2021
d3d5a71
migrate most of reporting menu directive and model
diosmosis Nov 27, 2021
902765c
Use themed font family for input forms to override materialize.css st…
diosmosis Nov 27, 2021
94e05ca
Merge branch 'local-ui-test-font-fix' into vue-period-selector
diosmosis Nov 27, 2021
16885ea
rebuild vue
diosmosis Nov 28, 2021
bac055e
add a missing div
diosmosis Nov 28, 2021
1d6d314
ui test fixes
diosmosis Nov 28, 2021
79687a9
update styling
diosmosis Nov 28, 2021
baf774a
get to build
diosmosis Nov 28, 2021
98d6a62
get to build
diosmosis Nov 28, 2021
6699936
get to load in the UI w/o error
diosmosis Nov 28, 2021
426cecf
clone result of functions
diosmosis Nov 28, 2021
0f805af
fix compile issue
diosmosis Nov 28, 2021
25075d6
migrate widget loader and get to load in UI
diosmosis Nov 28, 2021
451c56d
rebuild vue
diosmosis Nov 28, 2021
c87fc40
migrate widgetcontainer
diosmosis Nov 28, 2021
40df9a9
migrate widget bydimension container
diosmosis Nov 28, 2021
f296da6
migrate widget + add tooltips directive
diosmosis Nov 28, 2021
24d7234
quick fix
diosmosis Nov 28, 2021
a1d3808
Updating version to 4.6.0
justinvelluppillai Nov 28, 2021
8db9283
loading in page
diosmosis Nov 29, 2021
27115a7
update expected screenshot
diosmosis Nov 29, 2021
2b39963
Merge branch 'vue-period-selector' into vue-reporting-pages-model
diosmosis Nov 29, 2021
759c8b7
add wait just in case travis is slow
diosmosis Nov 29, 2021
6b8e4de
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Nov 29, 2021
0a67443
fix ordering bug
diosmosis Nov 29, 2021
9d35cb3
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Nov 29, 2021
98fb793
add another wait
diosmosis Nov 29, 2021
b2ed03e
Merge branch '4.x-dev' into vue-reporting-menu
diosmosis Nov 29, 2021
42dfdf3
rebuild vue
diosmosis Nov 29, 2021
041e05f
Merge branch '4.x-dev' into vue-reporting-menu
diosmosis Nov 29, 2021
6fc3970
css tweak
diosmosis Nov 29, 2021
155d528
fix some bugs and tests
diosmosis Nov 29, 2021
01a7381
undo screenshot changes
diosmosis Nov 29, 2021
7914ef0
Menus test passing locally
diosmosis Nov 29, 2021
f961b22
[Vue] date picker viewDate property is not kept up to date (#18385)
diosmosis Nov 29, 2021
6313136
reporting menu subcategory items are meant to be normal links
diosmosis Nov 29, 2021
b4671d8
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Nov 29, 2021
979c41b
update some screenshots
diosmosis Nov 29, 2021
c4a8bf3
use innerText instead of text() since angularjs maintains newlines in…
diosmosis Nov 30, 2021
265e2d0
trigger angularjs digest after ajaxhelper request
diosmosis Nov 30, 2021
d582816
rebuild vue
diosmosis Nov 30, 2021
31d50fc
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Nov 30, 2021
6856a79
update screenshots, fix bug in link generation in reporting menu and …
diosmosis Nov 30, 2021
b113d08
undo box-shadow change for UI tests
diosmosis Nov 30, 2021
1672a76
fix more issues & update more tests
diosmosis Nov 30, 2021
1aa82c6
update some screenshots
diosmosis Nov 30, 2021
524c8d4
fix some tests
diosmosis Nov 30, 2021
baada30
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Nov 30, 2021
6fdae14
rebuild CoreHome
diosmosis Nov 30, 2021
3c132bc
Merged 4.x-dev
justinvelluppillai Nov 30, 2021
fcd8343
quick fix
diosmosis Nov 30, 2021
729b57a
Merge branch '4.x-dev' into vue-reporting-menu
diosmosis Nov 30, 2021
a65c58c
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Nov 30, 2021
c5cf846
built vue files
justinvelluppillai Nov 30, 2021
ffd4113
fix angularjs issue
diosmosis Nov 30, 2021
a6d1b74
add comment
diosmosis Nov 30, 2021
94fd53b
update umd files
diosmosis Nov 30, 2021
f68f993
Merge branch 'next_release' into vue-widget-loader
diosmosis Nov 30, 2021
72a8886
Merge branch 'next_release' into vue-reporting-menu
diosmosis Nov 30, 2021
9882be4
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Nov 30, 2021
c5632f6
4.6.1-rc1
mattab Nov 30, 2021
3c8b892
4.6.1
mattab Dec 1, 2021
6541fab
Merge branch '4.x-dev' into vue-form-field
diosmosis Dec 1, 2021
366ce53
fix field array title
diosmosis Dec 1, 2021
6a9dc56
apply some pr feedback
diosmosis Dec 1, 2021
285442b
apply more pr feedback
diosmosis Dec 1, 2021
dd0a312
another fix
diosmosis Dec 1, 2021
08007bc
tweak
diosmosis Dec 1, 2021
d25c33a
fix ng-change not executed before ng-model
diosmosis Dec 1, 2021
0ca2df5
fix another set of issues
diosmosis Dec 1, 2021
82382d4
fix another issue
diosmosis Dec 1, 2021
8b64ffa
rebuild vue
diosmosis Dec 1, 2021
50ce86a
Merge branch '4.x-dev' into vue-form-field
diosmosis Dec 1, 2021
72d3bae
Merge branch 'vue-form-field' into vue-reporting-menu
diosmosis Dec 1, 2021
e3bedbe
better ng-change/ng-model fix
diosmosis Dec 1, 2021
2b01d90
Merge branch 'vue-form-field' into vue-reporting-menu
diosmosis Dec 1, 2021
5a751c5
Merge branch 'vue-form-field' into vue-period-selector
diosmosis Dec 1, 2021
078472d
update some screenshots
diosmosis Dec 1, 2021
e0a2338
rebuild vue
diosmosis Dec 1, 2021
abec781
Merge branch 'vue-period-selector' into vue-reporting-pages-model
diosmosis Dec 1, 2021
526df55
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Dec 1, 2021
4067686
remove some TODOs
diosmosis Dec 1, 2021
10000
303fcf4
initiate initial ng-change ONLY for site selectors where this behavio…
diosmosis Dec 1, 2021
00438ad
Merge branch 'vue-form-field' into vue-period-selector
diosmosis Dec 1, 2021
700eeed
Merge branch 'vue-period-selector' into vue-reporting-pages-model
diosmosis Dec 1, 2021
c2fb339
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Dec 1, 2021
5101693
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 1, 2021
cb0441a
emit/broadcast on correct scope in wrapper
diosmosis Dec 1, 2021
2991433
rebuild vue
diosmosis Dec 1, 2021
6d33299
Merge branch '4.x-dev' into vue-period-selector
diosmosis Dec 1, 2021
4833261
Merge branch 'vue-period-selector' into vue-reporting-pages-model
diosmosis Dec 1, 2021
2ec6bf7
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Dec 1, 2021
00aac86
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 1, 2021
1e0ecfa
Merge branch 'next_release' into vue-widget-loader
diosmosis Dec 2, 2021
2519f24
Merge branch 'vue-post-event-regression' into vue-widget-loader
diosmosis Dec 2, 2021
5546f95
fix some issues
diosmosis Dec 2, 2021
6497ead
Merge branch 'vue-widget-loader' into vue-widget
diosmosis Dec 2, 2021
6e56c3c
couple more fixes
diosmosis Dec 2, 2021
cc0b4fb
fix another title issue
diosmosis Dec 2, 2021
17de94c
Merge branch 'vue-widget-loader' into vue-widget
diosmosis Dec 2, 2021
9168633
rebuild vue
diosmosis Dec 2, 2021
9d732a8
do not report on ajax errors in notifications if not logged in
diosmosis Dec 2, 2021
4539552
migrate reporting page and model
diosmosis Dec 2, 2021
8587588
rebuild vue
diosmosis Dec 2, 2021
8fd921f
create sites selector model adapter
diosmosis Dec 2, 2021
a77e739
fix siteselector vue bug, initial site is only set if there is just o…
diosmosis Dec 2, 2021
01d723c
rebuild vue
diosmosis Dec 2, 2021
de7b07f
migrate plugin settings directive
diosmosis Dec 2, 2021
95d3df8
remove TODO
diosmosis Dec 2, 2021
913ec0a
fix a bunch of bugs
diosmosis Dec 2, 2021
070ba66
fix another widget bug
diosmosis Dec 2, 2021
192c5fb
Merge branch '4.x-dev' into vue-reporting-pages-model
diosmosis Dec 4, 2021
e75ba54
built vue files
diosmosis Dec 4, 2021
3a1a5d9
fix function signature
diosmosis Dec 4, 2021
880eec5
fix vue warning
diosmosis Dec 4, 2021
50d162d
fix ajax request race condition
diosmosis Dec 4, 2021
623f812
rebuild vue
diosmosis Dec 4, 2021
43133f4
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Dec 4, 2021
b504da3
add new notification type "help" so the help notification is not clea…
diosmosis Dec 4, 2021
43767eb
fix some bugs and tests
diosmosis Dec 4, 2021
2a8cac4
update screenshot
diosmosis Dec 4, 2021
33869c4
Merge branch 'vue-reporting-pages-model' into vue-reporting-menu
diosmosis Dec 4, 2021
f67e918
update screenshot & fix a test
diosmosis Dec 4, 2021
92efd7e
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
b314678
allow using unminified jquery ui + fix bug in last fix
diosmosis Dec 4, 2021
c33bb58
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
7efb296
fix error when enrichedheadline is used in modal
diosmosis Dec 4, 2021
b28d993
add polyfill min.js
diosmosis Dec 4, 2021
9244073
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
f9c0766
remove two todos
diosmosis Dec 4, 2021
94788be
fix widget url logic
diosmosis Dec 4, 2021
7d70d64
update some screenshots and fix sanitization/escape issue
diosmosis Dec 4, 2021
8268737
update screenshots
diosmosis Dec 4, 2021
904707c
rebuild vue
diosmosis Dec 4, 2021
5d490d2
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
ea50a04
Merge branch 'vue-widget-loader' into vue-widget
diosmosis Dec 4, 2021
4eeca1b
fix url location updating regression in MatomoUrl.updateLocation use
diosmosis Dec 4, 2021
6931227
submodule
diosmosis Dec 4, 2021
308f13f
Merge branch 'vue-period-selector-regression' into vue-widget
diosmosis Dec 4, 2021
8075d87
update screenshots and fix possible error in json parse
diosmosis Dec 4, 2021
b348cff
Merge branch 'vue-period-selector-regression' into vue-widget-loader
diosmosis Dec 4, 2021
96616f6
built vue files
diosmosis Dec 4, 2021
c3efc43
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
b0bc2af
Merge branch 'vue-period-selector-regression' into vue-reporting-menu
diosmosis Dec 4, 2021
77cd692
Merge branch 'vue-period-selector-regression' into vue-reporting-menu
diosmosis Dec 4, 2021
fbfbf89
rebuild vue
diosmosis Dec 4, 2021
99d5c5f
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
2b1177b
use correct variable
diosmosis Dec 4, 2021
90ef0e8
rebuild vue
diosmosis Dec 4, 2021
1c6d117
Merge branch 'vue-period-selector-regression' into vue-reporting-menu
diosmosis Dec 4, 2021
f00ce31
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
16c2573
fix widget url logic
diosmosis Dec 4, 2021
265362d
segment parameter can be undefined now for some reason
diosmosis Dec 4, 2021
fd4e220
fix ngmodel binding in siteselector adapter (for last time hopefully)
diosmosis Dec 4, 2021
8affb84
the original site selector only set the first site to the first site …
diosmosis Dec 4, 2021
2206ae6
fix sitesmanager ui test failure
diosmosis Dec 4, 2021
ee6de95
fix usersettings test failure
diosmosis Dec 4, 2021
e5b31c4
rebuild vue
diosmosis Dec 4, 2021
8eba658
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 4, 2021
b64eddf
more siteselector tweaks.
diosmosis Dec 4, 2021
97876dd
build CoreHome
diosmosis Dec 4, 2021
c7a17d6
more siteselector tweaks.
diosmosis Dec 4, 2021
ad41d70
another siteselector issue
diosmosis Dec 5, 2021
69b69db
update screenshots
diosmosis Dec 5, 2021
5fd728b
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 5, 2021
bd0dca4
Merge branch 'vue-widget-loader' into v 10000 ue-widget
diosmosis Dec 5, 2021
b0e01c0
Merge branch 'vue-widget' into vue-reporting-page
diosmosis Dec 5, 2021
6345c8e
update screenshot and try to fix random failure
diosmosis Dec 5, 2021
7d865ed
Merge branch 'vue-reporting-menu' into vue-widget-loader
diosmosis Dec 5, 2021
262b3d7
fix some issues in widget.vue when containerid is specified
diosmosis Dec 5, 2021
0f1003a
fix couple tests
diosmosis Dec 5, 2021
39c772b
Merge branch 'vue-widget-loader' into vue-widget
diosmosis Dec 5, 2021
9f369a4
fix several test failures
diosmosis Dec 5, 2021
23b148c
Merge branch 'vue-widget' into vue-reporting-page
diosmosis Dec 5, 2021
f77c676
Merge branch 'vue-reporting-page' into vue-site-selector-model
diosmosis Dec 5, 2021
a251280
Merge branch 'vue-site-selector-model' into vue-plugin-settings
diosmosis Dec 5, 2021
f63bda6
fix string concat
diosmosis Dec 5, 2021
f9401b1
fix test failure
diosmosis Dec 5, 2021
b2fd182
extra change
diosmosis Dec 5, 2021
734f89a
fix last change and random failure
diosmosis Dec 5, 2021
ff50e16
Merge branch 'vue-widget' into vue-reporting-page
diosmosis Dec 5, 2021
2d4329e
styling fix
diosmosis Dec 5, 2021
4338cb0
fix last fix
diosmosis Dec 5, 2021
2ccd52b
Merge branch 'vue-widget' into vue-reporting-page
diosmosis Dec 5, 2021
1ecdaac
real fix this time
diosmosis Dec 5, 2021
6fd44d3
Merge branch 'vue-widget' into vue-reporting-page
diosmosis Dec 5, 2021
73602a4
fix stray request
diosmosis Dec 5, 2021
281b0a2
Merge branch 'vue-widget' into vue-reporting-page
diosmosis Dec 5, 2021
6ab3004
proper fix
diosmosis Dec 5, 2021
1c169ec
update build files
diosmosis Dec 5, 2021
5f42e81
Merge branch 'vue-reporting-page' into vue-site-selector-model
diosmosis Dec 5, 2021
b3dbb3d
Merge branch 'vue-site-selector-model' into vue-plugin-settings
diosmosis Dec 5, 2021
6e02a74
try to fix random failure
diosmosis Dec 5, 2021
3ffea61
Merge branch 'vue-reporting-page' into vue-plugin-settings
diosmosis Dec 5, 2021
44a330e
do not submit form
diosmosis Dec 5, 2021
87ec1d4
check for api errors in promise chain in ajaxhelper.ts
diosmosis Dec 5, 2021
f30a89f
force a digest after a location change
diosmosis Dec 5, 2021
0189fec
use proper abortcontroller method instead of promise hack, have to ad…
diosmosis Dec 6, 2021
ac098b1
Merge branch '4.x-dev' into vue-reporting-page
diosmosis Dec 13, 2021
f551428
update screenshots
diosmosis Dec 14, 2021
1ad2478
post loadPage event after url changes so URL changes are propagated p…
diosmosis Dec 14, 2021
56aec83
Merge remote-tracking branch 'origin/4.x-dev' into vue-site-selector-…
Dec 14, 2021
7b26252
Update ReportingMenu.vue
Dec 14, 2021
9e3a67e
Merge remote-tracking branch 'origin/4.x-dev' into vue-plugin-settings
Dec 14, 2021
97032bf
built vue files
peterhashair Dec 14, 2021
ba59d99
Merge branch '4.x-dev' into vue-reporting-page
sgiehl Dec 14, 2021
6028b34
revert invalid UI file changes
sgiehl Dec 14, 2021
13d2bd6
fix two regressions in period selector comparison launching/detection…
diosmosis Dec 14, 2021
1676f3b
fix piwik-widget selector in dataTable.js
diosmosis Dec 14, 2021
85dadf4
Merge branch '4.x-dev' into vue-reporting-page
diosmosis Dec 14, 2021
79a7ddf
remove space
diosmosis Dec 14, 2021
3e93c63
Merge branch 'vue-reporting-page' into vue-site-selector-model
diosmosis Dec 14, 2021
eab5ee0
extra scope apply after hash change so angularjs notices, change css …
diosmosis Dec 14, 2021
c942ea6
rebuild vue
diosmosis Dec 14, 2021
9331419
Merge branch 'vue-reporting-page' into vue-site-selector-model
diosmosis Dec 14, 2021
2454e19
built vue files
diosmosis Dec 14, 2021
05d286b
try to fix random failure
diosmosis Dec 14, 2021
d6995e7
fix order of JS in karma tests
diosmosis Dec 15, 2021
87f7ceb
remove empty props
diosmosis Dec 15, 2021
42bd9d6
use promise chaining
diosmosis Dec 15, 2021
aaf30e6
Merge branch '4.x-dev' into vue-site-selector-model
diosmosis Dec 15, 2021
4061989
Merge branch 'vue-site-selector-model' into vue-plugin-settings
diosmosis Dec 15, 2021
0a60830
Merge branch 'vue-plugin-settings' of github.com:matomo-org/matomo in…
diosmosis Dec 15, 2021
594a27e
Merge branch '4.x-dev' into vue-plugin-settings
diosmosis Dec 15, 2021
94c0071
Merge branch '4.x-dev' into vue-plugin-settings
diosmosis Dec 15, 2021
7e6cd83
undo submodule change
diosmosis Dec 15, 2021
fa32634
Merge branch '4.x-dev' into vue-plugin-settings
sgiehl Dec 16, 2021
66d478e
Fixes: Saving plugin settings might not work with certain password ma…
Dec 20, 2021
377c336
apply review feedback
diosmosis Dec 20, 2021
616f11e
submodule updates
sgiehl Dec 20, 2021
be2ee99
Merge branch '4.x-dev' into vue-plugin-settings
sgiehl Dec 20, 2021
039f241
fix property type in vue
diosmosis Dec 21, 2021
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
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"nock": "^13.1.4",
"ts-jest": "^26.5.6",
"typescript": "^4.3.5",
"vue-jest": "^5.0.0-0"
"vue-jest": "^5.0.0-0",
"yet-another-abortcontroller-polyfill": "^0.0.4"
}
}
2 changes: 1 addition & 1 deletion plugins/Bandwidth
Submodule Bandwidth updated 1 files
+6 −6 lang/fr.json
2 changes: 0 additions & 2 deletions plugins/CoreHome/CoreHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ public function getJsFiles(&$jsFiles)
// we have to load these CorePluginsAdmin files here. If we loaded them in CorePluginsAdmin,
// there would be JS errors as CorePluginsAdmin is loaded first. Meaning it is loaded before
// any angular JS file is loaded etc.
$jsFiles[] = "plugins/CorePluginsAdmin/angularjs/plugin-settings/plugin-settings.controller.js";
$jsFiles[] = "plugins/CorePluginsAdmin/angularjs/plugin-settings/plugin-settings.directive.js";
$jsFiles[] = "plugins/CorePluginsAdmin/angularjs/form/form.directive.js";
$jsFiles[] = "plugins/CorePluginsAdmin/angularjs/save-button/save-button.directive.js";
$jsFiles[] = "plugins/CorePluginsAdmin/angularjs/plugins/plugin-filter.directive.js";
Expand Down
137 changes: 100 additions & 37 deletions plugins/CoreHome/vue/dist/CoreHome.umd.js

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions plugins/CoreHome/vue/dist/CoreHome.umd.min.js

Large diffs are not rendered by default.

47 changes: 40 additions & 7 deletions plugins/CoreHome/vue/src/AjaxHelper/AjaxHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/

/* eslint-disable max-classes-per-file */

import { ITimeoutService } from 'angular';
import jqXHR = JQuery.jqXHR;
import MatomoUrl from '../MatomoUrl/MatomoUrl';
Expand All @@ -15,6 +17,8 @@ interface AjaxOptions {
postParams?: QueryParameters;
headers?: Record<string, string>;
format?: string;
createErrorNotification?: boolean;
abortController?: AbortController;
}

window.globalAjaxQueue = [] as unknown as GlobalAjaxQueue;
Expand Down Expand Up @@ -74,6 +78,8 @@ function defaultErrorCallback(deferred: XMLHttpRequest, status: string): void {
}
}

class ApiResponseError extends Error {}

/**
* Global ajax helper to handle requests within Matomo
*/
Expand Down Expand Up @@ -158,6 +164,8 @@ export default class AjaxHelper<T = any> { // eslint-disable-line
*/
requestHandle: JQuery.jqXHR|null = null;

abortController: AbortController|null = null;

defaultParams = ['idSite', 'period', 'date', 'segment'];

// helper method entry point
Expand All @@ -178,7 +186,34 @@ export default class AjaxHelper<T = any> { // eslint-disable-line
if (options.headers) {
helper.headers = options.headers;
}
return helper.send();

if (typeof options.createErrorNotification !== 'undefined'
&& !options.createErrorNotification
) {
helper.useCallbackInCaseOfError();
}

if (options.abortController) {
helper.abortController = options.abortController;
}

return helper.send().then((data) => {
// check for error if not using default notification behavior
if (data.result === 'error') {
throw new ApiResponseError(data.message);
}

return data;
});
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
static post<R = any>(
params: QueryParameters,
postParams: QueryParameters,
options: AjaxOptions = {},
): Promise<R> {
return this.fetch<R>(params, { ...options, postParams });
}

constructor() {
Expand Down Expand Up @@ -380,6 +415,10 @@ export default class AjaxHelper<T = any> { // eslint-disable-line
// ignore
}

if (this.abortController) {
this.abortController.signal.addEventListener('abort', () => this.requestHandle.abort());
}

const result: AbortablePromise<T> = new Promise<T>((resolve, reject) => {
this.requestHandle!.then((data: unknown) => {
resolve(data as T); // ignoring textStatus/jqXHR
Expand All @@ -396,12 +435,6 @@ export default class AjaxHelper<T = any> { // eslint-disable-line
});
}) as AbortablePromise<T>;

result.abort = () => {
if (this.requestHandle) {
this.requestHandle.abort();
}
};

return result;
}

Expand Down
17 changes: 9 additions & 8 deletions plugins/CoreHome/vue/src/SiteSelector/SitesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class SitesStore {
isInitialized: false,
});

private currentRequest: AbortablePromise;
private currentRequestAbort: AbortController;

private limitRequest: AbortablePromise;
private limitRequest: Promise<{ value: number|string }>;

public readonly initialSites = computed(() => readonly(this.state.initialSites));

Expand Down Expand Up @@ -70,8 +70,8 @@ class SitesStore {
return this.loadInitialSites();
}

if (this.currentRequest) {
this.currentRequest.abort();
if (this.currentRequestAbort) {
this.currentRequestAbort.abort();
}

if (!this.limitRequest) {
Expand All @@ -86,21 +86,22 @@ class SitesStore {
methodToCall = 'SitesManager.getSitesWithAdminAccess';
}

this.currentRequest = AjaxHelper.fetch({
this.currentRequestAbort = new AbortController();
return AjaxHelper.fetch({
method: methodToCall,
limit,
pattern: term,
}, {
abortController: this.currentRequestAbort,
});

return this.currentRequest;
}).then((response) => {
if (response) {
return this.processWebsitesList(response);
}

return null;
}).finally(() => {
this.currentRequest = null;
this.currentRequestAbort = null;
});
}

Expand Down
20 changes: 10 additions & 10 deletions plugins/CoreHome/vue/src/WidgetLoader/WidgetLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export default defineComponent({
loading: false,
loadingFailed: '',
changeCounter: 0,
lastWidgetRequest: null,
currentScope: null,
};
},
Expand Down Expand Up @@ -102,9 +101,9 @@ export default defineComponent({
},
methods: {
abortHttpRequestIfNeeded() {
if (this.lastWidgetRequest) {
this.lastWidgetRequest.abort();
this.lastWidgetRequest = null;
if (this.lastWidgetAbortController) {
this.lastWidgetAbortController.abort();
this.lastWidgetAbortController = null;
}
},
cleanupLastWidgetContent() {
Expand Down Expand Up @@ -172,20 +171,21 @@ export default defineComponent({
this.abortHttpRequestIfNeeded();
this.cleanupL 97AE astWidgetContent();

this.lastWidgetRequest = AjaxHelper.fetch(this.getWidgetUrl(parameters), {
this.lastWidgetAbortController = new AbortController();

AjaxHelper.fetch(this.getWidgetUrl(parameters), {
format: 'html',
headers: {
'X-Requested-With': 'XMLHttpRequest',
},
});

this.lastWidgetRequest.then((response) => {
abortController: this.lastWidgetAbortController,
}).then((response) => {
if (thisChangeId !== this.changeCounter || !response || typeof response !== 'string') {
// another widget was requested meanwhile, ignore this response
return;
}

this.lastWidgetRequest = null;
this.lastWidgetAbortController = null;
this.loading = false;
this.loadingFailed = false;

Expand Down Expand Up @@ -226,7 +226,7 @@ export default defineComponent({
return;
}

this.lastWidgetRequest = null;
this.lastWidgetAbortController = null;
this.cleanupLastWidgetContent();

this.loading = false;
Expand Down
2 changes: 1 addition & 1 deletion plugins/CorePluginsAdmin/CorePluginsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function addSystemSummaryItems(&$systemSummary)
public function getStylesheetFiles(&$stylesheets)
{
$stylesheets[] = "plugins/CorePluginsAdmin/stylesheets/plugins_admin.less";
$stylesheets[] = "plugins/CorePluginsAdmin/angularjs/plugin-settings/plugin-settings.directive.less";
$stylesheets[] = "plugins/CorePluginsAdmin/vue/src/PluginSettings/PluginSettings.less";
$stylesheets[] = "plugins/CorePluginsAdmin/vue/src/FormField/FieldExpandableSelect.less";
$stylesheets[] = "plugins/CorePluginsAdmin/vue/src/FormField/FieldMultituple.less";
$stylesheets[] = "plugins/CorePluginsAdmin/vue/src/FormField/FieldSelect.less";
Expand Down

This file was deleted.

Loading
0