<commit_before>'use strict';

angular.module('subutai.environment.adv-controller', [])
	.controller('AdvancedEnvironmentCtrl', AdvancedEnvironmentCtrl);

AdvancedEnvironmentCtrl.$inject = ['$scope', '$rootScope', 'environmentService', 'trackerSrv', 'SweetAlert', 'ngDialog'];

var graph = new joint.dia.Graph;
var GRID_SIZE = 60;
var GRID_SPACING = 5;

var PEER_MAP = {};
var PEER_WIDTH = 155;
var PEER_SPACE = 30;

var RH_WIDTH = 100;
var RH_SPACE = 10;

function AdvancedEnvironmentCtrl($scope, $rootScope, environmentService, trackerSrv, SweetAlert, ngDialog) {

	var vm = this;

	vm.buildEnvironment = buildEnvironment;
	vm.buildEditedEnvironment = buildEditedEnvironment;
	vm.logMessages = [];

	vm.domainStrategies = [];
	vm.strategies = [];
	vm.activeCloudTab = 'peers';

	vm.peerIds = [];
	vm.resourceHosts = [];
	vm.currentResourceHosts = [];
	vm.advancedEnv = {};
	vm.nodeStatus = 'Add to';
	vm.nodeList = [];
	vm.colors = quotaColors;
	vm.templates = [];

	vm.excludedContainers = [];
	vm.cubeGrowth = 1;
	vm.environment2BuildName = 'Environment name';
	vm.currentPeer = false;
	vm.currentPeerIndex = false;
	vm.buildCompleted = false;
	vm.editingEnv = false;

	// functions

	vm.initJointJs = initJointJs;
	vm.buildEnvironmentByJoint = buildEnvironmentByJoint;
	vm.editEnvironment = editEnvironment;
	vm.clearWorkspace = clearWorkspace;
	vm.addSettingsToTemplate = addSettingsToTemplate;

	vm.showResources = showResources;
	vm.addResource2Build = addResource2Build;
	vm.closePopup = closePopup;

	environmentService.getTemplates()
		.success(function (data) {
			vm.templates = data;
		})
		.error(function (data) {
			VARS_MODAL_ERROR( SweetAlert, 'Error on getting templates ' + data );
		});

	//vm.templates = ['mongo', 'cassandra', 'master', 'hadoop'];

	environmentService.getStrategies().success(function (data) {
		vm.strategies = data;
	});

	environmentService.getDomainStrategies().success(function (data) {
		vm.domainStrategies = data;
	});

	function getPeers() {
		$('.js-peer-load-screen').show();
		environmentService.getPeers().success(function (data) {
			vm.peerIds = data;
			vm.peerIds['testPeer'] = ['rh1', 'rh2', 'rh3'];
			$('.js-peer-load-screen').hide();
		}).error(function(error){
			$('.js-peer-load-screen').hide();
			VARS_MODAL_ERROR( SweetAlert, 'Error on getting peers: ' + error );
		});
	}
	getPeers();


	clearWorkspace();<commit_msg>removed hardcode peers<commit_after>'use strict';

angular.module('subutai.environment.adv-controller', [])
	.controller('AdvancedEnvironmentCtrl', AdvancedEnvironmentCtrl);

AdvancedEnvironmentCtrl.$inject = ['$scope', '$rootScope', 'environmentService', 'trackerSrv', 'SweetAlert', 'ngDialog'];

var graph = new joint.dia.Graph;
var GRID_SIZE = 60;
var GRID_SPACING = 5;

var PEER_MAP = {};
var PEER_WIDTH = 155;
var PEER_SPACE = 30;

var RH_WIDTH = 100;
var RH_SPACE = 10;

function AdvancedEnvironmentCtrl($scope, $rootScope, environmentService, trackerSrv, SweetAlert, ngDialog) {

	var vm = this;

	vm.buildEnvironment = buildEnvironment;
	vm.buildEditedEnvironment = buildEditedEnvironment;
	vm.logMessages = [];

	vm.domainStrategies = [];
	vm.strategies = [];
	vm.activeCloudTab = 'peers';

	vm.peerIds = [];
	vm.resourceHosts = [];
	vm.currentResourceHosts = [];
	vm.advancedEnv = {};
	vm.nodeStatus = 'Add to';
	vm.nodeList = [];
	vm.colors = quotaColors;
	vm.templates = [];

	vm.excludedContainers = [];
	vm.cubeGrowth = 1;
	vm.environment2BuildName = 'Environment name';
	vm.currentPeer = false;
	vm.currentPeerIndex = false;
	vm.buildCompleted = false;
	vm.editingEnv = false;

	// functions

	vm.initJointJs = initJointJs;
	vm.buildEnvironmentByJoint = buildEnvironmentByJoint;
	vm.editEnvironment = editEnvironment;
	vm.clearWorkspace = clearWorkspace;
	vm.addSettingsToTemplate = addSettingsToTemplate;

	vm.showResources = showResources;
	vm.addResource2Build = addResource2Build;
	vm.closePopup = closePopup;

	environmentService.getTemplates()
		.success(function (data) {
			vm.templates = data;
		})
		.error(function (data) {
			VARS_MODAL_ERROR( SweetAlert, 'Error on getting templates ' + data );
		});

	//vm.templates = ['mongo', 'cassandra', 'master', 'hadoop'];

	environmentService.getStrategies().success(function (data) {
		vm.strategies = data;
	});

	environmentService.getDomainStrategies().success(function (data) {
		vm.domainStrategies = data;
	});

	function getPeers() {
		$('.js-peer-load-screen').show();
		environmentService.getPeers().success(function (data) {
			vm.peerIds = data;
			//vm.peerIds['testPeer'] = ['rh1', 'rh2', 'rh3'];
			$('.js-peer-load-screen').hide();
		}).error(function(error){
			$('.js-peer-load-screen').hide();
			VARS_MODAL_ERROR( SweetAlert, 'Error on getting peers: ' + error );
		});
	}
	getPeers();


	clearWorkspace();
{'fraction_non_alphanumeric': 0.15310604476051035, 'fraction_numerical': 0.00836645053336122, 'mean_word_length': 4.955168119551681, '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': '6276491', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1591, 'n_words': 295}