mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 04:31:21 -03:30
add inventory updates
This commit is contained in:
parent
8da2c3cad2
commit
a53f70f0af
@ -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();
|
||||
|
||||
@ -136,14 +136,14 @@
|
||||
<div class="JobResults-resultRowText">{{ vm.playbook.value }}</div>
|
||||
</div>
|
||||
|
||||
<!-- MACHINE CREDENTIAL DETAIL -->
|
||||
<div class="JobResults-resultRow" ng-show="vm.machineCredential">
|
||||
<label class="JobResults-resultRowLabel">{{ vm.machineCredential.label }}</label>
|
||||
<!-- CREDENTIAL DETAIL -->
|
||||
<div class="JobResults-resultRow" ng-show="vm.credential">
|
||||
<label class="JobResults-resultRowLabel">{{ vm.credential.label }}</label>
|
||||
<div class="JobResults-resultRowText">
|
||||
<a href="{{ vm.machineCredential.link }}"
|
||||
aw-tool-tip="{{ vm.machineCredential.tooltip }}"
|
||||
<a href="{{ vm.credential.link }}"
|
||||
aw-tool-tip="{{ vm.credential.tooltip }}"
|
||||
data-placement="top">
|
||||
{{ vm.machineCredential.value }}
|
||||
{{ vm.credential.value }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -84,7 +84,7 @@ function JobsIndexController (
|
||||
eventCounter = null;
|
||||
statsEvent = resource.stats;
|
||||
|
||||
// Panel Title
|
||||
// Panel
|
||||
vm.title = resource.model.get('name');
|
||||
|
||||
// Status Bar
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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 {
|
||||
|
||||
27
awx/ui/client/lib/models/InventoryUpdate.js
Normal file
27
awx/ui/client/lib/models/InventoryUpdate.js
Normal file
@ -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;
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user