From f6784a28790369b85ebbfd921ee26a4f21f9e2c5 Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Mon, 12 Sep 2016 19:12:54 +0900 Subject: [PATCH] Fix eslint errors This patch fixes eslint errors except warnings for TODO. Change-Id: I4024dfdd326c058c73a28b0655c0197bbffda075 Closes-Bug: #1622475 --- .../queues/actions/create-queue.service.js | 14 +++++++++--- .../queues/actions/create-queue.workflow.js | 6 ++++- .../actions/create-subscription.service.js | 22 ++++++++++++------- .../actions/create-subscription.workflow.js | 6 ++++- .../queues/actions/delete-queue.service.js | 13 +++++++++-- .../queues/actions/update-queue.service.js | 16 ++++++++++---- .../queues/actions/update-queue.workflow.js | 6 ++++- .../dashboard/project/queues/queues.module.js | 4 ++++ .../queue-details/queue-details.controller.js | 16 ++++++++------ .../queue-metadata.controller.js | 11 ++++++++-- .../subscription/subscription.controller.js | 10 ++++++--- .../project/queues/table/queue.controller.js | 4 ++-- .../queues/table/subscription.controller.js | 10 ++++----- .../util/validators/validateSubscriber.js | 3 +-- 14 files changed, 100 insertions(+), 41 deletions(-) diff --git a/zaqar_ui/static/dashboard/project/queues/actions/create-queue.service.js b/zaqar_ui/static/dashboard/project/queues/actions/create-queue.service.js index 88437dd..d7e4a46 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/create-queue.service.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/create-queue.service.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -34,7 +34,15 @@ /** * @ngDoc factory * @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) { @@ -89,7 +97,7 @@ } function allowed() { - return policy.ifAllowed({ rules: [['queue', 'add_queue']] });; + return policy.ifAllowed({ rules: [['queue', 'add_queue']] }); } function submit() { diff --git a/zaqar_ui/static/dashboard/project/queues/actions/create-queue.workflow.js b/zaqar_ui/static/dashboard/project/queues/actions/create-queue.workflow.js index 940e8b0..e4e6c1c 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/create-queue.workflow.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/create-queue.workflow.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -30,6 +30,10 @@ /** * @ngdoc factory * @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. */ function createQueueWorkflow(workflowService, basePath, gettext) { diff --git a/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.service.js b/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.service.js index 98c5c1e..e1de220 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.service.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.service.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -36,7 +36,16 @@ /** * @ngDoc factory * @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( $q, meta, policy, events, createSubWorkflow, zaqar, wizard, toast) { @@ -83,8 +92,8 @@ }); } - function allowed(queue) { - return policy.ifAllowed({ rules: [['queue', 'add_subscriptions']] });; + function allowed() { + return policy.ifAllowed({ rules: [['queue', 'add_subscriptions']] }); } function submit() { @@ -97,7 +106,7 @@ scope.$emit(events.SUBSCRIPTION_CREATE_SUCCESS, model); } - function error(response) { + function error() { // TODO: Currently, when server throws an error // close the modal dialog and display the error message // In the future, display the error message inside the dialog @@ -107,6 +116,3 @@ } // end of createSubscriptionService })(); // end of IIFE - - - diff --git a/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.workflow.js b/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.workflow.js index d876ec0..8d60570 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.workflow.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/create-subscription.workflow.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -31,6 +31,10 @@ /** * @ngdoc factory * @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. */ function createSubscriptionWorkflow(workflowService, basePath, gettext) { diff --git a/zaqar_ui/static/dashboard/project/queues/actions/delete-queue.service.js b/zaqar_ui/static/dashboard/project/queues/actions/delete-queue.service.js index 380c9bd..0cb0309 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/delete-queue.service.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/delete-queue.service.js @@ -35,7 +35,16 @@ /** * @ngDoc factory * @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 cancel, do nothing. */ @@ -65,7 +74,7 @@ $qExtensions.allSettled(queues.map(checkPermission)).then(afterCheck); } - function allowed(queue) { + function allowed() { return policy.ifAllowed({ rules: [['zaqar', 'delete_queues']] }); } diff --git a/zaqar_ui/static/dashboard/project/queues/actions/update-queue.service.js b/zaqar_ui/static/dashboard/project/queues/actions/update-queue.service.js index 469910f..c018724 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/update-queue.service.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/update-queue.service.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -34,7 +34,15 @@ /** * @ngDoc factory * @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) { @@ -91,8 +99,8 @@ }); } - function allowed(queue) { - return policy.ifAllowed({ rules: [['queue', 'update_queue']] });; + function allowed() { + return policy.ifAllowed({ rules: [['queue', 'update_queue']] }); } function submit() { diff --git a/zaqar_ui/static/dashboard/project/queues/actions/update-queue.workflow.js b/zaqar_ui/static/dashboard/project/queues/actions/update-queue.workflow.js index 67d0f3b..990ddff 100644 --- a/zaqar_ui/static/dashboard/project/queues/actions/update-queue.workflow.js +++ b/zaqar_ui/static/dashboard/project/queues/actions/update-queue.workflow.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -30,6 +30,10 @@ /** * @ngdoc factory * @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. */ function updateQueueWorkflow(createQueueWorkflow, basePath, gettext) { diff --git a/zaqar_ui/static/dashboard/project/queues/queues.module.js b/zaqar_ui/static/dashboard/project/queues/queues.module.js index 2904ed9..fcf70a4 100644 --- a/zaqar_ui/static/dashboard/project/queues/queues.module.js +++ b/zaqar_ui/static/dashboard/project/queues/queues.module.js @@ -38,6 +38,7 @@ /** * @ngdoc value * @name horizon.dashboard.project.queues.events + * @returns {Object} The event object * @description a list of events for queues */ function events() { @@ -54,6 +55,9 @@ /** * @ndoc config * @name horizon.dashboard.project.queues.basePath + * @param {Object} $provide + * @param {Object} $windowProvider + * @returns {undefined} Returns nothing * @description Base path for the queues panel */ function config($provide, $windowProvider) { diff --git a/zaqar_ui/static/dashboard/project/queues/steps/queue-details/queue-details.controller.js b/zaqar_ui/static/dashboard/project/queues/steps/queue-details/queue-details.controller.js index 4ccf8cc..a9c275f 100644 --- a/zaqar_ui/static/dashboard/project/queues/steps/queue-details/queue-details.controller.js +++ b/zaqar_ui/static/dashboard/project/queues/steps/queue-details/queue-details.controller.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -30,13 +30,17 @@ /** * @ngdoc controller * @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. */ function controller($scope, zaqar, events) { var ctrl = this; - ctrl.queue = $scope.queue? $scope.queue: {}; - ctrl.update = $scope.queue? true: false; + ctrl.queue = $scope.queue ? $scope.queue : {}; + ctrl.update = $scope.queue; //////////////////////// @@ -44,7 +48,7 @@ var watcher = $scope.$watchCollection(getQueue, onQueneChange); $scope.$on('$destroy', function() { watcher(); - }) + }); //////////////////////// @@ -52,12 +56,10 @@ return ctrl.queue; } - function onQueneChange(newValue, oldValue){ + function onQueneChange(newValue, oldValue) { if (newValue !== oldValue) { $scope.$emit(events.DETAILS_CHANGED, newValue); } } - } // end of controller - })(); diff --git a/zaqar_ui/static/dashboard/project/queues/steps/queue-metadata/queue-metadata.controller.js b/zaqar_ui/static/dashboard/project/queues/steps/queue-metadata/queue-metadata.controller.js index 76a628d..78d45b1 100644 --- a/zaqar_ui/static/dashboard/project/queues/steps/queue-metadata/queue-metadata.controller.js +++ b/zaqar_ui/static/dashboard/project/queues/steps/queue-metadata/queue-metadata.controller.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -33,12 +33,19 @@ /** * @ngdoc controller * @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. */ function controller($q, $scope, metadata, zaqar, events, metaTree) { var ctrl = this; - var queue = $scope.queue? $scope.queue: {}; + var queue = $scope.queue ? $scope.queue : {}; ctrl.tree = new metaTree.Tree([], []); diff --git a/zaqar_ui/static/dashboard/project/queues/steps/subscription/subscription.controller.js b/zaqar_ui/static/dashboard/project/queues/steps/subscription/subscription.controller.js index 3e09c73..81a6440 100644 --- a/zaqar_ui/static/dashboard/project/queues/steps/subscription/subscription.controller.js +++ b/zaqar_ui/static/dashboard/project/queues/steps/subscription/subscription.controller.js @@ -14,7 +14,7 @@ * under the License. */ - (function() { +(function() { 'use strict'; angular @@ -31,6 +31,10 @@ /** * @ngdoc controller * @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. */ function SubscriptionController($scope, zaqar, events) { @@ -45,7 +49,7 @@ var watcher = $scope.$watchCollection(getSubscription, onSubscriptionChange); $scope.$on('$destroy', function() { watcher(); - }) + }); //////////////////////// @@ -53,7 +57,7 @@ return ctrl.subscription; } - function onSubscriptionChange(newValue, oldValue){ + function onSubscriptionChange(newValue, oldValue) { if (newValue !== oldValue) { $scope.$emit(events.SUBSCRIPTION_CHANGED, newValue); } diff --git a/zaqar_ui/static/dashboard/project/queues/table/queue.controller.js b/zaqar_ui/static/dashboard/project/queues/table/queue.controller.js index fa20fbb..670eac9 100644 --- a/zaqar_ui/static/dashboard/project/queues/table/queue.controller.js +++ b/zaqar_ui/static/dashboard/project/queues/table/queue.controller.js @@ -33,7 +33,7 @@ 'horizon.dashboard.project.queues.basePath', 'horizon.dashboard.project.queues.events', '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) { @@ -80,7 +80,7 @@ // hz-table expects all items to have the id field // so we need to manually add name as id here ctrl.queuesSrc = response.data; - ctrl.queuesSrc.map(function addIdentifier(queue, index){ + ctrl.queuesSrc.map(function addIdentifier(queue) { queue.id = queue.name; }); } diff --git a/zaqar_ui/static/dashboard/project/queues/table/subscription.controller.js b/zaqar_ui/static/dashboard/project/queues/table/subscription.controller.js index 486cab2..87723a3 100644 --- a/zaqar_ui/static/dashboard/project/queues/table/subscription.controller.js +++ b/zaqar_ui/static/dashboard/project/queues/table/subscription.controller.js @@ -51,7 +51,7 @@ function initScope() { var expandWatcher = $scope.$on('hzTable:rowExpanded', getSubscriptions); var createWatcher = $scope.$on(events.SUBSCRIPTION_CREATE_SUCCESS, addSubscription); - $scope.$on('$destroy', function destroy() { + $scope.$on('$destroy', function destroy() { expandWatcher(); createWatcher(); }); @@ -69,20 +69,20 @@ } } - function addSubscription(event, sub){ + function addSubscription(event, sub) { checkAndInitMap(sub.queueName); 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 context = { subscriber: sub.subscriber, queue: queue.name }; zaqar.deleteSubscription(queue.name, sub).success(deleteSuccess); - function deleteSuccess(){ + function deleteSuccess() { toast.add('success', interpolate(msg, context, true)); 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); } } } diff --git a/zaqar_ui/static/framework/util/validators/validateSubscriber.js b/zaqar_ui/static/framework/util/validators/validateSubscriber.js index 41a2cec..44b352c 100644 --- a/zaqar_ui/static/framework/util/validators/validateSubscriber.js +++ b/zaqar_ui/static/framework/util/validators/validateSubscriber.js @@ -37,7 +37,7 @@ function validateSubscriber() { - var regex = /^(http:\/\/\w+|https:\/\/\w+|mailto:\w+)/ + var regex = /^(http:\/\/\w+|https:\/\/\w+|mailto:\w+)/; var directive = { require: 'ngModel', restrict: 'A', @@ -60,5 +60,4 @@ } } // end of link } // end of validateSubscriber - })();