From 27db190bedac2167f9ef257f6187d31a2ae032c7 Mon Sep 17 00:00:00 2001
From: Jared Tabor Drag and drop your custom inventory script file here or create one in the field to import your custom inventory.
Open the documentation for a complete list of filter options.
", + dataContainer: 'body' + }, + group_by: { + label: 'Group By', + type: 'text', + ngShow: "source && source.value == 'ec2'", + addRequired: false, + editRequired: false, + awMultiselect: 'group_by_choices', + dataTitle: 'Group By', + dataPlacement: 'right', + awPopOver: "FIXME: Create these automatic groups by default.
", + dataContainer: 'body' + }, + group_tag_filters: { + label: 'Tag Filters', + type: 'text', + ngShow: "source && source.value == 'ec2' && group_by.value.indexOf('tag_keys') >= 0", // FIXME: Not sure what's needed to make the last expression work. + addRequired: false, + editRequired: false, + dataTitle: 'Tag Filters', + dataPlacement: 'right', + awPopOver: "FIXME: When grouping by tags, specify which tag keys become groups.
", + dataContainer: 'body' + }, + custom_script: { + label : "Custom Inventory Scripts", + type: 'lookup', + ngShow: "source && source.value !== '' && source.value === 'custom'", + sourceModel: 'custom_script', + sourceField: 'name', + ngClick: 'lookUpCustomScript()', + addRequired: false, + editRequired: false + }, source_vars: { label: 'Source Variables', ngShow: "source && (source.value == 'file' || source.value == 'ec2' || source.value == 'custom')", diff --git a/awx/ui/static/js/helpers/CustomInventory.js b/awx/ui/static/js/helpers/CustomInventory.js new file mode 100644 index 0000000000..e3148d289c --- /dev/null +++ b/awx/ui/static/js/helpers/CustomInventory.js @@ -0,0 +1,479 @@ +/********************************************* + * Copyright (c) 2014 AnsibleWorks, Inc. + */ + /** + * @ngdoc function + * @name helpers.function:Schedules + * @description + * Schedules Helper + * + * Display the scheduler widget in a dialog + * + */ + +'use strict'; + +angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', 'ListGenerator', 'ModalDialog', + 'GeneratorHelpers', 'CustomInventoryFormDefinition']) + + .factory('CreateCustomInventory', ['Wait', 'CreateDialog', 'CustomInventoryList', 'GenerateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'LoadSchedulesScope', + 'SchedulesList', 'SchedulesControllerInit' , 'ConfigureTowerSchedule', 'Rest' , 'ProcessErrors', 'CustomInventoryForm', 'GenerateForm', + function(Wait, CreateDialog, CustomInventoryList, GenerateList, GetBasePath, SearchInit, PaginateInit, PlaybookRun, LoadSchedulesScope, + SchedulesList, SchedulesControllerInit, ConfigureTowerSchedule, Rest, ProcessErrors, CustomInventoryForm, GenerateForm) { + return function(params) { + // Set modal dimensions based on viewport width + + var scope = params.parent_scope.$new(), + parent_scope = params.parent_scope, + callback = 'OpenConfig', + defaultUrl = GetBasePath('system_job_templates'), + list = CustomInventoryList, + view = GenerateList, + scheduleUrl = GetBasePath('system_job_templates'), + form = CustomInventoryForm, + generator = GenerateForm, + buttons = [ + { + "label": "Close", + "onClick": function() { + // $(this).dialog('close'); + scope.cancelConfigure(); + }, + "icon": "fa-times", + "class": "btn btn-default", + "id": "configure-close-button" + } + ]; + + scope.cleanupJob = true; + + if(scope.removeOpenConfig) { + scope.removeOpenConfig(); + } + scope.removeOpenConfig = scope.$on('OpenConfig', function() { + $('#configure-tower-dialog').dialog('open'); + $('#configure-close-button').focus(); + $('#configure-close-button').blur(); + }); + + view.inject( list, { + id : 'configure-jobs', + mode: 'edit', + scope: scope, + breadCrumbs: false, + activityStream: false, + showSearch: true + }); + + SearchInit({ + scope: scope, + set: 'configure_jobs', + list: list, + url: defaultUrl + }); + PaginateInit({ + scope: scope, + list: list, + url: defaultUrl + }); + + scope.search(list.iterator); + + SchedulesControllerInit({ + scope: scope, + parent_scope: parent_scope, + // list: list + }); + + + CreateDialog({ + id: 'configure-tower-dialog', + title: 'Inventory Script', + target: 'configure-tower-dialog', + scope: scope, + buttons: buttons, + width: 670, + height: 800, + minWidth: 400, + callback: callback, + onClose: function () { + // Destroy on close + $('.tooltip').each(function () { + // Remove any lingering tooltipSelect existing credentials by clicking each credential or checking the related checkbox. When " + + "finished, click the blue Select button, located bottom right.
Create a brand new credential by clicking " + + "the button.
", + index: false, + hover: true, + + fields: { + name: { + key: true, + label: 'Name', + columnClass: 'col-md-3 col-sm-9 col-xs-9', + modalColumnClass: 'col-md-8' + }, + description: { + label: 'Description', + excludeModal: true, + columnClass: 'col-md-5 hidden-sm hidden-xs' + }, + // kind: { + // label: 'Type', + // searchType: 'select', + // searchOptions: [], // will be set by Options call to credentials resource + // excludeModal: true, + // nosort: true, + // columnClass: 'col-md-3 hidden-sm hidden-xs' + // } + }, + + actions: { + add: { + mode: 'all', // One of: edit, select, all + ngClick: 'addCustomInv()', + awToolTip: 'Create a new credential' + }, + stream: { + ngClick: "showActivity()", + awToolTip: "View Activity Stream", + mode: 'edit' + } + }, + + fieldActions: { + edit: { + ngClick: "editCredential(credential.id)", + icon: 'fa-edit', + label: 'Edit', + "class": 'btn-sm', + awToolTip: 'Edit credential', + dataPlacement: 'top' + }, + + "delete": { + ngClick: "deleteCredential(credential.id, credential.name)", + icon: 'fa-trash', + label: 'Delete', + "class": 'btn-sm', + awToolTip: 'Delete credential', + dataPlacement: 'top' + } + } + }); diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index f39a2b8373..66dbd1b8a4 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -89,6 +89,7 @@ + @@ -114,6 +115,7 @@ + @@ -133,6 +135,7 @@ + @@ -196,8 +199,9 @@ About Tower Account Settings - Configure Tower Contact Support + Inventory Script + Management Jobs Monitor Tower Portal Mode View License @@ -237,8 +241,9 @@