mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 20:50:06 -03:30
Inventory group add/delete working
This commit is contained in:
64
lib/static/web/app/js/forms/Groups.js
Normal file
64
lib/static/web/app/js/forms/Groups.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*********************************************
|
||||
* Copyright (c) 2013 AnsibleWorks, Inc.
|
||||
*
|
||||
* Groups.js
|
||||
* Form definition for Group model
|
||||
*
|
||||
*
|
||||
*/
|
||||
angular.module('GroupFormDefinition', [])
|
||||
.value(
|
||||
'GroupForm', {
|
||||
|
||||
addTitle: 'Create Group', //Legend in add mode
|
||||
editTitle: '{{ name }}', //Legend in edit mode
|
||||
name: 'group', //Form name attribute
|
||||
well: true, //Wrap the form with TB well
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
label: 'Name',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true
|
||||
},
|
||||
description: {
|
||||
label: 'Description',
|
||||
type: 'text',
|
||||
addRequired: true,
|
||||
editRequired: true
|
||||
},
|
||||
inventory: {
|
||||
label: 'Inventory',
|
||||
type: 'lookup',
|
||||
sourceModel: 'inventory',
|
||||
sourceField: 'name',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngClick: 'lookUpInventory()'
|
||||
}
|
||||
},
|
||||
|
||||
buttons: { //for now always generates <button> tags
|
||||
save: {
|
||||
label: 'Save',
|
||||
icon: 'icon-ok',
|
||||
class: 'btn btn-success',
|
||||
ngClick: 'formSave()', //$scope.function to call on click, optional
|
||||
ngDisabled: true //Disable when $pristine or $invalid, optional
|
||||
},
|
||||
reset: {
|
||||
ngClick: 'formReset()',
|
||||
label: 'Reset',
|
||||
icon: 'icon-remove',
|
||||
class: 'btn',
|
||||
ngDisabled: true //Disabled when $pristine
|
||||
}
|
||||
},
|
||||
|
||||
related: { //related colletions (and maybe items?)
|
||||
|
||||
}
|
||||
|
||||
}); //UserForm
|
||||
|
||||
@@ -68,7 +68,8 @@ angular.module('InventoryFormDefinition', [])
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "add('hosts')",
|
||||
icon: 'icon-plus'
|
||||
icon: 'icon-plus',
|
||||
awToolTip: 'Create a new host'
|
||||
},
|
||||
},
|
||||
|
||||
@@ -85,11 +86,50 @@ angular.module('InventoryFormDefinition', [])
|
||||
fieldActions: {
|
||||
edit: {
|
||||
ngClick: "edit('hosts', \{\{ host.id \}\}, '\{\{ host.name \}\}')",
|
||||
icon: 'icon-edit'
|
||||
icon: 'icon-edit',
|
||||
awToolTip: 'Edit host'
|
||||
},
|
||||
delete: {
|
||||
ngClick: "delete('hosts', \{\{ host.id \}\}, '\{\{ host.name \}\}', 'hosts')",
|
||||
icon: 'icon-remove',
|
||||
class: 'btn-danger',
|
||||
awToolTip: 'Create a new host'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
groups: {
|
||||
type: 'collection',
|
||||
title: 'Groups',
|
||||
iterator: 'group',
|
||||
open: false,
|
||||
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "add('groups')",
|
||||
icon: 'icon-plus',
|
||||
awToolTip: 'Create a new group'
|
||||
},
|
||||
},
|
||||
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
label: 'Name'
|
||||
},
|
||||
description: {
|
||||
label: 'Description'
|
||||
}
|
||||
},
|
||||
|
||||
fieldActions: {
|
||||
edit: {
|
||||
ngClick: "edit('groups', \{\{ group.id \}\}, '\{\{ group.name \}\}')",
|
||||
icon: 'icon-edit'
|
||||
},
|
||||
delete: {
|
||||
ngClick: "delete('groups', \{\{ group.id \}\}, '\{\{ group.name \}\}', 'groups')",
|
||||
icon: 'icon-remove',
|
||||
class: 'btn-danger'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user