From 1179f07d3c676ac199bba3c89bf06ac67031dd43 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Fri, 22 May 2020 10:08:16 +0800 Subject: [PATCH] MDL-68793 core_table: fix WS name to comply with guidelines --- lib/db/services.php | 6 +++--- .../amd/build/local/dynamic/repository.min.js | 2 +- .../build/local/dynamic/repository.min.js.map | 2 +- lib/table/amd/src/local/dynamic/repository.js | 2 +- .../external/dynamic/{fetch.php => get.php} | 5 ++--- .../dynamic/{fetch_test.php => get_test.php} | 20 +++++++++---------- version.php | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) rename lib/table/classes/external/dynamic/{fetch.php => get.php} (99%) rename lib/table/tests/external/dynamic/{fetch_test.php => get_test.php} (94%) diff --git a/lib/db/services.php b/lib/db/services.php index e8c1350e4b1..1a9ae7fa9e1 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -2764,10 +2764,10 @@ $functions = array( 'capabilities' => '', 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], ], - 'core_table_dynamic_fetch' => [ - 'classname' => 'core_table\external\dynamic\fetch', + 'core_table_get_dynamic_table_content' => [ + 'classname' => 'core_table\external\dynamic\get', 'methodname' => 'execute', - 'description' => 'Fetch a dynamic table view raw html', + 'description' => 'Get the dynamic table content raw html', 'type' => 'read', 'ajax' => true, 'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE], diff --git a/lib/table/amd/build/local/dynamic/repository.min.js b/lib/table/amd/build/local/dynamic/repository.min.js index ff5ca2626c1..e07cb965fd3 100644 --- a/lib/table/amd/build/local/dynamic/repository.min.js +++ b/lib/table/amd/build/local/dynamic/repository.min.js @@ -1,2 +1,2 @@ -define ("core_table/local/dynamic/repository",["exports","core/ajax"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.fetch=void 0;a.fetch=function fetch(a,c,d){var e=3.\n\n/**\n * A javascript module to handle calendar ajax actions.\n *\n * @module core_calendar/repository\n * @class repository\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Fetch table view.\n *\n * @method fetch\n * @param {String} component The component\n * @param {String} handler The name of the handler\n * @param {String} uniqueid The unique id of the table\n * @param {Object} options The options to use when updating the table\n * @param {Array} options.sortData The list of columns to sort by\n * @param {Number} options.joinType The filterset join type\n * @param {Object} options.filters The filters to apply when searching\n * @param {String} options.firstinitial The first name initial to filter on\n * @param {String} options.lastinitial The last name initial to filter on\n * @param {String} options.pageNumber The page number\n * @param {Number} options.pageSize The page size\n * @param {Object} options.hiddenColumns The columns to hide\n * @param {Bool} resetPreferences\n * @return {Promise} Resolved with requested table view\n */\nexport const fetch = (component, handler, uniqueid, {\n sortData = [],\n joinType = null,\n filters = {},\n firstinitial = null,\n lastinitial = null,\n pageNumber = null,\n pageSize = null,\n hiddenColumns = {}\n } = {}, resetPreferences = false) => {\n return fetchMany([{\n methodname: `core_table_dynamic_fetch`,\n args: {\n component,\n handler,\n uniqueid,\n sortdata: sortData,\n jointype: joinType,\n filters,\n firstinitial,\n lastinitial,\n pagenumber: pageNumber,\n pagesize: pageSize,\n hiddencolumns: hiddenColumns,\n resetpreferences: resetPreferences\n },\n }])[0];\n};\n"],"file":"repository.min.js"} \ No newline at end of file +{"version":3,"sources":["../../../src/local/dynamic/repository.js"],"names":["fetch","component","handler","uniqueid","sortData","joinType","filters","firstinitial","lastinitial","pageNumber","pageSize","hiddenColumns","resetPreferences","methodname","args","sortdata","jointype","pagenumber","pagesize","hiddencolumns","resetpreferences"],"mappings":"yKA6CqB,QAARA,CAAAA,KAAQ,CAACC,CAAD,CAAYC,CAAZ,CAAqBC,CAArB,CASoB,8DAAjC,EAAiC,KARjCC,QAQiC,CARjCA,CAQiC,YARtB,EAQsB,OAPjCC,QAOiC,CAPjCA,CAOiC,YAPtB,IAOsB,OANjCC,OAMiC,CANjCA,CAMiC,YANvB,EAMuB,OALjCC,YAKiC,CALjCA,CAKiC,YALlB,IAKkB,OAJjCC,WAIiC,CAJjCA,CAIiC,YAJnB,IAImB,OAHjCC,UAGiC,CAHjCA,CAGiC,YAHpB,IAGoB,OAFjCC,QAEiC,CAFjCA,CAEiC,YAFtB,IAEsB,OADjCC,aACiC,CADjCA,CACiC,YADjB,EACiB,GAA7BC,CAA6B,2DACrC,MAAO,WAAU,CAAC,CACdC,UAAU,uCADI,CAEdC,IAAI,CAAE,CACFb,SAAS,CAATA,CADE,CAEFC,OAAO,CAAPA,CAFE,CAGFC,QAAQ,CAARA,CAHE,CAIFY,QAAQ,CAAEX,CAJR,CAKFY,QAAQ,CAAEX,CALR,CAMFC,OAAO,CAAPA,CANE,CAOFC,YAAY,CAAZA,CAPE,CAQFC,WAAW,CAAXA,CARE,CASFS,UAAU,CAAER,CATV,CAUFS,QAAQ,CAAER,CAVR,CAWFS,aAAa,CAAER,CAXb,CAYFS,gBAAgB,CAAER,CAZhB,CAFQ,CAAD,CAAV,EAgBH,CAhBG,CAiBV,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * A javascript module to handle calendar ajax actions.\n *\n * @module core_calendar/repository\n * @class repository\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Fetch table view.\n *\n * @method fetch\n * @param {String} component The component\n * @param {String} handler The name of the handler\n * @param {String} uniqueid The unique id of the table\n * @param {Object} options The options to use when updating the table\n * @param {Array} options.sortData The list of columns to sort by\n * @param {Number} options.joinType The filterset join type\n * @param {Object} options.filters The filters to apply when searching\n * @param {String} options.firstinitial The first name initial to filter on\n * @param {String} options.lastinitial The last name initial to filter on\n * @param {String} options.pageNumber The page number\n * @param {Number} options.pageSize The page size\n * @param {Object} options.hiddenColumns The columns to hide\n * @param {Bool} resetPreferences\n * @return {Promise} Resolved with requested table view\n */\nexport const fetch = (component, handler, uniqueid, {\n sortData = [],\n joinType = null,\n filters = {},\n firstinitial = null,\n lastinitial = null,\n pageNumber = null,\n pageSize = null,\n hiddenColumns = {}\n } = {}, resetPreferences = false) => {\n return fetchMany([{\n methodname: `core_table_get_dynamic_table_content`,\n args: {\n component,\n handler,\n uniqueid,\n sortdata: sortData,\n jointype: joinType,\n filters,\n firstinitial,\n lastinitial,\n pagenumber: pageNumber,\n pagesize: pageSize,\n hiddencolumns: hiddenColumns,\n resetpreferences: resetPreferences\n },\n }])[0];\n};\n"],"file":"repository.min.js"} \ No newline at end of file diff --git a/lib/table/amd/src/local/dynamic/repository.js b/lib/table/amd/src/local/dynamic/repository.js index 3e43ac94965..e548e975c47 100644 --- a/lib/table/amd/src/local/dynamic/repository.js +++ b/lib/table/amd/src/local/dynamic/repository.js @@ -54,7 +54,7 @@ export const fetch = (component, handler, uniqueid, { hiddenColumns = {} } = {}, resetPreferences = false) => { return fetchMany([{ - methodname: `core_table_dynamic_fetch`, + methodname: `core_table_get_dynamic_table_content`, args: { component, handler, diff --git a/lib/table/classes/external/dynamic/fetch.php b/lib/table/classes/external/dynamic/get.php similarity index 99% rename from lib/table/classes/external/dynamic/fetch.php rename to lib/table/classes/external/dynamic/get.php index ad2fcda01fe..f21e463a3d7 100644 --- a/lib/table/classes/external/dynamic/fetch.php +++ b/lib/table/classes/external/dynamic/get.php @@ -31,7 +31,6 @@ use external_multiple_structure; use external_single_structure; use external_value; use external_warnings; -use moodle_url; /** * Core table external functions. @@ -41,7 +40,7 @@ use moodle_url; * @copyright 2020 Simey Lameze * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class fetch extends external_api { +class get extends external_api { /** * Describes the parameters for fetching the table html. @@ -140,7 +139,7 @@ class fetch extends external_api { } /** - * External function to fetch a table view. + * External function to get the table view content. * * @param string $component The component. * @param string $handler Dynamic table class name. diff --git a/lib/table/tests/external/dynamic/fetch_test.php b/lib/table/tests/external/dynamic/get_test.php similarity index 94% rename from lib/table/tests/external/dynamic/fetch_test.php rename to lib/table/tests/external/dynamic/get_test.php index c8250790e8c..be186e51e14 100644 --- a/lib/table/tests/external/dynamic/fetch_test.php +++ b/lib/table/tests/external/dynamic/get_test.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Unit tests for core_table\external\fetch; + * Unit tests for core_table\external\dynamic\get; * * @package core_table * @category test @@ -31,14 +31,14 @@ use core_table\local\filter\filter; use advanced_testcase; /** - * Unit tests for core_table\external\fetch; + * Unit tests for core_table\external\dynamic\get; * * @package core_table * @category test * @copyright 2020 Simey Lameze * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class fetch_test extends advanced_testcase { +class get_test extends advanced_testcase { /** * Setup before class. @@ -55,7 +55,7 @@ class fetch_test extends advanced_testcase { $this->resetAfterTest(); $this->expectException(\invalid_parameter_exception::class); - fetch::execute( + get::execute( "core-user", "participants", "", @@ -79,7 +79,7 @@ class fetch_test extends advanced_testcase { $this->resetAfterTest(); $this->expectException(\UnexpectedValueException::class); - fetch::execute( + get::execute( "core_users", "participants", "", @@ -106,7 +106,7 @@ class fetch_test extends advanced_testcase { $this->expectExceptionMessage("Table handler class {$handler} not found. Please make sure that your table handler class is under the \\core_user\\table namespace."); // Tests that invalid users_participants_table class gets an exception. - fetch::execute( + get::execute( "core_user", "users_participants_table", "", @@ -143,7 +143,7 @@ class fetch_test extends advanced_testcase { $this->expectExceptionMessage("Invalid parameter value detected (filters => Invalid parameter value detected " . "(Missing required key in single structure: name): Missing required key in single structure: name"); - fetch::execute( + get::execute( "core_user", "participants", "user-index-participants-{$course->id}", $this->get_sort_array(['firstname' => SORT_ASC]), @@ -153,9 +153,9 @@ class fetch_test extends advanced_testcase { } /** - * Test execute fetch table. + * Test execute method. */ - public function test_execute_fetch_table(): void { + public function test_table_get_execute(): void { $this->resetAfterTest(); $course = $this->getDataGenerator()->create_course(); @@ -176,7 +176,7 @@ class fetch_test extends advanced_testcase { ] ]; - $participantstable = fetch::execute( + $participantstable = get::execute( "core_user", "participants", "user-index-participants-{$course->id}", diff --git a/version.php b/version.php index 32f956cffac..17fac9b5ecb 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2020052900.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2020052900.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '3.9dev+ (Build: 20200529)'; // Human-friendly version name