diff --git a/views/js/controller/DeliveryTool/launchQueue.js b/views/js/controller/DeliveryTool/launchQueue.js index 2685af96..360ea668 100644 --- a/views/js/controller/DeliveryTool/launchQueue.js +++ b/views/js/controller/DeliveryTool/launchQueue.js @@ -18,11 +18,10 @@ */ define([ - 'lodash', 'module', 'core/polling', 'core/request', -], function (_, module, polling, request) { +], function (module, polling, request) { 'use strict'; const _defaultConfig = { @@ -35,7 +34,11 @@ define([ return { start() { const { relaunchConfig = {} } = module.config(); - const { capacityCheckUrl, relaunchInterval, runUrl } = _.defaults(relaunchConfig, _defaultConfig); + const { + capacityCheckUrl = _defaultConfig.capacityCheckUrl, + relaunchInterval = _defaultConfig.relaunchInterval, + runUrl = _defaultConfig.runUrl + } = relaunchConfig; polling({ action: function () { diff --git a/views/js/loader/ltiDeliveryProvider.min.js b/views/js/loader/ltiDeliveryProvider.min.js index de285c64..7106ae30 100644 --- a/views/js/loader/ltiDeliveryProvider.min.js +++ b/views/js/loader/ltiDeliveryProvider.min.js @@ -1,2 +1,2 @@ -define("ltiDeliveryProvider/controller/DeliveryTool/launchQueue",["lodash","module","core/polling","core/request"],function(_,module,polling,request){"use strict";const _defaultConfig={relaunchInterval:30};return{start(){const{relaunchConfig={}}=module.config(),{capacityCheckUrl,relaunchInterval,runUrl}=_.defaults(relaunchConfig,_defaultConfig);polling({action:function(){const async=this.async();request({url:capacityCheckUrl,method:"GET",dataType:"json",noToken:!0}).then(_ref=>{let{status}=_ref;1==status?(async.reject(),window.location=runUrl):async.resolve()}).catch(()=>{async.resolve()})},interval:1e3*relaunchInterval,autoStart:!0})}}}),define("ltiDeliveryProvider/controller/routes",{DeliveryTool:{actions:{launchQueue:"controller/DeliveryTool/launchQueue"}}}),define("ltiDeliveryProvider/loader/ltiDeliveryProvider.bundle",function(){}); +define("ltiDeliveryProvider/controller/DeliveryTool/launchQueue",["module","core/polling","core/request"],function(module,polling,request){"use strict";const _defaultConfig={relaunchInterval:30};return{start(){const{relaunchConfig={}}=module.config(),{capacityCheckUrl=_defaultConfig.capacityCheckUrl,relaunchInterval=_defaultConfig.relaunchInterval,runUrl=_defaultConfig.runUrl}=relaunchConfig;polling({action:function(){const async=this.async();request({url:capacityCheckUrl,method:"GET",dataType:"json",noToken:!0}).then(_ref=>{let{status}=_ref;1==status?(async.reject(),window.location=runUrl):async.resolve()}).catch(()=>{async.resolve()})},interval:1e3*relaunchInterval,autoStart:!0})}}}),define("ltiDeliveryProvider/controller/routes",{DeliveryTool:{actions:{launchQueue:"controller/DeliveryTool/launchQueue"}}}),define("ltiDeliveryProvider/loader/ltiDeliveryProvider.bundle",function(){}); //# sourceMappingURL=ltiDeliveryProvider.min.js.map \ No newline at end of file diff --git a/views/js/loader/ltiDeliveryProvider.min.js.map b/views/js/loader/ltiDeliveryProvider.min.js.map index 85d45c45..b0d50087 100644 --- a/views/js/loader/ltiDeliveryProvider.min.js.map +++ b/views/js/loader/ltiDeliveryProvider.min.js.map @@ -1 +1 @@ -{"version":3,"names":["define","_","module","polling","request","_defaultConfig","relaunchInterval","start","relaunchConfig","config","capacityCheckUrl","runUrl","defaults","action","async","url","method","dataType","noToken","then","_ref","status","reject","window","location","resolve","catch","interval","autoStart","DeliveryTool","actions","launchQueue"],"sources":["../controller/DeliveryTool/launchQueue.js","../controller/routes.js","module-create.js"],"sourcesContent":["/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program 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 this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2017 (original work) Open Assessment Technologies SA;\n *\n */\n\ndefine('ltiDeliveryProvider/controller/DeliveryTool/launchQueue',[\n 'lodash',\n 'module',\n 'core/polling',\n 'core/request',\n], function (_, module, polling, request) {\n 'use strict';\n\n const _defaultConfig = {\n relaunchInterval: 30,\n };\n\n /**\n * @exports\n */\n return {\n start() {\n const { relaunchConfig = {} } = module.config();\n const { capacityCheckUrl, relaunchInterval, runUrl } = _.defaults(relaunchConfig, _defaultConfig);\n\n polling({\n action: function () {\n const async = this.async();\n\n request({\n url: capacityCheckUrl,\n method: 'GET',\n dataType: 'json',\n noToken: true,\n })\n .then(({ status }) => {\n if (status == 1) {\n async.reject();\n window.location = runUrl;\n } else {\n async.resolve();\n }\n })\n .catch(() => {\n async.resolve();\n });\n },\n interval: relaunchInterval * 1000,\n autoStart: true,\n });\n }\n };\n});\n\n","define('ltiDeliveryProvider/controller/routes',{\n 'DeliveryTool' : {\n 'actions' : {\n 'launchQueue' : 'controller/DeliveryTool/launchQueue'\n }\n }\n});\n\n","\ndefine(\"ltiDeliveryProvider/loader/ltiDeliveryProvider.bundle\", function(){});\n"],"mappings":"AAmBAA,MAAA,4DACA,SACA,SACA,eACA,eACA,UAAAC,CAAA,CAAAC,MAAA,CAAAC,OAAA,CAAAC,OAAA,EACA,aAEA,MAAAC,cAAA,EACAC,gBAAA,GACA,EAKA,OACAC,MAAA,OACA,CAAAC,cAAA,KAAAN,MAAA,CAAAO,MAAA,GACA,CAAAC,gBAAA,CAAAJ,gBAAA,CAAAK,MAAA,EAAAV,CAAA,CAAAW,QAAA,CAAAJ,cAAA,CAAAH,cAAA,EAEAF,OAAA,EACAU,MAAA,SAAAA,CAAA,EACA,MAAAC,KAAA,MAAAA,KAAA,GAEAV,OAAA,EACAW,GAAA,CAAAL,gBAAA,CACAM,MAAA,OACAC,QAAA,QACAC,OAAA,GACA,GACAC,IAAA,CAAAC,IAAA,OAAAC,MAAA,EAAAD,IAAA,CACA,GAAAC,MAAA,EACAP,KAAA,CAAAQ,MAAA,GACAC,MAAA,CAAAC,QAAA,CAAAb,MAAA,EAEAG,KAAA,CAAAW,OAAA,EAEA,GACAC,KAAA,MACAZ,KAAA,CAAAW,OAAA,EACA,EACA,EACAE,QAAA,KAAArB,gBAAA,CACAsB,SAAA,GACA,EACA,CACA,CACA,GAEA5B,MCpEA,0CACA6B,YAAA,EACAC,OAAA,EACAC,WAAA,sCACA,CACA,CACA,GCLA/B,MAAA"} \ No newline at end of file +{"version":3,"names":["define","module","polling","request","_defaultConfig","relaunchInterval","start","relaunchConfig","config","capacityCheckUrl","runUrl","action","async","url","method","dataType","noToken","then","_ref","status","reject","window","location","resolve","catch","interval","autoStart","DeliveryTool","actions","launchQueue"],"sources":["../controller/DeliveryTool/launchQueue.js","../controller/routes.js","module-create.js"],"sourcesContent":["/**\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; under version 2\n * of the License (non-upgradable).\n *\n * This program 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 this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n *\n * Copyright (c) 2017 (original work) Open Assessment Technologies SA;\n *\n */\n\ndefine('ltiDeliveryProvider/controller/DeliveryTool/launchQueue',[\n 'module',\n 'core/polling',\n 'core/request',\n], function (module, polling, request) {\n 'use strict';\n\n const _defaultConfig = {\n relaunchInterval: 30,\n };\n\n /**\n * @exports\n */\n return {\n start() {\n const { relaunchConfig = {} } = module.config();\n const {\n capacityCheckUrl = _defaultConfig.capacityCheckUrl,\n relaunchInterval = _defaultConfig.relaunchInterval,\n runUrl = _defaultConfig.runUrl\n } = relaunchConfig;\n\n polling({\n action: function () {\n const async = this.async();\n\n request({\n url: capacityCheckUrl,\n method: 'GET',\n dataType: 'json',\n noToken: true,\n })\n .then(({ status }) => {\n if (status == 1) {\n async.reject();\n window.location = runUrl;\n } else {\n async.resolve();\n }\n })\n .catch(() => {\n async.resolve();\n });\n },\n interval: relaunchInterval * 1000,\n autoStart: true,\n });\n }\n };\n});\n\n","define('ltiDeliveryProvider/controller/routes',{\n 'DeliveryTool' : {\n 'actions' : {\n 'launchQueue' : 'controller/DeliveryTool/launchQueue'\n }\n }\n});\n\n","\ndefine(\"ltiDeliveryProvider/loader/ltiDeliveryProvider.bundle\", function(){});\n"],"mappings":"AAmBAA,MAAA,4DACA,SACA,eACA,eACA,UAAAC,MAAA,CAAAC,OAAA,CAAAC,OAAA,EACA,aAEA,MAAAC,cAAA,EACAC,gBAAA,GACA,EAKA,OACAC,MAAA,OACA,CAAAC,cAAA,KAAAN,MAAA,CAAAO,MAAA,GACA,CACAC,gBAAA,CAAAL,cAAA,CAAAK,gBAAA,CACAJ,gBAAA,CAAAD,cAAA,CAAAC,gBAAA,CACAK,MAAA,CAAAN,cAAA,CAAAM,MACA,EAAAH,cAAA,CAEAL,OAAA,EACAS,MAAA,SAAAA,CAAA,EACA,MAAAC,KAAA,MAAAA,KAAA,GAEAT,OAAA,EACAU,GAAA,CAAAJ,gBAAA,CACAK,MAAA,OACAC,QAAA,QACAC,OAAA,GACA,GACAC,IAAA,CAAAC,IAAA,OAAAC,MAAA,EAAAD,IAAA,CACA,GAAAC,MAAA,EACAP,KAAA,CAAAQ,MAAA,GACAC,MAAA,CAAAC,QAAA,CAAAZ,MAAA,EAEAE,KAAA,CAAAW,OAAA,EAEA,GACAC,KAAA,MACAZ,KAAA,CAAAW,OAAA,EACA,EACA,EACAE,QAAA,KAAApB,gBAAA,CACAqB,SAAA,GACA,EACA,CACA,CACA,GAEA1B,MCvEA,0CACA2B,YAAA,EACAC,OAAA,EACAC,WAAA,sCACA,CACA,CACA,GCLA7B,MAAA"} \ No newline at end of file