From d3f134a0e82e20e89d46fc4d9990e350ebbb45e0 Mon Sep 17 00:00:00 2001 From: Pawel Korczak Date: Tue, 17 Oct 2023 08:13:41 +0200 Subject: [PATCH 1/2] feature: remove lodash --- views/js/provider/group.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/js/provider/group.js b/views/js/provider/group.js index 497a2ea..f7f72b2 100644 --- a/views/js/provider/group.js +++ b/views/js/provider/group.js @@ -18,7 +18,7 @@ * @author Alexander Zagovorichev */ -define(['jquery', 'lodash', 'i18n', 'util/url', 'core/promise', 'core/request'], function ($, _, __, urlUtil, Promise, coreRequest) { +define(['jquery', 'i18n', 'util/url', 'core/promise', 'core/request'], function ($, __, urlUtil, Promise, coreRequest) { 'use strict'; /** @@ -52,7 +52,7 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'core/promise', 'core/request'], type: 'instance' }; - config = _.defaults(config || {}, _defaults); + config = Object.assign({}, _defaults, config); return new Promise((resolve, reject) => { coreRequest({ @@ -80,7 +80,7 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'core/promise', 'core/request'], return new Promise((resolve, reject) => { - if (!_.isString(uri) || _.isEmpty(uri)) { + if (typeof uri !== 'string' || uri.trim() === '') { return reject(new TypeError(__('Group uri is not valid'))); } From 9c00de4405a4368cd3692b00645d93ff06201934 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 1 Feb 2024 18:36:06 +0100 Subject: [PATCH 2/2] chore: bundle assets --- views/js/loader/taoGroups.min.js | 2 +- views/js/loader/taoGroups.min.js.map | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/views/js/loader/taoGroups.min.js b/views/js/loader/taoGroups.min.js index 6f2453f..182b6e3 100644 --- a/views/js/loader/taoGroups.min.js +++ b/views/js/loader/taoGroups.min.js @@ -1,2 +1,2 @@ -define("taoGroups/controller/routes",[],function(){"use strict";return{}}),define("taoGroups/provider/group",["jquery","lodash","i18n","util/url","core/promise","core/request"],function($,_,__,urlUtil,Promise,coreRequest){"use strict";return function groupProviderFactory(){return{addInstance(config){const _defaults={classUri:"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOGroup_0_rdf_3_Group",id:"http://www.tao.lu/Ontologies/TAOGroup.rdf#Group",type:"instance"};return config=_.defaults(config||{},_defaults),new Promise((resolve,reject)=>{coreRequest({url:urlUtil.route("addInstance","Groups","taoGroups"),method:"POST",data:config,dataType:"json"}).then(function(group){resolve(group)}).catch(function(){reject(new Error(__("Unable to create new group")))})})},deleteGroup(uri){return new Promise((resolve,reject)=>!_.isString(uri)||_.isEmpty(uri)?reject(new TypeError(__("Group uri is not valid"))):void coreRequest({url:urlUtil.route("delete","Groups","taoGroups"),method:"POST",data:{uri:uri},dataType:"json"}).then(function(response){resolve(response)}).catch(function(){reject(new Error(__("Unable to delete group")))}))}}}}),define("taoGroups/loader/taoGroups.bundle",function(){}); +define("taoGroups/controller/routes",[],function(){"use strict";return{}}),define("taoGroups/provider/group",["jquery","i18n","util/url","core/promise","core/request"],function($,__,urlUtil,Promise,coreRequest){"use strict";return function groupProviderFactory(){return{addInstance(config){const _defaults={classUri:"http_2_www_0_tao_0_lu_1_Ontologies_1_TAOGroup_0_rdf_3_Group",id:"http://www.tao.lu/Ontologies/TAOGroup.rdf#Group",type:"instance"};return config=Object.assign({},_defaults,config),new Promise((resolve,reject)=>{coreRequest({url:urlUtil.route("addInstance","Groups","taoGroups"),method:"POST",data:config,dataType:"json"}).then(function(group){resolve(group)}).catch(function(){reject(new Error(__("Unable to create new group")))})})},deleteGroup(uri){return new Promise((resolve,reject)=>"string"!=typeof uri||""===uri.trim()?reject(new TypeError(__("Group uri is not valid"))):void coreRequest({url:urlUtil.route("delete","Groups","taoGroups"),method:"POST",data:{uri:uri},dataType:"json"}).then(function(response){resolve(response)}).catch(function(){reject(new Error(__("Unable to delete group")))}))}}}}),define("taoGroups/loader/taoGroups.bundle",function(){}); //# sourceMappingURL=taoGroups.min.js.map \ No newline at end of file diff --git a/views/js/loader/taoGroups.min.js.map b/views/js/loader/taoGroups.min.js.map index 8886f98..7ccb048 100644 --- a/views/js/loader/taoGroups.min.js.map +++ b/views/js/loader/taoGroups.min.js.map @@ -1 +1 @@ -{"version":3,"names":["define","$","_","__","urlUtil","Promise","coreRequest","groupProviderFactory","addInstance","config","_defaults","classUri","id","type","defaults","resolve","reject","url","route","method","data","dataType","then","group","catch","Error","deleteGroup","uri","isString","isEmpty","TypeError","response"],"sources":["../controller/routes.js","../provider/group.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) 2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);\n * \n * \n */\n\n//@see http://forge.taotesting.com/projects/tao/wiki/Front_js\ndefine('taoGroups/controller/routes',[],function(){\n 'use strict';\n\n return {\n };\n});\n\n","/**\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-2019 (original work) Open Assessment Technologies SA;\n *\n * @author Alexander Zagovorichev \n */\n\ndefine('taoGroups/provider/group',['jquery', 'lodash', 'i18n', 'util/url', 'core/promise', 'core/request'], function ($, _, __, urlUtil, Promise, coreRequest) {\n 'use strict';\n\n /**\n * Creates a group provider\n *\n * @typedef {Object} groupProvider\n * @type {{addInstance: groupProvider.addInstance}}\n */\n return function groupProviderFactory () {\n\n /**\n * @returns {groupProvider}\n */\n return {\n\n /**\n * Create new group\n *\n * @param config\n * @param {String} [config.classUri] - rdf uri of the Group for current environment\n * @param {String} [config.id] - id of the Group for current environment\n * @param {String} [config.signature] - id signature received from BE, required\n * @param {String} [config.type] - Type of the instance\n * @return {*}\n */\n addInstance (config) {\n\n const _defaults = {\n classUri: 'http_2_www_0_tao_0_lu_1_Ontologies_1_TAOGroup_0_rdf_3_Group',\n id: 'http://www.tao.lu/Ontologies/TAOGroup.rdf#Group',\n type: 'instance'\n };\n\n config = _.defaults(config || {}, _defaults);\n\n return new Promise((resolve, reject) => {\n coreRequest({\n url: urlUtil.route('addInstance', 'Groups', 'taoGroups'),\n method: 'POST',\n data: config,\n dataType: 'json',\n })\n .then(function (group) {\n resolve(group);\n })\n .catch(function () {\n reject(new Error(__('Unable to create new group')));\n });\n });\n },\n\n /**\n * Group deleting\n *\n * @param uri\n * @return {*}\n */\n deleteGroup (uri) {\n\n return new Promise((resolve, reject) => {\n\n if (!_.isString(uri) || _.isEmpty(uri)) {\n return reject(new TypeError(__('Group uri is not valid')));\n }\n\n coreRequest({\n url: urlUtil.route('delete', 'Groups', 'taoGroups'),\n method: 'POST',\n data: {uri: uri},\n dataType: 'json',\n })\n .then(function (response) {\n resolve(response);\n })\n .catch(function () {\n reject(new Error(__('Unable to delete group')));\n });\n });\n }\n };\n };\n});\n\n","\ndefine(\"taoGroups/loader/taoGroups.bundle\", function(){});\n"],"mappings":"AAqBAA,MAAA,6CACA,aAEA,OACA,CACA,GCNAA,MAAA,yGAAAC,CAAA,CAAAC,CAAA,CAAAC,EAAA,CAAAC,OAAA,CAAAC,OAAA,CAAAC,WAAA,EACA,aAQA,gBAAAC,qBAAA,EAKA,OAYAC,YAAAC,MAAA,EAEA,MAAAC,SAAA,EACAC,QAAA,+DACAC,EAAA,mDACAC,IAAA,WACA,EAIA,MAFA,CAAAJ,MAAA,CAAAP,CAAA,CAAAY,QAAA,CAAAL,MAAA,KAAAC,SAAA,EAEA,IAAAL,OAAA,EAAAU,OAAA,CAAAC,MAAA,IACAV,WAAA,EACAW,GAAA,CAAAb,OAAA,CAAAc,KAAA,qCACAC,MAAA,QACAC,IAAA,CAAAX,MAAA,CACAY,QAAA,OACA,GACAC,IAAA,UAAAC,KAAA,EACAR,OAAA,CAAAQ,KAAA,CACA,GACAC,KAAA,YACAR,MAAA,KAAAS,KAAA,CAAAtB,EAAA,gCACA,EACA,EACA,EAQAuB,YAAAC,GAAA,EAEA,WAAAtB,OAAA,EAAAU,OAAA,CAAAC,MAAA,GAEA,CAAAd,CAAA,CAAA0B,QAAA,CAAAD,GAAA,GAAAzB,CAAA,CAAA2B,OAAA,CAAAF,GAAA,EACAX,MAAA,KAAAc,SAAA,CAAA3B,EAAA,iCAGA,CAAAG,WAAA,EACAW,GAAA,CAAAb,OAAA,CAAAc,KAAA,gCACAC,MAAA,QACAC,IAAA,EAAAO,GAAA,CAAAA,GAAA,EACAN,QAAA,OACA,GACAC,IAAA,UAAAS,QAAA,EACAhB,OAAA,CAAAgB,QAAA,CACA,GACAP,KAAA,YACAR,MAAA,KAAAS,KAAA,CAAAtB,EAAA,4BACA,EACA,CACA,CACA,CACA,CACA,GCrGAH,MAAA"} \ No newline at end of file +{"version":3,"names":["define","$","__","urlUtil","Promise","coreRequest","groupProviderFactory","addInstance","config","_defaults","classUri","id","type","Object","assign","resolve","reject","url","route","method","data","dataType","then","group","catch","Error","deleteGroup","uri","trim","TypeError","response"],"sources":["../controller/routes.js","../provider/group.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) 2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);\n * \n * \n */\n\n//@see http://forge.taotesting.com/projects/tao/wiki/Front_js\ndefine('taoGroups/controller/routes',[],function(){\n 'use strict';\n\n return {\n };\n});\n\n","/**\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-2019 (original work) Open Assessment Technologies SA;\n *\n * @author Alexander Zagovorichev \n */\n\ndefine('taoGroups/provider/group',['jquery', 'i18n', 'util/url', 'core/promise', 'core/request'], function ($, __, urlUtil, Promise, coreRequest) {\n 'use strict';\n\n /**\n * Creates a group provider\n *\n * @typedef {Object} groupProvider\n * @type {{addInstance: groupProvider.addInstance}}\n */\n return function groupProviderFactory () {\n\n /**\n * @returns {groupProvider}\n */\n return {\n\n /**\n * Create new group\n *\n * @param config\n * @param {String} [config.classUri] - rdf uri of the Group for current environment\n * @param {String} [config.id] - id of the Group for current environment\n * @param {String} [config.signature] - id signature received from BE, required\n * @param {String} [config.type] - Type of the instance\n * @return {*}\n */\n addInstance (config) {\n\n const _defaults = {\n classUri: 'http_2_www_0_tao_0_lu_1_Ontologies_1_TAOGroup_0_rdf_3_Group',\n id: 'http://www.tao.lu/Ontologies/TAOGroup.rdf#Group',\n type: 'instance'\n };\n\n config = Object.assign({}, _defaults, config);\n\n return new Promise((resolve, reject) => {\n coreRequest({\n url: urlUtil.route('addInstance', 'Groups', 'taoGroups'),\n method: 'POST',\n data: config,\n dataType: 'json',\n })\n .then(function (group) {\n resolve(group);\n })\n .catch(function () {\n reject(new Error(__('Unable to create new group')));\n });\n });\n },\n\n /**\n * Group deleting\n *\n * @param uri\n * @return {*}\n */\n deleteGroup (uri) {\n\n return new Promise((resolve, reject) => {\n\n if (typeof uri !== 'string' || uri.trim() === '') {\n return reject(new TypeError(__('Group uri is not valid')));\n }\n\n coreRequest({\n url: urlUtil.route('delete', 'Groups', 'taoGroups'),\n method: 'POST',\n data: {uri: uri},\n dataType: 'json',\n })\n .then(function (response) {\n resolve(response);\n })\n .catch(function () {\n reject(new Error(__('Unable to delete group')));\n });\n });\n }\n };\n };\n});\n\n","\ndefine(\"taoGroups/loader/taoGroups.bundle\", function(){});\n"],"mappings":"AAqBAA,MAAA,6CACA,aAEA,OACA,CACA,GCNAA,MAAA,gGAAAC,CAAA,CAAAC,EAAA,CAAAC,OAAA,CAAAC,OAAA,CAAAC,WAAA,EACA,aAQA,gBAAAC,qBAAA,EAKA,OAYAC,YAAAC,MAAA,EAEA,MAAAC,SAAA,EACAC,QAAA,+DACAC,EAAA,mDACAC,IAAA,WACA,EAIA,MAFA,CAAAJ,MAAA,CAAAK,MAAA,CAAAC,MAAA,IAAAL,SAAA,CAAAD,MAAA,EAEA,IAAAJ,OAAA,EAAAW,OAAA,CAAAC,MAAA,IACAX,WAAA,EACAY,GAAA,CAAAd,OAAA,CAAAe,KAAA,qCACAC,MAAA,QACAC,IAAA,CAAAZ,MAAA,CACAa,QAAA,OACA,GACAC,IAAA,UAAAC,KAAA,EACAR,OAAA,CAAAQ,KAAA,CACA,GACAC,KAAA,YACAR,MAAA,KAAAS,KAAA,CAAAvB,EAAA,gCACA,EACA,EACA,EAQAwB,YAAAC,GAAA,EAEA,WAAAvB,OAAA,EAAAW,OAAA,CAAAC,MAAA,GAEA,iBAAAW,GAAA,OAAAA,GAAA,CAAAC,IAAA,GACAZ,MAAA,KAAAa,SAAA,CAAA3B,EAAA,iCAGA,CAAAG,WAAA,EACAY,GAAA,CAAAd,OAAA,CAAAe,KAAA,gCACAC,MAAA,QACAC,IAAA,EAAAO,GAAA,CAAAA,GAAA,EACAN,QAAA,OACA,GACAC,IAAA,UAAAQ,QAAA,EACAf,OAAA,CAAAe,QAAA,CACA,GACAN,KAAA,YACAR,MAAA,KAAAS,KAAA,CAAAvB,EAAA,4BACA,EACA,CACA,CACA,CACA,CACA,GCrGAF,MAAA"} \ No newline at end of file