Skip to content

Commit 4bec74b

Browse files
committed
[MIG] web_widget_mermaid: Migration to 18.0
1 parent 64e7b8a commit 4bec74b

File tree

12 files changed

+310120
-166
lines changed

12 files changed

+310120
-166
lines changed

web_widget_mermaid/README.rst

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,30 @@ Usage
4242
Put a ``widget="mermaid"`` attribute in relevant field tags in the view
4343
declaration:
4444

45-
::
45+
.. code:: xml
4646
47-
<field name="flowchart" widget="mermaid"/>
47+
<field name="flowchart" widget="mermaid" />
4848
4949
Optionally, use an ``options`` attribute to pass a JSON object with
5050
`mermaid
51-
configuration <https://mermaidjs.github.io/#/mermaidAPI?id=configuration>`__:
51+
configuration <https://mermaid.js.org/config/schema-docs/config.html>`__:
5252

53-
::
53+
.. code:: xml
54+
55+
<field
56+
name="flowchart"
57+
widget="mermaid"
58+
options="{'theme': 'forest', 'gantt': {'fontSize': 14}}"
59+
/>
60+
61+
A specific ``options`` keyword has been added to enable Odoo theming
62+
63+
.. code:: xml
5464
55-
<field name="flowchart"
56-
widget="mermaid"
57-
options='{"theme": "forest", "gantt": {"fontSize": 14}}'/>
65+
<field name="flowchart" widget="mermaid" options="{'odoo_theme': true}" />
5866
5967
The syntax for creating diagrams is described in `mermaid's
60-
documentation <https://mermaidjs.github.io/#/flowchart>`__.
68+
documentation <https://mermaid.js.org/syntax/flowchart.html>`__.
6169

6270
As an example, this text:
6371

@@ -103,6 +111,7 @@ Contributors
103111

104112
- Jan Verbeek <jverbeek@therp.nl>
105113
- RoboHeart <heart4robots@gmail.com>
114+
- Yann Papouin <ypa@decgroupe.com>
106115

107116
Maintainers
108117
-----------

web_widget_mermaid/__manifest__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Mermaid flowchart widget",
66
"category": "Web",
77
"author": "Therp BV,Odoo Community Association (OCA)",
8-
"version": "15.0.1.0.0",
8+
"version": "18.0.1.0.0",
99
"license": "AGPL-3",
1010
"summary": "Render mermaid markdown flowcharts",
1111
"website": "https://github.com/OCA/web",
@@ -14,9 +14,10 @@
1414
"demo/res_users_flowchart.xml",
1515
],
1616
"assets": {
17-
"web.assets_common": [
18-
"https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js",
19-
"web_widget_mermaid/static/src/js/web_widget_mermaid.js",
17+
"web.assets_backend": [
18+
"web_widget_mermaid/static/src/scss/web_widget_mermaid.scss",
19+
"web_widget_mermaid/static/src/js/web_widget_mermaid.esm.js",
20+
"web_widget_mermaid/static/src/xml/web_widget_mermaid.xml",
2021
],
2122
},
2223
}

