From b030cdcd402a5e15e03c861c5254db8384b0abb3 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 9 May 2018 18:39:31 -0400 Subject: [PATCH 1/4] use inventory id from job args to construct inventory link --- .../features/output/details.component.js | 46 +++++++++++++++++++ .../features/output/details.partial.html | 12 +++++ 2 files changed, 58 insertions(+) diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index d74cea977a..ccd33bc8e0 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -135,6 +135,51 @@ 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 getLaunchedByDetails () { const createdBy = resource.model.get('summary_fields.created_by'); const jobTemplate = resource.model.get('summary_fields.job_template'); @@ -597,6 +642,7 @@ function JobDetailsController ( vm.skipTags = getSkipTagDetails(); vm.extraVars = getExtraVarsDetails(); vm.labels = getLabelDetails(); + vm.inventoryJobName = getInventoryJobNameDetails(); // 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..19d7deccf0 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -40,6 +40,18 @@ + +
+ + +
+
From 43ea72e27846b154fedcff61bb43aa2565135b43 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 9 May 2018 19:07:23 -0400 Subject: [PATCH 2/4] show inventory source details --- .../client/features/output/details.component.js | 15 +++++++++++++++ .../client/features/output/details.partial.html | 8 ++++++++ 2 files changed, 23 insertions(+) diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index ccd33bc8e0..516555920c 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -180,6 +180,20 @@ function getInventoryJobNameDetails () { 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 getLaunchedByDetails () { const createdBy = resource.model.get('summary_fields.created_by'); const jobTemplate = resource.model.get('summary_fields.job_template'); @@ -643,6 +657,7 @@ function JobDetailsController ( vm.extraVars = getExtraVarsDetails(); vm.labels = getLabelDetails(); vm.inventoryJobName = getInventoryJobNameDetails(); + vm.inventorySource = getInventorySourceDetails(); // 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 19d7deccf0..cb2b59176a 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -220,6 +220,14 @@
+ +
+ +
+ {{ vm.inventorySource.value }} +
+
+
From 4355b30afebda4c9579c7eb42e1d1fc511f17454 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 9 May 2018 19:21:43 -0400 Subject: [PATCH 3/4] show overwrite details --- .../features/output/details.component.js | 24 +++++++++++++++++++ .../features/output/details.partial.html | 16 +++++++++++++ 2 files changed, 40 insertions(+) diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index 516555920c..9112ffabbf 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -194,6 +194,28 @@ function getInventorySourceDetails () { 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 getLaunchedByDetails () { const createdBy = resource.model.get('summary_fields.created_by'); const jobTemplate = resource.model.get('summary_fields.job_template'); @@ -658,6 +680,8 @@ function JobDetailsController ( vm.labels = getLabelDetails(); vm.inventoryJobName = getInventoryJobNameDetails(); vm.inventorySource = getInventorySourceDetails(); + vm.overwrite = getOverwriteDetails(); + vm.overwriteVars = getOverwriteVarsDetails(); // 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 cb2b59176a..5cb30e9dab 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -228,6 +228,22 @@
+ +
+ +
+ {{ vm.overwrite.value }} +
+
+ + +
+ +
+ {{ vm.overwriteVars.value }} +
+
+
From e19ffc1fba017cd59e83f04e7cfabc63dc817498 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 9 May 2018 19:38:51 -0400 Subject: [PATCH 4/4] show license error details --- awx/ui/client/features/output/details.component.js | 12 ++++++++++++ awx/ui/client/features/output/details.partial.html | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/awx/ui/client/features/output/details.component.js b/awx/ui/client/features/output/details.component.js index 9112ffabbf..84a97ed050 100644 --- a/awx/ui/client/features/output/details.component.js +++ b/awx/ui/client/features/output/details.component.js @@ -216,6 +216,17 @@ function getOverwriteVarsDetails () { 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'); @@ -682,6 +693,7 @@ function JobDetailsController ( 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 5cb30e9dab..fd0d51c2d4 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -84,6 +84,14 @@
+ +
+ +
+ {{ vm.licenseError.value }} +
+
+