58 Commits

Author SHA1 Message Date
Marina Glancy
04f8fdd021 MDL-77164 various: fix javascript AMD module name 2023-04-13 09:43:15 +01:00
Andrew Nicols
f4a48a517b MDL-76867 core_table: Allow dynamic table filterset to be specified
The previous behaviour guessed the table filterset based on the table's
class name, but this is not very flexible if you wish to create an
abstract table class and use a generic filter for all implementations.

This change adds the ability to specify the filterset class, with the
default behaviour using the table class name as a prefix.
2023-03-14 08:44:15 +08:00
Andrew Nicols
511401f4f6 MDL-77559 js: Rebuild all JS with Node 16 2023-03-09 09:53:19 +08:00
Andrew Nicols
33b1e41f13 MDL-75012 js: Full build of all grunt things 2023-03-02 11:55:32 +08:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Eloy Lafuente (stronk7)
d590b08dfa MDL-75880 phpunit: fix all @coversDefaultClass missing @covers
Because @coversDefaultClass doesn't indicate any coverage (it's
just an alias to avoid having to write the class name in @covers),
this commit fixes all the files that were using that annotation
and missing any @covers.

Basically, replacing one by the other and done.
2022-11-04 16:51:20 +01:00
Marina Glancy
41b93bd7e5 MDL-73424 general: Internal methods must have same type as parent
Otherwise the error is thrown in PHP8.1
2022-10-10 16:46:13 +02:00
Andrew Nicols
e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.

Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.

Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.

The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.

Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
2022-02-23 08:55:09 +08:00
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Andrew Nicols
3a70983d53 MDL-72701 unit tests: Generate default coverage 2021-12-21 09:24:00 +08:00
Andrew Nicols
4f422785c6 MDL-71113 javascript: Improve basic JS Documentation 2021-06-18 09:38:05 +08:00
Andrew Nicols
92179b7057 MDL-71113 js: Fix all jsdoc warnings 2021-06-18 09:38:05 +08:00
Mikel Martín
2471e6ec8d MDL-70871 table: Add 'Show all X' functionality to dynamic_table 2021-03-23 09:55:16 +01:00
Eloy Lafuente (stronk7)
9fd6ac7c9d MDL-71036 phpunit: xml config - switch coverage info to new includes
This applies the "whitelist" => "include" changes to all the core
phpunit_coverage_info occurrences, so core won't emit any deprecation
warning (see previous commit).

At the same time, modified a bunch of comments in coverage files
to be more readable/understandable.
2021-03-11 23:04:32 +01:00
Eloy Lafuente (stronk7)
81407f18ec MDL-71036 phpunit: Mock->setMethods() silently deprecated
The current ->setMethods() has been silently (won't emit any
warning) in PHPUnit 9. And will stop working (current plans)
in PHPUnit 10.

Basically the now deprecated method has been split into:

- onlyMethods(): To point to existing methods in the mocked artifact.
- addMethods(): To point to non existing (yet) methods in the mocked
  artifact.

In practice that means that all our current setMethods() calls can be
converted to onlyMethods() (existing) and done. The addMethods() is
mostly useful on development phases, not final testing.

Finally note that <null> isn't accepted anymore as parameter to
double all the methods. Instead empty array [] must be used.

