getColumns : function()

in security-admin/src/main/webapp/scripts/views/reports/AuditLayout.js [1281:1529]


		getColumns : function(){
			var that = this;
			var cols = {
					policyId : {
                                                // cell : "html",
                                                cell: Backgrid.HtmlCell.extend({
                                                        className : 'policyIdColumn'
                                                }),
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
								var serviceDef = that.serviceDefList.findWhere({'id' : model.get('repoType')}),
								href = 'javascript:void(0)';
								if(rawValue == -1 || _.isUndefined(serviceDef)){
									return '--';
								}
								return '<a href="'+href+'" title="'+rawValue+'">'+rawValue+'</a>';
							}
						}),
						label	: localization.tt("lbl.policyId"),
						editable: false,
						sortable : true,
						sortType: 'toggle',
					},
                    policyVersion: {
                        label : localization.tt("lbl.policyVersion"),
                        cell: "html",
                        click: false,
                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                            fromRaw: function (rawValue, model) {
                                rawValue = _.escape(rawValue);
                                    if(_.isUndefined(rawValue) || _.isEmpty(rawValue)) {
                                        return '--'
                                    } else {
                                        return '<span title="'+rawValue+'">'+rawValue+'</span>';
                                    }
                                }
                            }),
                          drag: false,
                          sortable: false,
                          editable: false,
                    },
					eventTime : {
						label : 'Event Time',
						cell: "String",
						editable:false,
						sortable : true,
						direction: "descending",
                        sortType: 'toggle',
                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
								return Globalize.format(new Date(rawValue),  "MM/dd/yyyy hh:mm:ss tt");
							}
						})
					},
				    agentId : {
					label : 'Application',
					cell: "String",
					click : false,
					drag : false,
                                        editable:false,
                    sortable : false,
				},
					requestUser : {
						label : 'User',
						cell: "String",
						click : false,
						drag : false,
                                                editable:false,
                        sortable : true,
                        sortType: 'toggle',
					},
					repoName : {
						label : 'Service (Name / Type)',
						cell: "html",
						click : false,
						drag : false,
						sortable:false,
						editable:false,
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
                                                                return '<div title="'+model.get('repoDisplayName')+'">'+_.escape(model.get('repoDisplayName'))+'</div>\
                                    <div title="'+model.get('serviceTypeDisplayName')+'" style="border-top: 1px solid #ddd;">'+_.escape(model.get('serviceTypeDisplayName'))+'</div>';
							}
						})
					},
					resourceType: {
						label : 'Resource (Name / Type)',
						cell: "html",
						formatter: _.extend({},Backgrid.CellFormatter.prototype,{
							 fromRaw: function(rawValue,model) {
							     return XAViewUtils.resourceTypeFormatter(rawValue, model);
							 }
						}),
						drag: false,
						sortable: true,
						sortType: 'toggle',
						editable: false,
					},
					accessType : {
						label : localization.tt("lbl.accessType"),
						cell: "String",
						drag : false,
						sortable:true,
						sortType: 'toggle',
						editable:false
					},
					action : {
						label : localization.tt("lbl.permission"),
						cell: "html",
						drag : false,
						editable:false,
						sortable : true,
						sortType: 'toggle',
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw : function (rawValue, model) {
								rawValue = _.escape(rawValue);
								if(_.isUndefined(rawValue) || _.isEmpty(rawValue)){
									return '<center>--</center>';
								}else{
									return '<span  class="badge badge-info" title="'+rawValue+'">'+rawValue+'</span>';
								}
							}
						})
					},
					accessResult : {
						label : localization.tt("lbl.result"),
						cell: "html",
						click : false,
						drag : false,
						editable:false,
                        sortable : false,
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue) {
								var label = '', html = '';
								_.each(_.toArray(XAEnums.AccessResult),function(m){
									if(parseInt(rawValue) == m.value){
										label=  m.label;
										if(m.value == XAEnums.AccessResult.ACCESS_RESULT_ALLOWED.value){
											html = 	'<label class="badge badge-success">'+label+'</label>';
										} else {
											html = 	'<label class="badge badge-danger">'+label+'</label>';
										} 
									}	
								});
								return html;
							}
						})
					},
					aclEnforcer : {
						label :localization.tt("lbl.aclEnforcer"),
						cell: "String",
						drag : false,
						sortable:true,
						sortType: 'toggle',
						editable:false
					},
					agentHost : {
						cell : 'html',
						label : localization.tt("lbl.agentHost"),
						editable : false,
						sortable : false,
						formatter : _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw : function (rawValue, model) {
								rawValue = _.escape(rawValue);
								if(_.isUndefined(rawValue)){
									return '<center>--</center>';
								}else{
									return '<span title="'+rawValue+'">'+rawValue+'</span>';
								}
							}
						}),
					},
					clientIP : {
						label : 'Client IP',
						cell: "string",
						drag : false,
						sortable:true,
						sortType: 'toggle',
						editable:false
					},
                    clusterName : {
                        label : localization.tt("lbl.clusterName"),
                        cell: 'html',
                        click : false,
                        drag : false,
                        sortable:false,
                        editable:false,
                        formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                                fromRaw: function (rawValue, model) {
                                    rawValue = _.escape(rawValue);
                                    if (_.isUndefined(rawValue) || _.isEmpty(rawValue)) {
                                        '--'
                                    } else {
                                        return '<span title="'+rawValue+'">'+rawValue+'</span>';
                                    }
                                }
                        }),
					},
                    zoneName: {
						label : localization.tt("lbl.zoneName"),
						cell: "html",
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                            fromRaw: function (rawValue, model) {
                                rawValue = _.escape(rawValue);
                                if (_.isUndefined(rawValue) || _.isEmpty(rawValue)) {
                                    '--'
                                } else {
                                    return '<span class="badge badge-dark" title="'+rawValue+'">'+rawValue+'</span>';
                                }
                            }
                        }),
						drag: false,
						sortable: true,
						sortType: 'toggle',
						editable: false,
					},

                                        eventCount : {
                                                label : 'Event Count',
						cell: "string",
						click : false,
						drag : false,
						sortable:false,
						editable:false
					},
                                        tags : {
                                                label : 'Tags',
                                                cell: Backgrid.HtmlCell.extend({
                                                        className : 'tagsColumn'
                                                }),
						click : false,
						drag : false,
						sortable:false,
						editable:false,
						formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
							fromRaw: function (rawValue, model) {
                                                                if(_.isUndefined(rawValue)){
                                                                        return '<center>--</center>';
                                                                }
                                                                return XAUtils.showAuditLogTags(_.sortBy(JSON.parse(rawValue), 'type'), model);
							}
						}),
					},
            };
            if (this.accessAuditList.queryParams.sortBy && !_.isEmpty(this.accessAuditList.queryParams.sortBy)) {
                XAUtils.backgridSortType(this.accessAuditList, cols);
            }
			return this.accessAuditList.constructor.getTableCols(cols, this.accessAuditList);
		},