<commit_before>angular.module('lexicon.services', ['jsonRpc', 'sgw.ui.breadcrumb'])
.service('lexConfigService', [function(jsonRpc, $location) {

	var _callbacks = [];
	var _config = {};
	
	this.setConfig = function(config) {
		_config = angular.copy(config);
		if (angular.isDefined(_config.entry)) {
			angular.forEach(_callbacks, function(callback) {
				callback();
			});
		}
	};
	
	this.getConfig = function() {
		return _config;
	};
	
	this.registerListener = function(callback) {
		_callbacks.push(callback);
		if (angular.isDefined(_config.entry)) {
			callback();
		}
	};
	
}])
.service('lexLinkService', ['$location', function($location) {
	this.project = function () {
		return '/app/lexicon#/p/' + this.getProjectId();
	};
	
	this.projectView = function (view) {
		return this.project() + '/' + view;
	};

	this.getProjectId = function() {
		var parts = $location.path().split('/');
		// strip off the "/p/"
		return parts[2];
	};
}])
.service('lexProjectService', ['jsonRpc', 'breadcrumbService', 'lexLinkService', '$location', function(jsonRpc, breadcrumbService, linkService, $location) {
	jsonRpc.connect('/api/sf');

	this.baseViewDto = function(view, label, callback) {
		jsonRpc.call('lex_baseViewDto', [this.getProjectId()], function(result) {
			if (result.ok) {
				breadcrumbService.set('top',
					[
					 {href: '/app/projects', label: 'My Projects'},
					 {href: linkService.project(), label: result.data.project.projectname},
					 {href: linkService.projectView(view), label: label},
					]
				);
				callback(result);
			}
		});
	};

	this.updateConfiguration = function(config, callback) {
		jsonRpc.call('lex_configuration_update', [this.getProjectId(), config], callback);
	};
	
	this.importLift = function(importData, callback) {
		jsonRpc.call('lex_import_lift', [this.getProjectId(), importData], function(result) {
			if (result.ok) {
				callback(result);
			}
		});
	};
	
	this.users = function(callback) {
		projectId = this.getProjectId();
		jsonRpc.call('lex_manageUsersDto', [projectId], function(result) {
			if (result.ok) {
				breadcrumbService.set('top',
					[
					 {href: '/app/projects', label: 'My Projects'},
					 {href: linkService.project(), label: result.data.project.projectname},
					 {href: linkService.projectView('users'), label: 'User Management'},
					]
				);
				result.data.project.id = projectId;
				callback(result);
			}<commit_msg>fix missing var in js<commit_after>angular.module('lexicon.services', ['jsonRpc', 'sgw.ui.breadcrumb'])
.service('lexConfigService', [function(jsonRpc, $location) {

	var _callbacks = [];
	var _config = {};
	
	this.setConfig = function(config) {
		_config = angular.copy(config);
		if (angular.isDefined(_config.entry)) {
			angular.forEach(_callbacks, function(callback) {
				callback();
			});
		}
	};
	
	this.getConfig = function() {
		return _config;
	};
	
	this.registerListener = function(callback) {
		_callbacks.push(callback);
		if (angular.isDefined(_config.entry)) {
			callback();
		}
	};
	
}])
.service('lexLinkService', ['$location', function($location) {
	this.project = function () {
		return '/app/lexicon#/p/' + this.getProjectId();
	};
	
	this.projectView = function (view) {
		return this.project() + '/' + view;
	};

	this.getProjectId = function() {
		var parts = $location.path().split('/');
		// strip off the "/p/"
		return parts[2];
	};
}])
.service('lexProjectService', ['jsonRpc', 'breadcrumbService', 'lexLinkService', '$location', function(jsonRpc, breadcrumbService, linkService, $location) {
	jsonRpc.connect('/api/sf');

	this.baseViewDto = function(view, label, callback) {
		jsonRpc.call('lex_baseViewDto', [this.getProjectId()], function(result) {
			if (result.ok) {
				breadcrumbService.set('top',
					[
					 {href: '/app/projects', label: 'My Projects'},
					 {href: linkService.project(), label: result.data.project.projectname},
					 {href: linkService.projectView(view), label: label},
					]
				);
				callback(result);
			}
		});
	};

	this.updateConfiguration = function(config, callback) {
		jsonRpc.call('lex_configuration_update', [this.getProjectId(), config], callback);
	};
	
	this.importLift = function(importData, callback) {
		jsonRpc.call('lex_import_lift', [this.getProjectId(), importData], function(result) {
			if (result.ok) {
				callback(result);
			}
		});
	};
	
	this.users = function(callback) {
		var projectId = this.getProjectId();
		jsonRpc.call('lex_manageUsersDto', [projectId], function(result) {
			if (result.ok) {
				breadcrumbService.set('top',
					[
					 {href: '/app/projects', label: 'My Projects'},
					 {href: linkService.project(), label: result.data.project.projectname},
					 {href: linkService.projectView('users'), label: 'User Management'},
					]
				);
				result.data.project.id = projectId;
				callback(result);
			}
{'fraction_non_alphanumeric': 0.17771333885666943, 'fraction_numerical': 0.00041425020712510354, 'mean_word_length': 4.104651162790698, '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': '5623719', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1568, 'n_words': 269}