bemade-addons/unifi_integration/views/udm_configuration_views.xml
Benoît Vézina b2183d8601 fml unifi
2025-03-11 16:19:49 -04:00

167 lines
8.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Configuration List View -->
<record id="view_udm_configuration_list" model="ir.ui.view">
<field name="name">udm.configuration.list</field>
<field name="model">udm.configuration</field>
<field name="type">list</field>
<field name="arch" type="xml">
<list string="UDM Pro Configurations">
<field name="name"/>
<field name="timestamp"/>
<field name="system_info_id" optional="show"/>
<field name="network_count" optional="show"/>
<field name="device_count" optional="show"/>
<field name="user_count" optional="show"/>
<field name="firewall_rule_count" optional="show"/>
</list>
</field>
</record>
<!-- Configuration Form View -->
<record id="view_udm_configuration_form" model="ir.ui.view">
<field name="name">udm.configuration.form</field>
<field name="model">udm.configuration</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="UDM Pro Configuration">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_networks" type="object" class="oe_stat_button" icon="fa-diagram-project">
<field name="network_count" widget="statinfo" string="Networks"/>
</button>
<button name="action_view_devices" type="object" class="oe_stat_button" icon="fa-desktop">
<field name="device_count" widget="statinfo" string="Devices"/>
</button>
<button name="action_view_users" type="object" class="oe_stat_button" icon="fa-users">
<field name="user_count" widget="statinfo" string="Users"/>
</button>
<button name="action_view_firewall_rules" type="object" class="oe_stat_button" icon="fa-shield-halved">
<field name="firewall_rule_count" widget="statinfo" string="Firewall Rules"/>
</button>
</div>
<header>
<button name="action_import_configuration" string="Import Configuration" type="object" class="oe_highlight" invisible="not host"/>
</header>
<div class="oe_title">
<h1>
<field name="name"/>
</h1>
</div>
<group>
<group string="Connection Settings">
<field name="host" required="1"/>
<field name="port" required="1"/>
<field name="username" required="1"/>
<field name="password" password="True" required="1"/>
<field name="mfa_token" placeholder="Code reçu par email"/>
<field name="active"/>
</group>
<group string="Configuration Info">
<field name="timestamp"/>
<field name="system_info_id"/>
<field name="settings_id"/>
</group>
</group>
<notebook>
<page string="Networks" name="networks">
<field name="network_ids" nolabel="1">
<list>
<field name="name"/>
<field name="purpose"/>
<field name="subnet"/>
<field name="vlan_id"/>
<field name="dhcp_enabled"/>
</list>
</field>
</page>
<page string="VLANs" name="vlans">
<field name="vlan_ids" nolabel="1">
<list>
<field name="vlan_id"/>
<field name="name"/>
<field name="enabled"/>
</list>
</field>
</page>
<page string="Devices" name="devices">
<field name="device_ids" nolabel="1">
<list>
<field name="name"/>
<field name="mac"/>
<field name="ip"/>
<field name="device_type"/>
<field name="model" optional="show"/>
<field name="last_seen"/>
<field name="status" widget="badge" decoration-success="status == 'online'" decoration-danger="status == 'offline'" decoration-info="status == 'unknown'"/>
</list>
</field>
</page>
<page string="Users" name="users">
<field name="user_ids" nolabel="1">
<list>
<field name="name"/>
<field name="email"/>
<field name="role"/>
<field name="enabled"/>
<field name="is_admin"/>
</list>
</field>
</page>
<page string="Firewall Rules" name="firewall_rules">
<field name="firewall_rule_ids" nolabel="1">
<list>
<field name="name"/>
<field name="enabled"/>
<field name="action"/>
<field name="protocol"/>
<field name="src_address"/>
<field name="dst_address"/>
<field name="rule_summary" optional="show"/>
</list>
</field>
</page>
<page string="Raw Data" name="raw_data">
<field name="raw_data" widget="ace" options="{'mode': 'json'}" help="Données JSON brutes de la configuration"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- Configuration Search View -->
<record id="view_udm_configuration_search" model="ir.ui.view">
<field name="name">udm.configuration.search</field>
<field name="model">udm.configuration</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search UDM Pro Configurations">
<field name="name"/>
<field name="system_info_id"/>
<field name="timestamp"/>
<filter string="Last 7 Days" name="last_7_days" domain="[('timestamp','>=', (context_today() - relativedelta(days=7)))]"/>
<filter string="Last 30 Days" name="last_30_days" domain="[('timestamp','>=', (context_today() - relativedelta(days=30)))]"/>
<group expand="0" string="Group By">
<filter string="System Info" name="system_info" context="{'group_by': 'system_info_id'}"/>
<filter string="Month" name="month" context="{'group_by': 'timestamp:month'}"/>
</group>
</search>
</field>
</record>
<!-- Configuration Action Window -->
<record id="action_udm_configuration" model="ir.actions.act_window">
<field name="name">UDM Pro Configurations</field>
<field name="res_model">udm.configuration</field>
<field name="view_mode">list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No configurations found
</p>
<p>
Configurations are automatically created when you refresh your UDM Pro settings.
</p>
</field>
</record>
</odoo>