add inventory updates

This commit is contained in:
Jake McDermott 2018-03-28 21:58:35 -04:00
parent 8da2c3cad2
commit a53f70f0af
No known key found for this signature in database
GPG Key ID: 3B02CAD476EECB35
8 changed files with 66 additions and 20 deletions

View File

@ -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();

View File

@ -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>

View File

@ -84,7 +84,7 @@ function JobsIndexController (
eventCounter = null;
statsEvent = resource.stats;
// Panel Title
// Panel
vm.title = resource.model.get('name');
// Status Bar

View File

@ -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',

View File

@ -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 {

View 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;

View File

@ -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);

View File

@ -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)