Storable inventory script

Added the list and form for adding/editing/deleting custom inventory scripts.
This commit is contained in:
Jared Tabor
2014-11-19 16:59:59 -05:00
parent 3d98fe02b6
commit 0ffb979e8e
5 changed files with 229 additions and 513 deletions

View File

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