tao-test/app/taoEventLog/views/js/loader/taoEventLog.min.js

19 lines
11 KiB
JavaScript

define("taoEventLog/controller/routes",[],function(){"use strict";return{TaoEventLog:{actions:{index:"controller/TaoEventLog/show"}}}}),define("tpl!taoEventLog/controller/TaoEventLog/show/layout",["handlebars"],function(hb){return hb.template(function(helper,depth0,helpers,partials,stack1){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,helper.helpers),stack1=stack1||{};var options,buffer="",functionType="function",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing
;return buffer+='<div class="log">\n <div class="grid-row">\n <div class="col-12">\n <section class="log-browser">\n <header>\n <h2>'+escapeExpression((options={hash:{},data:stack1},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Log watcher",options):helperMissing.call(depth0,"__","Log watcher",options)))+'</h2>\n <div class="header-buttons">\n <button class="btn-info export js-export"><span class="icon-export"></span>'+escapeExpression((options={hash:{},data:stack1},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Export log entries",
options):helperMissing.call(depth0,"__","Export log entries",options)))+'</button>\n </div>\n </header>\n <div class="log-table-filters"></div>\n <div class="log-table"></div>\n </section>\n </div>\n <div class="col-5">\n <section class="event-viewer hidden">\n <div class="grid-row">\n <div class="col-10">\n <h3>'+escapeExpression((options={hash:{},data:stack1},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Event",options):helperMissing.call(depth0,"__","Event",options))
)+' #<span class="id"></span></h3>\n </div>\n </div>\n\n ',!(stack1=helpers.each.call(depth0,depth0&&depth0.dataTypes,{hash:{},inverse:this.noop,fn:this.program(1,function(depth0,data){var stack1,helper,buffer="";return buffer+='\n\n <div class="grid-row">\n <div class="col-12">\n <strong>',stack1=(helper=helpers.title)||typeof(helper=depth0&&depth0.title)===functionType?helper.call(depth0,{hash:{},data:data}):helper,buffer+=escapeExpression(stack1
)+'</strong>\n </div>\n </div>\n <div class="grid-row">\n <div class="col-10 desc">\n <span class="',stack1=(helper=helpers.key)||typeof(helper=depth0&&depth0.key)===functionType?helper.call(depth0,{hash:{},data:data}):helper,buffer+=escapeExpression(stack1)+'"></span>\n </div>\n </div>\n\n '},stack1),data:stack1}))&&0!==stack1||(buffer+=stack1),buffer+="\n\n </section>\n </div>\n </div>\n</div>"})}),define("tpl!taoEventLog/components/export/templates/layout",["handlebars"
],function(hb){return hb.template(function(options,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,options.helpers),data=data||{};var helper,buffer="",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing;return buffer+='<div class="mp-export-modal">\n <h1>',buffer+=escapeExpression((helper=helpers.title)||"function"==typeof(helper=depth0&&depth0.title)?helper.call(depth0,{hash:{},data:data}):helper)+'</h1>\n <form class="grid-row js-export-form">\n <div class="col-12">\n <h2>'+escapeExpression((options={hash:{},data:data},(helper=helpers.__||depth0&&depth0.__
)?helper.call(depth0,"CSV Options",options):helperMissing.call(depth0,"__","CSV Options",options)))+'</h2>\n <div class="grid-row">\n <label class="col-5" for="field_delimiter">'+escapeExpression((options={hash:{},data:data},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Field delimiter",options):helperMissing.call(depth0,"__","Field delimiter",options)))+'</label>\n <input class="col-7" name="field_delimiter" id="field_delimiter" size="2" value=";" type="text">\n </div>\n <div class="grid-row">\n <label class="col-5" for="field_encloser">'+escapeExpression((options={
hash:{},data:data},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Field encloser",options):helperMissing.call(depth0,"__","Field encloser",options)))+'</label>\n <input class="col-7" name="field_encloser" size="2" value=\'"\' type="text">\n </div>\n <div class="grid-row">\n <label class="col-5" for="multi_values_delimiter">'+escapeExpression((options={hash:{},data:data},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Multiple values delimiter",options):helperMissing.call(depth0,"__","Multiple values delimiter",options))
)+'</label>\n <input class="col-7" name="multi_values_delimiter" size="2" value=\'|\' type="text">\n </div>\n <label class="grid-row">\n <div class="col-5">'+escapeExpression((options={hash:{},data:data},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"First row column names",options):helperMissing.call(depth0,"__","First row column names",options))
)+'</div>\n <div class="col-7">\n <input type="checkbox" name="first_row_column_names" checked>\n <span class="icon-checkbox"></span>\n </div>\n </label>\n <button type="submit" class="btn-success"><span class="icon-upload"></span>'+escapeExpression((options={hash:{},data:data},(helper=helpers.__||depth0&&depth0.__)?helper.call(depth0,"Export",options):helperMissing.call(depth0,"__","Export",options)))+"</button>\n </div>\n </form>\n</div>"})}),define("taoEventLog/components/export/exporter",["jquery","lodash","i18n","ui/component","ui/feedback",
"layout/loading-bar","tpl!taoEventLog/components/export/templates/layout","util/url","layout/logout-event","jquery.fileDownload"],function($,_,__,component,feedback,loadingBar,layoutTpl,url,logoutEvent){"use strict";return function(options){if(!_.isPlainObject(options)||!_.isString(options.exportUrl))throw new TypeError("The exporter must be configured with exportUrl option");return component({},{title:__("Export")}).setTemplate(layoutTpl).on("render",function(){var self=this,$form=self.$component.find(".js-export-form");$form.on("submit",function(exportUrl){exportUrl.preventDefault(),loadingBar.start();var params={};_.each($form.serializeArray(),function(
param){params[param.name]=param.value}),exportUrl=url.build(options.exportUrl,params),$.fileDownload(exportUrl,{successCallback:function(){loadingBar.stop(),self.$component.modal("close")},failCallback:function(response){loadingBar.stop();response=$.parseJSON($(response).text());response?feedback().error(new Error(response.message)):(self.$component.modal("close"),logoutEvent())}})})}).init(options)}}),define("taoEventLog/components/export/modalExporter",["jquery","lodash","i18n","ui/feedback","taoEventLog/components/export/exporter","ui/modal"],function($,_,__,feedback,exporter){"use strict";return function(options){var feedbackOptions={timeout:{warning:8e3
},encodeHtml:!1};return exporter(options).on("warning",function(err){feedback().warning(err,feedbackOptions)}).on("error",function(err){feedback().error(err,feedbackOptions)}).on("render",function(){var self=this;this.$component.addClass("modal").on("close.modal",function(){self.$component.modal("close")}).modal({width:600})}).render("body")}}),define("taoEventLog/controller/TaoEventLog/show",["jquery","lodash","i18n","util/url","ui/datatable","tpl!taoEventLog/controller/TaoEventLog/show/layout","taoEventLog/components/export/modalExporter","ui/dateRange/dateRange"],function($,_,__,url,datatable,layoutTpl,exporter,dateRangeFactory){"use strict"
;var listUrl=url.route("search","TaoEventLog","taoEventLog");return{start:function(){var $exportLink={dataTypes:[{key:"event_name",title:__("Event Name")},{key:"action",title:__("Action")},{key:"user_id",title:__("User ID")},{key:"user_roles",title:__("User Roles")},{key:"occurred",title:__("Occurred")},{key:"properties",title:__("Properties")}]},$layout=$(layoutTpl($exportLink)),$eventFilter=$(".log-browser .log-table-filters",$layout),$eventList=$(".log-browser .log-table",$layout),$eventViewer=$(".event-viewer",$layout),$exportLink=$(".js-export",$layout),filterRange=dateRangeFactory($eventFilter),currentFilter={filtercolumns:{}};filterRange.on(
"submit reset",function(){$eventList.datatable("options",{params:{periodStart:this.getStart(),periodEnd:this.getEnd()}}),$eventList.datatable("refresh")}),$exportLink.on("click",function(){currentFilter.filtercolumns=_.merge(currentFilter.filtercolumns,{from:filterRange.getStart(),to:filterRange.getEnd()}),exporter({title:__("Export Log Entries"),exportUrl:url.route("export","TaoEventLog","taoEventLog",currentFilter)})}),$(".content").append($layout),$eventList.datatable({url:listUrl,sortby:"occurred",sortorder:"desc",filter:!0,rowSelection:!0,filterStrategy:"multiple",model:[{id:"identifier",label:__("ID"),transform:function(id,row){return row.raw.id}},{
id:"event_name",label:__("Event Name"),sortable:!0,filterable:!0},{id:"action",label:__("Action"),sortable:!0,filterable:!0},{id:"user_id",label:__("User ID"),sortable:!0,filterable:!0},{id:"user_roles",label:__("User Roles"),sortable:!0,filterable:!0,transform:function(roles){var result,rolesArray=roles.split(", "),rolesCount=rolesArray.length;return 1<rolesCount?result=currentFilter.filtercolumns.user_roles&&(result=_.find(rolesArray,function(item){return-1<item.toLowerCase().indexOf(currentFilter.filtercolumns.user_roles.toLowerCase())}))?__("%s and %s roles",result,rolesCount-1):__("%s roles",rolesCount):1===rolesCount&&(result=roles),result}},{
id:"occurred",label:__("Occurred"),sortable:!0}],listeners:{selected:function(e,event){!function(event){var key,str;for(key in event)event.hasOwnProperty(key)&&("properties"===key?(null!==(str=JSON.parse(event[key]))&&"object"!=typeof str&&(str=JSON.parse(str)),str=JSON.stringify(str,null,2),$("."+key,$eventViewer).html("<pre>"+str+"</pre>")):"user_roles"===key?$("."+key,$eventViewer).html(event.user_roles.split(",").join("<br>")):$("."+key,$eventViewer).html(event[key]))}(event.raw),$eventViewer.is(".hidden")&&($layout.find(".col-12").removeClass("col-12").addClass("col-7"),$eventViewer.removeClass("hidden"))},filter:function(e,options){options.page=1},
query:function(e,ajaxConfig){currentFilter=_.pick(ajaxConfig&&ajaxConfig.data,["filterquery","filtercolumns","sortby","sortorder","sorttype"])}}})}}}),define("taoEventLog/loader/taoEventLog.bundle",function(){});
//# sourceMappingURL=taoEventLog.min.js.map