mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Merge pull request #105 from jaredevantabor/scan-jobs-list
Scan jobs list
This commit is contained in:
commit
136efd9724
@ -92,6 +92,7 @@ var tower = angular.module('Tower', [
|
||||
'InventoryHostsDefinition',
|
||||
'HostsHelper',
|
||||
'AWFilters',
|
||||
'ScanJobsListDefinition',
|
||||
'HostFormDefinition',
|
||||
'HostListDefinition',
|
||||
'GroupFormDefinition',
|
||||
@ -261,6 +262,11 @@ var tower = angular.module('Tower', [
|
||||
controller: InventoriesEdit
|
||||
}).
|
||||
|
||||
when('/inventories/:inventory_id/job_templates/add', {
|
||||
templateUrl: urlPrefix + 'partials/job_templates.html',
|
||||
controller: JobTemplatesAdd
|
||||
}).
|
||||
|
||||
when('/inventories/:inventory_id/manage', {
|
||||
templateUrl: urlPrefix + 'partials/inventory-manage.html',
|
||||
controller: InventoriesManage
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
|
||||
export function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $compile, $filter, Rest, Alert, InventoryList, GenerateList,
|
||||
export function InventoriesList($scope, $rootScope, $location, $log, $routeParams, $compile, $filter, Rest, Alert, InventoryList, generateList,
|
||||
LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, Wait, Stream,
|
||||
EditInventoryProperties, Find, Empty, LogViewer) {
|
||||
|
||||
@ -22,7 +22,7 @@ export function InventoriesList($scope, $rootScope, $location, $log, $routeParam
|
||||
|
||||
var list = InventoryList,
|
||||
defaultUrl = GetBasePath('inventory'),
|
||||
view = GenerateList,
|
||||
view = generateList,
|
||||
paths = $location.path().replace(/^\//, '').split('/'),
|
||||
mode = (paths[0] === 'inventories') ? 'edit' : 'select';
|
||||
|
||||
@ -373,7 +373,7 @@ InventoriesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$routeP
|
||||
|
||||
|
||||
export function InventoriesAdd($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest,
|
||||
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, OrganizationList, SearchInit, PaginateInit,
|
||||
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
|
||||
LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON) {
|
||||
|
||||
ClearScope();
|
||||
@ -481,14 +481,14 @@ InventoriesAdd.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log
|
||||
];
|
||||
|
||||
export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest,
|
||||
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, OrganizationList, SearchInit, PaginateInit,
|
||||
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
|
||||
LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, Stream) {
|
||||
|
||||
ClearScope();
|
||||
|
||||
// Inject dynamic view
|
||||
var defaultUrl = GetBasePath('inventory'),
|
||||
form = InventoryForm,
|
||||
form = InventoryForm(),
|
||||
generator = GenerateForm,
|
||||
inventory_id = $routeParams.inventory_id,
|
||||
master = {},
|
||||
@ -498,27 +498,11 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $
|
||||
form.formLabelSize = null;
|
||||
form.formFieldSize = null;
|
||||
|
||||
generator.inject(form, { mode: 'edit', related: false, scope: $scope });
|
||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||
|
||||
generator.reset();
|
||||
LoadBreadCrumbs();
|
||||
|
||||
// $scope.parseType = 'yaml';
|
||||
// ParseTypeChange({
|
||||
// scope: $scope,
|
||||
// variable: 'variables',
|
||||
// parse_variable: 'parseType',
|
||||
// field_id: 'inventory_variables'
|
||||
// });
|
||||
|
||||
// LookUpInit({
|
||||
// scope: $scope,
|
||||
// form: form,
|
||||
// current_item: ($routeParams.organization_id) ? $routeParams.organization_id : null,
|
||||
// list: OrganizationList,
|
||||
// field: 'organization',
|
||||
// input_type: 'radio'
|
||||
// });
|
||||
Wait('start');
|
||||
Rest.setUrl(GetBasePath('inventory') + inventory_id + '/');
|
||||
Rest.get()
|
||||
@ -639,6 +623,10 @@ export function InventoriesEdit($scope, $rootScope, $compile, $location, $log, $
|
||||
field_id: 'inventory_variables'
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addScanJob = function(){
|
||||
$location.path($location.path()+'/job_templates/add');
|
||||
};
|
||||
}
|
||||
|
||||
InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm',
|
||||
@ -648,7 +636,7 @@ InventoriesEdit.$inject = ['$scope', '$rootScope', '$compile', '$location', '$lo
|
||||
|
||||
|
||||
|
||||
export function InventoriesManage ($log, $scope, $location, $routeParams, $compile, GenerateList, ClearScope, Empty, Wait, Rest, Alert, LoadBreadCrumbs, GetBasePath, ProcessErrors,
|
||||
export function InventoriesManage ($log, $scope, $location, $routeParams, $compile, generateList, ClearScope, Empty, Wait, Rest, Alert, LoadBreadCrumbs, GetBasePath, ProcessErrors,
|
||||
Breadcrumbs, InventoryGroups, InjectHosts, Find, HostsReload, SearchInit, PaginateInit, GetSyncStatusMsg, GetHostsStatusMsg, GroupsEdit, InventoryUpdate,
|
||||
GroupsCancelUpdate, ViewUpdateStatus, GroupsDelete, Store, HostsEdit, HostsDelete, EditInventoryProperties, ToggleHostEnabled, Stream, ShowJobSummary,
|
||||
InventoryGroupsHelp, HelpDialog, ViewJob, WatchInventoryWindowResize, GetHostContainerRows, GetGroupContainerRows, GetGroupContainerHeight,
|
||||
@ -740,7 +728,7 @@ export function InventoriesManage ($log, $scope, $location, $routeParams, $compi
|
||||
$compile(e)($scope);
|
||||
|
||||
// Add groups view
|
||||
GenerateList.inject(InventoryGroups, {
|
||||
generateList.inject(InventoryGroups, {
|
||||
mode: 'edit',
|
||||
id: 'group-list-container',
|
||||
breadCrumbs: false,
|
||||
|
||||
@ -977,7 +977,7 @@ export function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log,
|
||||
if($scope.survey_enabled === true && $scope.survey_exists!==true){
|
||||
// $scope.$emit("PromptForSurvey");
|
||||
|
||||
// The original design for this was a pop up that would prompt the user if they wanted to create a
|
||||
// The original design for this was a pop up that would prompt the user if they wanted to create a
|
||||
// survey, because they had enabled one but not created it yet. We switched this for now so that
|
||||
// an error message would be displayed by the survey buttons that tells the user to add a survey or disabled
|
||||
// surveys.
|
||||
|
||||
@ -13,13 +13,17 @@
|
||||
*/
|
||||
|
||||
export default
|
||||
angular.module('InventoryFormDefinition', [])
|
||||
.value('InventoryForm', {
|
||||
angular.module('InventoryFormDefinition', ['ScanJobsListDefinition'])
|
||||
.value('InventoryFormObject', {
|
||||
|
||||
addTitle: 'Create Inventory',
|
||||
editTitle: '{{ inventory_name }}',
|
||||
name: 'inventory',
|
||||
well: true,
|
||||
collapse: true,
|
||||
collapseTitle: "Properties",
|
||||
collapseMode: 'edit',
|
||||
collapseOpen: true,
|
||||
|
||||
actions: {
|
||||
stream: {
|
||||
@ -93,7 +97,75 @@ export default
|
||||
},
|
||||
|
||||
related: {
|
||||
scan_jobs: {
|
||||
type: 'collection',
|
||||
title: 'Scan Jobs',
|
||||
iterator: 'scan_job',
|
||||
index: false,
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "addScanJob(inventory_id)",
|
||||
icon: 'icon-plus',
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a scan job'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
label: 'Name'
|
||||
},
|
||||
description: {
|
||||
label: 'Description'
|
||||
}
|
||||
},
|
||||
|
||||
fieldActions: {
|
||||
edit: {
|
||||
label: 'Edit',
|
||||
ngClick: "edit('organizations', organization.id, organization.name)",
|
||||
icon: 'icon-edit',
|
||||
awToolTip: 'Edit the organization',
|
||||
'class': 'btn btn-default'
|
||||
},
|
||||
"delete": {
|
||||
label: 'Delete',
|
||||
ngClick: "delete('organizations', organization.id, organization.name, 'organizations')",
|
||||
icon: 'icon-trash',
|
||||
"class": 'btn-danger',
|
||||
awToolTip: 'Delete the organization'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
relatedSets: function(urls) {
|
||||
return {
|
||||
scan_jobs: {
|
||||
iterator: 'scan_job',
|
||||
url: urls.organizations
|
||||
},
|
||||
// schedules: {
|
||||
// iterator: 'schedule',
|
||||
// url: urls.schedules
|
||||
// }
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
.factory('InventoryForm', ['InventoryFormObject', 'ScanJobsList',
|
||||
function(InventoryFormObject, ScanJobsList) {
|
||||
return function() {
|
||||
var itm;
|
||||
for (itm in InventoryFormObject.related) {
|
||||
if (InventoryFormObject.related[itm].include === "ScanJobsList") {
|
||||
InventoryFormObject.related[itm] = ScanJobsList;
|
||||
InventoryFormObject.related[itm].generateList = true; // tell form generator to call list generator and inject a list
|
||||
}
|
||||
}
|
||||
return InventoryFormObject;
|
||||
};
|
||||
}]);
|
||||
|
||||
@ -22,6 +22,7 @@ import PortalJobs from "tower/lists/PortalJobs";
|
||||
import Projects from "tower/lists/Projects";
|
||||
import QueuedJobs from "tower/lists/QueuedJobs";
|
||||
import RunningJobs from "tower/lists/RunningJobs";
|
||||
import ScanJobsList from "tower/lists/ScanJobs";
|
||||
import ScheduledJobs from "tower/lists/ScheduledJobs";
|
||||
import Schedules from "tower/lists/Schedules";
|
||||
import Streams from "tower/lists/Streams";
|
||||
@ -53,6 +54,7 @@ export
|
||||
Projects,
|
||||
QueuedJobs,
|
||||
RunningJobs,
|
||||
ScanJobsList,
|
||||
ScheduledJobs,
|
||||
Schedules,
|
||||
Streams,
|
||||
|
||||
94
awx/ui/static/js/lists/ScanJobs.js
Normal file
94
awx/ui/static/js/lists/ScanJobs.js
Normal file
@ -0,0 +1,94 @@
|
||||
/*********************************************
|
||||
* Copyright (c) 2014 AnsibleWorks, Inc.
|
||||
*
|
||||
* Jobs.js
|
||||
* List view object for job data model.
|
||||
*
|
||||
* Used on dashboard to provide a list of all jobs, regardless of
|
||||
* status.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
export default
|
||||
angular.module('ScanJobsListDefinition', [])
|
||||
.value( 'ScanJobsList', {
|
||||
|
||||
name: 'scan_jobs',
|
||||
iterator: 'scan_job',
|
||||
editTitle: 'Scan Jobs',
|
||||
'class': 'table-condensed',
|
||||
index: false,
|
||||
hover: true,
|
||||
well: false,
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
label: 'Name',
|
||||
// columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8'
|
||||
},
|
||||
description: {
|
||||
label: 'Description',
|
||||
// columnClass: 'col-lg-4 col-md-3 hidden-sm hidden-xs'
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
mode: 'all', // One of: edit, select, all
|
||||
ngClick: 'addScanJobTemplate()',
|
||||
basePaths: ['job_templates'],
|
||||
awToolTip: 'Create a new template',
|
||||
ngHide: 'portalMode===true'
|
||||
},
|
||||
stream: {
|
||||
ngClick: "showActivity()",
|
||||
awToolTip: "View Activity Stream",
|
||||
icon: "icon-comments-alt",
|
||||
mode: 'edit',
|
||||
ngHide: 'portalMode===true'
|
||||
}
|
||||
},
|
||||
|
||||
fieldActions: {
|
||||
submit: {
|
||||
label: 'Launch',
|
||||
mode: 'all',
|
||||
ngClick: 'submitJob(job_template.id)',
|
||||
awToolTip: 'Start a job using this template',
|
||||
dataPlacement: 'top'
|
||||
},
|
||||
schedule: {
|
||||
label: 'Schedule',
|
||||
mode: 'all',
|
||||
ngHref: '#/job_templates/{{ job_template.id }}/schedules',
|
||||
awToolTip: 'Schedule future job template runs',
|
||||
dataPlacement: 'top',
|
||||
},
|
||||
edit: {
|
||||
label: 'Edit',
|
||||
ngClick: "editJobTemplate(job_template.id)",
|
||||
awToolTip: 'Edit template',
|
||||
"class": 'btn-default btn-xs',
|
||||
dataPlacement: 'top',
|
||||
},
|
||||
"delete": {
|
||||
label: 'Delete',
|
||||
ngClick: "deleteJobTemplate(job_template.id, job_template.name)",
|
||||
"class": 'btn-danger btn-xs',
|
||||
awToolTip: 'Delete template',
|
||||
dataPlacement: 'top',
|
||||
},
|
||||
copy: {
|
||||
label: 'Copy',
|
||||
ngClick: "copyJobTemplate(job_template.id, job_template.name)",
|
||||
"class": 'btn-danger btn-xs',
|
||||
awToolTip: 'Copy template',
|
||||
dataPlacement: 'top',
|
||||
ngHide: 'job_template.summary_fields.can_copy===false'
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1,5 +1,6 @@
|
||||
<div class="tab-pane" id="inventories">
|
||||
<div ng-cloak id="htmlTemplate"></div>
|
||||
<div id="inventory-edit-modal-dialog"></div>
|
||||
<div id="scan-jobs-list" style="padding-top:40px"></div>
|
||||
<div ng-include="'/static/partials/logviewer.html'"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user