Skip to content

Commit

Permalink
Merge pull request #405 from OCA/17.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/queue (17.0)
  • Loading branch information
bt-admin authored Oct 4, 2024
2 parents 230c21c + 9b0c436 commit 6b8906d
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[queue_job](queue_job/) | 17.0.1.0.4 | [![guewen](https://github.com/guewen.png?size=30px)](https://github.com/guewen) | Job Queue
[queue_job](queue_job/) | 17.0.1.0.5 | [![guewen](https://github.com/guewen.png?size=30px)](https://github.com/guewen) | Job Queue
[queue_job_cron](queue_job_cron/) | 17.0.1.0.0 | | Scheduled Actions as Queue Jobs
[queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 17.0.1.0.0 | [![ivantodorovich](https://github.com/ivantodorovich.png?size=30px)](https://github.com/ivantodorovich) | Run jobs without a dedicated JobRunner
[queue_job_subscribe](queue_job_subscribe/) | 17.0.1.0.0 | | Control which users are subscribed to queue job notifications
Expand Down
2 changes: 1 addition & 1 deletion queue_job/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Job Queue
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b8379c2bc14aad086397442fdeecc1e9cc2ce8aa0594147b2059ca748752738f
!! source digest: sha256:2d7114182561a5470d4b7a8cc9734203a2b864adc27b0890c08ca318cee5a0a2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
Expand Down
2 changes: 1 addition & 1 deletion queue_job/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "Job Queue",
"version": "17.0.1.0.4",
"version": "17.0.1.0.5",
"author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/queue",
"license": "LGPL-3",
Expand Down
7 changes: 7 additions & 0 deletions queue_job/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ msgstr ""
msgid "Is Follower"
msgstr "Ist Abonnent"

#. module: queue_job
#. odoo-javascript
#: code:addons/queue_job/static/src/views/fields/job_direct_graph/job_direct_graph.esm.js:0
#, python-format
msgid "Job %(id)s"
msgstr ""

#. module: queue_job
#: model:ir.model,name:queue_job.model_queue_job_channel
msgid "Job Channels"
Expand Down
7 changes: 7 additions & 0 deletions queue_job/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ msgstr "Función del trabajo no válida: {}"
msgid "Is Follower"
msgstr "Es un seguidor"

#. module: queue_job
#. odoo-javascript
#: code:addons/queue_job/static/src/views/fields/job_direct_graph/job_direct_graph.esm.js:0
#, python-format
msgid "Job %(id)s"
msgstr ""

#. module: queue_job
#: model:ir.model,name:queue_job.model_queue_job_channel
msgid "Job Channels"
Expand Down
7 changes: 7 additions & 0 deletions queue_job/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ msgstr "Funzione lavoro non valida: {}"
msgid "Is Follower"
msgstr "Segue"

#. module: queue_job
#. odoo-javascript
#: code:addons/queue_job/static/src/views/fields/job_direct_graph/job_direct_graph.esm.js:0
#, python-format
msgid "Job %(id)s"
msgstr ""

#. module: queue_job
#: model:ir.model,name:queue_job.model_queue_job_channel
msgid "Job Channels"
Expand Down
7 changes: 7 additions & 0 deletions queue_job/i18n/queue_job.pot
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ msgstr ""
msgid "Is Follower"
msgstr ""

#. module: queue_job
#. odoo-javascript
#: code:addons/queue_job/static/src/views/fields/job_direct_graph/job_direct_graph.esm.js:0
#, python-format
msgid "Job %(id)s"
msgstr ""

#. module: queue_job
#: model:ir.model,name:queue_job.model_queue_job_channel
msgid "Job Channels"
Expand Down
7 changes: 7 additions & 0 deletions queue_job/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ msgstr "无效的作业函数:{}"
msgid "Is Follower"
msgstr "关注者"

#. module: queue_job
#. odoo-javascript
#: code:addons/queue_job/static/src/views/fields/job_direct_graph/job_direct_graph.esm.js:0
#, python-format
msgid "Job %(id)s"
msgstr ""

#. module: queue_job
#: model:ir.model,name:queue_job.model_queue_job_channel
msgid "Job Channels"
Expand Down
2 changes: 1 addition & 1 deletion queue_job/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Job Queue</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b8379c2bc14aad086397442fdeecc1e9cc2ce8aa0594147b2059ca748752738f
!! source digest: sha256:2d7114182561a5470d4b7a8cc9734203a2b864adc27b0890c08ca318cee5a0a2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/queue/tree/17.0/queue_job"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/queue-17-0/queue-17-0-queue_job"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/queue&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon adds an integrated Job Queue to Odoo.</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
/* @odoo-module */
/* global vis */

import {Component, onMounted, onWillStart, useRef, useState} from "@odoo/owl";
import {loadCSS, loadJS} from "@web/core/assets";

import {_t} from "@web/core/l10n/translation";
import {registry} from "@web/core/registry";
import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {useRecordObserver} from "@web/model/relational_model/utils";
import {useService} from "@web/core/utils/hooks";

const {Component, onWillStart, useEffect, useRef} = owl;

export class JobDirectGraph extends Component {
setup() {
super.setup();
this.orm = useService("orm");
this.action = useService("action");
this.rootRef = useRef("root_vis");
this.network = null;
this.state = useState({});

onWillStart(async () => {
await loadJS("/queue_job/static/lib/vis/vis-network.min.js");
loadCSS("/queue_job/static/lib/vis/vis-network.min.css");
});
useEffect(() => {
useRecordObserver((record) => {
this.state.value = record.data[this.props.name];
});
onMounted(() => {
this.renderNetwork();
this._fitNetwork();
return () => {
if (this.network) {
this.$el.empty();
}
return this.rootRef.el;
};
});
}

Expand Down Expand Up @@ -56,24 +58,21 @@ export class JobDirectGraph extends Component {
if (this.network) {
this.$el.empty();
}
let nodes = this.props.value.nodes || [];
if (!nodes.length) {
return;
}
nodes = nodes.map((node) => {

const nodes = (this.state.value.nodes || []).map((node) => {
node.title = this.htmlTitle(node.title || "");
node.label = _t("Job %(id)s", {id: node.id});
return node;
});

const edges = [];
_.each(this.props.value.edges || [], function (edge) {
const edges = (this.state.value.edges || []).map((edge) => {
const edgeFrom = edge[0];
const edgeTo = edge[1];
edges.push({
return {
from: edgeFrom,
to: edgeTo,
arrows: "to",
});
};
});

const data = {
Expand All @@ -93,23 +92,22 @@ export class JobDirectGraph extends Component {
}
const network = new vis.Network(this.$el[0], data, options);
network.selectNodes([this.resId]);
var self = this;
network.on("dragging", function () {
network.on("dragging", () => {
// By default, dragging changes the selected node
// to the dragged one, we want to keep the current
// job selected
network.selectNodes([self.resId]);
network.selectNodes([this.resId]);
});
network.on("click", function (params) {
network.on("click", (params) => {
if (params.nodes.length > 0) {
var resId = params.nodes[0];
if (resId !== self.resId) {
self.openDependencyJob(resId);
const resId = params.nodes[0];
if (resId !== this.resId) {
this.openDependencyJob(resId);
}
} else {
// Clicked outside of the nodes, we want to
// keep the current job selected
network.selectNodes([self.resId]);
network.selectNodes([this.resId]);
}
});
this.network = network;
Expand Down Expand Up @@ -140,4 +138,8 @@ JobDirectGraph.props = {

JobDirectGraph.template = "queue.JobDirectGraph";

registry.category("fields").add("job_directed_graph", JobDirectGraph);
export const jobDirectGraph = {
component: JobDirectGraph,
};

registry.category("fields").add("job_directed_graph", jobDirectGraph);
1 change: 1 addition & 0 deletions queue_job/views/queue_job_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
</group>
<group>
<group>
<field name="id" invisible="True" />
<field name="priority" />
<field name="eta" />
<field
Expand Down

0 comments on commit 6b8906d

Please sign in to comment.