Use initAction instead initScope
initScope() is deprecated in Ocata and will be removed in Queens. So this patch changes to use initScope() to initAction(). Change-Id: I29773d135bebdeb54c1a9fa65d1e274f29e958bd Closes-Bug: #1647921
This commit is contained in:
parent
5a907b82e3
commit
e524400286
@ -57,7 +57,7 @@
|
||||
};
|
||||
|
||||
var service = {
|
||||
initScope: initScope,
|
||||
initAction: initAction,
|
||||
perform: perform,
|
||||
allowed: allowed
|
||||
};
|
||||
@ -66,16 +66,7 @@
|
||||
|
||||
//////////////
|
||||
|
||||
// we define initScope so that the table controller
|
||||
// will know when a new queue has been created
|
||||
function initScope($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();
|
||||
});
|
||||
function initAction() {
|
||||
}
|
||||
|
||||
function onDetailChange(e, queue) {
|
||||
@ -88,7 +79,15 @@
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function perform() {
|
||||
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,
|
||||
workflow: createQueueWorkflow,
|
||||
|
@ -58,7 +58,7 @@
|
||||
var model = null;
|
||||
|
||||
var service = {
|
||||
initScope: initScope,
|
||||
initAction: initAction,
|
||||
perform: perform,
|
||||
allowed: allowed
|
||||
};
|
||||
@ -67,14 +67,7 @@
|
||||
|
||||
//////////////
|
||||
|
||||
// we define initScope so that the table controller
|
||||
// will know when a new subscription has been created
|
||||
function initScope($scope) {
|
||||
scope = $scope;
|
||||
var subWatcher = $scope.$on(events.SUBSCRIPTION_CHANGED, onSubscriptionChange);
|
||||
$scope.$on('$destroy', function destroy() {
|
||||
subWatcher();
|
||||
});
|
||||
function initAction() {
|
||||
}
|
||||
|
||||
function onSubscriptionChange(e, subscription) {
|
||||
@ -82,7 +75,13 @@
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function perform(queue) {
|
||||
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({
|
||||
|
@ -51,9 +51,9 @@
|
||||
function deleteQueueService(
|
||||
$q, policy, zaqar, events, gettext, $qExtensions, deleteModal, toast) {
|
||||
|
||||
var scope, context;
|
||||
var context;
|
||||
var service = {
|
||||
initScope: initScope,
|
||||
initAction: initAction,
|
||||
allowed: allowed,
|
||||
perform: perform
|
||||
};
|
||||
@ -62,16 +62,24 @@
|
||||
|
||||
//////////////
|
||||
|
||||
function initScope(newScope) {
|
||||
scope = newScope;
|
||||
function initAction() {
|
||||
context = { successEvent: events.DELETE_SUCCESS };
|
||||
}
|
||||
|
||||
function perform(items) {
|
||||
function perform(items, $scope) {
|
||||
var queues = angular.isArray(items) ? items : [items];
|
||||
context.labels = labelize(queues.length);
|
||||
context.deleteEntity = deleteQueue;
|
||||
$qExtensions.allSettled(queues.map(checkPermission)).then(afterCheck);
|
||||
|
||||
function afterCheck(result) {
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(result.fail));
|
||||
}
|
||||
if (result.pass.length > 0) {
|
||||
deleteModal.open($scope, result.pass.map(getEntity), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function allowed() {
|
||||
@ -86,15 +94,6 @@
|
||||
return { promise: allowed(queue), context: queue };
|
||||
}
|
||||
|
||||
function afterCheck(result) {
|
||||
if (result.fail.length > 0) {
|
||||
toast.add('error', getMessage(result.fail));
|
||||
}
|
||||
if (result.pass.length > 0) {
|
||||
deleteModal.open(scope, result.pass.map(getEntity), context);
|
||||
}
|
||||
}
|
||||
|
||||
function getMessage(entities) {
|
||||
var message = gettext("You are not allowed to delete queues: %s");
|
||||
return interpolate(message, [entities.map(getName).join(", ")]);
|
||||
|
@ -57,7 +57,7 @@
|
||||
};
|
||||
|
||||
var service = {
|
||||
initScope: initScope,
|
||||
initAction: initAction,
|
||||
perform: perform,
|
||||
allowed: allowed
|
||||
};
|
||||
@ -66,16 +66,7 @@
|
||||
|
||||
//////////////
|
||||
|
||||
// we define initScope so that the table controller
|
||||
// will know when a queue has been updated
|
||||
function initScope($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();
|
||||
});
|
||||
function initAction() {
|
||||
}
|
||||
|
||||
function onDetailChange(e, queue) {
|
||||
@ -88,12 +79,20 @@
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function perform(queue) {
|
||||
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;
|
||||
$scope.queue = model;
|
||||
model.queue_name = queue.name;
|
||||
wizard.modal({
|
||||
scope: scope,
|
||||
scope: $scope,
|
||||
workflow: updateQueueWorkflow,
|
||||
submit: submit
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user