bemade-addons/odoo_proxmox_manager/views/proxmox_vm_views.xml
2025-01-27 07:17:59 -05:00

107 lines
4.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- VM Tree View -->
<record id="view_proxmox_vm_tree" model="ir.ui.view">
<field name="name">proxmox.vm.tree</field>
<field name="model">proxmox.vm</field>
<field name="arch" type="xml">
<tree string="Virtual Machines" create="False">
<field name="name"/>
<field name="vmid"/>
<field name="server_id"/>
<field name="status"/>
<field name="memory"/>
<field name="cpus"/>
<field name="disk_size"/>
<field name="ip_address"/>
</tree>
</field>
</record>
<!-- VM Form View -->
<record id="view_proxmox_vm_form" model="ir.ui.view">
<field name="name">proxmox.vm.form</field>
<field name="model">proxmox.vm</field>
<field name="arch" type="xml">
<form string="Virtual Machine">
<header>
<button name="action_start" string="Start" type="object"
invisible="status == 'running'"
class="oe_highlight"/>
<button name="action_stop" string="Stop" type="object"
invisible="status == 'stopped'"
class="btn-danger"/>
<button name="action_restart" string="Restart" type="object"
invisible="status == 'stopped'"
class="btn-warning"/>
<button name="action_suspend" string="Suspend" type="object"
invisible="status in ('suspended', 'stopped')"
class="btn-info"/>
<button name="action_resume" string="Resume" type="object"
invisible="status != 'suspended'"
class="oe_highlight"/>
<field name="status" widget="statusbar"/>
</header>
<sheet>
<div class="oe_title">
<h1>
<field name="name" placeholder="VM Name"/>
</h1>
</div>
<group>
<group>
<field name="vmid"/>
<field name="server_id"/>
<field name="ip_address"/>
</group>
<group>
<field name="memory"/>
<field name="cpus"/>
<field name="disk_size"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!-- VM Search View -->
<record id="view_proxmox_vm_search" model="ir.ui.view">
<field name="name">proxmox.vm.search</field>
<field name="model">proxmox.vm</field>
<field name="arch" type="xml">
<search string="Search Virtual Machines">
<field name="name"/>
<field name="vmid"/>
<field name="server_id"/>
<field name="ip_address"/>
<filter string="Running" name="running" domain="[('status', '=', 'running')]"/>
<filter string="Stopped" name="stopped" domain="[('status', '=', 'stopped')]"/>
<filter string="Suspended" name="suspended" domain="[('status', '=', 'suspended')]"/>
<group expand="0" string="Group By">
<filter string="Server" name="server" context="{'group_by': 'server_id'}"/>
<filter string="Status" name="status" context="{'group_by': 'status'}"/>
</group>
</search>
</field>
</record>
<!-- VM Action Window -->
<record id="action_proxmox_vm" model="ir.actions.act_window">
<field name="name">Virtual Machines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">proxmox.vm</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_proxmox_vm_search"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No virtual machines found!
</p>
<p>
Virtual machines will be synchronized from your Proxmox servers.
</p>
</field>
</record>
</data>
</odoo>