Fixed jobs list on Job Templates page. All the buttons and links now work.

This commit is contained in:
Chris Houseknecht
2014-04-01 17:44:35 -04:00
committed by Chris Houseknecht
parent 658581cce0
commit 5ea4a68820
15 changed files with 256 additions and 180 deletions

View File

@@ -143,7 +143,7 @@ angular.module('ansible', [
controller: 'JobTemplatesAdd' controller: 'JobTemplatesAdd'
}). }).
when('/job_templates/:id', { when('/job_templates/:template_id', {
templateUrl: urlPrefix + 'partials/job_templates.html', templateUrl: urlPrefix + 'partials/job_templates.html',
controller: 'JobTemplatesEdit' controller: 'JobTemplatesEdit'
}). }).

View File

@@ -38,8 +38,8 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam
$scope.removeSetHostLinks = $scope.$on('SetHostLinks', function (e, inventory_id) { $scope.removeSetHostLinks = $scope.$on('SetHostLinks', function (e, inventory_id) {
for (var i = 0; i < $scope.jobevents.length; i++) { for (var i = 0; i < $scope.jobevents.length; i++) {
if ($scope.jobevents[i].summary_fields.host) { if ($scope.jobevents[i].summary_fields.host) {
$scope.jobevents[i].hostLink = "/#/inventories/" + inventory_id + "/hosts/?name=" + $scope.jobevents[i].hostLink = "/#/inventories/" + inventory_id;
encodeURI($scope.jobevents[i].summary_fields.host.name); //encodeURI($scope.jobevents[i].summary_fields.host.name);
} }
} }
}); });

View File

