diff --git a/awx/ui/client/features/output/details.directive.js b/awx/ui/client/features/output/details.directive.js index 7f36ee84e6..221fc2266a 100644 --- a/awx/ui/client/features/output/details.directive.js +++ b/awx/ui/client/features/output/details.directive.js @@ -92,7 +92,7 @@ function getVerbosityDetails () { const choices = mapChoices(resource.model.options('actions.GET.verbosity.choices')); const label = 'Verbosity'; - const value = choices[value]; + const value = choices[verbosity]; return { label, value }; } @@ -256,17 +256,26 @@ function getResultTracebackDetails () { return { label, value }; } -function getMachineCredentialDetails () { - const machineCredential = resource.model.get('summary_fields.credential'); +function getCredentialDetails () { + const credential = resource.model.get('summary_fields.credential'); - if (!machineCredential) { + if (!credential) { return null; } - const label = 'Machine Credential'; - const link = `/#/credentials/${machineCredential.id}`; + let label = 'Credential'; + + if (resource.type === 'playbook') { + label = 'Machine Credential'; + } + + if (resource.type === 'inventory') { + label = 'Source Credential'; + } + + const link = `/#/credentials/${credential.id}`; const tooltip = 'Edit the Credential'; - const value = $filter('sanitize')(machineCredential.name); + const value = $filter('sanitize')(credential.name); return { label, link, tooltip, value }; } @@ -427,7 +436,7 @@ function handleSocketEvent (data) { vm.project.update = vm.project.update || {}; vm.project.update.status = data.status; } -}; +} function AtDetailsController ( _$http_, @@ -470,7 +479,7 @@ function AtDetailsController ( vm.launchedBy = getLaunchedByDetails(); vm.jobExplanation = getJobExplanationDetails(); vm.verbosity = getVerbosityDetails(); - vm.machineCredential = getMachineCredentialDetails(); + vm.credential = getCredentialDetails(); vm.forks = getForkDetails(); vm.limit = getLimitDetails(); vm.instanceGroup = getInstanceGroupDetails(); diff --git a/awx/ui/client/features/output/details.partial.html b/awx/ui/client/features/output/details.partial.html index e72b682e6e..4d26151b9e 100644 --- a/awx/ui/client/features/output/details.partial.html +++ b/awx/ui/client/features/output/details.partial.html @@ -136,14 +136,14 @@
{{ vm.playbook.value }}
- -
- + +
+
diff --git a/awx/ui/client/features/output/index.controller.js b/awx/ui/client/features/output/index.controller.js index df2a06034c..e938e45cd6 100644 --- a/awx/ui/client/features/output/index.controller.js +++ b/awx/ui/client/features/output/index.controller.js @@ -84,7 +84,7 @@ function JobsIndexController ( eventCounter = null; statsEvent = resource.stats; - // Panel Title + // Panel vm.title = resource.model.get('name'); // Status Bar diff --git a/awx/ui/client/features/output/index.js b/awx/ui/client/features/output/index.js index 62155aed1e..33c67d6f11 100644 --- a/awx/ui/client/features/output/index.js +++ b/awx/ui/client/features/output/index.js @@ -27,6 +27,7 @@ function resolveResource ( AdHocCommand, SystemJob, WorkflowJob, + InventoryUpdate, $stateParams, qs, Wait @@ -51,6 +52,9 @@ function resolveResource ( case 'system': Resource = SystemJob; break; + case 'inventory': + Resource = InventoryUpdate; + break; // case 'workflow': // todo: integrate workflow chart components into this view // break; @@ -117,7 +121,6 @@ function resolveWebSocketConnection ($stateParams, SocketService) { }; return SocketService.addStateResolve(state, id); - } function resolveBreadcrumb (strings) { @@ -181,6 +184,7 @@ function JobsRun ($stateRegistry) { 'AdHocCommandModel', 'SystemJobModel', 'WorkflowJobModel', + 'InventoryUpdateModel', '$stateParams', 'QuerySet', 'Wait', diff --git a/awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js b/awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js index e6ec40733b..a76e62eb52 100644 --- a/awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js +++ b/awx/ui/client/lib/components/relaunchButton/relaunchButton.component.js @@ -23,8 +23,6 @@ function atRelaunchCtrl ( const jobObj = new Job(); const jobTemplate = new JobTemplate(); - - const checkRelaunchPlaybook = (option) => { jobObj.getRelaunch({ id: vm.job.id @@ -165,7 +163,7 @@ function atRelaunchCtrl ( inventorySource.postUpdate(vm.job.inventory_source) .then((postUpdateRes) => { if (!$state.includes('jobs')) { - $state.go('inventorySyncStdout', { id: postUpdateRes.data.id }, { reload: true }); + $state.go('jobz', { id: postUpdateRes.data.id, type: 'inventory' }, { reload: true }); } }); } else { diff --git a/awx/ui/client/lib/models/InventoryUpdate.js b/awx/ui/client/lib/models/InventoryUpdate.js new file mode 100644 index 0000000000..668a05459d --- /dev/null +++ b/awx/ui/client/lib/models/InventoryUpdate.js @@ -0,0 +1,27 @@ +let BaseModel; + +function getStats () { + return Promise.resolve(null); +} + +function InventoryUpdateModel (method, resource, config) { + BaseModel.call(this, 'inventory_updates'); + + this.getStats = getStats.bind(this); + + this.Constructor = InventoryUpdateModel; + + return this.create(method, resource, config); +} + +function InventoryUpdateModelLoader (_BaseModel_) { + BaseModel = _BaseModel_; + + return InventoryUpdateModel; +} + +InventoryUpdateModelLoader.$inject = [ + 'BaseModel' +]; + +export default InventoryUpdateModelLoader; diff --git a/awx/ui/client/lib/models/SystemJob.js b/awx/ui/client/lib/models/SystemJob.js index cc092ff8f4..1f1f1c5ee3 100644 --- a/awx/ui/client/lib/models/SystemJob.js +++ b/awx/ui/client/lib/models/SystemJob.js @@ -1,8 +1,14 @@ let BaseModel; +function getStats () { + return Promise.resolve(null); +} + function SystemJobModel (method, resource, config) { BaseModel.call(this, 'system_jobs'); + this.getStats = getStats.bind(this); + this.Constructor = SystemJobModel; return this.create(method, resource, config); diff --git a/awx/ui/client/lib/models/index.js b/awx/ui/client/lib/models/index.js index 3875975d4d..d50c825e22 100644 --- a/awx/ui/client/lib/models/index.js +++ b/awx/ui/client/lib/models/index.js @@ -11,6 +11,7 @@ import InstanceGroup from '~models/InstanceGroup'; import Inventory from '~models/Inventory'; import InventoryScript from '~models/InventoryScript'; import InventorySource from '~models/InventorySource'; +import InventoryUpdate from '~models/InventoryUpdate'; import Job from '~models/Job'; import JobEvent from '~models/JobEvent'; import JobTemplate from '~models/JobTemplate'; @@ -46,6 +47,7 @@ angular .service('InventoryModel', Inventory) .service('InventoryScriptModel', InventoryScript) .service('InventorySourceModel', InventorySource) + .service('InventoryUpdateModel', InventoryUpdate) .service('JobEventModel', JobEvent) .service('JobModel', Job) .service('JobTemplateModel', JobTemplate)