job results link-in

This commit is contained in:
Jake McDermott
2018-03-28 22:46:40 -04:00
parent a53f70f0af
commit 6b302ef167
14 changed files with 29 additions and 20 deletions

View File

@@ -52,19 +52,19 @@ function ListJobsController (
switch (type) { switch (type) {
case 'job': case 'job':
link = `/#/jobs/${id}`; link = `/#/jobz/playbook/${id}`;
break; break;
case 'ad_hoc_command': case 'ad_hoc_command':
link = `/#/ad_hoc_commands/${id}`; link = `/#/jobz/command/${id}`;
break; break;
case 'system_job': case 'system_job':
link = `/#/management_jobs/${id}`; link = `/#/jobz/system/${id}`;
break; break;
case 'project_update': case 'project_update':
link = `/#/scm_update/${id}`; link = `/#/jobz/project/${id}`;
break; break;
case 'inventory_update': case 'inventory_update':
link = `/#/inventory_sync/${id}`; link = `/#/jobz/inventory/${id}`;
break; break;
case 'workflow_job': case 'workflow_job':
link = `/#/workflows/${id}`; link = `/#/workflows/${id}`;

View File

@@ -41,7 +41,7 @@ function atLaunchTemplateCtrl (
selectedJobTemplate selectedJobTemplate
.postLaunch({ id: vm.template.id }) .postLaunch({ id: vm.template.id })
.then(({ data }) => { .then(({ data }) => {
$state.go('jobResult', { id: data.job }, { reload: true }); $state.go('jobz', { id: data.job, type: 'playbook' }, { reload: true });
}); });
} else { } else {
const promptData = { const promptData = {
@@ -138,7 +138,7 @@ function atLaunchTemplateCtrl (
id: vm.promptData.template, id: vm.promptData.template,
launchData: jobLaunchData launchData: jobLaunchData
}).then((launchRes) => { }).then((launchRes) => {
$state.go('jobResult', { id: launchRes.data.job }, { reload: true }); $state.go('jobz', { id: launchRes.data.job, type: 'playbook' }, { reload: true });
}).catch(createErrorHandler('launch job template', 'POST')); }).catch(createErrorHandler('launch job template', 'POST'));
} else if (vm.promptData.templateType === 'workflow_job_template') { } else if (vm.promptData.templateType === 'workflow_job_template') {
workflowTemplate.create().postLaunch({ workflowTemplate.create().postLaunch({

View File

@@ -238,7 +238,7 @@ function atRelaunchCtrl (
relaunchData: PromptService.bundlePromptDataForRelaunch(vm.promptData) relaunchData: PromptService.bundlePromptDataForRelaunch(vm.promptData)
}).then((launchRes) => { }).then((launchRes) => {
if (!$state.includes('jobs')) { if (!$state.includes('jobs')) {
$state.go('jobResult', { id: launchRes.data.job }, { reload: true }); $state.go('jobz', { id: launchRes.data.job, type: 'playbook' }, { reload: true });
} }
}).catch(({ data, status }) => { }).catch(({ data, status }) => {
ProcessErrors($scope, data, status, null, { ProcessErrors($scope, data, status, null, {

View File

@@ -28,8 +28,17 @@ export default
function createList(list) { function createList(list) {
// detailsUrl, status, name, time // detailsUrl, status, name, time
scope.jobs = _.map(list, function(job){ scope.jobs = _.map(list, function(job){
let detailsUrl;
if (job.type === 'workflow_job') {
detailsUrl = `/#/workflows/${job.id}`;
} else {
detailsUrl = `/#/jobz/playbook/${job.id}`;
}
return { return {
detailsUrl: job.type && job.type === 'workflow_job' ? job.url.replace(/api\/v\d+\/workflow_jobs/, "#/workflows") : job.url.replace(/api\/v\d+/, "#"), detailsUrl,
status: job.status, status: job.status,
name: job.name, name: job.name,
id: job.id, id: job.id,

View File

@@ -241,7 +241,7 @@ function adhocController($q, $scope, $stateParams,
Rest.post(data) Rest.post(data)
.then(({data}) => { .then(({data}) => {
Wait('stop'); Wait('stop');
$state.go('adHocJobStdout', {id: data.id}); $state.go('jobz', {id: data.id, type: 'command'});
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
ProcessErrors($scope, data, status, adhocForm, { ProcessErrors($scope, data, status, adhocForm, {

View File

@@ -23,7 +23,7 @@ export default [ '$scope', 'Empty', 'Wait', 'GetBasePath', 'Rest', 'ProcessError
}; };
$scope.viewJob = function(jobId) { $scope.viewJob = function(jobId) {
$state.go('jobResult', {id: jobId}); $state.go('jobz', { id: jobId, type: 'playbook' });
}; };
} }

View File

@@ -20,7 +20,7 @@ export default [ '$scope', 'Wait', 'Empty', 'Rest', 'ProcessErrors', '$state',
$scope.viewJob = function(url) { $scope.viewJob = function(url) {
// Pull the id out of the URL // Pull the id out of the URL
var id = url.replace(/^\//, '').split('/')[3]; var id = url.replace(/^\//, '').split('/')[3];
$state.go('inventorySyncStdout', {id: id}); $state.go('jobz', { id, type: 'inventory' } );
}; };
} }

View File

@@ -17,7 +17,7 @@ export default
// Get the ID from the correct summary field // Get the ID from the correct summary field
var update_id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id; var update_id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id;
$state.go('inventorySyncStdout', {id: update_id}); $state.go('jobz', { id: update_id, type: 'inventory' });
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',

View File

@@ -89,7 +89,7 @@
.then(({data}) => { .then(({data}) => {
Wait('stop'); Wait('stop');
if($location.path().replace(/^\//, '').split('/')[0] !== 'jobs') { if($location.path().replace(/^\//, '').split('/')[0] !== 'jobs') {
$state.go('adHocJobStdout', {id: data.id}); $state.go('jobz', { id: data.id, type: 'command' });
} }
}) })
.catch(({data, status}) => { .catch(({data, status}) => {

View File

@@ -132,7 +132,7 @@ export default
Wait('stop'); Wait('stop');
$("#prompt-for-days-facts").dialog("close"); $("#prompt-for-days-facts").dialog("close");
$("#configure-dialog").dialog('close'); $("#configure-dialog").dialog('close');
$state.go('managementJobStdout', {id: data.system_job}, {reload:true}); $state.go('jobz', { id: data.system_job, type: 'system' }, { reload: true });
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
let template_id = scope.job_template_id; let template_id = scope.job_template_id;
@@ -222,7 +222,7 @@ export default
Wait('stop'); Wait('stop');
$("#prompt-for-days").dialog("close"); $("#prompt-for-days").dialog("close");
// $("#configure-dialog").dialog('close'); // $("#configure-dialog").dialog('close');
$state.go('managementJobStdout', {id: data.system_job}, {reload:true}); $state.go('jobz', { id: data.system_job, type: 'system' }, { reload: true });
}) })
.catch(({data, status}) => { .catch(({data, status}) => {
let template_id = scope.job_template_id; let template_id = scope.job_template_id;

View File

@@ -234,7 +234,7 @@ export default ['$scope', '$rootScope', '$location',
$scope.viewJob = function(url) { $scope.viewJob = function(url) {
// Pull the id out of the URL // Pull the id out of the URL
var id = url.replace(/^\//, '').split('/')[3]; var id = url.replace(/^\//, '').split('/')[3];
$state.go('inventorySyncStdout', { id: id }); $state.go('jobz', { id: id, type: 'inventory' });
}; };

View File

@@ -187,7 +187,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert',
// Grab the id from summary_fields // Grab the id from summary_fields
var id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id; var id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id;
$state.go('scmUpdateStdout', { id: id }); $state.go('jobz', { id: id, type: 'project' });
} else { } else {
Alert('No Updates Available', 'There is no SCM update information available for this project. An update has not yet been ' + Alert('No Updates Available', 'There is no SCM update information available for this project. An update has not yet been ' +

View File

@@ -146,7 +146,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
// Grab the id from summary_fields // Grab the id from summary_fields
var id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id; var id = (data.summary_fields.current_update) ? data.summary_fields.current_update.id : data.summary_fields.last_update.id;
$state.go('scmUpdateStdout', { id: id }); $state.go('jobz', { id: id, type: 'project'}, { reload: true });
} else { } else {
Alert(i18n._('No Updates Available'), i18n._('There is no SCM update information available for this project. An update has not yet been ' + Alert(i18n._('No Updates Available'), i18n._('There is no SCM update information available for this project. An update has not yet been ' +

View File

@@ -27,7 +27,7 @@ export default ['$scope', '$filter',
if (typeof $scope.templateType !== 'undefined' && $scope.templateType === 'workflow_job_template') { if (typeof $scope.templateType !== 'undefined' && $scope.templateType === 'workflow_job_template') {
detailsBaseUrl = '/#/workflows/'; detailsBaseUrl = '/#/workflows/';
} else { } else {
detailsBaseUrl = '/#/jobs/'; detailsBaseUrl = '/#/jobz/playbook/';
} }
var sparkData = var sparkData =