supply missing providers, resolves #1590

This commit is contained in:
Leigh Johnson
2016-04-19 12:50:13 -04:00
parent 2d8b1443cb
commit 1b51021a58
4 changed files with 73 additions and 58 deletions

View File

@@ -35,12 +35,15 @@ export default
resolve: { resolve: {
features: ['FeaturesService', function(FeaturesService){ features: ['FeaturesService', function(FeaturesService){
return FeaturesService.get(); return FeaturesService.get();
}] }],
JobTemplateExtraVars: function(){
return null;
}
} }
}); });
$stateExtender.addState({ $stateExtender.addState({
name: 'managementJobSchedules.edit', name: 'managementJobSchedules.edit',
route: '/add', route: '/edit/:schedule_id',
templateUrl: templateUrl('management-jobs/scheduler/schedulerForm'), templateUrl: templateUrl('management-jobs/scheduler/schedulerForm'),
controller: 'managementJobEditController', controller: 'managementJobEditController',
resolve: { resolve: {

View File

@@ -40,7 +40,7 @@ export default
Rest.setUrl(defaultUrl); Rest.setUrl(defaultUrl);
return Rest.get().then(function(res){ return Rest.get().then(function(res){
// handle unescaped newlines // handle unescaped newlines
return JSON.parse(JSON.stringify(res.data.extra_vars)) return JSON.parse(JSON.stringify(res.data.extra_vars));
}); });
}] }]
} }
@@ -64,7 +64,10 @@ export default
resolve: { resolve: {
features: ['FeaturesService', function(FeaturesService) { features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get(); return FeaturesService.get();
}] }],
JobTemplateExtraVars: function(){
return null;
}
} }
}); });
$stateExtender.addState({ $stateExtender.addState({
@@ -75,7 +78,10 @@ export default
resolve: { resolve: {
features: ['FeaturesService', function(FeaturesService) { features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get(); return FeaturesService.get();
}] }],
JobTemplateExtraVars: function(){
return null;
}
} }
}); });
$stateExtender.addState({ $stateExtender.addState({

View File

@@ -2,7 +2,6 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
$scope.$on("ScheduleFormCreated", function(e, scope) { $scope.$on("ScheduleFormCreated", function(e, scope) {
$scope.hideForm = false; $scope.hideForm = false;
$scope = angular.extend($scope, scope); $scope = angular.extend($scope, scope);
$scope.$on("formUpdated", function() { $scope.$on("formUpdated", function() {
$rootScope.$broadcast("loadSchedulerDetailPane"); $rootScope.$broadcast("loadSchedulerDetailPane");
}); });
@@ -46,15 +45,16 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
$state.go("^"); $state.go("^");
}; };
// extra_data field is not manifested in the UI when scheduling a Management Job
if ($state.current.name !== ('managementJobSchedules.add' || 'managementJobSchedules.edit')){
$scope.parseType = 'yaml'; $scope.parseType = 'yaml';
$scope.extraVars = JobTemplateExtraVars === '' ? '---' : JobTemplateExtraVars; $scope.extraVars = JobTemplateExtraVars === '' || JobTemplateExtraVars === null ? '---' : JobTemplateExtraVars;
ParseTypeChange({ ParseTypeChange({
scope: $scope, scope: $scope,
variable: 'extraVars', variable: 'extraVars',
parse_variable: 'parseType', parse_variable: 'parseType',
field_id: 'SchedulerForm-extraVars' field_id: 'SchedulerForm-extraVars'
}); });
$scope.$watch('extraVars', function(){ $scope.$watch('extraVars', function(){
if ($scope.parseType === 'yaml'){ if ($scope.parseType === 'yaml'){
try{ try{
@@ -69,6 +69,8 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
catch(err){ return; } catch(err){ return; }
} }
}); });
}
AddSchedule({ AddSchedule({
scope: $scope, scope: $scope,
@@ -88,4 +90,5 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait', '$s
}); });
callSelect2(); callSelect2();
}]; }];

View File

@@ -48,6 +48,8 @@ export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$
$state.go("^"); $state.go("^");
} }
// extra_data field is not manifested in the UI when scheduling a Management Job
if ($state.current.name !== ('managementJobSchedules.add' || 'managementJobSchedules.edit')){
$scope.$on('ScheduleFound', function(){ $scope.$on('ScheduleFound', function(){
if ($scope.parseType === 'yaml'){ if ($scope.parseType === 'yaml'){
try{ try{
@@ -83,6 +85,7 @@ export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$
catch(err){ return; } catch(err){ return; }
} }
}); });
}
EditSchedule({ EditSchedule({
scope: $scope, scope: $scope,