[MIG] web_widget_bokeh_chart: Migration to 17.0

Update bokeh from 3.1.1 to 3.4.1
pull/3076/head
DavidJForgeFlow 2024-06-13 12:50:18 +02:00 committed by JasminSForgeFlow
parent 660671f7ad
commit c276310a44
13 changed files with 1358 additions and 1307 deletions

View File

@ -6,13 +6,13 @@
"category": "Hidden",
"summary": "This widget allows to display charts using Bokeh library.",
"author": "ForgeFlow, " "Odoo Community Association (OCA), " "Creu Blanca",
"version": "16.0.1.1.0",
"version": "17.0.1.0.0",
"maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
"development_status": "Production/Stable",
"website": "https://github.com/OCA/web",
"depends": ["web"],
"data": [],
"external_dependencies": {"python": ["bokeh==3.1.1"]},
"external_dependencies": {"python": ["bokeh==3.4.1"]},
"auto_install": False,
"license": "LGPL-3",
"assets": {

View File

@ -1,9 +1,9 @@
/** @odoo-module **/
import {markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
import {CharField} from "@web/views/fields/char/char_field";
import {loadBundle} from "@web/core/assets";
import {registry} from "@web/core/registry";
const {onWillStart, markup, onMounted, onPatched, useRef} = owl;
export default class BokehChartWidget extends CharField {
setup() {
@ -22,23 +22,32 @@ export default class BokehChartWidget extends CharField {
onWillStart(() =>
loadBundle({
jsLibs: [
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.4.1.min.js",
],
})
);
}
get json_value() {
var value = JSON.parse(this.props.value);
if (value) {
value.div = markup(value.div.trim());
var value = false;
if (this.props.record.data[this.props.name]) {
value = JSON.parse(this.props.record.data[this.props.name]);
if (value) {
value.div = markup(value.div.trim());
}
}
return value;
}
}
BokehChartWidget.template = "web_widget_bokeh_chart.BokehChartField";
registry.category("fields").add("bokeh_chart", BokehChartWidget);
export const bokehChartWidget = {
...CharField,
component: BokehChartWidget,
};
registry.category("fields").add("bokeh_chart", bokehChartWidget);

View File

@ -1,31 +1,31 @@
/** @odoo-module **/
import {Component, markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
import {loadBundle} from "@web/core/assets";
import {registry} from "@web/core/registry";
const {onWillStart, markup, Component, onMounted, onPatched, useRef} = owl;
export default class BokehChartJsonWidget extends Component {
setup() {
this.widget = useRef("widget");
onPatched(() => {
var script = document.createElement("script");
script.text = this.props.value.script;
script.text = this.props.record.data[this.props.name].script;
this.widget.el.append(script);
});
onMounted(() => {
var script = document.createElement("script");
script.text = this.props.value.script;
script.text = this.props.record.data[this.props.name].script;
this.widget.el.append(script);
});
onWillStart(() =>
loadBundle({
jsLibs: [
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.1.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.4.1.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.4.1.min.js",
],
})
);
@ -37,4 +37,9 @@ export default class BokehChartJsonWidget extends Component {
}
BokehChartJsonWidget.template = "web_widget_bokeh_chart.BokehChartlJsonField";
registry.category("fields").add("bokeh_chart_json", BokehChartJsonWidget);
export const bokehChartJsonWidget = {
component: BokehChartJsonWidget,
};
registry.category("fields").add("bokeh_chart_json", bokehChartJsonWidget);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartField" owl="1">
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartField">
<t t-out="json_value.div" />
</div>
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartlJsonField" owl="1">
<t t-out="markup(props.value.div)" />
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartlJsonField">
<t t-out="markup(this.props.record.data[this.props.name].div)" />
</div>
</templates>