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

1 line
15 KiB
JavaScript
Raw Normal View History

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