Merge "Use initAction() instead initScope()"
This commit is contained in:
commit
7edfcd5f02
@ -41,14 +41,13 @@
|
|||||||
function createService(
|
function createService(
|
||||||
$location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
$location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var scope;
|
var scope;
|
||||||
var message = {
|
var message = {
|
||||||
success: gettext('Container %s was successfully created.')
|
success: gettext('Container %s was successfully created.')
|
||||||
};
|
};
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
perform: perform,
|
perform: perform,
|
||||||
allowed: allowed
|
allowed: allowed
|
||||||
};
|
};
|
||||||
@ -57,15 +56,13 @@
|
|||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
function initScope($scope) {
|
function initAction() {
|
||||||
scope = $scope;
|
|
||||||
scope.workflow = createWorkflow;
|
|
||||||
scope.model = model;
|
|
||||||
scope.$on('$destroy', function() {
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function perform(selected) {
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
|
scope.workflow = createWorkflow;
|
||||||
|
scope.model = model;
|
||||||
scope.model.init();
|
scope.model.init();
|
||||||
// for creation according to selected item
|
// for creation according to selected item
|
||||||
scope.selected = selected;
|
scope.selected = selected;
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
successEvent: events.DELETE_SUCCESS
|
successEvent: events.DELETE_SUCCESS
|
||||||
};
|
};
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
perform: perform
|
perform: perform
|
||||||
};
|
};
|
||||||
@ -61,10 +61,7 @@
|
|||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
|
|
||||||
// include this function in your service
|
function initAction() {
|
||||||
// if you plan to emit events to the parent controller
|
|
||||||
function initScope($scope) {
|
|
||||||
scope = $scope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowed() {
|
function allowed() {
|
||||||
@ -72,7 +69,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delete selected resource objects
|
// delete selected resource objects
|
||||||
function perform(selected) {
|
function perform(selected, newScope) {
|
||||||
|
scope = newScope;
|
||||||
var selected = angular.isArray(selected) ? selected : [selected];
|
var selected = angular.isArray(selected) ? selected : [selected];
|
||||||
context.labels = labelize(selected.length);
|
context.labels = labelize(selected.length);
|
||||||
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck);
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
perform: perform
|
perform: perform
|
||||||
};
|
};
|
||||||
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
// include this function in your service
|
// include this function in your service
|
||||||
// if you plan to emit events to the parent controller
|
// if you plan to emit events to the parent controller
|
||||||
function initScope() {
|
function initAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowed() {
|
function allowed() {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
perform: perform
|
perform: perform
|
||||||
};
|
};
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
// include this function in your service
|
// include this function in your service
|
||||||
// if you plan to emit events to the parent controller
|
// if you plan to emit events to the parent controller
|
||||||
function initScope() {
|
function initAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowed() {
|
function allowed() {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
perform: perform
|
perform: perform
|
||||||
};
|
};
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
// include this function in your service
|
// include this function in your service
|
||||||
// if you plan to emit events to the parent controller
|
// if you plan to emit events to the parent controller
|
||||||
function initScope() {
|
function initAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowed() {
|
function allowed() {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
perform: perform
|
perform: perform
|
||||||
};
|
};
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
// include this function in your service
|
// include this function in your service
|
||||||
// if you plan to emit events to the parent controller
|
// if you plan to emit events to the parent controller
|
||||||
function initScope() {
|
function initAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowed() {
|
function allowed() {
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
initScope: initScope,
|
initAction: initAction,
|
||||||
allowed: allowed,
|
allowed: allowed,
|
||||||
perform: perform
|
perform: perform
|
||||||
};
|
};
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
// include this function in your service
|
// include this function in your service
|
||||||
// if you plan to emit events to the parent controller
|
// if you plan to emit events to the parent controller
|
||||||
function initScope() {
|
function initAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowed() {
|
function allowed() {
|
||||||
|
Loading…
Reference in New Issue
Block a user