Files
Odoo-Modules/fusion_helpdesk_central/views/fusion_helpdesk_client_key_views.xml
gsinghpal 586f05d567 chnages
2026-05-04 02:14:34 -04:00

137 lines
6.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1
-->
<odoo>
<record id="view_fhc_client_key_list" model="ir.ui.view">
<field name="name">fusion.helpdesk.client.key.list</field>
<field name="model">fusion.helpdesk.client.key</field>
<field name="arch" type="xml">
<list string="Helpdesk Client API Keys"
decoration-muted="is_revoked">
<field name="client_label"/>
<field name="apikey_name" optional="hide"/>
<field name="bot_user_id"/>
<field name="create_date"/>
<field name="is_revoked" widget="boolean_toggle" readonly="1"/>
<field name="notes" optional="hide"/>
</list>
</field>
</record>
<record id="view_fhc_client_key_form" model="ir.ui.view">
<field name="name">fusion.helpdesk.client.key.form</field>
<field name="model">fusion.helpdesk.client.key</field>
<field name="arch" type="xml">
<form string="Helpdesk Client API Key">
<header>
<button name="action_mark_stored" type="object"
string="Mark Key Stored"
class="btn-primary"
invisible="not plaintext_key"
confirm="Wipe the plaintext key from this record? It can't be recovered after this."/>
<button name="action_rotate" type="object"
string="Rotate Key"
class="btn-secondary"
invisible="is_revoked or plaintext_key"
confirm="Revoke the existing key and issue a fresh one? The client deployment will need its config updated to keep working."/>
<button name="action_revoke" type="object"
string="Revoke"
class="btn-danger"
invisible="is_revoked"
confirm="Revoke this key permanently? The client deployment will stop being able to file tickets."/>
</header>
<sheet>
<widget name="web_ribbon" title="Revoked"
bg_color="bg-danger"
invisible="not is_revoked"/>
<div class="oe_title">
<label for="client_label"/>
<h1><field name="client_label" placeholder="e.g. ENTECH"/></h1>
</div>
<div class="alert alert-warning"
role="alert"
invisible="not plaintext_key">
<h4 class="alert-heading">
<i class="fa fa-key me-1"/> Copy the key now
</h4>
<p>
This is the <strong>only time</strong> the plaintext key
is shown. After you click <em>Mark Key Stored</em> in the
header it will be wiped from this record forever.
The key keeps working — we just stop displaying it.
</p>
<pre class="mt-2 p-2 bg-light text-dark"
style="user-select: all; word-break: break-all;"
><field name="plaintext_key" nolabel="1" readonly="1"/></pre>
</div>
<group>
<group>
<field name="bot_user_id"/>
<field name="apikey_name"/>
<field name="create_date"/>
</group>
<group>
<field name="apikey_id" readonly="1"/>
<field name="is_revoked" readonly="1"/>
</group>
</group>
<group string="Notes">
<field name="notes" nolabel="1" placeholder="Deployment URL, contact email, install date…"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_fhc_client_key_search" model="ir.ui.view">
<field name="name">fusion.helpdesk.client.key.search</field>
<field name="model">fusion.helpdesk.client.key</field>
<field name="arch" type="xml">
<search>
<field name="client_label"/>
<field name="notes"/>
<separator/>
<filter string="Active" name="active"
domain="[('is_revoked', '=', False)]"/>
<filter string="Revoked" name="revoked"
domain="[('is_revoked', '=', True)]"/>
<group>
<filter string="Bot User" name="g_bot"
context="{'group_by': 'bot_user_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_fhc_client_key" model="ir.actions.act_window">
<field name="name">Helpdesk Client API Keys</field>
<field name="res_model">fusion.helpdesk.client.key</field>
<field name="view_mode">list,form</field>
<field name="context">{'search_default_active': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Issue a new API key
</p>
<p>
Each row maps a client deployment (e.g. ENTECH, MOBILITY)
to a real API key on the shared bot user. The plaintext
key is shown ONCE on creation — copy it then click
"Mark Key Stored". Revoke any key in one click if a
deployment is compromised.
</p>
</field>
</record>
<menuitem id="menu_fhc_client_key"
name="Client API Keys"
parent="helpdesk.helpdesk_menu_config"
action="action_fhc_client_key"
sequence="90"/>
</odoo>