Link: https://github.com/sebastianbergmann/phpunit/issues/3770
2021-03-11 23:04:31 +01:00
Eloy Lafuente (stronk7)
857f6385a4 MDL-71036 phpunit: Fix param check, must be array
With stricter typed param checks in php73, the 7th param of the
getMockForAbstractClass() must be array, so previous code defaulting
to null now throws a TypeError.
2021-03-11 19:22:24 +01:00
Jun Pataleta
a489f20f17 MDL-69145 core: Set the default filterset join type to ALL
* Plus minor PHPDoc type fix for the JOINTYPE_DEFAULT constants
2020-12-09 10:51:06 +08:00
Michael Hawkins
bb32174261 MDL-69241 lib: Reset dynamic tables to page 1 when filtering or sorting
This ensures consistency and that the page will always exist, which may
not be true for later pages if applying filters returns fewer results.
2020-08-07 12:51:49 +08:00
Michael Hawkins
bd40419f2f MDL-69336 lib: Correctly return promises when table show/hide columns
Previously showColumn and HideColumn were returning nothing, so
attempts to catch exceptions were themselves throwing errors in the
browser console.
2020-08-04 15:18:39 +08:00
Andrew Nicols
efc3dfff47 MDL-68977 core_table: Do not update dynamic tables on nullop
When a setting is added/removed (i.e. an empty filter is removed) and
there is no change, then we should treat this is a null-op and not
refresh the table unnecessarily.
2020-06-09 11:21:04 +08:00
Andrew Nicols
efa490c61f MDL-68951 table: Page numbers are 1-indexed, not 0 2020-06-08 09:35:39 +08:00
Andrew Nicols
eb087fc5de MDL-68951 user: Add appropriate exceptions for table/participants 2020-06-08 09:35:39 +08:00
Sara Arjona
6ddab9d6d3 Merge branch 'MDL-68745-master-2' of git://github.com/mickhawkins/moodle 2020-06-05 21:30:07 +02:00
Michael Hawkins
f32f25b89d MDL-68745 lib: Updated table filters to support non-English characters
Added support for non-English first/last name filtering.
2020-06-04 12:48:03 +08:00
Andrew Nicols
444ae8c8f0 MDL-68612 core_table: Pending checks for dyanmic updates 2020-06-04 10:47:27 +08:00
Jun Pataleta
7fcdd9d983 Merge branch 'MDL-68612-master-integration' of git://github.com/mickhawkins/moodle 2020-06-03 15:39:36 +08:00
Andrew Nicols
084c955e49 MDL-68612 user: Set the initial filter on page load 2020-06-03 14:29:22 +08:00
Simey Lameze
1179f07d3c MDL-68793 core_table: fix WS name to comply with guidelines 2020-06-02 11:49:04 +08:00
Michael Hawkins
9e791ff7f5 MDL-68612 lib: Reverting filter/filterset default join types to match UI
These had temporarily been set to ALL for consistency while the unified
filter remained in use. Now that is being replaced with the new UI, it
can be returned to its intended default.
2020-05-29 10:10:33 +08:00
Andrew Nicols
110f3ebf54 MDL-68169 user: Limit the number of filter conditions
Part of MDL-67743
2020-05-27 10:49:44 +08:00
Michael Hawkins
3f069a2c48 MDL-68348 lib: Default filters to match ALL for backwards compatibility
Temporarily defaulting filtersets and their filters to join type ALL
for backwards compatibility, so the existing participants unified
filter continues to function consistently. This will be reverted once
the new participants filter UI replaces the existing unified filter.
2020-05-25 18:10:53 +08:00
Andrew Nicols
a31a2b6d54 MDL-68508 core_table: Improve sorting to support sorting by multiple columns 2020-05-22 10:42:30 +08:00
Eloy Lafuente (stronk7)
de185f1c2b Merge branch 'MDL-68417-master' of git://github.com/lameze/moodle 2020-05-12 23:20:21 +02:00
Simey Lameze
eebe3ca611 MDL-68417 core_table: add spinner to dynamic table 2020-05-12 06:58:06 +08:00
Andrew Nicols
f879cc518e MDL-66109 js: Build changes for NodeJS upgrade
This change includes a build to fix all minified file changes in Moodle
as a result of upgrades to our build process.
2020-05-11 10:55:54 +08:00
Simey Lameze
68c46a28d6 MDL-68462 core_table: add support for reset table preferences 2020-05-06 09:44:39 +08:00
Andrew Nicols
685fe08003 MDL-68454 table: Improve documentation for dynamic table 2020-05-04 11:52:19 +08:00
Andrew Nicols
5615a772a6 MDL-68454 table: Move guessing of base URL to flexible 2020-05-04 11:52:19 +08:00
Andrew Nicols
56143dd622 MDL-68454 table: Move filterset functionality to flexible_table 2020-05-04 11:52:19 +08:00
Andrew Nicols
c00552b3b0 MDL-68454 table: Move get_context from dynamic to flexible 2020-05-04 11:52:19 +08:00
Andrew Nicols
ff475522fb MDL-68454 table: Drop get_unique_id_from_argument fn requirement
This was originally intended to be a way for the calling code to specify
data as part of the table construction which could then be used as
appropriate. When the filterset was created the requirement for this
function no longer existed.

Removing this to simplify the API.
2020-05-04 11:52:19 +08:00
Jun Pataleta
cfcbebaacb Merge branch 'MDL-68506-master' of git://github.com/andrewnicols/moodle 2020-05-01 11:20:21 +08:00
Adrian Greeve
b8cf95bb48 Merge branch 'MDL-68442-master' of git://github.com/andrewnicols/moodle 2020-04-29 13:54:57 +08:00
Andrew Nicols
478039f99a MDL-68442 user: Rewrite participant status to work with dynamic tables 2020-04-28 10:21:45 +08:00
Simey Lameze
e2f12c2220 MDL-67915 core_table: add support for hide and show of columns 2020-04-24 18:23:34 +08:00
Andrew Nicols
ca69d3875e MDL-68506 core_table: Add a tableContentRefreshed event 2020-04-24 14:53:35 +08:00
Simey Lameze
fb17c31c46 MDL-68341 core_table: fix wrong participanttablehtml variable name 2020-04-21 10:28:05 +08:00
Simey Lameze
ad176d6f0a MDL-68341 core_table: improve fetch WS php unit coverage 2020-04-21 10:28:05 +08:00
Simey Lameze
4cf97b7f42 MDL-68341 core_table: add component parameter to fetch WS 2020-04-21 10:28:01 +08:00