2025-03-10 10:09:39 -04:00
<?xml version="1.0" encoding="utf-8"?>
<odoo >
2025-03-11 16:19:49 -04:00
<!-- Import Site Action -->
<record id= "action_import_udm_site" model= "ir.actions.act_window" >
<field name= "name" > Import UDM Pro Site</field>
<field name= "res_model" > udm.site.import.wizard</field>
<field name= "view_mode" > form</field>
<field name= "target" > new</field>
</record>
<!-- Import Site Wizard Form View -->
<record id= "view_udm_site_import_wizard_form" model= "ir.ui.view" >
<field name= "name" > udm.site.import.wizard.form</field>
<field name= "model" > udm.site.import.wizard</field>
<field name= "arch" type= "xml" >
<form string= "Import UDM Pro Site" >
<sheet >
<group >
<group >
<field name= "name" placeholder= "e.g., Bureau Principal" />
<field name= "site_id" />
</group>
<group >
<field name= "host" placeholder= "e.g., 192.168.1.1" />
<field name= "port" />
</group>
<group >
<field name= "username" placeholder= "Admin username" />
<field name= "password" password= "True" placeholder= "Admin password" />
</group>
</group>
</sheet>
<footer >
<button name= "action_import_site" string= "Import" type= "object" class= "btn-primary" />
<button string= "Cancel" class= "btn-secondary" special= "cancel" />
</footer>
</form>
</field>
</record>
<!-- UDM Site List View -->
<record id= "view_udm_site_list" model= "ir.ui.view" >
<field name= "name" > udm.site.list</field>
2025-03-10 10:09:39 -04:00
<field name= "model" > udm.site</field>
2025-03-11 16:19:49 -04:00
<field name= "type" > list</field>
2025-03-10 10:09:39 -04:00
<field name= "arch" type= "xml" >
2025-03-11 16:19:49 -04:00
<list string= "UDM Pro Sites" >
<header >
<button name= "%(action_import_udm_site)d" string= "Import UDM Pro Site" type= "action" class= "btn-primary" />
</header>
2025-03-10 10:09:39 -04:00
<field name= "name" />
<field name= "site_id" />
<field name= "active" />
2025-03-11 16:19:49 -04:00
<field name= "create_date" optional= "show" />
</list>
2025-03-10 10:09:39 -04:00
</field>
</record>
<!-- UDM Site Form View -->
<record id= "view_udm_site_form" model= "ir.ui.view" >
<field name= "name" > udm.site.form</field>
<field name= "model" > udm.site</field>
2025-03-11 16:19:49 -04:00
<field name= "type" > form</field>
2025-03-10 10:09:39 -04:00
<field name= "arch" type= "xml" >
<form string= "UDM Pro Site" >
<header >
<button name= "action_refresh_metrics" string= "Refresh Metrics" type= "object" class= "btn-primary" />
<button name= "action_view_dashboard" string= "View Dashboard" type= "object" class= "btn-secondary" />
</header>
<sheet >
<div class= "oe_button_box" name= "button_box" >
<button name= "action_view_configurations" type= "object" class= "oe_stat_button" icon= "fa-cog" >
2025-03-11 16:19:49 -04:00
<div class= "o_stat_info" >
<span class= "o_stat_text" > Configurations</span>
</div>
2025-03-10 10:09:39 -04:00
</button>
</div>
<div class= "oe_title" >
<h1 >
<field name= "name" />
</h1>
</div>
<group >
<group >
<field name= "site_id" />
<field name= "active" />
</group>
<group >
<field name= "create_date" readonly= "1" />
2025-03-11 16:19:49 -04:00
2025-03-10 10:09:39 -04:00
</group>
</group>
<notebook >
<page string= "Configurations" name= "configurations" >
<field name= "configuration_ids" >
<tree >
<field name= "name" />
<field name= "timestamp" />
<field name= "active" />
</tree>
</field>
</page>
<page string= "Dashboard Metrics" name= "dashboard_metrics" >
<field name= "dashboard_ids" >
<tree >
2025-03-11 16:19:49 -04:00
<field name= "metric_type" />
<field name= "formatted_value" />
2025-03-10 10:09:39 -04:00
<field name= "status" />
<field name= "last_update" />
</tree>
</field>
</page>
2025-03-11 16:19:49 -04:00
<page string= "Statistics" name= "statistics" >
<field name= "statistic_ids" >
<tree >
<field name= "date" />
<field name= "stat_type" />
<field name= "value" />
<field name= "unit" />
<field name= "is_aggregate" />
<field name= "aggregate_type" invisible= "not is_aggregate" />
</tree>
</field>
</page>
2025-03-10 10:09:39 -04:00
</notebook>
</sheet>
</form>
</field>
</record>
<!-- UDM Site Dashboard View -->
<record id= "view_udm_site_dashboard" model= "ir.ui.view" >
<field name= "name" > udm.site.dashboard</field>
<field name= "model" > udm.site</field>
<field name= "mode" > primary</field>
<field name= "arch" type= "xml" >
2025-03-11 16:19:49 -04:00
<form string= "UDM Pro Dashboard" create= "false" edit= "false" delete= "false" >
2025-03-10 10:09:39 -04:00
<div class= "d-flex flex-column" >
<!-- Dashboard Header -->
<div class= "d-flex justify-content-between align-items-center pb-2 mb-3 border-bottom" >
<div class= "d-flex flex-column" >
<h2 > <field name= "name" /> Dashboard</h2>
<div class= "text-muted" >
Site ID: <field name= "site_id" />
</div>
</div>
<div >
<button name= "action_refresh_metrics" string= "Refresh Metrics" type= "object" class= "btn btn-primary" />
</div>
</div>
<!-- Dashboard Metrics -->
<div class= "row mb-4" >
<!-- CPU Usage -->
<div class= "col-md-6 col-lg-4 mb-3" >
<div class= "card h-100" >
<div class= "card-header d-flex justify-content-between align-items-center bg-light" >
<h6 class= "m-0" > CPU Usage</h6>
<i class= "fa fa-microchip" > </i>
</div>
<div class= "card-body d-flex flex-column align-items-center justify-content-center text-center" >
2025-03-11 16:19:49 -04:00
<t t-set= "cpu_metric" t-value= "dashboard_ids.filtered(lambda m: m.metric_type == 'cpu_usage')" />
<h3 class= "mb-0" t-att-class= "cpu_metric and cpu_metric.status == 'warning' and 'text-warning' or cpu_metric.status == 'critical' and 'text-danger' or ''" >
<t t-esc= "cpu_metric and cpu_metric.formatted_value or '0%'" />
2025-03-10 10:09:39 -04:00
</h3>
<div class= "progress w-75 mt-2" >
<div class= "progress-bar" role= "progressbar"
2025-03-11 16:19:49 -04:00
t-att-style="'width: ' + (cpu_metric and cpu_metric.current_value or '0') + '%;'"
t-att-class="cpu_metric and cpu_metric.status == 'warning' and 'bg-warning' or cpu_metric.status == 'critical' and 'bg-danger' or 'bg-success'"
t-att-aria-valuenow="cpu_metric and cpu_metric.current_value or 0" aria-valuemin="0" aria-valuemax="100">
2025-03-10 10:09:39 -04:00
</div>
</div>
</div>
</div>
</div>
<!-- Memory Usage -->
<div class= "col-md-6 col-lg-4 mb-3" >
<div class= "card h-100" >
<div class= "card-header d-flex justify-content-between align-items-center bg-light" >
<h6 class= "m-0" > Memory Usage</h6>
<i class= "fa fa-memory" > </i>
</div>
<div class= "card-body d-flex flex-column align-items-center justify-content-center text-center" >
2025-03-11 16:19:49 -04:00
<t t-set= "memory_metric" t-value= "dashboard_ids.filtered(lambda m: m.metric_type == 'memory_usage')" />
<h3 class= "mb-0" t-att-class= "memory_metric and memory_metric.status == 'warning' and 'text-warning' or memory_metric.status == 'critical' and 'text-danger' or ''" >
<t t-esc= "memory_metric and memory_metric.formatted_value or '0%'" />
2025-03-10 10:09:39 -04:00
</h3>
<div class= "progress w-75 mt-2" >
<div class= "progress-bar" role= "progressbar"
2025-03-11 16:19:49 -04:00
t-att-style="'width: ' + (memory_metric and memory_metric.current_value or '0') + '%;'"
t-att-class="memory_metric and memory_metric.status == 'warning' and 'bg-warning' or memory_metric.status == 'critical' and 'bg-danger' or 'bg-success'"
t-att-aria-valuenow="memory_metric and memory_metric.current_value or 0" aria-valuemin="0" aria-valuemax="100">
2025-03-10 10:09:39 -04:00
</div>
</div>
</div>
</div>
</div>
<!-- Network Bandwidth -->
<div class= "col-md-6 col-lg-4 mb-3" >
<div class= "card h-100" >
<div class= "card-header d-flex justify-content-between align-items-center bg-light" >
<h6 class= "m-0" > Network Bandwidth</h6>
<i class= "fa fa-network-wired" > </i>
</div>
<div class= "card-body d-flex flex-column align-items-center justify-content-center text-center" >
2025-03-11 16:19:49 -04:00
<t t-set= "bandwidth_metric" t-value= "dashboard_ids.filtered(lambda m: m.metric_type == 'bandwidth_usage')" />
<h3 class= "mb-0" t-att-class= "bandwidth_metric and bandwidth_metric.status == 'warning' and 'text-warning' or bandwidth_metric.status == 'critical' and 'text-danger' or ''" >
<t t-esc= "bandwidth_metric and bandwidth_metric.formatted_value or '0 Mbps'" />
2025-03-10 10:09:39 -04:00
</h3>
<div class= "text-muted" > Current Network Load</div>
</div>
</div>
</div>
<!-- WAN Status -->
<div class= "col-md-6 col-lg-4 mb-3" >
<div class= "card h-100" >
<div class= "card-header d-flex justify-content-between align-items-center bg-light" >
<h6 class= "m-0" > WAN Status</h6>
<i class= "fa fa-globe" > </i>
</div>
<div class= "card-body d-flex flex-column align-items-center justify-content-center text-center" >
<t t-set= "wan_metric" t-value= "dashboard_ids.filtered(lambda m: m.name == 'wan_status')" />
<t t-if= "wan_metric and wan_metric.value == 'connected'" >
<i class= "fa fa-check-circle fa-3x text-success mb-2" > </i>
<div > Connected</div>
<div class= "text-muted small" > Internet is available</div>
</t>
<t t-else= "" >
<i class= "fa fa-times-circle fa-3x text-danger mb-2" > </i>
<div > Disconnected</div>
<div class= "text-muted small" > Internet is unavailable</div>
</t>
</div>
</div>
</div>
<!-- Device Status -->
<div class= "col-md-6 col-lg-4 mb-3" >
<div class= "card h-100" >
<div class= "card-header d-flex justify-content-between align-items-center bg-light" >
<h6 class= "m-0" > Device Status</h6>
<i class= "fa fa-wifi" > </i>
</div>
<div class= "card-body d-flex flex-column align-items-center justify-content-center text-center" >
<t t-set= "device_metric" t-value= "dashboard_ids.filtered(lambda m: m.name == 'device_status')" />
<h3 class= "mb-0" >
<t t-esc= "device_metric and device_metric.value or '0'" />
<small > online</small>
</h3>
<div class= "text-muted" > Out of <t t-esc= "device_metric and device_metric.description or '0'" /> devices</div>
</div>
</div>
</div>
<!-- Security Threats -->
<div class= "col-md-6 col-lg-4 mb-3" >
<div class= "card h-100" >
<div class= "card-header d-flex justify-content-between align-items-center bg-light" >
<h6 class= "m-0" > Security Threats</h6>
<i class= "fa fa-shield" > </i>
</div>
<div class= "card-body d-flex flex-column align-items-center justify-content-center text-center" >
<t t-set= "threat_metric" t-value= "dashboard_ids.filtered(lambda m: m.name == 'security_threats')" />
<h3 class= "mb-0" t-att-class= "threat_metric and int(threat_metric.value) > 0 and 'text-danger' or 'text-success'" >
<t t-esc= "threat_metric and threat_metric.value or '0'" />
</h3>
<div t-att-class= "threat_metric and int(threat_metric.value) > 0 and 'text-danger' or 'text-success'" >
<t t-if= "threat_metric and int(threat_metric.value) > 0" > Threats Detected</t>
<t t-else= "" > No Threats</t>
</div>
</div>
</div>
</div>
</div>
<!-- Last Update Info -->
<div class= "text-muted text-end" > Last updated:
<t t-esc= "dashboard_ids and dashboard_ids[0].last_update or ''" />
</div>
</div>
</dashboard>
</field>
</record>
<!-- UDM Site Search View -->
<record id= "view_udm_site_search" model= "ir.ui.view" >
<field name= "name" > udm.site.search</field>
2025-03-11 16:19:49 -04:00
<field name= "type" > search</field>
2025-03-10 10:09:39 -04:00
<field name= "model" > udm.site</field>
<field name= "arch" type= "xml" >
<search string= "Search UDM Pro Sites" >
<field name= "name" />
<field name= "site_id" />
<filter string= "Active" name= "active" domain= "[('active', '=', True)]" />
<filter string= "Inactive" name= "inactive" domain= "[('active', '=', False)]" />
</search>
</field>
</record>
<!-- UDM Site Action -->
<record id= "action_udm_site" model= "ir.actions.act_window" >
<field name= "name" > UDM Sites</field>
<field name= "res_model" > udm.site</field>
<field name= "view_mode" > tree,form,dashboard</field>
<field name= "context" > {'search_default_active': 1}</field>
<field name= "help" type= "html" >
<p class= "o_view_nocontent_smiling_face" >
Create a new UDM Pro Site
</p>
<p >
Create sites to organize your UDM Pro configurations by location or purpose.
</p>
</field>
</record>
<!-- Dashboard Action -->
<record id= "action_udm_dashboard" model= "ir.actions.act_window" >
<field name= "name" > Dashboard</field>
<field name= "res_model" > udm.site</field>
<field name= "view_mode" > dashboard,form</field>
<field name= "context" > {'search_default_active': 1}</field>
<field name= "domain" > [('active', '=', True)]</field>
<field name= "help" type= "html" >
<p class= "o_view_nocontent_smiling_face" >
No UDM Pro sites found
</p>
<p >
Create a site and configure UDM Pro to view the dashboard.
</p>
</field>
</record>
</odoo>