Fix issue with schedulers

editing/adding schedules in the related accordians for Projects and Job Templates were not working, where the action buttons for schedules not even showing up in the Schedule accordian. I've updated hte form objects as well as the form-generator to accept the list of action buttons and their icons. Also fixed a related issue where the scheduler titles were not showing up on the scheduler dialog
This commit is contained in:
Jared Tabor 2015-06-19 12:01:57 -04:00
parent 39e508373f
commit 94c242c608
6 changed files with 172 additions and 40 deletions

View File

@ -669,7 +669,6 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
var defaultUrl = GetBasePath('job_templates'),
generator = GenerateForm,
form = JobTemplateForm(),
loadingFinishedCount = 0,
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $routeParams.template_id,
@ -832,19 +831,15 @@ export function JobTemplatesEdit($filter, $scope, $rootScope, $compile, $locatio
$scope.removeJobTemplateLoadFinished();
}
$scope.removeJobTemplateLoadFinished = $scope.$on('jobTemplateLoadFinished', function () {
loadingFinishedCount++;
if (loadingFinishedCount >= 2) {
// The initial template load finished. Now load related jobs, which
// will turn off the 'working' spinner.
for (var set in relatedSets) {
$scope.search(relatedSets[set].iterator);
}
SchedulesControllerInit({
scope: $scope,
parent_scope: $scope,
iterator: 'schedule'
});
for (var set in relatedSets) {
$scope.search(relatedSets[set].iterator);
}
SchedulesControllerInit({
scope: $scope,
parent_scope: $scope,
iterator: 'schedule'
});
});
// Set the status/badge for each related job

View File

@ -266,7 +266,6 @@ export default
control: '<button type="button" class="btn btn-sm btn-primary" id="job_templates_create_survey_btn" ng-show="survey_enabled" ng-click="addSurvey()"><i class="fa fa-pencil"></i> Create Survey</button>'+
'<button style="display:none;" type="button" class="btn btn-sm btn-primary" id="job_templates_edit_survey_btn" ng-show="survey_enabled" ng-click="editSurvey()"><i class="fa fa-pencil"></i> Edit Survey</button>'+
'<button style="display:none;margin-left:5px" type="button" class="btn btn-sm btn-primary" id="job_templates_delete_survey_btn" ng-show="survey_enabled" ng-click="deleteSurvey()"><i class="fa fa-trash-o"></i> Delete Survey</button>'+
// '<div class="error ng-hide" id="job-template-survey-error" ng-show="survey_enabled === true && survey_exists!==true">A survey is enabled but it does not exist. Create a survey or disable the survey. </div>'
'<div class="error ng-hide" id="job-template-survey-error" ng-show="invalid_survey">A survey is enabled but it does not exist. Create a survey or uncheck the Enable Survey box to disable the survey. </div>'
},
become_enabled: {
@ -336,9 +335,81 @@ export default
},
related: {
schedules: {
include: "SchedulesList"
type: 'collection',
title: 'Schedules',
iterator: 'schedule',
index: false,
open: false,
actions: {
add: {
mode: 'all',
ngClick: 'addSchedule()',
awToolTip: 'Add a new schedule'
},
refresh: {
mode: 'all',
awToolTip: "Refresh the page",
ngClick: "refreshSchedules()"
},
stream: {
ngClick: "showActivity()",
awToolTip: "View Activity Stream",
mode: 'edit',
awFeature: 'activity_streams'
}
},
fields: {
name: {
key: true,
label: 'Name',
ngClick: "editSchedule(schedule.id)",
columnClass: "col-md-3 col-sm-3 col-xs-3"
},
dtstart: {
label: 'First Run',
filter: "longDate",
searchable: false,
columnClass: "col-md-2 col-sm-3 hidden-xs"
},
next_run: {
label: 'Next Run',
filter: "longDate",
searchable: false,
columnClass: "col-md-2 col-sm-3 col-xs-3"
},
dtend: {
label: 'Final Run',
filter: "longDate",
searchable: false,
columnClass: "col-md-2 col-sm-3 hidden-xs"
}
},
fieldActions: {
"play": {
mode: "all",
ngClick: "toggleSchedule($event, schedule.id)",
awToolTip: "{{ schedule.play_tip }}",
dataTipWatch: "schedule.play_tip",
iconClass: "{{ 'fa icon-schedule-enabled-' + schedule.enabled }}",
dataPlacement: "top"
},
edit: {
label: 'Edit',
ngClick: "editSchedule(schedule.id)",
icon: 'icon-edit',
awToolTip: 'Edit schedule',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteSchedule(schedule.id)",
icon: 'icon-trash',
awToolTip: 'Delete schedule',
dataPlacement: 'top'
}
}
},
"completed_jobs": {
include: "CompletedJobsList"

View File

@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name forms.function:Projects
@ -25,15 +25,6 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
collapseOpen: true,
actions: {
// scm_update: {
// mode: 'edit',
// ngClick: 'SCMUpdate()',
// awToolTip: "{{ scm_update_tooltip }}",
// dataTipWatch: "scm_update_tooltip",
// ngClass: "scm_type_class",
// dataPlacement: 'top',
// ngDisabled: "scm_type.value === 'manual' "
// },
stream: {
'class': "btn-primary btn-xs activity-btn",
ngClick: "showActivity()",
@ -296,8 +287,80 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition'])
},
schedules: {
include: "SchedulesList",
index: false
type: 'collection',
title: 'Schedules',
iterator: 'schedule',
index: false,
open: false,
actions: {
add: {
mode: 'all',
ngClick: 'addSchedule()',
awToolTip: 'Add a new schedule'
},
refresh: {
mode: 'all',
awToolTip: "Refresh the page",
ngClick: "refreshSchedules()"
},
stream: {
ngClick: "showActivity()",
awToolTip: "View Activity Stream",
mode: 'edit',
awFeature: 'activity_streams'
}
},
fields: {
name: {
key: true,
label: 'Name',
ngClick: "editSchedule(schedule.id)",
columnClass: "col-md-3 col-sm-3 col-xs-3"
},
dtstart: {
label: 'First Run',
filter: "longDate",
searchable: false,
columnClass: "col-md-2 col-sm-3 hidden-xs"
},
next_run: {
label: 'Next Run',
filter: "longDate",
searchable: false,
columnClass: "col-md-2 col-sm-3 col-xs-3"
},
dtend: {
label: 'Final Run',
filter: "longDate",
searchable: false,
columnClass: "col-md-2 col-sm-3 hidden-xs"
}
},
fieldActions: {
"play": {
mode: "all",
ngClick: "toggleSchedule($event, schedule.id)",
awToolTip: "{{ schedule.play_tip }}",
dataTipWatch: "schedule.play_tip",
iconClass: "{{ 'fa icon-schedule-enabled-' + schedule.enabled }}",
dataPlacement: "top"
},
edit: {
label: 'Edit',
ngClick: "editSchedule(schedule.id)",
icon: 'icon-edit',
awToolTip: 'Edit schedule',
dataPlacement: 'top'
},
"delete": {
label: 'Delete',
ngClick: "deleteSchedule(schedule.id)",
icon: 'icon-trash',
awToolTip: 'Delete schedule',
dataPlacement: 'top'
}
}
}
},

View File

@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
/**
* @ngdoc function
* @name helpers.function:Schedules
@ -26,7 +26,8 @@ export default
var buttons,
scope = params.scope,
callback = params.callback;
callback = params.callback,
title = params.title;
buttons = [{
"label": "Cancel",
@ -54,6 +55,7 @@ export default
id: 'scheduler-modal-dialog',
scope: scope,
buttons: buttons,
title: title,
width: 700,
height: 725,
minWidth: 400,
@ -111,7 +113,7 @@ export default
schedule.rrule = schedule.rrule.replace(/ RRULE:/,';');
schedule.rrule = schedule.rrule.replace(/DTSTART:/,'DTSTART=');
ShowSchedulerModal({ scope: scope, callback: 'DialogReady' });
ShowSchedulerModal({ scope: scope, callback: 'DialogReady', title: 'Edit Schedule' });
scope.showRRuleDetail = false;
});
@ -194,7 +196,7 @@ export default
scheduler.inject('form-container', false);
scheduler.injectDetail('occurrences', false);
scheduler.clear();
ShowSchedulerModal({ scope: scope, callback: 'DialogReady' });
ShowSchedulerModal({ scope: scope, callback: 'DialogReady', title: 'Add Schedule' });
scope.showRRuleDetail = false;
if (scope.removeScheduleSaved) {

View File

@ -3,7 +3,7 @@
*
* All Rights Reserved
*************************************************/
export default
angular.module('SchedulesListDefinition', [])
@ -42,12 +42,6 @@ export default
searchable: false,
columnClass: "col-md-2 col-sm-3 hidden-xs"
}
/*,
id: {
label: 'ID',
searchType: 'int',
searchOnly: true
}*/
},
actions: {

View File

@ -1818,7 +1818,14 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += (fAction.ngHref) ? this.attr(fAction, 'ngHref') : "";
html += (fAction.ngShow) ? this.attr(fAction, 'ngShow') : "";
html += ">";
html += SelectIcon({ action: act });
if (fAction.iconClass) {
html += "<i class=\"" + fAction.iconClass + "\"></i>";
} else {
html += SelectIcon({
action: act
});
}
// html += SelectIcon({ action: act });
//html += (fAction.label) ? "<span class=\"list-action-label\"> " + fAction.label + "</span>": "";
html += "</a>";
}