added scan jobs list to inventory properties

added the scan jobs list in an accordion underneath the inventory properties.
This commit is contained in:
Jared Tabor 2015-03-13 15:37:21 -04:00
parent 757e77e9a3
commit 45513ca4bd
6 changed files with 105 additions and 34 deletions

View File

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

View File

@ -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,16 @@ 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,
LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, Stream) {
Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, generateList, OrganizationList, SearchInit, PaginateInit,
LookUpInit, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, Stream, ScanJobsList) {
ClearScope();
// Inject dynamic view
var defaultUrl = GetBasePath('inventory'),
form = InventoryForm,
form = InventoryForm(),
list = ScanJobsList,
view = generateList,
generator = GenerateForm,
inventory_id = $routeParams.inventory_id,
master = {},
@ -498,27 +500,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 });
// view.inject(list, { scope: $scope, id: 'scan-jobs-list' });
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,16 +625,20 @@ 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',
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', 'OrganizationList', 'SearchInit',
'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', 'Stream'
'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'generateList', 'OrganizationList', 'SearchInit',
'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', 'Stream', 'ScanJobsList'
];
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 +730,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,
@ -1191,7 +1181,7 @@ export function InventoriesManage ($log, $scope, $location, $routeParams, $compi
}
InventoriesManage.$inject = ['$log', '$scope', '$location', '$routeParams', '$compile', 'GenerateList', 'ClearScope', 'Empty', 'Wait', 'Rest', 'Alert', 'LoadBreadCrumbs',
InventoriesManage.$inject = ['$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',

View File

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

View File

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

View File

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

View File

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