diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index d74cea977a..84a97ed050 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -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', {})); diff --git a/awx/ui/client/features/output/details.partial.html b/awx/ui/client/features/output/details.partial.html index 65e35278b0..fd0d51c2d4 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -40,6 +40,18 @@ + +
+ +
+ + {{ vm.inventoryJobName.value }} + +
+
+
@@ -72,6 +84,14 @@
+ +
+ +
+ {{ vm.licenseError.value }} +
+
+
@@ -208,6 +228,30 @@
+ +
+ +
+ {{ vm.inventorySource.value }} +
+
+ + +
+ +
+ {{ vm.overwrite.value }} +
+
+ + +
+ +
+ {{ vm.overwriteVars.value }} +
+
+