Adding files for custom inventory script modal

I'm adding the initial files and references in app.js and index.html for the custom inventory script modal window
This commit is contained in:
Jared Tabor
2014-11-18 16:49:48 -05:00
parent d72d95b282
commit 27db190bed
6 changed files with 810 additions and 6 deletions

View File

@@ -0,0 +1,187 @@
/*********************************************
* Copyright (c) 2014 AnsibleWorks, Inc.
*
* Organization.js
* Form definition for Organization model
*
*
*/
/**
* @ngdoc function
* @name forms.function:Organizations
* @description This form is for adding/editing an organization
*/
angular.module('CustomInventoryFormDefinition', [])
.value('CustomInventoryForm', {
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'
}
},
fields: {
name: {
label: 'Name',
type: 'text',
addRequired: true,
editRequired: true,
capitalize: false
},
description: {
label: 'Description',
type: 'text',
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",
addRequired: true,
editRequired: true,
awDropFile: true,
'class': 'ssh-key-field',
rows: 10,
awPopOver: "<p>Drag and drop your custom inventory script file here or create one in the field to import your custom inventory. </p>",
// awPopOverWatch: "",
dataTitle: 'Custom Script',
dataPlacement: 'right',
dataContainer: "body"
},
},
buttons: { //for now always generates <button> tags
save: {
ngClick: 'formSave()', //$scope.function to call on click, optional
ngDisabled: true //Disable when $pristine or $invalid, optional
},
reset: {
ngClick: 'formReset()',
ngDisabled: true //Disabled when $pristine
}
},
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

View File

@@ -63,6 +63,50 @@ angular.module('SourceFormDefinition', [])
"</p>",
dataContainer: 'body'
},
instance_filters: {
label: 'Instance Filters',
type: 'text',
ngShow: "source && source.value == 'ec2'",
addRequired: false,
editRequired: false,
dataTitle: 'Instance Filters',
dataPlacement: 'right',
awPopOver: "<p>Open the <a href=http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html target='_blank'>documentation</a> for a complete list of filter options.</p>",
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: "<p>FIXME: Create these automatic groups by default.</p>",
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: "<p>FIXME: When grouping by tags, specify which tag keys become groups.</p>",
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')",