From 0ffb979e8e4eb9586c1649aeecba3c46e162226d Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Wed, 19 Nov 2014 16:59:59 -0500 Subject: [PATCH] Storable inventory script Added the list and form for adding/editing/deleting custom inventory scripts. --- awx/ui/static/js/forms/CustomInventory.js | 129 +---- awx/ui/static/js/helpers/CustomInventory.js | 530 +++++++------------- awx/ui/static/js/lists/CustomInventory.js | 17 +- awx/ui/static/partials/configure_tower.html | 30 ++ awx/ui/templates/ui/index.html | 36 +- 5 files changed, 229 insertions(+), 513 deletions(-) create mode 100644 awx/ui/static/partials/configure_tower.html diff --git a/awx/ui/static/js/forms/CustomInventory.js b/awx/ui/static/js/forms/CustomInventory.js index d6fee2e21f..4cf7d07c9b 100644 --- a/awx/ui/static/js/forms/CustomInventory.js +++ b/awx/ui/static/js/forms/CustomInventory.js @@ -16,24 +16,9 @@ angular.module('CustomInventoryFormDefinition', []) addTitle: 'Create Custom Inventory', //Title in add mode editTitle: '{{ name }}', //Title in edit mode - name: 'organization', //entity or model name in singular form - well: true, - // collapse: true, - // collapseTitle: "Properties", - // collapseMode: 'edit', - // collapseOpen: true, - - actions: { - stream: { - 'class': "btn-primary btn-xs activity-btn", - ngClick: "showActivity()", - awToolTip: "View Activity Stream", - dataPlacement: "top", - icon: "icon-comments-alt", - mode: 'edit', - iconSize: 'large' - } - }, + name: 'custom_inventory', //entity or model name in singular form + well: false, + showActions: false, fields: { name: { @@ -49,30 +34,16 @@ angular.module('CustomInventoryFormDefinition', []) addRequired: false, editRequired: false }, - // script: { - // label: 'Custom Script', - // type: 'textarea', - // addRequired: false, - // editRequired: false - // } script: { - // labelBind: 'sshKeyDataLabel', label: 'Custom Script', type: 'textarea', - // ngShow: "kind.value == 'ssh' || kind.value == 'scm' || " + - // "kind.value == 'gce' || kind.value == 'azure'", - // awRequiredWhen: { - // variable: 'key_required', - // init: true - // }, - hintText: "Hint: drag and drop an inventory script on the field below", + hintText: "Drag and drop an inventory script on the field below", addRequired: true, editRequired: true, awDropFile: true, 'class': 'ssh-key-field', rows: 10, awPopOver: "

Drag and drop your custom inventory script file here or create one in the field to import your custom inventory.

