You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.7 KiB
91 lines
2.7 KiB
import CRUDBase from '../CRUDBase.js'
|
|
|
|
class MachineGroupResource extends CRUDBase {
|
|
constructor() {
|
|
super()
|
|
|
|
this.endpoint = '/api/v1/ldap/machine-groups'
|
|
this.required_fields = ['name']
|
|
this.permission_base = 'v1:ldap:machine_groups'
|
|
|
|
this.item = 'Computer Group'
|
|
this.plural = 'Computer Groups'
|
|
|
|
this.listing_definition = {
|
|
columns: [
|
|
{
|
|
name: 'Group Name',
|
|
field: 'name',
|
|
},
|
|
{
|
|
name: '# Computers',
|
|
field: 'machine_ids',
|
|
renderer: machine_ids => Array.isArray(machine_ids) ? machine_ids.length : 0,
|
|
},
|
|
{
|
|
name: 'Description',
|
|
field: 'description',
|
|
},
|
|
],
|
|
actions: [
|
|
{
|
|
type: 'resource',
|
|
position: 'main',
|
|
action: 'insert',
|
|
text: 'Create New',
|
|
color: 'success',
|
|
},
|
|
{
|
|
type: 'resource',
|
|
position: 'row',
|
|
action: 'update',
|
|
icon: 'fa fa-edit',
|
|
color: 'primary',
|
|
},
|
|
{
|
|
type: 'resource',
|
|
position: 'row',
|
|
action: 'delete',
|
|
icon: 'fa fa-times',
|
|
color: 'danger',
|
|
confirm: true,
|
|
},
|
|
],
|
|
}
|
|
|
|
this.form_definition = {
|
|
// back_action: {
|
|
// text: 'Back',
|
|
// action: 'back',
|
|
// },
|
|
fields: [
|
|
{
|
|
name: 'Group Name',
|
|
field: 'name',
|
|
placeholder: 'DNS Servers',
|
|
required: true,
|
|
type: 'text',
|
|
},
|
|
{
|
|
name: 'Description',
|
|
field: 'description',
|
|
type: 'textarea',
|
|
},
|
|
{
|
|
name: 'Computers',
|
|
field: 'machine_ids',
|
|
type: 'select.dynamic.multiple',
|
|
options: {
|
|
resource: 'ldap/Machine',
|
|
display: machine => `${machine.name}${machine.host_name ? ' (' + machine.host_name + ')' : ''}`,
|
|
value: 'id',
|
|
},
|
|
},
|
|
],
|
|
}
|
|
}
|
|
}
|
|
|
|
const ldap_machinegroup = new MachineGroupResource()
|
|
export { ldap_machinegroup }
|