@@ -337,7 +337,8 @@ JobTemplatesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$lo
function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm, GenerateForm, Rest, function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm, GenerateForm, Rest,
Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList,
CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate, CredentialList, ProjectList, LookUpInit, GetBasePath, md5Setup, ParseTypeChange, JobStatusToolTip, FormatDate,
Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit) { Wait, Stream, Empty, Prompt, ParseVariableString, ToJSON, SchedulesControllerInit, JobsControllerInit, JobsListUpdate,
GetChoices) {
ClearScope(); ClearScope();
@@ -347,13 +348,15 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
loadingFinishedCount = 0, loadingFinishedCount = 0,
base = $location.path().replace(/^\//, '').split('/')[0], base = $location.path().replace(/^\//, '').split('/')[0],
master = {}, master = {},
id = $routeParams.id, id = $routeParams.template_id,
relatedSets = {}, relatedSets = {},
checkSCMStatus, getPlaybooks, callback; checkSCMStatus, getPlaybooks, callback,
choicesCount = 0;
generator.inject(form, { mode: 'edit', related: true, scope: $scope }); generator.inject(form, { mode: 'edit', related: true, scope: $scope });
$scope.parseType = 'yaml'; $scope.parseType = 'yaml';
$scope.showJobType = false;
// Our job type options // Our job type options
$scope.job_type_options = [ $scope.job_type_options = [
@@ -475,22 +478,20 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
}); });
// Set the status/badge for each related job // Set the status/badge for each related job
if ($scope.removeRelatedJobs) { if ($scope.removeRelatedCompletedJobs) {
$scope.removeRelatedJobs(); $scope.removeRelatedCompletedJobs();
} }
$scope.removeRelatedJobs = $scope.$on('relatedjobs', function () { $scope.removeRelatedCompletedJobs = $scope.$on('relatedcompleted_jobs', function () {
var i, cDate; JobsControllerInit({
if ($scope.jobs && $scope.jobs.length) { scope: $scope,
for (i = 0; i < $scope.jobs.length; i++) { parent_scope: $scope,
// Convert created date to local time zone iterator: form.related.completed_jobs.iterator
cDate = new Date($scope.jobs[i].created); });
$scope.jobs[i].created = FormatDate(cDate); JobsListUpdate({
// Set tooltip and link scope: $scope,
$scope.jobs[i].statusBadgeToolTip = JobStatusToolTip($scope.jobs[i].status) + parent_scope: $scope,
" Click to view status details."; list: form.related.completed_jobs
$scope.jobs[i].statusLinkTo = '/#/jobs/' + $scope.jobs[i].id; });
}
}
}); });
if ($scope.cloudCredentialReadyRemove) { if ($scope.cloudCredentialReadyRemove) {
@@ -553,94 +554,126 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
}); });
Wait('start'); Wait('start');
// Retrieve detail record and prepopulate the form
Rest.setUrl(defaultUrl + ':id/'); if ($scope.removeLoadJobs) {
Rest.get({ params: { id: id } }) $scope.rmoveLoadJobs();
.success(function (data) { }
var fld, i; $scope.removeLoadJobs = $scope.$on('LoadJobs', function() {
LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name }); // Retrieve detail record and prepopulate the form
for (fld in form.fields) { Rest.setUrl(defaultUrl + ':id/');
if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) { Rest.get({ params: { id: id } })
if (form.fields[fld].type === 'select') { .success(function (data) {
if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) { var fld, i;
for (i = 0; i < $scope[fld + '_options'].length; i++) { LoadBreadCrumbs({ path: '/job_templates/' + id, title: data.name });
if (data[fld] === $scope[fld + '_options'][i].value) { for (fld in form.fields) {
$scope[fld] = $scope[fld + '_options'][i]; if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) {
if (form.fields[fld].type === 'select') {
if ($scope[fld + '_options'] && $scope[fld + '_options'].length > 0) {
for (i = 0; i < $scope[fld + '_options'].length; i++) {
if (data[fld] === $scope[fld + '_options'][i].value) {
$scope[fld] = $scope[fld + '_options'][i];
}
} }
} else {
$scope[fld] = data[fld];
} }
} else { } else {
$scope[fld] = data[fld]; $scope[fld] = data[fld];
} }
} else { master[fld] = $scope[fld];
$scope[fld] = data[fld]; }
if (fld === 'variables') {
// Parse extra_vars, converting to YAML.
$scope.variables = ParseVariableString(data.extra_vars);
master.variables = $scope.variables;
}
if (form.fields[fld].type === 'lookup' && data.summary_fields[form.fields[fld].sourceModel]) {
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
} }
master[fld] = $scope[fld];
} }
if (fld === 'variables') {
// Parse extra_vars, converting to YAML.
$scope.variables = ParseVariableString(data.extra_vars);
master.variables = $scope.variables;
}
if (form.fields[fld].type === 'lookup' && data.summary_fields[form.fields[fld].sourceModel]) {
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
data.summary_fields[form.fields[fld].sourceModel][form.fields[fld].sourceField];
master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
}
}
$scope.url = data.url; $scope.url = data.url;
relatedSets = form.relatedSets(data.related); relatedSets = form.relatedSets(data.related);
$scope.callback_url = data.related.callback; $scope.callback_url = data.related.callback;
master.callback_url = $scope.callback_url; master.callback_url = $scope.callback_url;
LookUpInit({ LookUpInit({
scope: $scope, scope: $scope,
form: form, form: form,
current_item: data.inventory, current_item: data.inventory,
list: InventoryList, list: InventoryList,
field: 'inventory' field: 'inventory'
}); });
LookUpInit({ LookUpInit({
url: GetBasePath('credentials') + '?kind=ssh', url: GetBasePath('credentials') + '?kind=ssh',
scope: $scope, scope: $scope,
form: form, form: form,
current_item: data.credential, current_item: data.credential,
list: CredentialList, list: CredentialList,
field: 'credential', field: 'credential',
hdr: 'Select Machine Credential' hdr: 'Select Machine Credential'
}); });
LookUpInit({ LookUpInit({
scope: $scope, scope: $scope,
form: form, form: form,
current_item: data.project, current_item: data.project,
list: ProjectList, list: ProjectList,
field: 'project' field: 'project'
}); });
RelatedSearchInit({ RelatedSearchInit({
scope: $scope, scope: $scope,
form: form, form: form,
relatedSets: relatedSets relatedSets: relatedSets
}); });
RelatedPaginateInit({ RelatedPaginateInit({
scope: $scope, scope: $scope,
relatedSets: relatedSets relatedSets: relatedSets
}); });
$scope.$emit('jobTemplateLoaded', data.related.cloud_credential); $scope.$emit('jobTemplateLoaded', data.related.cloud_credential);
}) })
.error(function (data, status) { .error(function (data, status) {
ProcessErrors($scope, data, status, form, { ProcessErrors($scope, data, status, form, {
hdr: 'Error!', hdr: 'Error!',
msg: 'Failed to retrieve job template: ' + $routeParams.id + '. GET status: ' + status msg: 'Failed to retrieve job template: ' + $routeParams.template_id + '. GET status: ' + status
});
}); });
}); });
if ($scope.removeChoicesReady) {
$scope.removeChoicesReady();
}
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
choicesCount++;
if (choicesCount === 2) {
$scope.$emit('LoadJobs');
}
});
GetChoices({
scope: $scope,
url: GetBasePath('unified_jobs'),
field: 'status',
variable: 'status_choices',
callback: 'choicesReady'
});
GetChoices({
scope: $scope,
url: GetBasePath('unified_jobs'),
field: 'type',
variable: 'type_choices',
callback: 'choicesReady'
});
function saveCompleted() { function saveCompleted() {
setTimeout(function() { $scope.$apply(function() { $location.path('/job_templates'); }); }, 500); setTimeout(function() { $scope.$apply(function() { $location.path('/job_templates'); }); }, 500);
@@ -713,7 +746,7 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
// Related set: Add button // Related set: Add button
$scope.add = function (set) { $scope.add = function (set) {
$rootScope.flashMessage = null; $rootScope.flashMessage = null;
$location.path('/' + base + '/' + $routeParams.id + '/' + set); $location.path('/' + base + '/' + $routeParams.template_id + '/' + set);
}; };
// Related set: Edit button // Related set: Edit button
@@ -757,5 +790,5 @@ JobTemplatesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$l
'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit',
'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit',
'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt', 'GetBasePath', 'md5Setup', 'ParseTypeChange', 'JobStatusToolTip', 'FormatDate', 'Wait', 'Stream', 'Empty', 'Prompt',
'ParseVariableString', 'ToJSON', 'SchedulesControllerInit' 'ParseVariableString', 'ToJSON', 'SchedulesControllerInit', 'JobsControllerInit', 'JobsListUpdate', 'GetChoices'
]; ];

