<commit_before>'use strict';

angular.module('App.Controllers', [])
	.controller('ListDefinitionController',
		function ($scope, $http, JobDefinitions, $log, promiseTracker, $q, $timeout, growl, JobDefinitionService) {

		var testPromise = $q.defer();

		promiseTracker('trackerName').addPromise(testPromise.promise);
		$timeout(function(){
			testPromise.resolve();
		}, 1000);

		JobDefinitions.get(function(data) {
			$log.info(data);
			$scope.jobDefinitions = data.content;
		}, function(error) {
			$log.error('Error fetching data. Is the XD server running?');
			$log.error(error);
			growl.addErrorMessage('Error fetching data. Is the XD server running?');
		});

		$scope.deployJob = function (jobDefinition) {
			$log.info('Deploying Job ' + jobDefinition.name);
			$log.info(JobDefinitionService);
			JobDefinitionService.deploy(jobDefinition);
		};
		$scope.undeployJob = function (jobDefinition) {
			$log.info('Undeploying Job ' + jobDefinition.name);
			$log.info(JobDefinitionService);
			JobDefinitionService.undeploy(jobDefinition);
		};
	})
	.controller('ListJobDeploymentsController', function($scope, $http, JobDeployments, $log, $state, growl) {
			JobDeployments.getArray(function(data) {
				$log.info(data);
				$scope.jobDeployments = data;

				$scope.launchJob = function (item) {
					$log.info('Launching Job: ' + item.name);
					$state.go('home.jobs.deployments.launch', {jobName: item.name});
				};

			}, function(error) {
				$log.error('Error fetching data. Is the XD server running?');
				$log.error(error);
				growl.addErrorMessage('Error fetching data. Is the XD server running?');
			});
		})
	.controller('ListJobExecutionsController', function($scope, $http, JobExecutions, $log, growl) {
			JobExecutions.getArray().$promise.then(
				function (result) {
					$log.info('>>>>');
					$log.info(result);
					$scope.jobExecutions = result;
				}, function(error) {
					$log.error('Error fetching data. Is the XD server running?');
					$log.error(error);
					growl.addErrorMessage('Error fetching data. Is the XD server running?');
				});

			$scope.restartJob = function (job) {
				$log.info('Restarting Job ' + job.name);
				JobExecutions.restart(job).$promise.then(
					function (result) {
						$log.info('>>>>');
						$log.info(result);
						$scope.jobExecutions = result;
					}, function(error) {
						$log.error('Error fetching data. Is the XD server running?');
						$log.error(error);
						growl.addErrorMessage('Error fetching data. Is the XD server running?');
						growl.addErrorMessage(error.data[0].message);
					});
			};
		})
	.controller('LaunchJobController', function($scope, $http, $log, $state, $stateParams, growl, $location, JobLaunchService) {
			var jobLaunchRequest = $scope.jobLaunchRequest = {
				jobName: $stateParams.jobName,
				jobParameters:[]
			};

			$log.info($stateParams);

			$scope.addParameter = function() {
				jobLaunchRequest.jobParameters.push({key:'new', value:''});
			};
<commit_msg>XD-1331 Fix Job Restart<commit_after>'use strict';

angular.module('App.Controllers', [])
	.controller('ListDefinitionController',
		function ($scope, $http, JobDefinitions, $log, promiseTracker, $q, $timeout, growl, JobDefinitionService) {

		var testPromise = $q.defer();

		promiseTracker('trackerName').addPromise(testPromise.promise);
		$timeout(function(){
			testPromise.resolve();
		}, 1000);

		JobDefinitions.get(function(data) {
			$log.info(data);
			$scope.jobDefinitions = data.content;
		}, function(error) {
			$log.error('Error fetching data. Is the XD server running?');
			$log.error(error);
			growl.addErrorMessage('Error fetching data. Is the XD server running?');
		});

		$scope.deployJob = function (jobDefinition) {
			$log.info('Deploying Job ' + jobDefinition.name);
			$log.info(JobDefinitionService);
			JobDefinitionService.deploy(jobDefinition);
		};
		$scope.undeployJob = function (jobDefinition) {
			$log.info('Undeploying Job ' + jobDefinition.name);
			$log.info(JobDefinitionService);
			JobDefinitionService.undeploy(jobDefinition);
		};
	})
	.controller('ListJobDeploymentsController', function($scope, $http, JobDeployments, $log, $state, growl) {
			JobDeployments.getArray(function(data) {
				$log.info(data);
				$scope.jobDeployments = data;

				$scope.launchJob = function (item) {
					$log.info('Launching Job: ' + item.name);
					$state.go('home.jobs.deployments.launch', {jobName: item.name});
				};

			}, function(error) {
				$log.error('Error fetching data. Is the XD server running?');
				$log.error(error);
				growl.addErrorMessage('Error fetching data. Is the XD server running?');
			});
		})
	.controller('ListJobExecutionsController', function($scope, $http, JobExecutions, $log, growl) {
			JobExecutions.getArray().$promise.then(
				function (result) {
					$log.info('>>>>');
					$log.info(result);
					$scope.jobExecutions = result;
				}, function(error) {
					$log.error('Error fetching data. Is the XD server running?');
					$log.error(error);
					growl.addErrorMessage('Error fetching data. Is the XD server running?');
				});

			$scope.restartJob = function (job) {
				$log.info('Restarting Job ' + job.name);
				JobExecutions.restart(job).$promise.then(
					function (result) {
						$log.info('>>>>');
						$log.info(result);
						$scope.jobExecutions = result;
					}, function(error) {
						$log.error('Error fetching data. Is the XD server running?');
						$log.error(error);
						growl.addErrorMessage('Error fetching data. Is the XD server running?');
						growl.addErrorMessage(error.data[0].message);
					});
			};
		})
	.controller('LaunchJobController', function($scope, $http, $log, $state, $stateParams, growl, $location, JobLaunchService) {
			var jobLaunchRequest = $scope.jobLaunchRequest = {
				jobName: $stateParams.jobName,
				jobParameters:[]
			};

			$log.info($stateParams);

			$scope.addParameter = function() {
				jobLaunchRequest.jobParameters.push({key:'', value:'', type: 'string'});
			};

{'fraction_non_alphanumeric': 0.1619237809951739, 'fraction_numerical': 0.002329838575470128, 'mean_word_length': 4.106202209005947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '7544544', 'n_tokens_mistral': 2329, 'n_tokens_neox': 1908, 'n_words': 365}