add inventory updates

This commit is contained in:
Jake McDermott
2018-03-28 21:58:35 -04:00
parent 8da2c3cad2
commit a53f70f0af
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 choices = mapChoices(resource.model.options('actions.GET.verbosity.choices'));
const label = 'Verbosity'; const label = 'Verbosity';
const value = choices[value]; const value = choices[verbosity];
return { label, value }; return { label, value };
} }
@@ -256,17 +256,26 @@ function getResultTracebackDetails () {
return { label, value }; return { label, value };
} }
function getMachineCredentialDetails () { function getCredentialDetails () {
const machineCredential = resource.model.get('summary_fields.credential'); const credential = resource.model.get('summary_fields.credential');
if (!machineCredential) { if (!credential) {
return null; return null;
} }
const label = 'Machine Credential'; let label = 'Credential';
const link = `/#/credentials/${machineCredential.id}`;
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 tooltip = 'Edit the Credential';
const value = $filter('sanitize')(machineCredential.name); const value = $filter('sanitize')(credential.name);
return { label, link, tooltip, value }; return { label, link, tooltip, value };
} }
@@ -427,7 +436,7 @@ function handleSocketEvent (data) {
vm.project.update = vm.project.update || {}; vm.project.update = vm.project.update || {};
vm.project.update.status = data.status; vm.project.update.status = data.status;
} }
}; }
function AtDetailsController ( function AtDetailsController (
_$http_, _$http_,
@@ -470,7 +479,7 @@ function AtDetailsController (
vm.launchedBy = getLaunchedByDetails(); vm.launchedBy = getLaunchedByDetails();
vm.jobExplanation = getJobExplanationDetails(); vm.jobExplanation = getJobExplanationDetails();
vm.verbosity = getVerbosityDetails(); vm.verbosity = getVerbosityDetails();
vm.machineCredential = getMachineCredentialDetails(); vm.credential = getCredentialDetails();
vm.forks = getForkDetails(); vm.forks = getForkDetails();
vm.limit = getLimitDetails(); vm.limit = getLimitDetails();
vm.instanceGroup = getInstanceGroupDetails(); vm.instanceGroup = getInstanceGroupDetails();

View File

@@ -136,14 +136,14 @@
<div class="JobResults-resultRowText">{{ vm.playbook.value }}</div> <div class="JobResults-resultRowText">{{ vm.playbook.value }}</div>
</div> </div>
<!-- MACHINE CREDENTIAL DETAIL --> <!-- CREDENTIAL DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.machineCredential"> <div class="JobResults-resultRow" ng-show="vm.credential">
<label class="JobResults-resultRowLabel">{{ vm.machineCredential.label }}</label> <label class="JobResults-resultRowLabel">{{ vm.credential.label }}</label>
<div class="JobResults-resultRowText"> <div class="JobResults-resultRowText">
<a href="{{ vm.machineCredential.link }}" <a href="{{ vm.credential.link }}"
aw-tool-tip="{{ vm.machineCredential.tooltip }}" aw-tool-tip="{{ vm.credential.tooltip }}"
data-placement="top"> data-placement="top">
{{ vm.machineCredential.value }} {{ vm.credential.value }}
</a> </a>
</div> </div>
</div> </div>

View File

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

View File

@@ -27,6 +27,7 @@ function resolveResource (
AdHocCommand, AdHocCommand,
SystemJob, SystemJob,
WorkflowJob, WorkflowJob,
InventoryUpdate,
$stateParams, $stateParams,
qs, qs,
Wait Wait
@@ -51,6 +52,9 @@ function resolveResource (
case 'system': case 'system':
Resource = SystemJob; Resource = SystemJob;
break; break;
case 'inventory':
Resource = InventoryUpdate;
break;
// case 'workflow': // case 'workflow':
// todo: integrate workflow chart components into this view // todo: integrate workflow chart components into this view
// break; // break;
@@ -117,7 +121,6 @@ function resolveWebSocketConnection ($stateParams, SocketService) {
}; };
return SocketService.addStateResolve(state, id); return SocketService.addStateResolve(state, id);
} }
function resolveBreadcrumb (strings) { function resolveBreadcrumb (strings) {
@@ -181,6 +184,7 @@ function JobsRun ($stateRegistry) {
'AdHocCommandModel', 'AdHocCommandModel',
'SystemJobModel', 'SystemJobModel',
'WorkflowJobModel', 'WorkflowJobModel',
'InventoryUpdateModel',
'$stateParams', '$stateParams',
'QuerySet', 'QuerySet',
'Wait', 'Wait',

View File

@@ -23,8 +23,6 @@ function atRelaunchCtrl (
const jobObj = new Job(); const jobObj = new Job();
const jobTemplate = new JobTemplate(); const jobTemplate = new JobTemplate();
const checkRelaunchPlaybook = (option) => { const checkRelaunchPlaybook = (option) => {
jobObj.getRelaunch({ jobObj.getRelaunch({
id: vm.job.id id: vm.job.id
@@ -165,7 +163,7 @@ function atRelaunchCtrl (
inventorySource.postUpdate(vm.job.inventory_source) inventorySource.postUpdate(vm.job.inventory_source)
.then((postUpdateRes) => { .then((postUpdateRes) => {
if (!$state.includes('jobs')) { 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 { } 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; let BaseModel;
function getStats () {
return Promise.resolve(null);
}
function SystemJobModel (method, resource, config) { function SystemJobModel (method, resource, config) {
BaseModel.call(this, 'system_jobs'); BaseModel.call(this, 'system_jobs');
this.getStats = getStats.bind(this);
this.Constructor = SystemJobModel; this.Constructor = SystemJobModel;
return this.create(method, resource, config); return this.create(method, resource, config);

View File

@@ -11,6 +11,7 @@ import InstanceGroup from '~models/InstanceGroup';
import Inventory from '~models/Inventory'; import Inventory from '~models/Inventory';
import InventoryScript from '~models/InventoryScript'; import InventoryScript from '~models/InventoryScript';
import InventorySource from '~models/InventorySource'; import InventorySource from '~models/InventorySource';
import InventoryUpdate from '~models/InventoryUpdate';
import Job from '~models/Job'; import Job from '~models/Job';
import JobEvent from '~models/JobEvent'; import JobEvent from '~models/JobEvent';
import JobTemplate from '~models/JobTemplate'; import JobTemplate from '~models/JobTemplate';
@@ -46,6 +47,7 @@ angular
.service('InventoryModel', Inventory) .service('InventoryModel', Inventory)
.service('InventoryScriptModel', InventoryScript) .service('InventoryScriptModel', InventoryScript)
.service('InventorySourceModel', InventorySource) .service('InventorySourceModel', InventorySource)
.service('InventoryUpdateModel', InventoryUpdate)
.service('JobEventModel', JobEvent) .service('JobEventModel', JobEvent)
.service('JobModel', Job) .service('JobModel', Job)
.service('JobTemplateModel', JobTemplate) .service('JobTemplateModel', JobTemplate)