web_widget_mermaid/demo/res_users_flowchart.xml

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,61 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<odoo>
3-
<record id="res_users_flowchart" model="ir.model.fields">
4-
<field name="name">x_flowchart</field>
3+
<record model="ir.model.fields" id="res_users_flowchart1">
4+
<field name="name">x_flowchart1</field>
55
<field name="model_id" ref="base.model_res_users" />
6-
<field name="field_description">Demo mermaid flowchart</field>
6+
<field name="field_description">Demo mermaid flowchart #1</field>
77
<field name="ttype">char</field>
88
</record>
9-
<record id="view_users_form_flowchart" model="ir.ui.view">
9+
<record model="ir.model.fields" id="res_users_flowchart2">
10+
<field name="name">x_flowchart2</field>
11+
<field name="model_id" ref="base.model_res_users" />
12+
<field name="field_description">Demo mermaid flowchart #2</field>
13+
<field name="ttype">char</field>
14+
</record>
15+
<record model="ir.model.fields" id="res_users_flowchart3">
16+
<field name="name">x_flowchart3</field>
17+
<field name="model_id" ref="base.model_res_users" />
18+
<field name="field_description">Demo mermaid flowchart #3</field>
19+
<field name="ttype">char</field>
20+
</record>
21+
<record model="ir.ui.view" id="view_users_form_flowchart">
22+
<field name="name">res.users.form.flowchart@web_widget_mermaid</field>
1023
<field name="inherit_id" ref="base.view_users_form" />
1124
<field name="model">res.users</field>
1225
<field name="arch" type="xml">
1326
<xpath expr="//notebook" position="inside">
1427
<page name="mermaid_page" string="Mermaid flowchart">
15-
<field name="x_flowchart" widget="mermaid" />
28+
<p>Default widget</p>
29+
<field name="x_flowchart1" widget="mermaid" />
30+
<p>Widget with Odoo theme</p>
31+
<field
32+
name="x_flowchart2"
33+
widget="mermaid"
34+
options="{'odoo_theme': true}"
35+
/>
36+
<p>Widget with custom theme</p>
37+
<field
38+
name="x_flowchart3"
39+
widget="mermaid"
40+
options="{
41+
'themeVariables': {
42+
'primaryColor': '#FF0000',
43+
'textColor': '#0000FF'
44+
}
45+
}"
46+
/>
1647
</page>
1748
</xpath>
1849
</field>
1950
</record>
20-
<record id="base.user_demo" model="res.users">
21-
<field name="x_flowchart">graph TD
51+
<record model="res.users" id="base.user_demo">
52+
<field name="x_flowchart1">graph TD
53+
A[This is an example flowchart] --> B{{Edit it}}
54+
B -. save it .-> C(See what happens)</field>
55+
<field name="x_flowchart2">graph TD
56+
A[This is an example flowchart] --> B{{Edit it}}
57+
B -. save it .-> C(See what happens)</field>
58+
<field name="x_flowchart3">graph TD
2259
A[This is an example flowchart] --> B{{Edit it}}
2360
B -. save it .-> C(See what happens)</field>
2461
</record>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
- Jan Verbeek \<jverbeek@therp.nl\>
22
- RoboHeart \<heart4robots@gmail.com\>
3+
- Yann Papouin \<ypa@decgroupe.com\>

web_widget_mermaid/readme/USAGE.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
1-
Put a `widget="mermaid"` attribute in relevant field tags in the view
2-
declaration:
1+
Put a `widget="mermaid"` attribute in relevant field tags in the view declaration:
32

4-
<field name="flowchart" widget="mermaid"/>
3+
```xml
4+
<field name="flowchart" widget="mermaid" />
5+
```
56

