Add ability to manage computers and computer groups from web interface
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -60,6 +60,18 @@ export default class SideBarComponent extends Component {
|
||||
type: 'resource',
|
||||
resource: 'iam/Policy',
|
||||
},
|
||||
{
|
||||
text: 'Computers',
|
||||
action: 'list',
|
||||
type: 'resource',
|
||||
resource: 'ldap/Machine',
|
||||
},
|
||||
{
|
||||
text: 'Computer Groups',
|
||||
action: 'list',
|
||||
type: 'resource',
|
||||
resource: 'ldap/MachineGroup',
|
||||
},
|
||||
{
|
||||
text: 'LDAP Clients',
|
||||
action: 'list',
|
||||
|
||||
92
app/assets/app/resource/ldap/Machine.resource.js
Normal file
92
app/assets/app/resource/ldap/Machine.resource.js
Normal file
@@ -0,0 +1,92 @@
|
||||
import CRUDBase from '../CRUDBase.js'
|
||||
|
||||
class MachineResource extends CRUDBase {
|
||||
constructor() {
|
||||
super()
|
||||
|
||||
this.endpoint = '/api/v1/ldap/machines'
|
||||
this.required_fields = ['name', 'description']
|
||||
this.permission_base = 'v1:ldap:machines'
|
||||
|
||||
this.item = 'Computer'
|
||||
this.plural = 'Computers'
|
||||
|
||||
this.listing_definition = {
|
||||
columns: [
|
||||
{
|
||||
name: 'Machine Name',
|
||||
field: 'name',
|
||||
},
|
||||
{
|
||||
name: 'Host Name',
|
||||
field: 'host_name',
|
||||
},
|
||||
{
|
||||
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: 'Machine Name',
|
||||
field: 'name',
|
||||
placeholder: 'DNS01',
|
||||
required: true,
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'Description',
|
||||
field: 'description',
|
||||
required: true,
|
||||
type: 'textarea',
|
||||
},
|
||||
{
|
||||
name: 'Location',
|
||||
field: 'location',
|
||||
type: 'text',
|
||||
placeholder: 'Server room 1',
|
||||
},
|
||||
{
|
||||
name: 'Host Name (FQDN)',
|
||||
field: 'host_name',
|
||||
type: 'text',
|
||||
placeholder: 'dns01.my.domain',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ldap_machine = new MachineResource()
|
||||
export { ldap_machine }
|
||||
90
app/assets/app/resource/ldap/MachineGroup.resource.js
Normal file
90
app/assets/app/resource/ldap/MachineGroup.resource.js
Normal file
@@ -0,0 +1,90 @@
|
||||
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 }
|
||||
Reference in New Issue
Block a user