lemonldap-ng/lemonldap-ng-manager/site/htdocs/static/js/manager.min.js

1 line
15 KiB
JavaScript
Raw Normal View History

2020-05-06 15:31:10 +02:00
(function(){angular.module("llngManager",["ui.tree","ui.bootstrap","llApp","ngCookies"]).controller("TreeCtrl",["$scope","$http","$location","$q","$uibModal","$translator","$cookies","$htmlParams",function(f,u,a,l,o,n,r,e){var t,s,d,c,i,p,m,g,h;return f.links=window.links,f.menu=e.menu,f.menulinks=window.menulinks,f.staticPrefix=window.staticPrefix,f.formPrefix=window.formPrefix,f.availableLanguages=window.availableLanguages,f.waiting=!0,f.showM=!1,f.showT=!1,f.form="home",f.currentCfg={},f.confPrefix=window.confPrefix,f.message={},f.result="",f.translateTitle=function(e){return n.translateField(e,"title")},f.translateP=n.translateP,f.translate=n.translate,f.helpUrl="start.html#configuration",f.setShowHelp=function(e){var t;return null==e&&(e=!f.showH),f.showH=e,(t=new Date(Date.now())).setFullYear(t.getFullYear()+1),r.put("showhelp",e?"true":"false",{expires:t})},f.showH="false"!==r.get("showhelp"),null==f.showH&&f.setShowHelp(!0),m=function(e){var t,n;return t=e.status,n=e.statusLine,f.waiting=!1,403===t?f.message={title:"forbidden",message:"",items:[]}:401===t?(console.log("Authentication needed"),f.message={title:"authenticationNeeded",message:"__waitOrF5__",items:[]}):f.message=400===t||0<t?{title:"badRequest",message:n,items:[]}:{title:"networkProblem",message:"",items:[]},f.showModal("message.html")},f.showModal=function(e,t){var n,r;return r=o.open({templateUrl:e,controller:"ModalInstanceCtrl",size:"lg",resolve:{elem:function(){return function(e){return f[e]}},set:function(){return function(e,t){return f[e]=t}},init:function(){return t}}}),n=l.defer(),r.result.then(function(e){return f.message={title:"",message:"",items:[]},n.resolve(e)},function(e){return f.message={title:"",message:"",items:[]},n.reject(e)}),n.promise},f.menuClick=function(e){if(e.popup)window.open(e.popup);else switch(e.action||(e.action=e.title),typeof e.action){case"function":e.action(f.currentNode,f);break;case"string":f[e.action]();break;default:console.log(typeof e.action)}return f.showM=!1},f.home=function(){return f.form="home",f.showM=!1},t=function(e){var t;if(f.message={title:"",message:"",items:[],itemsE:[],itemsNC:[],itemsW:[]},e.needConfirm&&(f.confirmNeeded=!0),e.message&&(f.message.message=e.message),e.details){for(t in e.details)"__changes__"!==t&&("__needConfirmation__"===t?(f.message.itemsNC.push({message:t,items:e.details[t]}),console.log("NeedConfirmation:",f.message.itemsNC)):"__warnings__"===t?(f.message.itemsW.push({message:t,items:e.details[t]}),console.log("Warnings:",f.message.itemsW)):(f.message.itemsE.push({message:t,items:e.details[t]}),console.log("Errors:",f.message.itemsE)));f.message.items=f.message.itemsE.concat(f.message.itemsNC.concat(f.message.itemsW))}return f.waiting=!1,1===e.result?(a.path("/confs/"),f.message.title="successfullySaved"):f.message.title="saveReport",f.showModal("message.html")},f.downloadConf=function(){return window.open(f.confPrefix+f.currentCfg.cfgNum+"?full=1")},f.save=function(){return f.showModal("save.html").then(function(){return f.waiting=!0,f.data.push({id:"cfgLog",title:"cfgLog",data:f.result?f.result:""}),u.post(window.confPrefix+"?cfgNum="+f.currentCfg.cfgNum+(f.forceSave?"&force=1":""),f.data).then(function(e){return f.data.pop(),t(e.data)},function(e){return m(e),f.data.pop()})},function(){return console.log("Saving canceled")}),f.showM=!1},f.saveRawConf=function(e){return f.waiting=!0,u.post(window.confPrefix+"/raw",e).then(function(e){return t(e.data)},m)},f.restore=function(){return f.currentNode=null,f.form="restore"},f.cancel=function(){return f.currentNode.data=null,f.getKey(f.currentNode)},i=1,f._findContainer=function(){return f._findScopeContainer().$modelValue},f._findScopeContainer=function(){var e;for(e=f.currentScope;!e.$modelValue.type.match(/Container$/);)e=e.$parentNodeScope;return e},f._findScopeByKey=function(e){var t;for(t=f.currentScope;t.$modelValue.title!==e;)t=t.$parentNodeScope;return t},f.newGrantRule=function(){var e,t;return e=(t=f._findContainer()).nodes.length,t.nodes.push({id:t.id+"/n"+i++,title:"New rule",re:"Message",comment:"New rule",data: