Merge branch 'MDL-76291-400' of https://github.com/paulholden/moodle into MOODLE_400_STABLE

This commit is contained in:
Ilya Tregubov
2022-11-24 10:59:47 +03:00
8 changed files with 39 additions and 41 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,10 +1,10 @@
define("mod_bigbluebuttonbn/roomupdater",["exports","core/templates","core/notification","./repository"],(function(_exports,_templates,_notification,_repository){var obj;
define("mod_bigbluebuttonbn/roomupdater",["exports","core/pending","core/templates","core/notification","./repository"],(function(_exports,_pending,_templates,_notification,_repository){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* JS room updater.
*
* @module mod_bigbluebuttonbn/roomupdater
* @copyright 2021 Blindside Networks Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.updateRoom=_exports.stop=_exports.start=void 0,_templates=(obj=_templates)&&obj.__esModule?obj:{default:obj};let updateCount=0,updateFactor=1,timerReference=null,timerRunning=!1;_exports.start=()=>{timerRunning=!0,timerReference=setTimeout((()=>poll()),5e3)};_exports.stop=()=>{timerRunning=!1,timerReference&&(clearInterval(timerReference),timerReference=null),updateCount=0,updateFactor=1};const poll=()=>{timerRunning&&updateCount%updateFactor==0&&updateRoom().then((()=>{updateFactor>=10?updateFactor=1:updateFactor++})).catch().then((()=>{timerReference=setTimeout((()=>poll()),5e3)})).catch()},updateRoom=function(){let updatecache=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const bbbRoomViewElement=document.getElementById("bbb-room-view");if(!bbbRoomViewElement)return Promise.resolve(!1);const bbbId=bbbRoomViewElement.dataset.bbbId,groupId=bbbRoomViewElement.dataset.groupId;return(0,_repository.getMeetingInfo)(bbbId,groupId,updatecache).then((data=>(data.haspresentations=!1,data.presentations&&data.presentations.length&&(data.haspresentations=!0),_templates.default.renderForPromise("mod_bigbluebuttonbn/room_view",data)))).then((_ref=>{let{html:html,js:js}=_ref;return _templates.default.replaceNodeContents(bbbRoomViewElement,html,js)})).catch(_notification.exception)};_exports.updateRoom=updateRoom}));
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.updateRoom=_exports.stop=_exports.start=void 0,_pending=_interopRequireDefault(_pending),_templates=_interopRequireDefault(_templates);let updateCount=0,updateFactor=1,timerReference=null,timerRunning=!1;_exports.start=()=>{timerRunning=!0,timerReference=setTimeout((()=>poll()),5e3)};_exports.stop=()=>{timerRunning=!1,timerReference&&(clearInterval(timerReference),timerReference=null),updateCount=0,updateFactor=1};const poll=()=>{timerRunning&&updateCount%updateFactor==0&&updateRoom().then((()=>{updateFactor>=10?updateFactor=1:updateFactor++})).catch().then((()=>{timerReference=setTimeout((()=>poll()),5e3)})).catch()},updateRoom=function(){let updatecache=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const bbbRoomViewElement=document.getElementById("bbb-room-view");if(null===bbbRoomViewElement)return Promise.resolve(!1);const bbbId=bbbRoomViewElement.dataset.bbbId,groupId=bbbRoomViewElement.dataset.groupId,pendingPromise=new _pending.default("mod_bigbluebuttonbn/roomupdater:updateRoom");return(0,_repository.getMeetingInfo)(bbbId,groupId,updatecache).then((data=>(data.haspresentations=!1,data.presentations&&data.presentations.length&&(data.haspresentations=!0),_templates.default.renderForPromise("mod_bigbluebuttonbn/room_view",data)))).then((_ref=>{let{html:html,js:js}=_ref;return _templates.default.replaceNodeContents(bbbRoomViewElement,html,js)})).then((()=>pendingPromise.resolve())).catch(_notification.exception)};_exports.updateRoom=updateRoom}));
//# sourceMappingURL=roomupdater.min.js.map
@@ -1 +1 @@
{"version":3,"file":"roomupdater.min.js","sources":["../src/roomupdater.js"],"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 <http://www.gnu.org/licenses/>.\n\n/**\n * JS room updater.\n *\n * @module mod_bigbluebuttonbn/roomupdater\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Templates from \"core/templates\";\nimport {exception as displayException} from 'core/notification';\nimport {getMeetingInfo} from './repository';\n\nconst timeout = 5000;\nconst maxFactor = 10;\n\nlet updateCount = 0;\nlet updateFactor = 1;\nlet timerReference = null;\nlet timerRunning = false;\n\nconst resetValues = () => {\n updateCount = 0;\n updateFactor = 1;\n};\n\n/**\n * Start the information poller.\n */\nexport const start = () => {\n timerRunning = true;\n timerReference = setTimeout(() => poll(), timeout);\n};\n\n/**\n * Stop the room updater.\n */\nexport const stop = () => {\n timerRunning = false;\n if (timerReference) {\n clearInterval(timerReference);\n timerReference = null;\n }\n\n resetValues();\n};\n\nconst poll = () => {\n if (!timerRunning) {\n // The poller has been stopped.\n return;\n }\n if ((updateCount % updateFactor) === 0) {\n updateRoom()\n .then(() => {\n if (updateFactor >= maxFactor) {\n updateFactor = 1;\n } else {\n updateFactor++;\n }\n\n return;\n\n })\n .catch()\n .then(() => {\n timerReference = setTimeout(() => poll(), timeout);\n return;\n })\n .catch();\n }\n};\n\n/**\n * Update the room information.\n *\n * @param {boolean} [updatecache=false]\n * @returns {Promise}\n */\nexport const updateRoom = (updatecache = false) => {\n const bbbRoomViewElement = document.getElementById('bbb-room-view');\n if (!bbbRoomViewElement) {\n return Promise.resolve(false);\n }\n const bbbId = bbbRoomViewElement.dataset.bbbId;\n const groupId = bbbRoomViewElement.dataset.groupId;\n return getMeetingInfo(bbbId, groupId, updatecache)\n .then(data => {\n // Just make sure we have the right information for the template.\n data.haspresentations = false;\n if (data.presentations && data.presentations.length) {\n data.haspresentations = true;\n }\n return Templates.renderForPromise('mod_bigbluebuttonbn/room_view', data);\n })\n .then(({html, js}) => Templates.replaceNodeContents(bbbRoomViewElement, html, js))\n .catch(displayException);\n};\n"],"names":["updateCount","updateFactor","timerReference","timerRunning","setTimeout","poll","clearInterval","updateRoom","then","catch","updatecache","bbbRoomViewElement","document","getElementById","Promise","resolve","bbbId","dataset","groupId","data","haspresentations","presentations","length","Templates","renderForPromise","_ref","html","js","replaceNodeContents","displayException"],"mappings":";;;;;;;uLA8BIA,YAAc,EACdC,aAAe,EACfC,eAAiB,KACjBC,cAAe,iBAUE,KACjBA,cAAe,EACfD,eAAiBE,YAAW,IAAMC,QAlBtB,oBAwBI,KAChBF,cAAe,EACXD,iBACAI,cAAcJ,gBACdA,eAAiB,MAnBrBF,YAAc,EACdC,aAAe,SAwBbI,KAAO,KACJF,cAIAH,YAAcC,cAAkB,GACjCM,aACCC,MAAK,KACEP,cAzCE,GA0CFA,aAAe,EAEfA,kBAMPQ,QACAD,MAAK,KACFN,eAAiBE,YAAW,IAAMC,QArD9B,QAwDPI,SAUIF,WAAa,eAACG,0EACjBC,mBAAqBC,SAASC,eAAe,qBAC9CF,0BACMG,QAAQC,SAAQ,SAErBC,MAAQL,mBAAmBM,QAAQD,MACnCE,QAAUP,mBAAmBM,QAAQC,eACpC,8BAAeF,MAAOE,QAASR,aACjCF,MAAKW,OAEFA,KAAKC,kBAAmB,EACpBD,KAAKE,eAAiBF,KAAKE,cAAcC,SACzCH,KAAKC,kBAAmB,GAErBG,mBAAUC,iBAAiB,gCAAiCL,SAEtEX,MAAKiB,WAACC,KAACA,KAADC,GAAOA,gBAAQJ,mBAAUK,oBAAoBjB,mBAAoBe,KAAMC,OAC7ElB,MAAMoB"}
{"version":3,"file":"roomupdater.min.js","sources":["../src/roomupdater.js"],"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 <http://www.gnu.org/licenses/>.\n\n/**\n * JS room updater.\n *\n * @module mod_bigbluebuttonbn/roomupdater\n * @copyright 2021 Blindside Networks Inc\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Pending from 'core/pending';\nimport Templates from \"core/templates\";\nimport {exception as displayException} from 'core/notification';\nimport {getMeetingInfo} from './repository';\n\nconst timeout = 5000;\nconst maxFactor = 10;\n\nlet updateCount = 0;\nlet updateFactor = 1;\nlet timerReference = null;\nlet timerRunning = false;\n\nconst resetValues = () => {\n updateCount = 0;\n updateFactor = 1;\n};\n\n/**\n * Start the information poller.\n */\nexport const start = () => {\n timerRunning = true;\n timerReference = setTimeout(() => poll(), timeout);\n};\n\n/**\n * Stop the room updater.\n */\nexport const stop = () => {\n timerRunning = false;\n if (timerReference) {\n clearInterval(timerReference);\n timerReference = null;\n }\n\n resetValues();\n};\n\nconst poll = () => {\n if (!timerRunning) {\n // The poller has been stopped.\n return;\n }\n if ((updateCount % updateFactor) === 0) {\n updateRoom()\n .then(() => {\n if (updateFactor >= maxFactor) {\n updateFactor = 1;\n } else {\n updateFactor++;\n }\n\n return;\n\n })\n .catch()\n .then(() => {\n timerReference = setTimeout(() => poll(), timeout);\n return;\n })\n .catch();\n }\n};\n\n/**\n * Update the room information.\n *\n * @param {boolean} [updatecache=false]\n * @returns {Promise}\n */\nexport const updateRoom = (updatecache = false) => {\n const bbbRoomViewElement = document.getElementById('bbb-room-view');\n if (bbbRoomViewElement === null) {\n return Promise.resolve(false);\n }\n\n const bbbId = bbbRoomViewElement.dataset.bbbId;\n const groupId = bbbRoomViewElement.dataset.groupId;\n\n const pendingPromise = new Pending('mod_bigbluebuttonbn/roomupdater:updateRoom');\n\n return getMeetingInfo(bbbId, groupId, updatecache)\n .then(data => {\n // Just make sure we have the right information for the template.\n data.haspresentations = false;\n if (data.presentations && data.presentations.length) {\n data.haspresentations = true;\n }\n return Templates.renderForPromise('mod_bigbluebuttonbn/room_view', data);\n })\n .then(({html, js}) => Templates.replaceNodeContents(bbbRoomViewElement, html, js))\n .then(() => pendingPromise.resolve())\n .catch(displayException);\n};\n"],"names":["updateCount","updateFactor","timerReference","timerRunning","setTimeout","poll","clearInterval","updateRoom","then","catch","updatecache","bbbRoomViewElement","document","getElementById","Promise","resolve","bbbId","dataset","groupId","pendingPromise","Pending","data","haspresentations","presentations","length","Templates","renderForPromise","_ref","html","js","replaceNodeContents","displayException"],"mappings":";;;;;;;iNA+BIA,YAAc,EACdC,aAAe,EACfC,eAAiB,KACjBC,cAAe,iBAUE,KACjBA,cAAe,EACfD,eAAiBE,YAAW,IAAMC,QAlBtB,oBAwBI,KAChBF,cAAe,EACXD,iBACAI,cAAcJ,gBACdA,eAAiB,MAnBrBF,YAAc,EACdC,aAAe,SAwBbI,KAAO,KACJF,cAIAH,YAAcC,cAAkB,GACjCM,aACCC,MAAK,KACEP,cAzCE,GA0CFA,aAAe,EAEfA,kBAMPQ,QACAD,MAAK,KACFN,eAAiBE,YAAW,IAAMC,QArD9B,QAwDPI,SAUIF,WAAa,eAACG,0EACjBC,mBAAqBC,SAASC,eAAe,oBACxB,OAAvBF,0BACOG,QAAQC,SAAQ,SAGrBC,MAAQL,mBAAmBM,QAAQD,MACnCE,QAAUP,mBAAmBM,QAAQC,QAErCC,eAAiB,IAAIC,iBAAQ,qDAE5B,8BAAeJ,MAAOE,QAASR,aACjCF,MAAKa,OAEFA,KAAKC,kBAAmB,EACpBD,KAAKE,eAAiBF,KAAKE,cAAcC,SACzCH,KAAKC,kBAAmB,GAErBG,mBAAUC,iBAAiB,gCAAiCL,SAEtEb,MAAKmB,WAACC,KAACA,KAADC,GAAOA,gBAAQJ,mBAAUK,oBAAoBnB,mBAAoBiB,KAAMC,OAC7ErB,MAAK,IAAMW,eAAeJ,YAC1BN,MAAMsB"}
+8 -3
View File
@@ -99,6 +99,9 @@ const getTableNode = tableSelector => document.querySelector(tableSelector);
const fetchRecordingData = tableSelector => {
const tableNode = getTableNode(tableSelector);
if (tableNode === null) {
return Promise.resolve(false);
}
if (tableNode.dataset.importMode) {
return repository.fetchRecordingsToImport(
@@ -225,7 +228,7 @@ const getDataTableFunctions = (tableId, searchFormId, dataTable) => {
modal.show();
return modal;
}).catch(Notification.exception)
}).catch(displayException)
).then((proceed) =>
proceed ? repository.updateRecording(payload) : () => null
);
@@ -292,9 +295,8 @@ const getDataTableFunctions = (tableId, searchFormId, dataTable) => {
requestAction(clickedLink)
.then(refreshTableData)
.catch(displayException)
.then(iconPromise.resolve)
.catch();
.catch(displayException);
}
};
@@ -405,7 +407,10 @@ const setupDatatable = (tableId, searchFormId, response) => {
* @param {String} searchFormId The Id of the relate.
*/
export const init = (tableId, searchFormId) => {
const pendingPromise = new Pending('mod_bigbluebuttonbn/recordings:init');
fetchRecordingData(tableId)
.then(response => setupDatatable(tableId, searchFormId, response))
.then(() => pendingPromise.resolve())
.catch(displayException);
};
+7 -1
View File
@@ -21,6 +21,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import Pending from 'core/pending';
import Templates from "core/templates";
import {exception as displayException} from 'core/notification';
import {getMeetingInfo} from './repository';
@@ -93,11 +94,15 @@ const poll = () => {
*/
export const updateRoom = (updatecache = false) => {
const bbbRoomViewElement = document.getElementById('bbb-room-view');
if (!bbbRoomViewElement) {
if (bbbRoomViewElement === null) {
return Promise.resolve(false);
}
const bbbId = bbbRoomViewElement.dataset.bbbId;
const groupId = bbbRoomViewElement.dataset.groupId;
const pendingPromise = new Pending('mod_bigbluebuttonbn/roomupdater:updateRoom');
return getMeetingInfo(bbbId, groupId, updatecache)
.then(data => {
// Just make sure we have the right information for the template.
@@ -108,5 +113,6 @@ export const updateRoom = (updatecache = false) => {
return Templates.renderForPromise('mod_bigbluebuttonbn/room_view', data);
})
.then(({html, js}) => Templates.replaceNodeContents(bbbRoomViewElement, html, js))
.then(() => pendingPromise.resolve())
.catch(displayException);
};
@@ -36,16 +36,17 @@ Feature: bigbluebuttonbn instance
And I should see "Recordings"
Scenario: Add a Recording Only activity and check that no live session settings are available for this instance type
Given I am on the "Test course" "course" page logged in as "admin"
And I am on "Test course" course homepage with editing mode on
When I turn editing mode on
And I change window size to "large"
And I add a "BigBlueButton" to section "1"
When I select "Recordings only" from the "Instance type" singleselect
And I select "Recordings only" from the "Instance type" singleselect
Then I should not see "Lock settings"
Scenario Outline: Add an activity and check that required settings are available for the three types of instance types
When I turn editing mode on
And I change window size to "large"
And I add a "BigBlueButton" to section "1"
And I select "<type>" from the "Instance type" singleselect
And I select "<type>" from the "Instance type" singleselect
Then I should see "Restrict access"
Examples:
@@ -24,36 +24,25 @@ Feature: The recording can be managed through the room page
| RoomRecordings | Recording 3 | Description 3 | 0 |
| RoomRecordings | Recording 4 | Description 4 | 1 |
@javascript
Scenario: Recordings are not listed until the server informs that they are available
Given I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
And I should not see "Recording 3"
When the BigBlueButtonBN server has sent recording ready notifications
And I reload the page
And I should see "Recording 3"
@javascript
Scenario: Recordings are not listed until we can fetch their metadata, then they are listed
Given I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
# Recording 3 will be fetched and metadata will be present so, we will see it.
And I should not see "Recording 3"
And I should not see "Recording 4"
When the BigBlueButtonBN server has sent recording ready notifications
And I reload the page
Then I should see "Recording 3"
And I should not see "Recording 4"
@javascript
Scenario: I can see the recordings related to an activity
Given the BigBlueButtonBN server has sent recording ready notifications
When I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
Given I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
And "Recording 1" "table_row" should exist
And "Recording 2" "table_row" should exist
And "Recording 3" "table_row" should not exist
And "Recording 4" "table_row" should not exist
# Recording 3 will be fetched and metadata will be present so, we will see it.
When the BigBlueButtonBN server has sent recording ready notifications
And I run the scheduled task "mod_bigbluebuttonbn\task\check_pending_recordings"
And I reload the page
Then "Recording 1" "table_row" should exist
And "Recording 2" "table_row" should exist
And "Recording 3" "table_row" should exist
And "Recording 4" "table_row" should not exist
@javascript
Scenario: I can rename the recording
Given the BigBlueButtonBN server has sent recording ready notifications
And I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
Given I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
When I set the field "Edit name" in the "Recording 1" "table_row" to "Recording with an updated name 1"
Then I should see "Recording with an updated name 1"
And I should see "Recording 2"
@@ -63,8 +52,7 @@ Feature: The recording can be managed through the room page
@javascript
Scenario: I can set a new description for this recording
Given the BigBlueButtonBN server has sent recording ready notifications
And I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
Given I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
When I set the field "Edit description" in the "Recording 1" "table_row" to "This is a new recording description 1"
Then I should see "This is a new recording description 1"
And I should see "Description 2" in the "Recording 2" "table_row"
@@ -74,10 +62,8 @@ Feature: The recording can be managed through the room page
@javascript
Scenario: I can delete a recording
Given the BigBlueButtonBN server has sent recording ready notifications
And I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
Given I am on the "RoomRecordings" "bigbluebuttonbn activity" page logged in as admin
When I click on "a[data-action='delete']" "css_element" in the "Recording 1" "table_row"
And I wait until the page is ready
And I click on "OK" "button" in the "Confirm" "dialogue"
Then I should not see "Recording 1"
And I should see "Recording 2"