", - // awPopOverWatch: "", dataTitle: 'Custom Script', dataPlacement: 'right', dataContainer: "body" @@ -90,98 +61,6 @@ angular.module('CustomInventoryFormDefinition', []) } }, - related: { - users: { - type: 'collection', - title: 'Users', - iterator: 'user', - open: false, - - actions: { - add: { - ngClick: "add('users')", - label: 'Add', - icon: 'icon-plus', - awToolTip: 'Add a new user' - } - }, - - fields: { - username: { - key: true, - label: 'Username' - }, - first_name: { - label: 'First Name' - }, - last_name: { - label: 'Last Name' - } - }, - - fieldActions: { - edit: { - label: 'Edit', - ngClick: "edit('users', user.id, user.username)", - icon: 'icon-edit', - 'class': 'btn-default', - awToolTip: 'Edit user' - }, - "delete": { - label: 'Delete', - ngClick: "delete('users', user.id, user.username, 'users')", - icon: 'icon-trash', - "class": 'btn-danger', - awToolTip: 'Remove user' - } - } - }, - - admins: { // Assumes a plural name (e.g. things) - type: 'collection', - title: 'Administrators', - iterator: 'admin', // Singular form of name (e.g. thing) - open: false, // Open accordion on load? - base: '/users', - actions: { // Actions displayed top right of list - add: { - ngClick: "add('admins')", - icon: 'icon-plus', - label: 'Add', - awToolTip: 'Add new administrator' - } - }, - fields: { - username: { - key: true, - label: 'Username' - }, - first_name: { - label: 'First Name' - }, - last_name: { - label: 'Last Name' - } - }, - fieldActions: { // Actions available on each row - edit: { - label: 'Edit', - ngClick: "edit('users', admin.id, admin.username)", - icon: 'icon-edit', - awToolTip: 'Edit administrator', - 'class': 'btn-default' - }, - "delete": { - label: 'Delete', - ngClick: "delete('admins', admin.id, admin.username, 'administrators')", - icon: 'icon-trash', - "class": 'btn-danger', - awToolTip: 'Remove administrator' - } - } - } - - } }); //OrganizationForm diff --git a/awx/ui/static/js/helpers/CustomInventory.js b/awx/ui/static/js/helpers/CustomInventory.js index e3148d289c..64e61952d7 100644 --- a/awx/ui/static/js/helpers/CustomInventory.js +++ b/awx/ui/static/js/helpers/CustomInventory.js @@ -16,22 +16,18 @@ 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) { + .factory('CreateCustomInventory', ['Wait', 'CreateDialog', 'CustomInventoryList', 'GenerateList', 'GetBasePath' , 'SearchInit' , 'PaginateInit', 'PlaybookRun', 'CustomInventoryAdd', + 'SchedulesList', 'CustomInventoryEdit', 'Rest' , 'ProcessErrors', 'CustomInventoryForm', 'GenerateForm', 'Prompt', + function(Wait, CreateDialog, CustomInventoryList, GenerateList, GetBasePath, SearchInit, PaginateInit, PlaybookRun, CustomInventoryAdd, + SchedulesList, CustomInventoryEdit, Rest, ProcessErrors, CustomInventoryForm, GenerateForm, Prompt) { 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'), + defaultUrl = GetBasePath('inventory_scripts'), list = CustomInventoryList, view = GenerateList, - scheduleUrl = GetBasePath('system_job_templates'), - form = CustomInventoryForm, - generator = GenerateForm, buttons = [ { "label": "Close", @@ -41,7 +37,7 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc }, "icon": "fa-times", "class": "btn btn-default", - "id": "configure-close-button" + "id": "script-close-button" } ]; @@ -51,13 +47,13 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc scope.removeOpenConfig(); } scope.removeOpenConfig = scope.$on('OpenConfig', function() { - $('#configure-tower-dialog').dialog('open'); - $('#configure-close-button').focus(); - $('#configure-close-button').blur(); + $('#custom-script-dialog').dialog('open'); + $('#script-close-button').focus(); + $('#script-close-button').blur(); }); view.inject( list, { - id : 'configure-jobs', + id : 'custom-script-dialog', mode: 'edit', scope: scope, breadCrumbs: false, @@ -67,7 +63,7 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc SearchInit({ scope: scope, - set: 'configure_jobs', + set: 'custum_inventories', list: list, url: defaultUrl }); @@ -79,20 +75,20 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc scope.search(list.iterator); - SchedulesControllerInit({ - scope: scope, - parent_scope: parent_scope, - // list: list - }); + // SchedulesControllerInit({ + // scope: scope, + // parent_scope: parent_scope, + // // list: list + // }); CreateDialog({ - id: 'configure-tower-dialog', + id: 'custom-script-dialog', title: 'Inventory Script', - target: 'configure-tower-dialog', + target: 'custom-script-dialog', scope: scope, buttons: buttons, - width: 670, + width: 700, height: 800, minWidth: 400, callback: callback, @@ -106,12 +102,12 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc // remove lingering popover
elements $(this).remove(); }); - $("#configure-jobs").show(); - $("#configure-schedules-form-container").hide(); - $('#configure-schedules-list').empty(); - $('#configure-schedules-form').empty(); - $('#configure-schedules-detail').empty(); - $('#configure-tower-dialog').hide(); + // $("#configure-jobs").show(); + // $("#configure-schedules-form-container").hide(); + // $('#configure-schedules-list').empty(); + // $('#configure-schedules-form').empty(); + // $('#configure-schedules-detail').empty(); + // $('#configure-tower-dialog').hide(); $(this).dialog('destroy'); scope.cancelConfigure(); }, @@ -122,7 +118,7 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc // Cancel scope.cancelConfigure = function () { try { - $('#configure-tower-dialog').dialog('close'); + $('#custom-script-dialog').dialog('close'); } catch(e) { //ignore @@ -138,342 +134,194 @@ angular.module('CreateCustomInventoryHelper', [ 'Utilities', 'RestServices', 'Sc } }; - scope.submitJob = function (id) { - Wait('start'); - scheduleUrl += id+'/launch/'; - CreateDialog({ - id: 'prompt-for-days' , - title: "Cleanup Job", + scope.editCustomInv = function(id){ + CustomInventoryEdit({ scope: scope, - width: 500, - height: 300, - minWidth: 200, - callback: 'PromptForDays', - buttons: [{ - "label": "Cancel", - "onClick": function() { - $(this).dialog('close'); - - }, - "icon": "fa-times", - "class": "btn btn-default", - "id": "prompt-for-days-button" - },{ - "label": "Launch", - "onClick": function() { - var extra_vars = {"days": $("#days_to_keep").val() }, - data = {}; - data.extra_vars = JSON.stringify(extra_vars); - - Rest.setUrl(scheduleUrl); - Rest.post(data) - .success(function() { - Wait('stop'); - $("#prompt-for-days").dialog("close"); - $("#configure-tower-dialog").dialog('close'); - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed updating job ' + scope.job_template_id + ' with variables. PUT returned: ' + status }); - }); - }, - "icon": "fa-rocket", - "class": "btn btn-primary", - "id": "prompt-for-days-button" - }] + id: id }); - - if (scope.removePromptForDays) { - scope.removePromptForDays(); - } - scope.removePromptForDays = scope.$on('PromptForDays', function() { - // $('#configure-tower-dialog').dialog('close'); - $('#prompt-for-days').show(); - $('#prompt-for-days').dialog('open'); - Wait('stop'); - }); - - - }; + scope.deleteCustomInv = function(id, name){ - scope.configureSchedule = function(id, name) { - Rest.setUrl(scheduleUrl+id+'/schedules/'); - Rest.get() - .success(function(data) { - if(data.count>0){ - scope.days=data.results[0].extra_data.days; - ConfigureTowerSchedule({ - scope: scope, - mode: 'edit', - url: scheduleUrl+id+'/schedules/' - }); - } else { - ConfigureTowerSchedule({ - scope: scope, - mode: 'add', - url: scheduleUrl+id+'/schedules/', - name: name - }); - } - }) - .error(function(data, status) { - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed updating job ' + scope.job_template_id + ' with variables. PUT returned: ' + status }); - }); + var action = function () { + $('#prompt-modal').modal('hide'); + Wait('start'); + var url = defaultUrl + id + '/'; + Rest.setUrl(url); + Rest.destroy() + .success(function () { + scope.search(list.iterator); + }) + .error(function (data, status) { + ProcessErrors(scope, data, status, null, { hdr: 'Error!', + msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); + }); + }; + Prompt({ + hdr: 'Delete', + body: "
Are you sure you want to delete " + name + "?
", + action: action + }); }; scope.addCustomInv = function(){ - // generator.inject(form, { mode: 'add', related: false, scope: $scope, }); - generator.inject(form, { id:'configure-jobs', mode: 'add' , scope:scope, related: false, breadCrumbs: false}); - generator.reset(); + CustomInventoryAdd({ + scope: scope + }); }; - parent_scope.refreshJobs = function(){ - scope.search(SchedulesList.iterator); - }; + }; }]) -.factory('ConfigureTowerSchedule', ['$compile','SchedulerInit', 'Rest', 'Wait', 'SetSchedulesInnerDialogSize', 'SchedulePost', 'ProcessErrors', 'GetBasePath', 'Empty', 'Prompt', -function($compile, SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize, SchedulePost, ProcessErrors, GetBasePath, Empty, Prompt) { +.factory('CustomInventoryAdd', ['$compile','SchedulerInit', 'Rest', 'Wait', 'CustomInventoryList', 'CustomInventoryForm', 'ProcessErrors', 'GetBasePath', 'Empty', 'GenerateForm', + 'SearchInit' , 'PaginateInit', 'GenerateList', +function($compile, SchedulerInit, Rest, Wait, CustomInventoryList, CustomInventoryForm, ProcessErrors, GetBasePath, Empty, GenerateForm, + SearchInit, PaginateInit, GenerateList) { return function(params) { - var parent_scope = params.scope, - mode = params.mode, // 'add' or 'edit' - url = params.url, - scope = parent_scope.$new(), - id = params.id || undefined, - name = params.name || undefined, - schedule = {}, - scheduler, - target, - showForm, - list, - detail, - restoreList, - container, - elem; + var scope = params.scope, + generator = GenerateForm, + form = CustomInventoryForm, + view = GenerateList, + list = CustomInventoryList, + url = GetBasePath('inventory_scripts'); + // base = $location.path().replace(/^\//, '').split('/')[0]; -// - - // Wait('start'); - // detail = $('#schedules-detail').hide(); - // list = $('#schedules-list'); - // target = $('#schedules-form'); - // container = $('#schedules-form-container'); - - Wait('start'); - // $('#configure-jobs').hide(); - detail = $('#configure-schedules-detail').hide(); - list = $('#configure-schedules-list'); - target = $('#configure-schedules-form'); - container = $('#configure-schedules-form-container'); - $("#configure-jobs").show(); - $("#configure-schedules-form-container").hide(); - scope.mode = mode; - // Clean up any lingering stuff - container.hide(); - target.empty(); - $('.tooltip').each(function () { - $(this).remove(); - }); - $('.popover').each(function () { - $(this).remove(); - }); - - elem = angular.element(document.getElementById('configure-schedules-form-container')); - $compile(elem)(scope); - - if (scope.removeScheduleReady) { - scope.removeScheduleReady(); - } - scope.removeScheduleReady = scope.$on('ScheduleReady', function() { - // Insert the scheduler widget into the hidden div - scheduler = SchedulerInit({ scope: scope, requireFutureStartTime: false }); - scheduler.inject('configure-schedules-form', false); - scheduler.injectDetail('configure-schedules-detail', false); - scheduler.clear(); - scope.formShowing = true; - scope.showRRuleDetail = false; - scope.schedulesTitle = (mode === 'edit') ? 'Edit Schedule' : 'Create Schedule'; + generator.inject(form, { id:'custom-script-dialog', mode: 'add' , scope:scope, related: false, breadCrumbs: false}); + generator.reset(); - // display the scheduler widget - showForm = function() { - $('#configure-jobs').show('slide', { direction: 'left' }, 500); - $('#configure-jobs').hide(); - Wait('stop'); - $('#configure-schedules-overlay').width($('#configure-schedules-tab') - .width()).height($('#configure-schedules-tab').height()).show(); - container.width($('#configure-schedules-tab').width() - 18); - SetSchedulesInnerDialogSize(); - container.show('slide', { direction: 'right' }, 300); - // scope.schedulerPurgeDays = (!Empty(scope.days)) ? Number(scope.days) : 30; - target.show(); - if(mode==="add"){ - scope.$apply(function(){ - scope.schedulerPurgeDays = 30; - scope.schedulerName = name+' Schedule'; + // Save + scope.formSave = function () { + generator.clearApiErrors(); + Wait('start'); + Rest.setUrl(url); + Rest.post({ name: scope.name, description: scope.description, script: scope.script }) + .success(function () { + view.inject( list, { + id : 'custom-script-dialog', + mode: 'edit', + scope: scope, + breadCrumbs: false, + activityStream: false, + showSearch: true }); - } - if (mode === 'edit') { - scope.$apply(function() { - scheduler.setRRule(schedule.rrule); - scheduler.setName(schedule.name); - scope.schedulerPurgeDays = (!Empty(scope.days)) ? Number(scope.days) : 30; + + SearchInit({ + scope: scope, + set: 'custum_inventories', + list: list, + url: url }); - } - }; - setTimeout(function() { showForm(); }, 1000); - }); - - restoreList = function() { - // $('#group-save-button').prop('disabled', false); - $('#configure-jobs').show('slide', { direction: 'right' }, 500); - // $('#configure-jobs').width($('#configure-jobs').width()).height($('#configure-jobs').height()).hide(); - // parent_scope.refreshSchedules(); - list.show('slide', { direction: 'right' }, 500); - $('#configure-schedules-overlay').width($('#configure-schedules-tab').width()).height($('#configure-schedules-tab').height()).hide(); - parent_scope.refreshSchedules(); - - }; - - scope.showScheduleDetail = function() { - if (scope.formShowing) { - if (scheduler.isValid()) { - detail.width($('#configure-schedules-form').width()).height($('#configure-schedules-form').height()); - target.hide(); - detail.show(); - scope.formShowing = false; - } - } - else { - detail.hide(); - target.show(); - scope.formShowing = true; - } - }; - - if (scope.removeScheduleSaved) { - scope.removeScheduleSaved(); - } - scope.removeScheduleSaved = scope.$on('ScheduleSaved', function() { - Wait('stop'); - container.hide('slide', { direction: 'left' }, 500, restoreList); - scope.$destroy(); - }); - - scope.saveScheduleForm = function() { - var extra_vars; - if (scheduler.isValid()) { - scope.schedulerIsValid = true; - url = (mode==="edit") ? GetBasePath('schedules')+id+'/' : url; - - extra_vars = { - "days" : scope.scheduler_form.schedulerPurgeDays.$viewValue - }; - schedule.extra_data = JSON.stringify(extra_vars); - - SchedulePost({ - scope: scope, - url: url, - scheduler: scheduler, - callback: 'ScheduleSaved', - mode: mode, - schedule: schedule - }); - } - else { - scope.schedulerIsValid = false; - } - }; - - scope.deleteSystemSchedule = function(){ - var hdr = 'Delete Schedule', - action = function () { - Wait('start'); - Rest.setUrl(schedule.url); - Rest.destroy() - .success(function () { - $('#prompt-modal').modal('hide'); - Wait('stop'); - // scope.$emit(callback, id); - scope.cancelScheduleForm(); - }) - .error(function (data, status) { - try { - $('#prompt-modal').modal('hide'); - } - catch(e) { - // ignore - } - ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + - ' failed. DELETE returned: ' + status }); + PaginateInit({ + scope: scope, + list: list, + url: url }); - }; - Prompt({ - hdr: hdr, - body: "
Are you sure you want to delete the " + scope.schedulerName + " schedule?
", - action: action, - backdrop: false - }); - // } - // } else { - // //a schedule doesn't exist - // $("#prompt_action_btn").text('OK'); - // $('#prompt_cancel_btn').hide(); - // var action2 = function(){ - // $('#prompt-modal').modal('hide'); - // $("#prompt_action_btn").text('Yes'); - // $('#prompt_cancel_btn').show(); - // }; - // Prompt({ - // hdr: "Delete", - // body: "
No schedule exists for that job.
", - // action: action2, - // backdrop: false - // }); - // } - // }) - // .error(function(data, status) { - // ProcessErrors(scope, data, status, null, { hdr: 'Error!', - // msg: 'Failed updating job ' + scope.job_template_id + ' with variables. PUT returned: ' + status }); - // }); - }; + scope.search(list.iterator); + Wait('stop'); + Wait('stop'); - scope.cancelScheduleForm = function() { - container.hide('slide', { direction: 'right' }, 500, restoreList); - scope.$destroy(); - }; - - if (mode === 'edit') { - // Get the existing record - Rest.setUrl(url); //GetBasePath('schedules')+id+'/'); - Rest.get() - .success(function(data) { - schedule = data.results[0]; - id = schedule.id; - if (!/DTSTART/.test(schedule.rrule)) { - schedule.rrule += ";DTSTART=" + schedule.dtstart.replace(/\.\d+Z$/,'Z'); - } - schedule.rrule = schedule.rrule.replace(/ RRULE:/,';'); - schedule.rrule = schedule.rrule.replace(/DTSTART:/,'DTSTART='); - scope.$emit('ScheduleReady'); }) - .error(function(data,status){ - ProcessErrors(scope, data, status, null, { hdr: 'Error!', - msg: 'Failed to get: ' + url + ' GET returned: ' + status }); + .error(function (data, status) { + ProcessErrors(scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to add new inventory script. Post returned status: ' + status }); }); - } - else { - scope.$emit('ScheduleReady'); - } + }; + + // Cancel + scope.formReset = function () { + generator.reset(); + }; + }; +}]) + +.factory('CustomInventoryEdit', ['$compile','CustomInventoryList', 'Rest', 'Wait', 'GenerateList', 'CustomInventoryForm', 'ProcessErrors', 'GetBasePath', 'Empty', 'GenerateForm', + 'SearchInit', 'PaginateInit', '$routeParams', +function($compile, CustomInventoryList, Rest, Wait, GenerateList, CustomInventoryForm, ProcessErrors, GetBasePath, Empty, GenerateForm, + SearchInit, PaginateInit, $routeParams) { + return function(params) { + var scope = params.scope, + id = params.id, + generator = GenerateForm, + form = CustomInventoryForm, + view = GenerateList, + list = CustomInventoryList, + master = {}, + url = GetBasePath('inventory_scripts'); + // base = $location.path().replace(/^\//, '').split('/')[0]; + + generator.inject(form, { + id:'custom-script-dialog', + mode: 'edit' , + scope:scope, + related: false, + breadCrumbs: false, + activityStream: false + }); + generator.reset(); + + // Retrieve detail record and prepopulate the form + Wait('start'); + Rest.setUrl(url + id+'/'); + Rest.get() + .success(function (data) { + var fld; + for (fld in form.fields) { + if (data[fld]) { + scope[fld] = data[fld]; + master[fld] = data[fld]; + } + } + Wait('stop'); + }) + .error(function (data, status) { + ProcessErrors(scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to retrieve inventory script: ' + $routeParams.id + '. GET status: ' + status }); + }); + + scope.formSave = function () { + generator.clearApiErrors(); + Wait('start'); + Rest.setUrl(url+ id+'/'); + Rest.put({ name: scope.name, description: scope.description, script: scope.script }) + .success(function () { + view.inject( list, { + id : 'custom-script-dialog', + mode: 'edit', + scope: scope, + breadCrumbs: false, + activityStream: false, + showSearch: true + }); + + SearchInit({ + scope: scope, + set: 'custum_inventories', + list: list, + url: url + }); + PaginateInit({ + scope: scope, + list: list, + url: url + }); + + scope.search(list.iterator); + Wait('stop'); + + }) + .error(function (data, status) { + ProcessErrors(scope, data, status, form, { hdr: 'Error!', + msg: 'Failed to add new inventory script. Post returned status: ' + status }); + }); + }; + + scope.formReset = function () { + generator.reset(); + }; }; }]); diff --git a/awx/ui/static/js/lists/CustomInventory.js b/awx/ui/static/js/lists/CustomInventory.js index e6d0d61cdc..037ae99dfc 100644 --- a/awx/ui/static/js/lists/CustomInventory.js +++ b/awx/ui/static/js/lists/CustomInventory.js @@ -34,14 +34,6 @@ angular.module('CustomInventoryListDefinition', []) 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: { @@ -50,16 +42,11 @@ angular.module('CustomInventoryListDefinition', []) ngClick: 'addCustomInv()', awToolTip: 'Create a new credential' }, - stream: { - ngClick: "showActivity()", - awToolTip: "View Activity Stream", - mode: 'edit' - } }, fieldActions: { edit: { - ngClick: "editCredential(credential.id)", + ngClick: "editCustomInv(custom_inventory.id)", icon: 'fa-edit', label: 'Edit', "class": 'btn-sm', @@ -68,7 +55,7 @@ angular.module('CustomInventoryListDefinition', []) }, "delete": { - ngClick: "deleteCredential(credential.id, credential.name)", + ngClick: "deleteCustomInv(custom_inventory.id, custom_inventory.name)", icon: 'fa-trash', label: 'Delete', "class": 'btn-sm', diff --git a/awx/ui/static/partials/configure_tower.html b/awx/ui/static/partials/configure_tower.html new file mode 100644 index 0000000000..7b4ca42c0c --- /dev/null +++ b/awx/ui/static/partials/configure_tower.html @@ -0,0 +1,30 @@ +
+
+
+
+
+
+

+ +
+
+
+
+
+
+ View Details + Back to options + + + +
+
+
+ + \ No newline at end of file diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 66dbd1b8a4..d2adf13967 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -396,38 +396,10 @@ - - - + + + +