post processing for credentials list

This commit is contained in:
jaredevantabor 2016-12-14 17:38:09 -08:00
parent db4bb50976
commit 8c55eaec99
3 changed files with 32 additions and 26 deletions

View File

@ -36,6 +36,36 @@ export function CredentialsList($scope, $rootScope, $location, $log,
$scope.selected = [];
}
$scope.$on(`${list.iterator}_options`, function(event, data){
$scope.options = data.data.actions.GET;
optionsRequestDataProcessing();
});
$scope.$watchCollection(`${$scope.list.name}`, function() {
optionsRequestDataProcessing();
}
);
// iterate over the list and add fields like type label, after the
// OPTIONS request returns, or the list is sorted/paginated/searched
function optionsRequestDataProcessing(){
$scope[list.name].forEach(function(item, item_idx) {
var itm = $scope[list.name][item_idx];
// Set the item type label
debugger;
if (list.fields.kind && $scope.options &&
$scope.options.hasOwnProperty('kind')) {
$scope.options.kind.choices.every(function(choice) {
if (choice[0] === item.kind) {
itm.kind_label = choice[1];
return false;
}
return true;
});
}
});
}
$scope.addCredential = function() {
$state.go('credentials.add');
};

View File

@ -28,33 +28,8 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
$scope.showJobType = true;
// _.forEach($scope[list.name], buildTooltips);
// if ($scope.removeChoicesReady) {
// $scope.removeChoicesReady();
// }
// $scope.removeChoicesReady = $scope.$on('choicesReady', function() {
// $scope[list.name].forEach(function(item, item_idx) {
// var itm = $scope[list.name][item_idx];
// if(item.summary_fields && item.summary_fields.source_workflow_job &&
// item.summary_fields.source_workflow_job.id){
// item.workflow_result_link = `/#/workflows/${item.summary_fields.source_workflow_job.id}`;
// }
// // Set the item type label
// if (list.fields.type) {
// $scope.type_choices.every(function(choice) {
// if (choice.value === item.type) {
// itm.type_label = choice.label;
// return false;
// }
// return true;
// });
// }
// });
// });
}
$scope.$on(`${list.iterator}_options`, function(event, data){
$scope.options = data.data.actions.GET;
optionsRequestDataProcessing();

View File

@ -37,6 +37,7 @@ export default
},
kind: {
label: i18n._('Type'),
ngBind: 'credential.kind_label',
excludeModal: true,
nosort: true,
columnClass: 'col-md-2 hidden-sm hidden-xs'