%PDF- %PDF-
Direktori : /home/vacivi36/ava/report/insights/amd/build/ |
Current File : /home/vacivi36/ava/report/insights/amd/build/actions.min.js.map |
{"version":3,"file":"actions.min.js","sources":["../src/actions.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 * Module to manage report insights actions that are executed using AJAX.\n *\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * This module manages prediction actions that require AJAX requests.\n *\n * @module report_insights/actions\n */\ndefine(['jquery', 'core/str', 'core/ajax', 'core/notification', 'core/url', 'core/modal_factory', 'core/modal_events'],\n function($, Str, Ajax, Notification, Url, ModalFactory, ModalEvents) {\n\n return {\n\n /**\n * Attach on click handlers for bulk actions.\n *\n * @param {String} rootNode\n * @access public\n */\n initBulk: function(rootNode) {\n\n /**\n * Executes the provided action.\n *\n * @param {Array} predictionIds\n * @param {Array} predictionContainers\n * @param {String} actionName\n * @return {Promise}\n */\n var executeAction = function(predictionIds, predictionContainers, actionName) {\n\n return Ajax.call([\n {\n methodname: 'report_insights_action_executed',\n args: {\n predictionids: predictionIds,\n actionname: actionName\n }\n }\n ])[0].then(function() {\n // Remove the selected elements from the list.\n\n var tableNode = false;\n predictionContainers.forEach(function(el) {\n if (tableNode === false) {\n tableNode = el.closest('table');\n }\n el.remove();\n });\n\n if (tableNode.find('tbody > tr').length === 0) {\n let params = {\n contextid: tableNode.closest('div.insight-container').data('context-id'),\n modelid: tableNode.closest('div.insight-container').data('model-id')\n };\n window.location.assign(Url.relativeUrl(\"report/insights/insights.php\", params, false));\n }\n return;\n }).catch(Notification.exception);\n };\n\n $(rootNode + ' [data-bulk-actionname]').on('click', function(e) {\n e.preventDefault();\n var action = $(e.currentTarget);\n var actionName = action.data('bulk-actionname');\n var actionVisibleName = action.text().trim();\n\n var predictionIds = [];\n var predictionContainers = [];\n\n $('.insights-list input[data-togglegroup^=\"insight-bulk-action-\"][data-toggle=\"slave\"]:checked').each(function() {\n var container = $(this).closest('tr[data-prediction-id]');\n predictionContainers.push(container);\n predictionIds.push(container.data('prediction-id'));\n });\n\n if (predictionIds.length === 0) {\n // No items selected message.\n return this;\n }\n\n var strings = [];\n Str.get_strings([{\n key: 'confirmbulkaction',\n component: 'report_insights',\n param: {\n action: actionVisibleName,\n nitems: predictionIds.length\n }\n }, {\n key: 'confirm',\n component: 'moodle'\n }]\n ).then(function(strs) {\n strings = strs;\n return ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: actionVisibleName,\n body: strings[0],\n });\n }).then(function(modal) {\n modal.setSaveButtonText(strings[1]);\n modal.show();\n modal.getRoot().on(ModalEvents.save, function() {\n // The action is now confirmed, sending an action for it.\n return executeAction(predictionIds, predictionContainers, actionName);\n });\n\n return modal;\n }).catch(Notification.exception);\n\n return this;\n });\n },\n };\n});\n"],"names":["define","$","Str","Ajax","Notification","Url","ModalFactory","ModalEvents","initBulk","rootNode","on","e","preventDefault","action","currentTarget","actionName","data","actionVisibleName","text","trim","predictionIds","predictionContainers","each","container","this","closest","push","length","strings","get_strings","key","component","param","nitems","then","strs","create","type","types","SAVE_CANCEL","title","body","modal","setSaveButtonText","show","getRoot","save","call","methodname","args","predictionids","actionname","tableNode","forEach","el","remove","find","params","contextid","modelid","window","location","assign","relativeUrl","catch","exception","executeAction"],"mappings":";;;;;;AA2BAA,iCAAO,CAAC,SAAU,WAAY,YAAa,oBAAqB,WAAY,qBAAsB,sBAC1F,SAASC,EAAGC,IAAKC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