<commit_before>/**
 * @ngdoc function
 * @name ngmReportHubApp.controller:DashboardClusterAdminCtrl
 * @description
 * # DashboardClusterAdminCtrl
 * Controller of the ngmReportHub
 */
angular.module('ngmReportHub')
	.controller('DashboardClusterAdminCtrl', [
			'$scope', 
			'$q', 
			'$http', 
			'$location', 
			'$route',
			'$rootScope',
			'$window', 
			'$timeout', 
			'$filter', 
			'ngmUser', 
			'ngmData',
			'ngmClusterHelper', 
		function ( $scope, $q, $http, $location, $route, $rootScope, $window, $timeout, $filter, ngmUser, ngmData, ngmClusterHelper ) {
			this.awesomeThings = [
				'HTML5 Boilerplate',
				'AngularJS',
				'Karma'
			];

			// empty model
			$scope.model = {
				menu: [],
				rows: []
			};

			// create dews object
			$scope.dashboard = {
				
				// parent
				ngm: $scope.$parent.ngm,
				
				// current user
				user: ngmUser.get(),

				// report start
				startDate: moment( $route.current.params.start) .format( 'YYYY-MM-DD' ),

				// report end
				endDate: moment( $route.current.params.end ).format( 'YYYY-MM-DD' ),
				
				// current report
				report_file_name: 'report' + $location.$$path.replace(/\//g, '_') + '-extracted-',

				// hq / region
				names:{
					'all': 'ALL',
					'hq': 'HQ',
					'emro': 'EMRO',
					'af': 'AFGHANISTAN',
				},

				// lists
				lists: {
					clusters: ngmClusterHelper.getClusters(),
					// admin1: localStorage.getObject( 'lists' ).admin1List,
					// admin2: localStorage.getObject( 'lists' ).admin2List
				},

				// filtered data
				data: {
					cluster: false,
					admin1: false,
					admin2: false,
				},

        // set URL based on user rights
				setUrl: function(){

					// if ADMIN
					var path;
					if ( $scope.dashboard.user.roles.indexOf( 'SUPERADMIN' ) !== -1 || $scope.dashboard.user.roles.indexOf( 'ADMIN' ) !== -1 ) {
						path = $scope.dashboard.getAdminPath( $scope.dashboard.cluster_id, $scope.dashboard.report_type, $scope.dashboard.organization_tag );
					} else {
						path = $scope.dashboard.getUserPath( $scope.dashboard.cluster_id, $scope.dashboard.report_type, $scope.dashboard.organization_tag );
					}
					
					// if current location is not equal to path 
					if ( path !== $location.$$path ) {
						// 
						$location.path( path );
					}

				},

				// request
				getRequest: function( indicator, list ){

					var request = {
						list: list,
						indicator: indicator,
						cluster_id: $scope.dashboard.cluster_id,
						organization_tag: $scope.dashboard.organization_tag, 
						adminRpcode: $scope.dashboard.adminRpcode,
						admin0pcode: $scope.dashboard.admin0pcode,
						report_type: $scope.dashboard.report_type,
						start_date: $scope.dashboard.startDate,
						end_date: $scope.dashboard.endDate
					}
					
					console.log(request)

					return request;

				},

				// admin
				getAdminPath: function( cluster_id, report_type, organization_tag ){

					var path = '/cluster/admin/' + $scope.dashboard.adminRpcode.toLowerCase() +
												 '/' + $scope.dashboard.admin0pcode.toLowerCase() +
												 '/' + cluster_id +
												 '/' + organization_tag +
												 '/' + report_type +
												 '/' + $scope.dashboard.startDate + 
												 '/' + $scope.dashboard.endDate;

					return path;
				},

				// user
				getUserPath: function( cluster_id, report_type, organization_tag ){

					var path = '/cluster/admin/' + $scope.dashboard.adminRpcode.toLowerCase() +
												 '/' + $scope.dashboard.admin0pcode.toLowerCase() +
												 '/' + cluster_id + 
												 '/' + organization_tag +
												 '/' + report_type +
												 '/' + $scope.dashboard.startDate + <commit_msg>Cluster: test for pdf print<commit_after>/**
 * @ngdoc function
 * @name ngmReportHubApp.controller:DashboardClusterAdminCtrl
 * @description
 * # DashboardClusterAdminCtrl
 * Controller of the ngmReportHub
 */
angular.module('ngmReportHub')
	.controller('DashboardClusterAdminCtrl', [
			'$scope', 
			'$q', 
			'$http', 
			'$location', 
			'$route',
			'$rootScope',
			'$window', 
			'$timeout', 
			'$filter', 
			'ngmUser', 
			'ngmData',
			'ngmClusterHelper', 
		function ( $scope, $q, $http, $location, $route, $rootScope, $window, $timeout, $filter, ngmUser, ngmData, ngmClusterHelper ) {
			this.awesomeThings = [
				'HTML5 Boilerplate',
				'AngularJS',
				'Karma'
			];

			// empty model
			$scope.model = {
				menu: [],
				rows: []
			};

			// create dews object
			$scope.dashboard = {
				
				// parent
				ngm: $scope.$parent.ngm,
				
				// current user
				user: ngmUser.get(),

				// report start
				startDate: moment( $route.current.params.start) .format( 'YYYY-MM-DD' ),

				// report end
				endDate: moment( $route.current.params.end ).format( 'YYYY-MM-DD' ),
				
				// current report
				report_file_name: 'report' + $location.$$path.replace(/\//g, '_') + '-extracted-',

				// hq / region
				names:{
					'all': 'ALL',
					'hq': 'HQ',
					'emro': 'EMRO',
					'af': 'AFGHANISTAN',
				},

				// lists
				lists: {
					clusters: ngmClusterHelper.getClusters(),
					// admin1: localStorage.getObject( 'lists' ).admin1List,
					// admin2: localStorage.getObject( 'lists' ).admin2List
				},

				// filtered data
				data: {
					cluster: false,
					admin1: false,
					admin2: false,
				},

        // set URL based on user rights
				setUrl: function(){

					// if ADMIN
					var path;
					if ( $scope.dashboard.user.roles.indexOf( 'SUPERADMIN' ) !== -1 || $scope.dashboard.user.roles.indexOf( 'ADMIN' ) !== -1 ) {
						path = $scope.dashboard.getAdminPath( $scope.dashboard.cluster_id, $scope.dashboard.report_type, $scope.dashboard.organization_tag );
					} else {
						path = $scope.dashboard.getUserPath( $scope.dashboard.cluster_id, $scope.dashboard.report_type, $scope.dashboard.organization_tag );
					}
					
					// if current location is not equal to path 
					if ( path !== $location.$$path ) {
						// 
						$location.path( path );
					}

				},

				// request
				getRequest: function( indicator, list ){

					var request = {
						list: list,
						indicator: indicator,
						cluster_id: $scope.dashboard.cluster_id,
						organization_tag: $scope.dashboard.organization_tag, 
						adminRpcode: $scope.dashboard.adminRpcode,
						admin0pcode: $scope.dashboard.admin0pcode,
						report_type: $scope.dashboard.report_type,
						start_date: $scope.dashboard.startDate,
						end_date: $scope.dashboard.endDate
					}
					
					console.log(request.cluster_id)

					return request;

				},

				// admin
				getAdminPath: function( cluster_id, report_type, organization_tag ){

					var path = '/cluster/admin/' + $scope.dashboard.adminRpcode.toLowerCase() +
												 '/' + $scope.dashboard.admin0pcode.toLowerCase() +
												 '/' + cluster_id +
												 '/' + organization_tag +
												 '/' + report_type +
												 '/' + $scope.dashboard.startDate + 
												 '/' + $scope.dashboard.endDate;

					return path;
				},

				// user
				getUserPath: function( cluster_id, report_type, organization_tag ){

					var path = '/cluster/admin/' + $scope.dashboard.adminRpcode.toLowerCase() +
												 '/' + $scope.dashboard.admin0pcode.toLowerCase() +
												 '/' + cluster_id + 
												 '/' + organization_tag +
												 '/' + report_type +
												 '/' + $scope.dashboard.startDate + 
{'fraction_non_alphanumeric': 0.15138794854434665, 'fraction_numerical': 0.0035206499661475966, 'mean_word_length': 2.3390596745027126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '933672', 'n_tokens_mistral': 3303, 'n_tokens_neox': 2410, 'n_words': 434}