Commit 5c7167e5 authored by jaapjansma's avatar jaapjansma
Browse files

Improvement for performance #22

parent 7843cf0a
......@@ -95,7 +95,7 @@ class CRM_FormProcessor_Upgrader extends CRM_FormProcessor_Upgrader_Base {
$manager = CRM_Extension_System::singleton()->getManager();
$dependencies = array(
['action-provider', '1.20']
['action-provider', '1.61']
);
$unmet = array();
......
(function(angular, $, _) {
// Declare a list of dependencies.
angular.module('form_processor', [
'crmUi', 'crmUtil', 'ngRoute'
'crmUi', 'crmUtil', 'ngRoute', 'action_provider'
]);
angular.module('form_processor').factory('formProcessorFactory', ["crmApi", "$q", function(crmApi, $q) {
angular.module('form_processor').factory('formProcessorFactory', ["crmApi", "$q", "actionProviderFactory", function(crmApi, $q, actionProviderFactory) {
var actionTypes = {};
// Initialize the context.
......@@ -13,17 +13,15 @@
}
}
var retrieveAction = function(name, context) {
setAction = function(name, context, action) {
setContext(context);
if (!(name in actionTypes[context])) {
return crmApi('ActionProvider', 'getaction', {name: name, context:context});
}
return $q.resolve(actionTypes[context][name]);
};
actionTypes[context][name] = action;
actionProviderFactory.setAction(name, context, action);
}
return {
getAction: function(name, context) {
return retrieveAction(name, context);
return actionProviderFactory.getAction(name, context);
},
getFieldList: function (inputs, actions, selectedAction, context) {
......@@ -74,7 +72,7 @@
.then(function(results) {
angular.forEach(results, function(actionType, key) {
var action = actions[key];
actionTypes[context][action.name] = actionType;
setAction(action.name, context, actionType);
angular.forEach(actionType.output_spec, function(output_field, output_field_key) {
var field = {
'id': 'action.' + action.name + '.' + output_field.name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment