Browse Source

[ADD] build config static page

robert 6 years ago
parent
commit
d2d030c733
5 changed files with 226 additions and 2 deletions
  1. 3 0
      __openerp__.py
  2. 0 0
      static/src/css/main.css
  3. 25 0
      static/src/js/main.js
  4. 181 0
      static/src/xml/main.xml
  5. 17 2
      templates.xml

+ 3 - 0
__openerp__.py

@@ -11,5 +11,8 @@
     'data': [
         'templates.xml',
         'workflow.xml'
+    ],
+    'qweb': [
+        'static/src/xml/*.xml'
     ]
 }

+ 0 - 0
static/src/css/main.css


+ 25 - 0
static/src/js/main.js

@@ -0,0 +1,25 @@
+openerp.odoo_management = function(instance, local) {
+
+    local.ConfigPage = instance.Widget.extend({
+        template: 'ConfigTemplate',
+        start: function() {
+           this.initializeInputs(); 
+        },
+        initializeInputs: function() {
+            this.$('#exclusions-input').textext({
+                plugins : 'tags arrow autocomplete',
+                tagsItems : [ 'eiru', 'db'],
+                core: {
+                    onSetInputData: function(e, data) {
+                        if (data === '') {
+                            this._plugins.autocomplete._suggestions = null;
+                        }
+                        this.input().val(data);
+                    },
+                }
+            });
+        }
+    });
+
+    instance.web.client_actions.add('odoo_management.configuration', 'instance.odoo_management.ConfigPage');
+}

+ 181 - 0
static/src/xml/main.xml

@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<template xml:space="preserve">
+
+    <!-- Base configuration template -->
+    <t t-name="BaseConfigTemplate">
+        <div class="oe_view_manager oe_view_manager_inline">
+            <div class="oe_view_manager_wrapper">
+                <div>
+                    <div class="oe_view_manager_body">
+                        <div class="oe_view_manager_view_form">
+                            <div class="oe_formview oe_view">
+                                <div class="oe_form_container">
+                                    <div class="oe_form">
+                                        <div class="oe_form_nosheet">
+                                            <t t-raw="0" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+
+    <!-- Docker section template -->
+    <t t-name="DockerSectionTemplate">
+        <table border="0" cellpadding="0" cellspacing="0" class="oe_form_group">
+            <tbody>
+                <tr class="oe_form_group_row">
+                    <td class="oe_form_group_cell" colspan="1" width="50%">
+                        <div class="oe_horizontal_separator oe_clear">Docker</div>
+                        <table border="0" cellpadding="0" cellspacing="0" class="oe_form_group">
+                            <tbody>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="socket-input" class="oe_form_label oe_align_right">Socket</label>
+                                    </td>
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="socket-input" maxlength="100" type="text" placeholder="/var/run/docker.sock" />
+                                        </span>
+                                    </td>
+                                </tr>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="exclusions-input" class=" oe_form_label oe_align_right">Lista de exclusión</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_tags">
+                                            <textarea id="exclusions-input" rows="1"></textarea>
+                                        </span>
+                                    </td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </td>
+                    <td class="oe_form_group_cell oe_group_right" colspan="1" width="50%"></td>
+                </tr>
+            </tbody>
+        </table>
+    </t>
+
+    <!-- Odoo section template -->
+    <t t-name="OdooSectionTemplate">
+        <table border="0" cellpadding="0" cellspacing="0" class="oe_form_group">
+            <tbody>
+                <tr class="oe_form_group_row">
+                    <td class="oe_form_group_cell" colspan="1" width="50%">
+                        <div class="oe_horizontal_separator oe_clear">Odoo</div>
+                        <table border="0" cellpadding="0" cellspacing="0" class="oe_form_group">
+                            <tbody>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="oe-field-input-4" class=" oe_form_label oe_align_right">Imagen docker</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="oe-field-input-4" maxlength="50" type="text" />
+                                        </span>
+                                    </td>
+                                </tr>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="oe-field-input-5" class=" oe_form_label oe_align_right">Red virtual</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="oe-field-input-5" maxlength="50" type="text" />
+                                        </span>
+                                    </td>
+                                </tr>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="oe-field-input-6" class=" oe_form_label oe_align_right">Rango de puertos</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="oe-field-input-6" maxlength="50" type="text" />
+                                        </span>
+                                    </td>
+                                </tr>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="oe-field-input-7" class=" oe_form_label oe_align_right">Ruta raíz</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="oe-field-input-7" maxlength="50" type="text" />
+                                        </span>
+                                    </td>
+                                </tr>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="oe-field-input-8" class=" oe_form_label oe_align_right">Base de datos</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="oe-field-input-8" maxlength="50" type="text" />
+                                        </span>
+                                    </td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </td>
+                    <td class="oe_form_group_cell oe_group_right" colspan="1" width="50%"></td>
+                </tr>
+            </tbody>
+        </table>
+    </t>
+
+    <!-- Git section template -->
+    <t t-name="GitSectionTemplate">
+        <table border="0" cellpadding="0" cellspacing="0" class="oe_form_group">
+            <tbody>
+                <tr class="oe_form_group_row">
+                    <td class="oe_form_group_cell" colspan="1" width="50%">
+                        <div class="oe_horizontal_separator oe_clear">Git</div>
+                        <table border="0" cellpadding="0" cellspacing="0" class="oe_form_group ">
+                            <tbody>
+                                <tr class="oe_form_group_row">
+                                    <td class="oe_form_group_cell oe_form_group_cell_label" colspan="1" width="1%">
+                                        <label for="oe-field-input-9" class=" oe_form_label oe_align_right">Ruta del repositorio</label>
+                                    </td>
+                                    <td class="oe_form_group_cell" colspan="1" width="99%">
+                                        <span class="oe_form_field oe_form_field_char">
+                                            <input id="oe-field-input-9" maxlength="100" type="text" />
+                                        </span>
+                                    </td>
+                                </tr>
+                            </tbody>
+                        </table>
+                    </td>
+                    <td class="oe_form_group_cell oe_group_right" colspan="1" width="50%"></td>
+                </tr>
+            </tbody>
+        </table>
+    </t>
+
+    <!-- Configuration template  -->
+    <t t-name="ConfigTemplate">
+        <t t-call="BaseConfigTemplate">
+            <header>
+                <button type="button" class="oe_button oe_form_button oe_highlight">
+                    <span>Guardar</span>
+                </button>
+                o
+                <button type="button" class="oe_button oe_form_button oe_link">
+                    <span>Cancelar</span>
+                </button>
+            </header>
+            <div name="general">
+                <t t-call="DockerSectionTemplate" />
+                <t t-call="OdooSectionTemplate" />
+                <t t-call="GitSectionTemplate" />
+            </div>
+        </t>
+    </t>
+</template>

+ 17 - 2
templates.xml

@@ -1,6 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
     <data>
+        <!-- odoo_management configuration assets -->
+        <template id="odoo_management.assets" inherit_id="web.assets_backend">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/odoo_management/static/src/css/main.css" />
+                <script type="text/javascript" src="/odoo_management/static/src/js/main.js" />
+            </xpath>
+        </template>
+
         <!-- system.instance tree view -->
         <record id="system_instance_tree_view" model="ir.ui.view">
             <field name="name">system.instance.tree</field>
@@ -232,16 +240,23 @@
             <field name="target">inline</field>
         </record>
 
+        <!-- odoo.management.config action -->
+        <record id="odoo_management_config_action2" model="ir.actions.client">
+            <field name="name">Configuración</field>
+            <field name="tag">odoo_management.configuration</field>
+        </record>
+
         <!-- root menu -->
         <menuitem id="sysadmin_menu_root" name="Administración de Sistemas" />
 
         <!-- containers menu -->
         <menuitem id="containers_menu_categ" name="Contenedores" parent="sysadmin_menu_root" />
         <menuitem id="systems_menu_act" name="Sistemas" parent="containers_menu_categ" action="odoo_container_action" />
-        
+
         <!-- configuration menu  -->
         <menuitem id="configuration_menu_categ" name="Configuración" parent="sysadmin_menu_root" />
         <menuitem id="payment_plan_menu_act" name="Planes de pago" parent="configuration_menu_categ" action="payment_plan_action" />
         <menuitem id="configuration_menu_act" name="Configuración" parent="configuration_menu_categ" action="odoo_management_config_action" />
+        <menuitem id="configuration_menu_act2" name="Configuración 2" parent="configuration_menu_categ" action="odoo_management_config_action2" />
     </data>
-</openerp>
+</openerp>