Fix eslint errors

This patch fixes eslint errors except warnings for TODO.

Change-Id: I4024dfdd326c058c73a28b0655c0197bbffda075
Closes-Bug: #1622475
This commit is contained in:
Shu Muto 2016-09-12 19:12:54 +09:00
parent 4264fc3858
commit f6784a2879
14 changed files with 100 additions and 41 deletions

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -34,7 +34,15 @@
/** /**
* @ngDoc factory * @ngDoc factory
* @name horizon.dashboard.project.queues.actions.createQueueService * @name horizon.dashboard.project.queues.actions.createQueueService
* @Description A service to open the queues wizard. * @param {Object} meta
* @param {Object} policy
* @param {Object} events
* @param {Object} createQueueWorkflow
* @param {Object} zaqar
* @param {Object} wizard
* @param {Object} toast
* @returns {Object} service
* @description A service to open the queues wizard.
*/ */
function createQueueService(meta, policy, events, createQueueWorkflow, zaqar, wizard, toast) { function createQueueService(meta, policy, events, createQueueWorkflow, zaqar, wizard, toast) {
@ -89,7 +97,7 @@
} }
function allowed() { function allowed() {
return policy.ifAllowed({ rules: [['queue', 'add_queue']] });; return policy.ifAllowed({ rules: [['queue', 'add_queue']] });
} }
function submit() { function submit() {

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -30,6 +30,10 @@
/** /**
* @ngdoc factory * @ngdoc factory
* @name horizon.dashboard.project.queues.actions.createQueueWorkflow * @name horizon.dashboard.project.queues.actions.createQueueWorkflow
* @param {Object} workflowService
* @param {Object} basePath
* @param {Object} gettext
* @returns {Object} create queue workflow service
* @description A workflow for the create queue action. * @description A workflow for the create queue action.
*/ */
function createQueueWorkflow(workflowService, basePath, gettext) { function createQueueWorkflow(workflowService, basePath, gettext) {

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -36,7 +36,16 @@
/** /**
* @ngDoc factory * @ngDoc factory
* @name horizon.dashboard.project.queues.actions.createSubscriptionService * @name horizon.dashboard.project.queues.actions.createSubscriptionService
* @Description A service to open the subscriptions wizard. * @param {Object} $q
* @param {Object} meta
* @param {Object} policy
* @param {Object} events
* @param {Object} createSubWorkflow
* @param {Object} zaqar
* @param {Object} wizard
* @param {Object} toast
* @returns {Object} create subscription service
* @description A service to open the subscriptions wizard.
*/ */
function createSubscriptionService( function createSubscriptionService(
$q, meta, policy, events, createSubWorkflow, zaqar, wizard, toast) { $q, meta, policy, events, createSubWorkflow, zaqar, wizard, toast) {
@ -83,8 +92,8 @@
}); });
} }
function allowed(queue) { function allowed() {
return policy.ifAllowed({ rules: [['queue', 'add_subscriptions']] });; return policy.ifAllowed({ rules: [['queue', 'add_subscriptions']] });
} }
function submit() { function submit() {
@ -97,7 +106,7 @@
scope.$emit(events.SUBSCRIPTION_CREATE_SUCCESS, model); scope.$emit(events.SUBSCRIPTION_CREATE_SUCCESS, model);
} }
function error(response) { function error() {
// TODO: Currently, when server throws an error // TODO: Currently, when server throws an error
// close the modal dialog and display the error message // close the modal dialog and display the error message
// In the future, display the error message inside the dialog // In the future, display the error message inside the dialog
@ -107,6 +116,3 @@
} // end of createSubscriptionService } // end of createSubscriptionService
})(); // end of IIFE })(); // end of IIFE

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -31,6 +31,10 @@
/** /**
* @ngdoc factory * @ngdoc factory
* @name horizon.dashboard.project.queues.actions.createSubscriptionWorkflow * @name horizon.dashboard.project.queues.actions.createSubscriptionWorkflow
* @param {Object} workflowService
* @param {Object} basePath
* @param {Object} gettext
* @returns {Object} create subscription workflow service
* @description A workflow for the create subscription action. * @description A workflow for the create subscription action.
*/ */
function createSubscriptionWorkflow(workflowService, basePath, gettext) { function createSubscriptionWorkflow(workflowService, basePath, gettext) {

View File

@ -35,7 +35,16 @@
/** /**
* @ngDoc factory * @ngDoc factory
* @name horizon.dashboard.project.queues.actions.deleteQueueService * @name horizon.dashboard.project.queues.actions.deleteQueueService
* @Description Brings up the delete queues confirmation modal dialog. * @param {Object} $q
* @param {Object} policy
* @param {Object} zaqar
* @param {Object} events
* @param {Object} gettext
* @param {Object} $qExtensions
* @param {Object} deleteModal
* @param {Object} toast
* @returns {Object} delete queue service
* @description Brings up the delete queues confirmation modal dialog.
* On submit, delete given queues. * On submit, delete given queues.
* On cancel, do nothing. * On cancel, do nothing.
*/ */
@ -65,7 +74,7 @@
$qExtensions.allSettled(queues.map(checkPermission)).then(afterCheck); $qExtensions.allSettled(queues.map(checkPermission)).then(afterCheck);
} }
function allowed(queue) { function allowed() {
return policy.ifAllowed({ rules: [['zaqar', 'delete_queues']] }); return policy.ifAllowed({ rules: [['zaqar', 'delete_queues']] });
} }

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -34,7 +34,15 @@
/** /**
* @ngDoc factory * @ngDoc factory
* @name horizon.dashboard.project.queues.actions.updateQueueService * @name horizon.dashboard.project.queues.actions.updateQueueService
* @Description A service to open the queues wizard. * @param {Object} meta
* @param {Object} policy
* @param {Object} events
* @param {Object} updateQueueWorkflow
* @param {Object} zaqar
* @param {Object} wizard
* @param {Object} toast
* @returns {Object} update queue service
* @description A service to open the queues wizard.
*/ */
function updateQueueService(meta, policy, events, updateQueueWorkflow, zaqar, wizard, toast) { function updateQueueService(meta, policy, events, updateQueueWorkflow, zaqar, wizard, toast) {
@ -91,8 +99,8 @@
}); });
} }
function allowed(queue) { function allowed() {
return policy.ifAllowed({ rules: [['queue', 'update_queue']] });; return policy.ifAllowed({ rules: [['queue', 'update_queue']] });
} }
function submit() { function submit() {

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -30,6 +30,10 @@
/** /**
* @ngdoc factory * @ngdoc factory
* @name horizon.dashboard.project.queues.actions.updateQueueWorkflow * @name horizon.dashboard.project.queues.actions.updateQueueWorkflow
* @param {Object} createQueueWorkflow
* @param {Object} basePath
* @param {Object} gettext
* @returns {Object} update queue workflow service
* @description A workflow for the update queue action. * @description A workflow for the update queue action.
*/ */
function updateQueueWorkflow(createQueueWorkflow, basePath, gettext) { function updateQueueWorkflow(createQueueWorkflow, basePath, gettext) {

View File

@ -38,6 +38,7 @@
/** /**
* @ngdoc value * @ngdoc value
* @name horizon.dashboard.project.queues.events * @name horizon.dashboard.project.queues.events
* @returns {Object} The event object
* @description a list of events for queues * @description a list of events for queues
*/ */
function events() { function events() {
@ -54,6 +55,9 @@
/** /**
* @ndoc config * @ndoc config
* @name horizon.dashboard.project.queues.basePath * @name horizon.dashboard.project.queues.basePath
* @param {Object} $provide
* @param {Object} $windowProvider
* @returns {undefined} Returns nothing
* @description Base path for the queues panel * @description Base path for the queues panel
*/ */
function config($provide, $windowProvider) { function config($provide, $windowProvider) {

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -30,13 +30,17 @@
/** /**
* @ngdoc controller * @ngdoc controller
* @name horizon.dashboard.project.queues.steps.QueueDetailsController * @name horizon.dashboard.project.queues.steps.QueueDetailsController
* @param {Object} $scope
* @param {Object} zaqar
* @param {Object} events
* @returns {undefined} Returns nothing
* @description This controller is use for creating a queue. * @description This controller is use for creating a queue.
*/ */
function controller($scope, zaqar, events) { function controller($scope, zaqar, events) {
var ctrl = this; var ctrl = this;
ctrl.queue = $scope.queue? $scope.queue: {}; ctrl.queue = $scope.queue ? $scope.queue : {};
ctrl.update = $scope.queue? true: false; ctrl.update = $scope.queue;
//////////////////////// ////////////////////////
@ -44,7 +48,7 @@
var watcher = $scope.$watchCollection(getQueue, onQueneChange); var watcher = $scope.$watchCollection(getQueue, onQueneChange);
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
watcher(); watcher();
}) });
//////////////////////// ////////////////////////
@ -52,12 +56,10 @@
return ctrl.queue; return ctrl.queue;
} }
function onQueneChange(newValue, oldValue){ function onQueneChange(newValue, oldValue) {
if (newValue !== oldValue) { if (newValue !== oldValue) {
$scope.$emit(events.DETAILS_CHANGED, newValue); $scope.$emit(events.DETAILS_CHANGED, newValue);
} }
} }
} // end of controller } // end of controller
})(); })();

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -33,12 +33,19 @@
/** /**
* @ngdoc controller * @ngdoc controller
* @name horizon.dashboard.project.queues.steps.QueueDetailsController * @name horizon.dashboard.project.queues.steps.QueueDetailsController
* @param {Object} $q
* @param {Object} $scope
* @param {Object} metadata
* @param {Object} zaqar
* @param {Object} events
* @param {Object} metaTree
* @returns {undefined} Returns nothing
* @description This controller is use for creating a queue. * @description This controller is use for creating a queue.
*/ */
function controller($q, $scope, metadata, zaqar, events, metaTree) { function controller($q, $scope, metadata, zaqar, events, metaTree) {
var ctrl = this; var ctrl = this;
var queue = $scope.queue? $scope.queue: {}; var queue = $scope.queue ? $scope.queue : {};
ctrl.tree = new metaTree.Tree([], []); ctrl.tree = new metaTree.Tree([], []);

View File

@ -14,7 +14,7 @@
* under the License. * under the License.
*/ */
(function() { (function() {
'use strict'; 'use strict';
angular angular
@ -31,6 +31,10 @@
/** /**
* @ngdoc controller * @ngdoc controller
* @name horizon.dashboard.project.queues.steps.SubscriptionController * @name horizon.dashboard.project.queues.steps.SubscriptionController
* @param {Object} $scope
* @param {Object} zaqar
* @param {Object} events
* @returns {undefined} Returns nothing
* @description This controller is use for creating a subscription. * @description This controller is use for creating a subscription.
*/ */
function SubscriptionController($scope, zaqar, events) { function SubscriptionController($scope, zaqar, events) {
@ -45,7 +49,7 @@
var watcher = $scope.$watchCollection(getSubscription, onSubscriptionChange); var watcher = $scope.$watchCollection(getSubscription, onSubscriptionChange);
$scope.$on('$destroy', function() { $scope.$on('$destroy', function() {
watcher(); watcher();
}) });
//////////////////////// ////////////////////////
@ -53,7 +57,7 @@
return ctrl.subscription; return ctrl.subscription;
} }
function onSubscriptionChange(newValue, oldValue){ function onSubscriptionChange(newValue, oldValue) {
if (newValue !== oldValue) { if (newValue !== oldValue) {
$scope.$emit(events.SUBSCRIPTION_CHANGED, newValue); $scope.$emit(events.SUBSCRIPTION_CHANGED, newValue);
} }

View File

@ -33,7 +33,7 @@
'horizon.dashboard.project.queues.basePath', 'horizon.dashboard.project.queues.basePath',
'horizon.dashboard.project.queues.events', 'horizon.dashboard.project.queues.events',
'horizon.dashboard.project.queues.resourceType', 'horizon.dashboard.project.queues.resourceType',
'horizon.framework.conf.resource-type-registry.service', 'horizon.framework.conf.resource-type-registry.service'
]; ];
function queueController($scope, zaqar, base, events, type, registry) { function queueController($scope, zaqar, base, events, type, registry) {
@ -80,7 +80,7 @@
// hz-table expects all items to have the id field // hz-table expects all items to have the id field
// so we need to manually add name as id here // so we need to manually add name as id here
ctrl.queuesSrc = response.data; ctrl.queuesSrc = response.data;
ctrl.queuesSrc.map(function addIdentifier(queue, index){ ctrl.queuesSrc.map(function addIdentifier(queue) {
queue.id = queue.name; queue.id = queue.name;
}); });
} }

View File

@ -51,7 +51,7 @@
function initScope() { function initScope() {
var expandWatcher = $scope.$on('hzTable:rowExpanded', getSubscriptions); var expandWatcher = $scope.$on('hzTable:rowExpanded', getSubscriptions);
var createWatcher = $scope.$on(events.SUBSCRIPTION_CREATE_SUCCESS, addSubscription); var createWatcher = $scope.$on(events.SUBSCRIPTION_CREATE_SUCCESS, addSubscription);
$scope.$on('$destroy', function destroy() { $scope.$on('$destroy', function destroy() {
expandWatcher(); expandWatcher();
createWatcher(); createWatcher();
}); });
@ -69,20 +69,20 @@
} }
} }
function addSubscription(event, sub){ function addSubscription(event, sub) {
checkAndInitMap(sub.queueName); checkAndInitMap(sub.queueName);
ctrl.queuesMap[sub.queueName].subscriptions.push(sub); ctrl.queuesMap[sub.queueName].subscriptions.push(sub);
} }
function deleteSubscription(queue, sub){ function deleteSubscription(queue, sub) {
var msg = gettext('Removed %(subscriber)s subscriber from the %(queue)s queue.'); var msg = gettext('Removed %(subscriber)s subscriber from the %(queue)s queue.');
var context = { subscriber: sub.subscriber, queue: queue.name }; var context = { subscriber: sub.subscriber, queue: queue.name };
zaqar.deleteSubscription(queue.name, sub).success(deleteSuccess); zaqar.deleteSubscription(queue.name, sub).success(deleteSuccess);
function deleteSuccess(){ function deleteSuccess() {
toast.add('success', interpolate(msg, context, true)); toast.add('success', interpolate(msg, context, true));
var index = ctrl.queuesMap[queue.name].subscriptions.indexOf(sub); var index = ctrl.queuesMap[queue.name].subscriptions.indexOf(sub);
if (index >= 0){ ctrl.queuesMap[queue.name].subscriptions.splice(index, 1); } if (index >= 0) { ctrl.queuesMap[queue.name].subscriptions.splice(index, 1); }
} }
} }

View File

@ -37,7 +37,7 @@
function validateSubscriber() { function validateSubscriber() {
var regex = /^(http:\/\/\w+|https:\/\/\w+|mailto:\w+)/ var regex = /^(http:\/\/\w+|https:\/\/\w+|mailto:\w+)/;
var directive = { var directive = {
require: 'ngModel', require: 'ngModel',
restrict: 'A', restrict: 'A',
@ -60,5 +60,4 @@
} }
} // end of link } // end of link
} // end of validateSubscriber } // end of validateSubscriber
})(); })();