<commit_before>"use strict";
var hacloudServices = soajsApp.components;
hacloudServices.service('hacloudSrv', ['ngDataApi', '$timeout', '$modal', '$sce', function (ngDataApi, $timeout, $modal, $sce) {

	/**
	 * Service Functions
	 * @param currentScope
	 * @param env
	 * @param noPopulate
	 */
	function listServices(currentScope, cb) {
		var env = currentScope.envCode.toLowerCase();
		currentScope.showCtrlHosts = true;
        currentScope.controllers =[];
		if (currentScope.access.listHosts) {
            getSendDataFromServer(currentScope, ngDataApi, {
                "method": "get",
                "routeName": "/dashboard/cloud/services/list",
                "params": {
                    "env": env
                }
            }, function (error, response) {
                if (error || !response) {
                    currentScope.displayAlert('danger', translation.unableRetrieveServicesHostsInformation[LANG]);
                }
                else {
                    if (response && response.length > 0) {
	                    currentScope.hosts = {
		                    'soajs': {
			                    "label": "SOAJS"
		                    },
		                    'nginx':{
			                    "label": "Nginx",
			                    "list": []
		                    },
		                    'elk': {
			                    "label": "ELK",
			                    "list": []
		                    },
		                    'db': {
			                    "label": "Clusters",
			                    "list": []
		                    },
		                    'miscellaneous': {
			                    "label": "Miscellaneous",
			                    "list": []
		                    }
	                    };
	                    
                        for (var j = 0; j < response.length; j++) {
                        	response[j].expanded = true;
	                        
                        	var failures = 0;
	                        response[j].tasks.forEach(function(oneTask){
		                        if(['running','preparing', 'pending', 'starting'].indexOf(oneTask.status.state.toLowerCase()) === -1){
			                        failures++;
			                        oneTask.hideIt = true;
		                        }
	                        });
	
	                        if(failures === response[j].tasks.length){
		                        response[j].hideIt = true;
	                        }
	                        
	                        response[j].failures = failures;
	                        
                        	if(response[j].labels['soajs.content'] === 'true'){
                        		if(response[j].labels['soajs.service.name'] === 'controller' && !response[j].labels['soajs.service.group']){
			                        response[j].labels['soajs.service.group'] = "SOAJS Core Services";
		                        }
                        		if(['nginx', 'db', 'elk'].indexOf(response[j].labels['soajs.service.group']) !== -1){
			                        currentScope.hosts[response[j].labels['soajs.service.group']].list.push(response[j]);
		                        }
		                        else{
                        			if(!currentScope.hosts.soajs.groups){
				                        currentScope.hosts.soajs.groups = {};
			                        }
			                        
			                        response[j]['color'] = 'green';
			                        response[j]['healthy'] = true;
			                        var groupName = response[j].labels['soajs.service.group'];
			                        if(!currentScope.hosts.soajs.groups[groupName]){
				                        currentScope.hosts.soajs.groups[groupName] = {
				                        	expanded : true,
					                        list: []
				                        };
			                        }
			                        
			                        if(response[j].labels['soajs.service.name'] === 'controller'){
				                        currentScope.hosts.soajs.groups[groupName].list.unshift(response[j]);
				                        currentScope.controllers.push(response[j]);
			                        }
			                        else{
				                        currentScope.hosts.soajs.groups[groupName].list.push(response[j]);
			                        }
		                        }
	                        }
                        	else{
		                        //service is not SOAJS
		                        var myGroup = 'miscellaneous';
		                        if(response[j].labels && response[j].labels['soajs.service.group']){
			                        myGroup = response[j].labels['soajs.service.group'];
		                        }
		                        currentScope.hosts[myGroup].list.push(response[j]);
		                        break;
	                        }
                        }
                        
                        console.log(currentScope.hosts.soajs);
	                    step2();
                    }
                    else{
                    	delete currentScope.hosts;
                    }
                }
            });
        }

        function step2(){
	        currentScope.controllers.forEach(function(oneController){
		        var i = 1;
		        var failure = 0;

	        	oneController.tasks.forEach(function(oneCtrlTask){
			        oneCtrlTask.code = "CTRL-" + i;
			        var healthy = (oneCtrlTask.status.state === 'running');
			        oneCtrlTask.healthy = healthy;
			        if(!healthy){
			        	failure++;
			        }

			        var tooltip = "<b>Name:</b> " + oneCtrlTask.name + "<br>";
			        tooltip += "<b>State:</b> " + oneCtrlTask.status.state + "<br>";
			        tooltip += "<b>Started:</b> " + oneCtrlTask.status.ts;
<commit_msg>removed unneeded log message.<commit_after>"use strict";
var hacloudServices = soajsApp.components;
hacloudServices.service('hacloudSrv', ['ngDataApi', '$timeout', '$modal', '$sce', function (ngDataApi, $timeout, $modal, $sce) {

	/**
	 * Service Functions
	 * @param currentScope
	 * @param env
	 * @param noPopulate
	 */
	function listServices(currentScope, cb) {
		var env = currentScope.envCode.toLowerCase();
		currentScope.showCtrlHosts = true;
        currentScope.controllers =[];
		if (currentScope.access.listHosts) {
            getSendDataFromServer(currentScope, ngDataApi, {
                "method": "get",
                "routeName": "/dashboard/cloud/services/list",
                "params": {
                    "env": env
                }
            }, function (error, response) {
                if (error || !response) {
                    currentScope.displayAlert('danger', translation.unableRetrieveServicesHostsInformation[LANG]);
                }
                else {
                    if (response && response.length > 0) {
	                    currentScope.hosts = {
		                    'soajs': {
			                    "label": "SOAJS"
		                    },
		                    'nginx':{
			                    "label": "Nginx",
			                    "list": []
		                    },
		                    'elk': {
			                    "label": "ELK",
			                    "list": []
		                    },
		                    'db': {
			                    "label": "Clusters",
			                    "list": []
		                    },
		                    'miscellaneous': {
			                    "label": "Miscellaneous",
			                    "list": []
		                    }
	                    };
	                    
                        for (var j = 0; j < response.length; j++) {
                        	response[j].expanded = true;
	                        
                        	var failures = 0;
	                        response[j].tasks.forEach(function(oneTask){
		                        if(['running','preparing', 'pending', 'starting'].indexOf(oneTask.status.state.toLowerCase()) === -1){
			                        failures++;
			                        oneTask.hideIt = true;
		                        }
	                        });
	
	                        if(failures === response[j].tasks.length){
		                        response[j].hideIt = true;
	                        }
	                        
	                        response[j].failures = failures;
	                        
                        	if(response[j].labels['soajs.content'] === 'true'){
                        		if(response[j].labels['soajs.service.name'] === 'controller' && !response[j].labels['soajs.service.group']){
			                        response[j].labels['soajs.service.group'] = "SOAJS Core Services";
		                        }
                        		if(['nginx', 'db', 'elk'].indexOf(response[j].labels['soajs.service.group']) !== -1){
			                        currentScope.hosts[response[j].labels['soajs.service.group']].list.push(response[j]);
		                        }
		                        else{
                        			if(!currentScope.hosts.soajs.groups){
				                        currentScope.hosts.soajs.groups = {};
			                        }
			                        
			                        response[j]['color'] = 'green';
			                        response[j]['healthy'] = true;
			                        var groupName = response[j].labels['soajs.service.group'];
			                        if(!currentScope.hosts.soajs.groups[groupName]){
				                        currentScope.hosts.soajs.groups[groupName] = {
				                        	expanded : true,
					                        list: []
				                        };
			                        }
			                        
			                        if(response[j].labels['soajs.service.name'] === 'controller'){
				                        currentScope.hosts.soajs.groups[groupName].list.unshift(response[j]);
				                        currentScope.controllers.push(response[j]);
			                        }
			                        else{
				                        currentScope.hosts.soajs.groups[groupName].list.push(response[j]);
			                        }
		                        }
	                        }
                        	else{
		                        //service is not SOAJS
		                        var myGroup = 'miscellaneous';
		                        if(response[j].labels && response[j].labels['soajs.service.group']){
			                        myGroup = response[j].labels['soajs.service.group'];
		                        }
		                        currentScope.hosts[myGroup].list.push(response[j]);
		                        break;
	                        }
                        }
                        
	                    step2();
                    }
                    else{
                    	delete currentScope.hosts;
                    }
                }
            });
        }

        function step2(){
	        currentScope.controllers.forEach(function(oneController){
		        var i = 1;
		        var failure = 0;

	        	oneController.tasks.forEach(function(oneCtrlTask){
			        oneCtrlTask.code = "CTRL-" + i;
			        var healthy = (oneCtrlTask.status.state === 'running');
			        oneCtrlTask.healthy = healthy;
			        if(!healthy){
			        	failure++;
			        }

			        var tooltip = "<b>Name:</b> " + oneCtrlTask.name + "<br>";
			        tooltip += "<b>State:</b> " + oneCtrlTask.status.state + "<br>";
			        tooltip += "<b>Started:</b> " + oneCtrlTask.status.ts;

{'fraction_non_alphanumeric': 0.11962052608883139, 'fraction_numerical': 0.0015523932729624838, 'mean_word_length': 0.9584529640263469, 'pattern_counts': {'":': 26, '<': 21, '<?xml version=': 0, '>': 21, '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': '411800', 'n_tokens_mistral': 3257, 'n_tokens_neox': 2578, 'n_words': 380}