You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2022/02/22 15:57:42 UTC
[airflow] branch fix-graph-autorefresh created (now e61e3cb)
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a change to branch fix-graph-autorefresh
in repository https://gitbox.apache.org/repos/asf/airflow.git.
at e61e3cb fix auto refresh check on page load
This branch includes the following new commits:
new e61e3cb fix auto refresh check on page load
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[airflow] 01/01: fix auto refresh check on page load
Posted by bb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch fix-graph-autorefresh
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit e61e3cb0a65060caddc7d2a40a4aa49cc7fd755e
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Sun Feb 20 12:46:01 2022 -0500
fix auto refresh check on page load
---
airflow/www/static/js/graph.js | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/airflow/www/static/js/graph.js b/airflow/www/static/js/graph.js
index 2e0522c..1bf4b96 100644
--- a/airflow/www/static/js/graph.js
+++ b/airflow/www/static/js/graph.js
@@ -58,6 +58,15 @@ const stateFocusMap = {
deferred: false,
no_status: false,
};
+
+const isFinal = () => {
+ const states = Object.values(taskInstances).map((ti) => ti.state);
+
+ // end refresh if all states are final
+ return !states.some((state) => (
+ ['success', 'failed', 'upstream_failed', 'skipped', 'removed'].indexOf(state) === -1));
+};
+
const taskTip = d3.tip()
.attr('class', 'tooltip d3-tip')
.html((toolTipHtml) => toolTipHtml);
@@ -363,13 +372,10 @@ function handleRefresh() {
if (prevTis !== tis) {
// eslint-disable-next-line no-global-assign
taskInstances = JSON.parse(tis);
- const states = Object.values(taskInstances).map((ti) => ti.state);
updateNodesStates(taskInstances);
// end refresh if all states are final
- if (!states.some((state) => (
- ['success', 'failed', 'upstream_failed', 'skipped', 'removed'].indexOf(state) === -1))
- ) {
+ if (isFinal()) {
$('#auto_refresh').prop('checked', false);
clearInterval(refreshInterval);
}
@@ -411,9 +417,8 @@ $('#auto_refresh').change(() => {
});
function initRefresh() {
- if (localStorage.getItem('disableAutoRefresh')) {
- $('#auto_refresh').prop('checked', false);
- }
+ const isDisabled = localStorage.getItem('disableAutoRefresh');
+ $('#auto_refresh').prop('checked', !(isDisabled || isFinal()));
startOrStopRefresh();
d3.select('#refresh_button').on('click', () => handleRefresh());
}
@@ -472,14 +477,15 @@ function groupTooltip(node, tis) {
// Initiating the tooltips
function updateNodesStates(tis) {
g.nodes().forEach((nodeId) => {
- const { elem } = g.node(nodeId);
+ const node = g.node(nodeId);
+ const { elem } = node;
+ const taskId = nodeId;
+
if (elem) {
const classes = `node enter ${getNodeState(nodeId, tis)}`;
elem.setAttribute('class', classes);
elem.setAttribute('data-toggle', 'tooltip');
- const taskId = nodeId;
- const node = g.node(nodeId);
elem.onmouseover = (evt) => {
let tt;
if (taskId in tis) {