Merge pull request #1745 from jakemcdermott/fix-1740

show inventory-related and license error on for inventory update job details
This commit is contained in:
Jake McDermott 2018-05-10 12:00:55 -04:00 committed by GitHub
commit 4b5c09c07c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 141 additions and 0 deletions

View File

@ -135,6 +135,98 @@ function getJobTemplateDetails () {
return { label, link, value, tooltip };
}
function getInventoryJobNameDetails () {
if (resource.model.get('type') !== 'inventory_update') {
return null;
}
const jobArgs = resource.model.get('job_args');
if (!jobArgs) {
return null;
}
let parsedJobArgs;
try {
parsedJobArgs = JSON.parse(jobArgs);
} catch (e) {
return null;
}
if (!Array.isArray(parsedJobArgs)) {
return null;
}
const jobArgIndex = parsedJobArgs.indexOf('--inventory-id');
const inventoryId = parsedJobArgs[jobArgIndex + 1];
if (jobArgIndex < 0) {
return null;
}
if (!Number.isInteger(parseInt(inventoryId, 10))) {
return null;
}
const name = resource.model.get('name');
const id = resource.model.get('id');
const label = 'Name';
const tooltip = strings.get('resourceTooltips.INVENTORY');
const value = `${id} - ${$filter('sanitize')(name)}`;
const link = `/#/inventories/inventory/${inventoryId}`;
return { label, link, tooltip, value };
}
function getInventorySourceDetails () {
if (!resource.model.has('summary_fields.inventory_source.source')) {
return null;
}
const { source } = resource.model.get('summary_fields.inventory_source');
const choices = mapChoices(resource.model.options('actions.GET.source.choices'));
const label = 'Source';
const value = choices[source];
return { label, value };
}
function getOverwriteDetails () {
if (!resource.model.has('overwrite')) {
return null;
}
const label = 'Overwrite';
const value = resource.model.get('overwrite');
return { label, value };
}
function getOverwriteVarsDetails () {
if (!resource.model.has('overwrite_vars')) {
return null;
}
const label = 'Overwrite Vars';
const value = resource.model.get('overwrite_vars');
return { label, value };
}
function getLicenseErrorDetails () {
if (!resource.model.has('license_error')) {
return null;
}
const label = 'License Error';
const value = resource.model.get('license_error');
return { label, value };
}
function getLaunchedByDetails () {
const createdBy = resource.model.get('summary_fields.created_by');
const jobTemplate = resource.model.get('summary_fields.job_template');
@ -597,6 +689,11 @@ function JobDetailsController (
vm.skipTags = getSkipTagDetails();
vm.extraVars = getExtraVarsDetails();
vm.labels = getLabelDetails();
vm.inventoryJobName = getInventoryJobNameDetails();
vm.inventorySource = getInventorySourceDetails();
vm.overwrite = getOverwriteDetails();
vm.overwriteVars = getOverwriteVarsDetails();
vm.licenseError = getLicenseErrorDetails();
// Relaunch and Delete Components
vm.job = angular.copy(_.get(resource.model, 'model.GET', {}));

View File

@ -40,6 +40,18 @@
</div>
<!-- LEFT PANE DETAILS GROUP -->
<!-- INVENTORY JOB NAME DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.inventoryJobName">
<label class="JobResults-resultRowLabel">{{ vm.inventoryJobName.label }}</label>
<div class="JobResults-resultRowText">
<a href="{{ vm.inventoryJobName.link }}"
aw-tool-tip="{{ vm.inventoryJobName.tooltip }}"
data-placement="top">
{{ vm.inventoryJobName.value }}
</a>
</div>
</div>
<!-- STATUS DETAIL -->
<div class="JobResults-resultRow">
<label class="JobResults-resultRowLabel">{{ vm.status.label }}</label>
@ -72,6 +84,14 @@
</div>
</div>
<!-- LICENSE ERROR DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.licenseError">
<label class="JobResults-resultRowLabel">{{ vm.licenseError.label }}</label>
<div class="JobResults-resultRowText">
{{ vm.licenseError.value }}
</div>
</div>
<!-- START TIME DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.started">
<label class="JobResults-resultRowLabel">{{ vm.started.label }}</label>
@ -208,6 +228,30 @@
</div>
</div>
<!-- INVENTORY SOURCE DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.inventorySource">
<label class="JobResults-resultRowLabel">{{ vm.inventorySource.label }}</label>
<div class="JobResults-resultRowText">
{{ vm.inventorySource.value }}
</div>
</div>
<!-- OVERWRITE DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.overwrite">
<label class="JobResults-resultRowLabel">{{ vm.overwrite.label }}</label>
<div class="JobResults-resultRowText">
{{ vm.overwrite.value }}
</div>
</div>
<!-- OVERWRITE VARS DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.overwriteVars">
<label class="JobResults-resultRowLabel">{{ vm.overwriteVars.label }}</label>
<div class="JobResults-resultRowText">
{{ vm.overwriteVars.value }}
</div>
</div>
<!-- FORKS DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.forks">
<label class="JobResults-resultRowLabel">{{ vm.forks.label }}</label>