View File

@@ -21,6 +21,8 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
LoadBreadCrumbs(); LoadBreadCrumbs();
$scope.showJobType = true;
// Add breadcrumbs // Add breadcrumbs
e = angular.element(document.getElementById('breadcrumbs')); e = angular.element(document.getElementById('breadcrumbs'));
e.html(Breadcrumbs({ list: { editTitle: 'Jobs' } , mode: 'edit' })); e.html(Breadcrumbs({ list: { editTitle: 'Jobs' } , mode: 'edit' }));
@@ -62,7 +64,7 @@ function JobsListController ($scope, $compile, ClearScope, Breadcrumbs, LoadBrea
scope: scheduled_scope, scope: scheduled_scope,
list: ScheduledJobsList, list: ScheduledJobsList,
id: 'scheduled-jobs', id: 'scheduled-jobs',
url: GetBasePath('schedules') url: GetBasePath('schedules') + '?next_run__isnull=false'
}); });
$scope.refreshJobs = function() { $scope.refreshJobs = function() {

View File

@@ -23,7 +23,7 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet
collapse: true, collapse: true,
collapseTitle: "Properties", collapseTitle: "Properties",
collapseMode: 'edit', collapseMode: 'edit',
collapseOpenFirst: true, //Always open first panel collapseOpenFirst: false, //Always open first panel
actions: { actions: {
stream: { stream: {
@@ -291,7 +291,7 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet
schedules: { schedules: {
include: "SchedulesList" include: "SchedulesList"
}, },
completed_jobs: { "completed_jobs": {
include: "CompletedJobsList" include: "CompletedJobsList"
} }
}, },
@@ -300,7 +300,7 @@ angular.module('JobTemplateFormDefinition', ['SchedulesListDefinition', 'Complet
return { return {
completed_jobs: { completed_jobs: {
iterator: 'completed_job', iterator: 'completed_job',
url: urls.jobs url: urls.jobs + '?or__status=successful&or__status=failed&or__status=error&or__status=canceled'
}, },
schedules: { schedules: {
iterator: 'schedule', iterator: 'schedule',

View File

@@ -154,16 +154,21 @@ function(Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialList) {
}]) }])
// Submit request to run a playbook // Submit request to run a playbook
.factory('PlaybookRun', ['LaunchJob', 'PromptForPasswords', 'Rest', '$location', 'GetBasePath', 'ProcessErrors', 'Wait', 'Empty', 'PromptForCredential', .factory('PlaybookRun', ['$location','$routeParams', 'LaunchJob', 'PromptForPasswords', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'Empty', 'PromptForCredential',
function (LaunchJob, PromptForPasswords, Rest, $location, GetBasePath, ProcessErrors, Wait, Empty, PromptForCredential) { function ($location, $routeParams, LaunchJob, PromptForPasswords, Rest, GetBasePath, ProcessErrors, Wait, Empty, PromptForCredential) {
return function (params) { return function (params) {
var scope = params.scope, var scope = params.scope,
id = params.id, id = params.id,
base = $location.path().replace(/^\//, '').split('/')[0], base = $location.path().replace(/^\//, '').split('/')[0],
url = GetBasePath(base) + id + '/', url, job_template, new_job_id, launch_url;
job_template,
new_job_id, if (!Empty($routeParams.template_id)) {
launch_url; // launching a job from job_template detail page
url = GetBasePath('jobs') + id + '/';
}
else {
url = GetBasePath(base) + id + '/';
}
if (scope.removePostTheJob) { if (scope.removePostTheJob) {
scope.removePostTheJob(); scope.removePostTheJob();

View File

@@ -22,7 +22,9 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
function($location, Find, DeleteJob, RelaunchJob, LogViewer) { function($location, Find, DeleteJob, RelaunchJob, LogViewer) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
parent_scope = params.parent_scope; parent_scope = params.parent_scope,
iterator = (params.iterator) ? params.iterator : scope.iterator,
base = $location.path().replace(/^\//, '').split('/')[0];
scope.deleteJob = function(id) { scope.deleteJob = function(id) {
DeleteJob({ scope: scope, id: id }); DeleteJob({ scope: scope, id: id });
@@ -59,7 +61,13 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
}; };
scope.refreshJobs = function() { scope.refreshJobs = function() {
parent_scope.refreshJobs(); if (base === 'jobs') {
parent_scope.refreshJobs();
}
else {
scope.search(iterator);
}
}; };
scope.viewJobLog = function(id, url) { scope.viewJobLog = function(id, url) {
@@ -80,8 +88,7 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
job = Find({ list: list, key: 'id', val: id }); job = Find({ list: list, key: 'id', val: id });
LogViewer({ LogViewer({
scope: scope, scope: scope,
url: job.url, url: job.url
status_icon: 'icon-job-' + job.status
}); });
} }
}; };
@@ -262,13 +269,77 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
} }
]) ])
.factory('JobsListUpdate', ['Rest', function(Rest) {
return function(params) {
var scope = params.scope,
parent_scope = params.scope,
list = params.list;
scope[list.name].forEach(function(item, item_idx) {
var fld, field,
itm = scope[list.name][item_idx];
// Set the item type label
if (list.fields.type) {
parent_scope.type_choices.every(function(choice) {
if (choice.value === item.type) {
itm.type_label = choice.label;
return false;
}
return true;
});
}
// Set the job status label
parent_scope.status_choices.every(function(status) {
if (status.value === item.status) {
itm.status_label = status.label;
return false;
}
return true;
});
//Set the name link
if (item.type === "inventory_update") {
Rest.setUrl(item.related.inventory_source);
Rest.get()
.success(function(data) {
itm.nameHref = "/inventories/" + data.inventory;
});
}
else if (item.type === "project_update") {
itm.nameHref = "/projects/" + item.project;
}
else if (item.type === "job") {
itm.nameHref = "";
}
if (list.name === 'completed_jobs' || list.name === 'running_jobs') {
itm.status_tip = itm.status_label + '. Click for details.';
}
else if (list.name === 'queued_jobs') {
itm.status_tip = 'Pending';
}
// Copy summary_field values
for (field in list.fields) {
fld = list.fields[field];
if (fld.sourceModel) {
if (itm.summary_fields[fld.sourceModel]) {
itm[field] = itm.summary_fields[fld.sourceModel][fld.sourceField];
}
}
}
});
};
}])
/** /**
* *
* Called from JobsList controller to load each section or list on the page * Called from JobsList controller to load each section or list on the page
* *
*/ */
.factory('LoadJobsScope', ['SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'Rest', .factory('LoadJobsScope', ['SearchInit', 'PaginateInit', 'GenerateList', 'JobsControllerInit', 'JobsListUpdate',
function(SearchInit, PaginateInit, GenerateList, JobsControllerInit, Rest) { function(SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) {
return function(params) { return function(params) {
var parent_scope = params.parent_scope, var parent_scope = params.parent_scope,
scope = params.scope, scope = params.scope,
@@ -298,70 +369,15 @@ angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'Job
url: url, url: url,
pageSize: 5 pageSize: 5
}); });
scope.iterator = list.iterator; scope.iterator = list.iterator;
if (scope.removePostRefresh) { if (scope.removePostRefresh) {
scope.removePostRefresh(); scope.removePostRefresh();
} }
scope.$on('PostRefresh', function(){ scope.$on('PostRefresh', function(){
JobsControllerInit({ scope: scope, parent_scope: parent_scope }); JobsControllerInit({ scope: scope, parent_scope: parent_scope });
JobsListUpdate({ scope: scope, parent_scope: parent_scope, list: list });
scope[list.name].forEach(function(item, item_idx) {
var fld, field,
itm = scope[list.name][item_idx];
// Set the item type label
if (list.fields.type) {
parent_scope.type_choices.every(function(choice) {
if (choice.value === item.type) {
itm.type_label = choice.label;
return false;
}
return true;
});
}
// Set the job status label
parent_scope.status_choices.every(function(status) {
if (status.value === item.status) {
itm.status_label = status.label;
return false;
}
return true;
});
//Set the name link
if (item.type === "inventory_update") {
Rest.setUrl(item.related.inventory_source);
Rest.get()
.success(function(data) {
itm.nameHref = "/inventories/" + data.inventory;
});
}
else if (item.type === "project_update") {
itm.nameHref = "/projects/" + item.project;
}
else if (item.type === "job") {
itm.nameHref = "";
}
if (list.name === 'completed_jobs' || list.name === 'running_jobs') {
itm.status_tip = itm.status_label + '. Click for details.';
}
else if (list.name === 'queued_jobs') {
itm.status_tip = 'Pending';
}
// Copy summary_field values
for (field in list.fields) {
fld = list.fields[field];
if (fld.sourceModel) {
if (itm.summary_fields[fld.sourceModel]) {
itm[field] = itm.summary_fields[fld.sourceModel][fld.sourceField];
}
}
}
});
parent_scope.$emit('listLoaded'); parent_scope.$emit('listLoaded');
}); });
scope.search(list.iterator); scope.search(list.iterator);
@@ -415,7 +431,7 @@ function(Find, GetBasePath, Rest, Wait, ProcessErrors, Prompt){
Rest.destroy() Rest.destroy()
.success(function () { .success(function () {
$('#prompt-modal').modal('hide'); $('#prompt-modal').modal('hide');
scope.search(scope.iterator); scope.refreshJobs();
}) })
.error(function (data, status) { .error(function (data, status) {
$('#prompt-modal').modal('hide'); $('#prompt-modal').modal('hide');

View File

@@ -240,6 +240,9 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
html += "<i class=\"fa icon-job-" + getIcon(scope[fld]) + "\"></i> " + scope[fld]; html += "<i class=\"fa icon-job-" + getIcon(scope[fld]) + "\"></i> " + scope[fld];
//html += "<i class=\"fa " + status_icon + scope[fld] + "\"></i> " + scope[fld]; //html += "<i class=\"fa " + status_icon + scope[fld] + "\"></i> " + scope[fld];
} }
else if (fld === 'status') {
html += "<i class=\"fa icon-job-" + scope[fld] + "\"></i> " + scope[fld];
}
else { else {
html += scope[fld]; html += scope[fld];
} }

View File

@@ -29,7 +29,7 @@ angular.module('ProjectsHelper', ['RestServices', 'Utilities', 'ProjectStatusDef
break; break;
case 'updating': case 'updating':
case 'running': case 'running':
result = 'running pulsate'; result = 'running';
break; break;
case 'successful': case 'successful':
result = 'success'; result = 'success';

View File

@@ -419,7 +419,7 @@ angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelpe
}); });
}; };
scope.refreshJobs = function() { scope.refreshSchedule = function() {
if (base === 'jobs') { if (base === 'jobs') {
parent_scope.refreshJobs(); parent_scope.refreshJobs();
} }

View File

@@ -34,11 +34,25 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities', 'RefreshRela
iterator = form.related[set].iterator; iterator = form.related[set].iterator;
for (fld in form.related[set].fields) { for (fld in form.related[set].fields) {
if (form.related[set].fields[fld].key) { if (form.related[set].fields[fld].key) {
scope[iterator + 'SearchField'] = fld; if (form.related[set].fields[fld].searchable === undefined || form.related[set].fields[fld].searchable === true) {
scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label; scope[iterator + 'SearchField'] = fld;
scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label;
}
break; break;
} }
} }
if (Empty(scope[iterator + 'SearchField'])) {
// A field marked as key may not be 'searchable'. Find the first searchable field.
for (fld in form.related[set].fields) {
if (form.related[set].fields[fld].searchable === undefined || form.related[set].fields[fld].searchable === true) {
scope[iterator + 'SearchField'] = fld;
scope[iterator + 'SearchFieldLabel'] = form.related[set].fields[fld].label;
break;
}
}
}
scope[iterator + 'SortOrder'] = null; scope[iterator + 'SortOrder'] = null;
scope[iterator + 'SearchType'] = 'icontains'; scope[iterator + 'SearchType'] = 'icontains';
scope[iterator + 'SearchTypeLabel'] = 'Contains'; scope[iterator + 'SearchTypeLabel'] = 'Contains';
@@ -121,7 +135,7 @@ angular.module('RelatedSearchHelper', ['RestServices', 'Utilities', 'RefreshRela
scope.search = function (iterator) { scope.search = function (iterator) {
//scope[iterator + 'SearchSpin'] = true; //scope[iterator + 'SearchSpin'] = true;
Wait('start'); Wait('start');
scope[iterator + 'Loading'] = true; scope[iterator + 'Loading'] = false;
scope[iterator + 'HoldInput'] = true; scope[iterator + 'HoldInput'] = true;
if (scope[iterator + 'SearchValue']) { if (scope[iterator + 'SearchValue']) {

View File

@@ -64,6 +64,7 @@ angular.module('CompletedJobsDefinition', [])
ngBind: 'completed_job.type_label', ngBind: 'completed_job.type_label',
link: false, link: false,
columnClass: "col-md-2 hidden-sm hidden-xs", columnClass: "col-md-2 hidden-sm hidden-xs",
columnShow: "showJobType",
searchable: false searchable: false
}, },
name: { name: {

View File

@@ -28,7 +28,8 @@ angular.module('ScheduledJobsDefinition', [])
icon: 'icon-job-{{ schedule.status }}', icon: 'icon-job-{{ schedule.status }}',
iconOnly: true, iconOnly: true,
ngClick: "toggleSchedule($event, schedule.id)", ngClick: "toggleSchedule($event, schedule.id)",
searchable: false searchable: false,
nosort: true
}, },
next_run: { next_run: {
label: 'Next Run', label: 'Next Run',
@@ -61,7 +62,7 @@ angular.module('ScheduledJobsDefinition', [])
refresh: { refresh: {
mode: 'all', mode: 'all',
awToolTip: "Refresh the page", awToolTip: "Refresh the page",
ngClick: "refreshJobs()" ngClick: "refreshSchedule()"
} }
}, },

View File

@@ -15,7 +15,7 @@ angular.module('SchedulesListDefinition', [])
iterator: 'schedule', iterator: 'schedule',
selectTitle: '', selectTitle: '',
editTitle: 'Schedules', editTitle: 'Schedules',
well: true, well: false,
index: true, index: true,
hover: true, hover: true,
@@ -55,7 +55,7 @@ angular.module('SchedulesListDefinition', [])
refresh: { refresh: {
mode: 'all', mode: 'all',
awToolTip: "Refresh the page", awToolTip: "Refresh the page",
ngClick: "refreshJobs()" ngClick: "refreshSchedule()"
}, },
stream: { stream: {
ngClick: "showActivity()", ngClick: "showActivity()",

View File

@@ -1,4 +1,5 @@
<div class="tab-pane" id="job_templates"> <div class="tab-pane" id="job_templates">
<div ng-cloak id="htmlTemplate"></div> <div ng-cloak id="htmlTemplate"></div>
<div ng-include="'/static/partials/schedule_dialog.html'"></div> <div ng-include="'/static/partials/schedule_dialog.html'"></div>
<div ng-include="'/static/partials/logviewer.html'"></div>
</div> </div>