mirror of https://github.com/OCA/web.git
[MIG] web_widget_bokeh_chart: Migration to 17.0
Update bokeh from 3.1.1 to 3.4.1pull/3076/head
parent
660671f7ad
commit
c276310a44
|
@ -6,13 +6,13 @@
|
||||||
"category": "Hidden",
|
"category": "Hidden",
|
||||||
"summary": "This widget allows to display charts using Bokeh library.",
|
"summary": "This widget allows to display charts using Bokeh library.",
|
||||||
"author": "ForgeFlow, " "Odoo Community Association (OCA), " "Creu Blanca",
|
"author": "ForgeFlow, " "Odoo Community Association (OCA), " "Creu Blanca",
|
||||||
"version": "16.0.1.1.0",
|
"version": "17.0.1.0.0",
|
||||||
"maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
|
"maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
|
||||||
"development_status": "Production/Stable",
|
"development_status": "Production/Stable",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"depends": ["web"],
|
"depends": ["web"],
|
||||||
"data": [],
|
"data": [],
|
||||||
"external_dependencies": {"python": ["bokeh==3.1.1"]},
|
"external_dependencies": {"python": ["bokeh==3.4.1"]},
|
||||||
"auto_install": False,
|
"auto_install": False,
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"assets": {
|
"assets": {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||||
import {CharField} from "@web/views/fields/char/char_field";
|
import {CharField} from "@web/views/fields/char/char_field";
|
||||||
import {loadBundle} from "@web/core/assets";
|
import {loadBundle} from "@web/core/assets";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
const {onWillStart, markup, onMounted, onPatched, useRef} = owl;
|
|
||||||
|
|
||||||
export default class BokehChartWidget extends CharField {
|
export default class BokehChartWidget extends CharField {
|
||||||
setup() {
|
setup() {
|
||||||
|
@ -22,23 +22,32 @@ export default class BokehChartWidget extends CharField {
|
||||||
onWillStart(() =>
|
onWillStart(() =>
|
||||||
loadBundle({
|
loadBundle({
|
||||||
jsLibs: [
|
jsLibs: [
|
||||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-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.1.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.1.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.1.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.1.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.1.1.min.js",
|
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.4.1.min.js",
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
get json_value() {
|
get json_value() {
|
||||||
var value = JSON.parse(this.props.value);
|
var value = false;
|
||||||
|
if (this.props.record.data[this.props.name]) {
|
||||||
|
value = JSON.parse(this.props.record.data[this.props.name]);
|
||||||
if (value) {
|
if (value) {
|
||||||
value.div = markup(value.div.trim());
|
value.div = markup(value.div.trim());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BokehChartWidget.template = "web_widget_bokeh_chart.BokehChartField";
|
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);
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import {Component, markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||||
import {loadBundle} from "@web/core/assets";
|
import {loadBundle} from "@web/core/assets";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
const {onWillStart, markup, Component, onMounted, onPatched, useRef} = owl;
|
|
||||||
|
|
||||||
export default class BokehChartJsonWidget extends Component {
|
export default class BokehChartJsonWidget extends Component {
|
||||||
setup() {
|
setup() {
|
||||||
this.widget = useRef("widget");
|
this.widget = useRef("widget");
|
||||||
onPatched(() => {
|
onPatched(() => {
|
||||||
var script = document.createElement("script");
|
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);
|
this.widget.el.append(script);
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
var script = document.createElement("script");
|
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);
|
this.widget.el.append(script);
|
||||||
});
|
});
|
||||||
onWillStart(() =>
|
onWillStart(() =>
|
||||||
loadBundle({
|
loadBundle({
|
||||||
jsLibs: [
|
jsLibs: [
|
||||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-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.1.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.1.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.1.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.1.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.1.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";
|
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
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
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<templates xml:space="preserve">
|
<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" />
|
<t t-out="json_value.div" />
|
||||||
</div>
|
</div>
|
||||||
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartlJsonField" owl="1">
|
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartlJsonField">
|
||||||
<t t-out="markup(props.value.div)" />
|
<t t-out="markup(this.props.record.data[this.props.name].div)" />
|
||||||
</div>
|
</div>
|
||||||
</templates>
|
</templates>
|
||||||
|
|
Loading…
Reference in New Issue