OCA/server-tools

View on GitHub
dead_mans_switch_server/views/dead_mans_switch_instance.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <record id="search_dead_mans_switch_instance" model="ir.ui.view">
            <field name="model">dead.mans.switch.instance</field>
            <field name="arch" type="xml">
                <search>
                    <field name="partner_id" />
                    <field name="database_uuid" />
                    <field name="description" />
                    <group string="State">
                        <filter name="active" string="Active" domain="[('state', '=', 'active')]" />
                        <filter name="new" string="New" domain="[('state', '=', 'new')]" />
                        <filter name="suspended" string="Suspended" domain="[('state', '=', 'suspended')]" />
                    </group>
                </search>
            </field>
        </record>
        <record id="form_dead_mans_switch_instance" model="ir.ui.view">
            <field name="model">dead.mans.switch.instance</field>
            <field name="arch" type="xml">
                <form>
                    <header>
                        <button type="object" name="button_active"
                            string="Activate" states="new,suspended"
                            class="oe_highlight" />
                        <button type="object" name="button_suspended"
                            string="Suspend" states="active" />
                        <field name="state" widget="statusbar" />
                    </header>
                    <sheet>
                        <div class="oe_title">
                            <h1 class="oe_read_only"><field name="display_name" /></h1>
                        </div>
                        <div class="oe_button_box oe_right">
                            <button type="object" name="button_logs"
                                string="Open logs" class="oe_stat_button"
                                icon="fa-tasks" />
                        </div>
                        <group>
                            <group name="description">
                                <field name="partner_id" />
                                <field name="description" />
                            </group>
                            <group name="data">
                                <field name="database_uuid" />
                                <field name="user_id" />
                            </group>
                        </group>
                        <div class="oe_chatter">
                            <field name="message_follower_ids" widget="mail_followers"/>
                            <field name="message_ids" widget="mail_thread"/>
                        </div>
                    </sheet>
                </form>
            </field>
        </record>
        <record id="tree_dead_mans_switch_instance" model="ir.ui.view">
            <field name="model">dead.mans.switch.instance</field>
            <field name="arch" type="xml">
                <tree>
                    <field name="display_name" />
                    <field name="alive" />
                    <field name="user_id" />
                </tree>
            </field>
        </record>
        <record id="kanban_dead_mans_switch_instance" model="ir.ui.view">
            <field name="model">dead.mans.switch.instance</field>
            <field name="arch" type="xml">
                <kanban>
                    <field name="partner_id" />
                    <field name="alive" />
                    <field name="state" />
                    <templates>
                        <div t-name="kanban-box" t-attf-class="oe_kanban_card #{widget.kanban_color(record.partner_id.raw_value[0])}">
                            <h4>
                                <a type="open"><field name="display_name" /></a>
                                <t t-if="record.alive.raw_value and record.state.raw_value == 'active'">
                                    <i class="fa fa-circle" style="color: green" />
                                </t>
                                <t t-if="!record.alive.raw_value and record.state.raw_value == 'active'">
                                    <i class="fa fa-circle" style="color: red" />
                                </t>
                                <t t-if="record.state.raw_value != 'active'">
                                    <i class="fa fa-circle" style="color: gray" />
                                </t>
                            </h4>
                            <table class="table">
                                <tr>
                                    <th>CPU</th>
                                    <td><field name="last_cpu" />%</td>
                                    <td><field name="last_cpu_sparkline" widget="sparkline_bar" /></td>
                                </tr>
                                <tr>
                                    <th>RAM</th>
                                    <td><field name="last_ram" />%</td>
                                    <td><field name="last_ram_sparkline" widget="sparkline_bar" /></td>
                                </tr>
                                <tr>
                                    <th>Users</th>
                                    <td><field name="last_user_count" /></td>
                                    <td><field name="last_user_count_sparkline" widget="sparkline_bar" /></td>
                                </tr>
                                <tr>
                                    <th>Last seen</th>
                                    <td><field name="last_seen" /></td>
                                    <td />
                                </tr>
                            </table>
                        </div>
                    </templates>
                </kanban>
            </field>
        </record>
     </data>
</openerp>