Add assignment of on list change

This commit is contained in:
gconsidine 2017-07-24 14:27:40 -04:00
parent 01316aebf7
commit ce4eccc513

View File

@ -21,16 +21,14 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
$scope.canAdd = params.canAdd;
});
$scope.$watch(list.name, assignCredentialKinds);
// search init
$scope.list = list;
$scope[`${list.iterator}_dataset`] = Dataset.data;
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
$scope.selected = [];
$scope[list.name].forEach(credential => {
credential.kind = credentialType.getById(credential.credential_type).name;
});
}
$scope.$on(`${list.iterator}_options`, function(event, data){
@ -42,6 +40,12 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
optionsRequestDataProcessing();
});
function assignCredentialKinds () {
$scope[list.name].forEach(credential => {
credential.kind = credentialType.getById(credential.credential_type).name;
});
}
// iterate over the list and add fields like type label, after the
// OPTIONS request returns, or the list is sorted/paginated/searched
function optionsRequestDataProcessing(){