quick change to copy template name building, misc #1131 work

This commit is contained in:
Leigh Johnson 2016-03-28 17:34:37 -04:00
parent 488b333387
commit d0f3248d79
5 changed files with 23 additions and 13 deletions

View File

@ -25,7 +25,7 @@
<!-- controls -->
<div class="HostEvent-controls">
<button ng-show="showPrev()" ng-click="goPrevious()"
<button ng-show="showPrev()" ng-click="goPrev()"
class="btn btn-sm btn-default">Prev</button>
<button ng-show="showNext()"ng-click="goNext()" class="btn btn-sm btn-default">Next</button>
<button ui-sref="jobDetail" class="btn btn-sm btn-default" ng-show="true" >Close</button>

View File

@ -9,6 +9,9 @@
}
.HostEvent-controls{
float: right;
button {
margin-left: 10px;
}
}
.HostEvent-status--ok{
color: @green;

View File

@ -44,7 +44,7 @@
$state.go('jobDetail.host-event.details', {eventId: id})
};
$scope.goPrevious = function(){
$scope.goPrev = function(){
var index = $scope.getActiveHostIndex() - 1;
var id = $scope.hostResults[index].id;
$state.go('jobDetail.host-event.details', {eventId: id})

View File

@ -33,16 +33,18 @@ export default
});
// flatten Ansible's passed-through response
result.event_data = {};
Object.keys(data.event_data.res).forEach(function(key, index){
if (ignored.indexOf(key) > -1) {
return
}
else{
//console.log(key, data.event_data.res[key])
result.event_data[key] = data.event_data.res[key];
}
});
try{
result.event_data = {};
Object.keys(data.event_data.res).forEach(function(key, index){
if (ignored.indexOf(key) > -1) {
return
}
else{
result.event_data[key] = data.event_data.res[key];
}
});
}
catch(err){result.event_data = null;}
return result
},

View File

@ -23,7 +23,8 @@
set: function(data){
var defaultUrl = GetBasePath('job_templates');
Rest.setUrl(defaultUrl);
data.results[0].name = data.results[0].name + ' ' + moment().format('h:mm:ss a'); // 2:49:11 pm
var name = this.buildName(data.results[0].name)
data.results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm
return Rest.post(data.results[0])
.success(function(res){
return res
@ -32,6 +33,10 @@
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status});
});
},
buildName: function(name){
var result = name.split('@')[0];
return result
}
}
}