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.
*/
(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() {

View File

@ -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) {

View File

@ -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

View File

@ -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) {

View File

@ -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']] });
}

View File

@ -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() {

View File

@ -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) {

View File

@ -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) {

View File

@ -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
})();

View File

@ -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([], []);

View File

@ -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);
}

View File

@ -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;
});
}

View File

@ -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); }
}
}

View File

@ -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
})();