'use strict';
app.controller('logTestController', ['$scope', '$http', '$modalInstance', '$translate', 'blockUI', 'lib', function ($scope, $http, $modalInstance, $translate, blockUI, lib) {

	$scope.levels = [
		'trace',
		'debug',
		'info',
		'warn',
		'error',
		'fatal'
	];
	$scope.level = 'info';

	$scope.submit = function () {
		blockUI.start();
		$http.post('/Api/Admin/LogTest/' + $scope.level).then(function (response) {
			blockUI.stop();
			$translate(['message', 'ltSuccess']).then(function (msgs) {
				lib.showAlert(msgs.message, msgs.ltSuccess, function (alertDialog) {
					alertDialog.close();
					$modalInstance.close();
				});
			});
		}, lib.handleRestError);
	};

	$scope.cancel = function () {
		$modalInstance.close();
	};
}]);
