Un-use 'scope' attribute for wizard modal service
'scope' attribute for wizard modal service is deprecated. It will be removed on Queens. So this patch changes not to use 'scope' attribute. Change-Id: Id716858468fcb05dcce9160809308b4213da923c Closes-Bug: #1647995
This commit is contained in:
parent
9fb9727321
commit
d4b03832ed
@ -69,37 +69,22 @@
|
||||
function initAction() {
|
||||
}
|
||||
|
||||
function onDetailChange(e, queue) {
|
||||
angular.extend(model, queue);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function onMetadataChange(e, metadata) {
|
||||
model.metadata = metadata;
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function perform(selected, $scope) {
|
||||
scope = $scope;
|
||||
var queueWatcher = $scope.$on(events.DETAILS_CHANGED, onDetailChange);
|
||||
var metadataWatcher = $scope.$on(events.METADATA_CHANGED, onMetadataChange);
|
||||
$scope.$on('$destroy', function destroy() {
|
||||
queueWatcher();
|
||||
metadataWatcher();
|
||||
});
|
||||
|
||||
wizard.modal({
|
||||
scope: scope,
|
||||
return wizard.modal({
|
||||
workflow: createQueueWorkflow,
|
||||
submit: submit
|
||||
});
|
||||
}).result;
|
||||
}
|
||||
|
||||
function allowed() {
|
||||
return policy.ifAllowed({ rules: [['queue', 'add_queue']] });
|
||||
}
|
||||
|
||||
function submit() {
|
||||
function submit(stepModels) {
|
||||
model = stepModels.queueDetailsForm;
|
||||
model.metadata = stepModels.queueMetadataForm;
|
||||
return zaqar.createQueue(model).then(success);
|
||||
}
|
||||
|
||||
|
@ -70,22 +70,12 @@
|
||||
function initAction() {
|
||||
}
|
||||
|
||||
function onSubscriptionChange(e, subscription) {
|
||||
angular.extend(model, subscription);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function perform(queue, $scope) {
|
||||
scope = $scope;
|
||||
var subWatcher = $scope.$on(events.SUBSCRIPTION_CHANGED, onSubscriptionChange);
|
||||
$scope.$on('$destroy', function destroy() {
|
||||
subWatcher();
|
||||
});
|
||||
|
||||
model = { subscriber: null, ttl: null, options: {} };
|
||||
model.queueName = queue.name;
|
||||
wizard.modal({
|
||||
scope: scope,
|
||||
workflow: createSubWorkflow,
|
||||
submit: submit
|
||||
});
|
||||
@ -95,7 +85,8 @@
|
||||
return policy.ifAllowed({ rules: [['queue', 'add_subscriptions']] });
|
||||
}
|
||||
|
||||
function submit() {
|
||||
function submit(stepModels) {
|
||||
angular.extend(model, stepModels.subscriptionForm);
|
||||
return zaqar.addSubscription(model).then(success, error);
|
||||
}
|
||||
|
||||
|
@ -69,30 +69,13 @@
|
||||
function initAction() {
|
||||
}
|
||||
|
||||
function onDetailChange(e, queue) {
|
||||
angular.extend(model, queue);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function onMetadataChange(e, metadata) {
|
||||
model.metadata = metadata;
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function perform(queue, $scope) {
|
||||
scope = $scope;
|
||||
var queueWatcher = $scope.$on(events.DETAILS_CHANGED, onDetailChange);
|
||||
var metadataWatcher = $scope.$on(events.METADATA_CHANGED, onMetadataChange);
|
||||
$scope.$on('$destroy', function destroy() {
|
||||
queueWatcher();
|
||||
metadataWatcher();
|
||||
});
|
||||
|
||||
model = queue;
|
||||
$scope.queue = model;
|
||||
model.queue_name = queue.name;
|
||||
wizard.modal({
|
||||
scope: $scope,
|
||||
data: {queue: model},
|
||||
workflow: updateQueueWorkflow,
|
||||
submit: submit
|
||||
});
|
||||
@ -102,7 +85,9 @@
|
||||
return policy.ifAllowed({ rules: [['queue', 'update_queue']] });
|
||||
}
|
||||
|
||||
function submit() {
|
||||
function submit(stepModels) {
|
||||
model = stepModels.queueDetailsForm;
|
||||
model.metadata = stepModels.queueMetadataForm;
|
||||
return zaqar.updateQueue(model).then(success);
|
||||
}
|
||||
|
||||
|
@ -22,44 +22,22 @@
|
||||
.controller('horizon.dashboard.project.queues.steps.QueueDetailsController', controller);
|
||||
|
||||
controller.$inject = [
|
||||
'$scope',
|
||||
'horizon.app.core.openstack-service-api.zaqar',
|
||||
'horizon.dashboard.project.queues.events'
|
||||
'$scope'
|
||||
];
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
function controller($scope) {
|
||||
|
||||
var ctrl = this;
|
||||
ctrl.queue = $scope.queue ? $scope.queue : {};
|
||||
ctrl.update = $scope.queue;
|
||||
|
||||
////////////////////////
|
||||
|
||||
// watch this object, when it changes, emit to parent listeners
|
||||
var watcher = $scope.$watchCollection(getQueue, onQueneChange);
|
||||
$scope.$on('$destroy', function() {
|
||||
watcher();
|
||||
});
|
||||
|
||||
////////////////////////
|
||||
|
||||
function getQueue() {
|
||||
return ctrl.queue;
|
||||
}
|
||||
|
||||
function onQueneChange(newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
$scope.$emit(events.DETAILS_CHANGED, newValue);
|
||||
}
|
||||
}
|
||||
$scope.stepModels.queueDetailsForm = ctrl.queue;
|
||||
} // end of controller
|
||||
})();
|
||||
|
@ -105,7 +105,7 @@
|
||||
|
||||
function onMetadataChanged(newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
$scope.$emit(events.METADATA_CHANGED, newValue);
|
||||
$scope.stepModels.queueMetadataForm = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,46 +23,21 @@
|
||||
SubscriptionController);
|
||||
|
||||
SubscriptionController.$inject = [
|
||||
'$scope',
|
||||
'horizon.app.core.openstack-service-api.zaqar',
|
||||
'horizon.dashboard.project.queues.events'
|
||||
'$scope'
|
||||
];
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
function SubscriptionController($scope) {
|
||||
|
||||
var ctrl = this;
|
||||
ctrl.subscription = { ttl: 3600 };
|
||||
ctrl.update = false;
|
||||
|
||||
////////////////////////
|
||||
|
||||
// watch this object, when it changes, emit to parent listeners
|
||||
var watcher = $scope.$watchCollection(getSubscription, onSubscriptionChange);
|
||||
$scope.$on('$destroy', function() {
|
||||
watcher();
|
||||
});
|
||||
|
||||
////////////////////////
|
||||
|
||||
function getSubscription() {
|
||||
return ctrl.subscription;
|
||||
}
|
||||
|
||||
function onSubscriptionChange(newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
$scope.$emit(events.SUBSCRIPTION_CHANGED, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.stepModels.subscriptionForm = ctrl.subscription;
|
||||
} // end of SubscriptionController
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user