67
Optionally, use an `options` attribute to pass a JSON object with
7-
[mermaid
8-
configuration](https://mermaidjs.github.io/#/mermaidAPI?id=configuration):
8+
[mermaid configuration](https://mermaid.js.org/config/schema-docs/config.html):
99

10-
<field name="flowchart"
11-
widget="mermaid"
12-
options='{"theme": "forest", "gantt": {"fontSize": 14}}'/>
10+
```xml
11+
<field
12+
name="flowchart"
13+
widget="mermaid"
14+
options="{'theme': 'forest', 'gantt': {'fontSize': 14}}"
15+
/>
16+
```
1317

14-
The syntax for creating diagrams is described in [mermaid's
15-
documentation](https://mermaidjs.github.io/#/flowchart).
18+
A specific `options` keyword has been added to enable Odoo theming
19+
20+
```xml
21+
<field name="flowchart" widget="mermaid" options="{'odoo_theme': true}" />
22+
```
23+
24+
The syntax for creating diagrams is described in
25+
[mermaid's documentation](https://mermaid.js.org/syntax/flowchart.html).
1626

1727
As an example, this text:
1828

19-
graph LR
20-
10.0 --> 11.0
21-
11.0 --> 12.0
22-
12.0 -.-> 13.0
29+
```
30+
graph LR
31+
10.0 --> 11.0
32+
11.0 --> 12.0
33+
12.0 -.-> 13.0
34+
```
2335

2436
Produces this flowchart:
2537

2638
![Flowchart](./static/description/flowchart_example.png)
2739

2840
## Demonstration
2941

30-
In demo mode, the addon adds a flowchart field to users so you can try
31-
it. This shows up in Runbot instances.
42+
In demo mode, the addon adds a flowchart field to users so you can try it. This shows up
43+
in Runbot instances.

web_widget_mermaid/static/description/index.html

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,18 +392,24 @@ <h1 class="title">Mermaid flowchart widget</h1>
392392
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
393393
<p>Put a <tt class="docutils literal"><span class="pre">widget=&quot;mermaid&quot;</span></tt> attribute in relevant field tags in the view
394394
declaration:</p>
395-
<pre class="literal-block">
396-
&lt;field name=&quot;flowchart&quot; widget=&quot;mermaid&quot;/&gt;
395+
<pre class="code xml literal-block">
396+
<span class="nt">&lt;field</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;flowchart&quot;</span><span class="w"> </span><span class="na">widget=</span><span class="s">&quot;mermaid&quot;</span><span class="w"> </span><span class="nt">/&gt;</span>
397397
</pre>
398398
<p>Optionally, use an <tt class="docutils literal">options</tt> attribute to pass a JSON object with
399-
<a class="reference external" href="https://mermaidjs.github.io/#/mermaidAPI?id=configuration">mermaid
399+
<a class="reference external" href="https://mermaid.js.org/config/schema-docs/config.html">mermaid
400400
configuration</a>:</p>
401-
<pre class="literal-block">
402-
&lt;field name=&quot;flowchart&quot;
403-
widget=&quot;mermaid&quot;
404-
options='{&quot;theme&quot;: &quot;forest&quot;, &quot;gantt&quot;: {&quot;fontSize&quot;: 14}}'/&gt;
401+
<pre class="code xml literal-block">
402+
<span class="nt">&lt;field</span><span class="w">
403+
</span><span class="na">name=</span><span class="s">&quot;flowchart&quot;</span><span class="w">
404+
</span><span class="na">widget=</span><span class="s">&quot;mermaid&quot;</span><span class="w">
405+
</span><span class="na">options=</span><span class="s">&quot;{'theme': 'forest', 'gantt': {'fontSize': 14}}&quot;</span><span class="w">
406+
</span><span class="nt">/&gt;</span>
407+
</pre>
408+
<p>A specific <tt class="docutils literal">options</tt> keyword has been added to enable Odoo theming</p>
409+
<pre class="code xml literal-block">
410+
<span class="nt">&lt;field</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;flowchart&quot;</span><span class="w"> </span><span class="na">widget=</span><span class="s">&quot;mermaid&quot;</span><span class="w"> </span><span class="na">options=</span><span class="s">&quot;{'odoo_theme': true}&quot;</span><span class="w"> </span><span class="nt">/&gt;</span>
405411
</pre>
406-
<p>The syntax for creating diagrams is described in <a class="reference external" href="https://mermaidjs.github.io/#/flowchart">mermaid’s
412+
<p>The syntax for creating diagrams is described in <a class="reference external" href="https://mermaid.js.org/syntax/flowchart.html">mermaid’s
407413
documentation</a>.</p>
408414
<p>As an example, this text:</p>
409415
<pre class="literal-block">
@@ -441,6 +447,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
441447
<ul class="simple">
442448
<li>Jan Verbeek &lt;<a class="reference external" href="mailto:jverbeek&#64;therp.nl">jverbeek&#64;therp.nl</a>&gt;</li>
443449
<li>RoboHeart &lt;<a class="reference external" href="mailto:heart4robots&#64;gmail.com">heart4robots&#64;gmail.com</a>&gt;</li>
450+
<li>Yann Papouin &lt;<a class="reference external" href="mailto:ypa&#64;decgroupe.com">ypa&#64;decgroupe.com</a>&gt;</li>
444451
</ul>
445452
</div>
446453
<div class="section" id="maintainers">

0 commit comments

Comments
 (0)