onTabChange : function()

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


		onTabChange : function(e){
                        var that = this, tab, sortObj = {};
			tab = !_.isUndefined(e) ? $(e.currentTarget).attr('href') : this.currentTab;
			this.$el.parents('body').find('.datepicker').remove();
            if (!_.isUndefined(e)) {
                    Backbone.history.navigate("!/reports/audit/"+ tab.slice(1), false)
            }
            if(Backbone.history.fragment.indexOf("?") !== -1) {
                var sortFragment = Backbone.history.fragment.substring(Backbone.history.fragment.indexOf("?") + 1);
                sortObj = _.pick(XAUtils.changeUrlToSearchQuery(decodeURIComponent(sortFragment)), 'sortType','sortBy');
                        }
            switch (tab) {
				case "#bigData":
					this.currentTab = '#bigData';
                    //Remove empty search values on tab changes for visual search.
                    App.vsHistory.bigData = XAUtils.removeEmptySearchValue(App.vsHistory.bigData);
					this.ui.visualSearch.show();
					this.ui.visualSearch.parents('.well').show();
					this.renderBigDataTable();
					this.addSearchForBigDataTab();
					XAUtils.resizeableColumn(this, 'resourceType');
                    this.listenTo(this.accessAuditList, "request", that.updateLastRefresh);
                    this.ui.iconSearchInfo.show();
                    this.showTagsAttributes();
                    this.ui.excludeServiceUser.show();
                    this.ui.colManager.show();
					break;
				case "#admin":
					this.currentTab = '#admin';
                    App.vsHistory.admin = XAUtils.removeEmptySearchValue(App.vsHistory.admin);
                    this.trxLogList = new VXTrxLogList();
                    if(!_.isEmpty(sortObj)) {
                        XAUtils.setSorting(this.trxLogList, sortObj);
                    }
                    this.renderAdminTable();
					if(_.isEmpty(App.vsHistory.admin) && _.isUndefined(App.sessionId)){
			     	    this.trxLogList.fetch({
							   cache : false
						});
					}
					this.addSearchForAdminTab();
					this.listenTo(this.trxLogList, "request", that.updateLastRefresh);
					this.listenTo(this.trxLogList, "sync reset", that.showPageDetail);
                    this.ui.iconSearchInfo.hide();
                    $('.popover').remove();
                    this.ui.excludeServiceUser.hide();
                    this.ui.colManager.hide();
					break;
				case "#loginSession":
					this.currentTab = '#loginSession';
                    App.vsHistory.loginSession = XAUtils.removeEmptySearchValue(App.vsHistory.loginSession);
					this.authSessionList = new VXAuthSession();
                    if(!_.isEmpty(sortObj)) {
                        XAUtils.setSorting(this.authSessionList, sortObj);
                    } else {
                        _.extend(this.authSessionList.queryParams,{ 'sortBy'  :  'id' });
					//Setting SortBy as id and sortType as desc = 1
                                        this.authSessionList.setSorting('id',1);
                    }
                                        this.renderLoginSessionTable();
                    if(_.isEmpty(App.vsHistory.loginSession)){
                        this.authSessionList.fetch({
                        	cache:false,
                        });
                    }
					this.addSearchForLoginSessionTab();
					this.listenTo(this.authSessionList, "request", that.updateLastRefresh);
					this.listenTo(this.authSessionList, "sync reset", that.showPageDetail);
                    this.ui.iconSearchInfo.hide();
                    $('.popover').remove();
                    this.ui.excludeServiceUser.hide();
                    this.ui.colManager.hide();
					break;
				case "#agent":
					this.currentTab = '#agent';
                    App.vsHistory.agent = XAUtils.removeEmptySearchValue(App.vsHistory.agent);
					this.policyExportAuditList = new VXPolicyExportAuditList();	
					var params = { priAcctId : 1 };
                    if(!_.isEmpty(sortObj)) {
                        XAUtils.setSorting(this.policyExportAuditList, sortObj);
                    } else {
                        _.extend(this.policyExportAuditList.queryParams,{ 'sortBy'  :  'createDate' });
					this.policyExportAuditList.setSorting('createDate',1);
                    }
                    that.renderAgentTable();
                    if(_.isEmpty(App.vsHistory.agent)){
                    this.policyExportAuditList.fetch({
	                    cache : false,
	                    data :params
                    });
                    }
					this.addSearchForAgentTab();
					this.listenTo(this.policyExportAuditList, "request", that.updateLastRefresh);
					 this.listenTo(this.policyExportAuditList, "sync reset", that.showPageDetail);
                    this.ui.iconSearchInfo.hide();
                    $('.popover').remove();
                    this.ui.excludeServiceUser.hide();
                    this.ui.colManager.hide();
					break;
				case "#pluginStatus":
					 this.currentTab = '#pluginStatus';
                     App.vsHistory.pluginStatus = XAUtils.removeEmptySearchValue(App.vsHistory.pluginStatus);
					 this.ui.visualSearch.show();
					 this.pluginInfoList = new VXPolicyExportAuditList();
                     if(!_.isEmpty(sortObj)){
                        XAUtils.setSorting(this.pluginInfoList, sortObj);
                     }
                     this.renderPluginInfoTable();
					 this.modifyPluginStatusTableSubcolumns();
                     XAUtils.customPopover(this.$el.find('[data-id ="policyTimeDetails"]'),'Policy (Time details)',localization.tt('msg.policyTimeDetails'),'left');
                     XAUtils.customPopover(this.$el.find('[data-id ="tagPolicyTimeDetails"]'),'Tag Policy (Time details)',localization.tt('msg.tagPolicyTimeDetails'),'left');
					 //To use existing collection
					 this.pluginInfoList.url = 'service/plugins/plugins/info';
					 this.pluginInfoList.modelAttrName = 'pluginInfoList';
                                         this.pluginInfoList.switchMode("client",  {fetch:false});
                     if(_.isEmpty(App.vsHistory.pluginStatus)){
                         this.pluginInfoList.fetch({cache : false});
                     }
					 this.addSearchForPluginStatusTab();
					 this.listenTo(this.pluginInfoList, "request", that.updateLastRefresh);
					 this.listenTo(this.pluginInfoList, "sync reset", that.showPageDetail);
					 this.ui.iconSearchInfo.hide();
                     $('.popover').remove();
                     this.ui.excludeServiceUser.hide();
                     this.ui.colManager.hide();
					 break;
                case "#userSync":
                     this.currentTab = '#userSync';
                     this.ui.visualSearch.show();
                     this.userSyncAuditList = new VXUserList();
                     if(!_.isEmpty(sortObj)) {
                        XAUtils.setSorting(this.userSyncAuditList, sortObj);
                     } else {
                        _.extend(this.userSyncAuditList.queryParams,{ 'sortBy'  :  'eventTime' });
                        this.userSyncAuditList.setSorting('eventTime',1);
                     }
                     this.renderUserSyncTable();
                     this.modifyUserSyncTableSubcolumns();
                     //To use existing collection
                     this.userSyncAuditList.url = 'service/assets/ugsyncAudits';
                     this.userSyncAuditList.modelAttrName = 'vxUgsyncAuditInfoList';
                     this.addSearchForUserSyncTab();
                     this.listenTo(this.userSyncAuditList, "request", that.updateLastRefresh);
                     this.listenTo(this.userSyncAuditList, "sync reset", that.showPageDetail);
                     this.ui.iconSearchInfo.hide();
                     this.ui.excludeServiceUser.hide();
                     this.ui.colManager.hide();
                     break;
			}
			var lastUpdateTime = Globalize.format(new Date(),  "MM/dd/yyyy hh:mm:ss tt");
			that.ui.lastUpdateTimeLabel.html(lastUpdateTime);
		},