<commit_before>{#
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
#}

{% extends "airflow/dag.html" %}
{% block page_title %}{{ dag.dag_id }} - Tree - Airflow{% endblock %}

{% block head_css %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/tree.css') }}">
{% endblock %}

{% block content %}
{{ super() }}
<div style="float: left" class="form-inline">
  <form method="get" style="float:left;">
    Base date: {{ form.base_date(class_="form-control") }}
    Number of runs: {{ form.num_runs(class_="form-control") }}
    <input type="hidden" name="root" value="{{ root if root else '' }}">
    <input type="hidden" value="{{ dag.dag_id }}" name="dag_id">
    <input type="submit" value="Go" class="btn btn-default">
    <input name="_csrf_token" type="hidden" value="{{ csrf_token() }}">
  </form>
</div>
<div style="clear: both;"></div>
<hr/>
<div>
  <div class="legend_item" style="border: none;">no_status</div>
  <div class="square" style="background: white;"></div>
  <div class="legend_item" style="border: none;">queued</div>
  <div class="square" style="background: grey;"></div>
  <div class="legend_item" style="border: none;">up_for_retry</div>
  <div class="square" style="background: gold;"></div>
  <div class="legend_item" style="border: none;">up_for_reschedule</div>
  <div class="square" style="background: turquoise;"></div>
  <div class="legend_item" style="border: none;">upstream_failed</div>
  <div class="square" style="background: orange;"></div>
  <div class="legend_item" style="border: none;">skipped</div>
  <div class="square" style="background: pink;"></div>
  <div class="legend_item" style="border: none;">failed</div>
  <div class="square" style="background: red;"></div>
  <div class="legend_item" style="border: none;">running</div>
  <div class="square" style="background: lime;"></div>
  <div class="legend_item" style="border: none;">success</div>
  <div class="square" style="background: green;"></div>
  {% for op in operators %}
  <div class="legend_circle" style="background:{{ op.ui_color }};">
  </div>
  <div class="legend_item" style="float:left;border-color:white;">{{ op.task_type }}</div>
  {% endfor %}
  <div style="clear:both;"></div>
</div>
<hr/>
<div id="svg_container">
  <img id='loading' width="50" src="{{ url_for('static', filename='loading.gif') }}">
  <svg class='tree' width="100%">
    <filter id="blur-effect-1">
      <feGaussianBlur stdDeviation="3"></feGaussianBlur>
    </filter>
  </svg>
</div>
{% endblock %}

{% block tail %}
{{ super() }}
<script src="{{ url_for_asset('d3.min.js') }}"></script>
<script src="{{ url_for_asset('d3-tip.js') }}"></script>
<script>
$('span.status_square').tooltip({html: true});

function ts_to_dtstr(ts) {
  var dt = new Date(ts * 1000);
  return dt.toISOString();
}

function is_dag_run(d) {
  return d.run_id != undefined;
}

var now_ts = Date.now()/1000;

function populate_taskinstance_properties(node) {
  // populate task instance properties for display purpose
  var j;
  for (j=0; j<node.instances.length; j++) {
    var dr_instance = data.instances[j];
    var row = node.instances[j];

    if (row === null) {
      node.instances[j] = {
        task_id: node.name,
        execution_date: dr_instance.execution_date,
      };
      continue;
    }

    var task_instance = {
      state: row[0],
      try_number: row[1],
      start_ts: row[2],
      duration: row[3],
    };
    node.instances[j] = task_instance;

    task_instance.task_id = node.name;
    task_instance.operator = node.operator;
    task_instance.execution_date = dr_instance.execution_date;
    task_instance.external_trigger = dr_instance.external_trigger;

    // compute start_date and end_date if applicable
    if (task_instance.start_ts !== null) {
      task_instance.start_date = ts_to_dtstr(task_instance.start_ts);
      if (task_instance.state === "running") {
        task_instance.duration = now_ts - task_instance.start_ts;
      } else if (task_instance.duration !== null) {
        task_instance.end_date = ts_to_dtstr(task_instance.start_ts + task_instance.duration);
      }
    }
  }
}

var devicePixelRatio = window.devicePixelRatio || 1;
// JSON.parse is faster for large payloads than an object literal (because the JSON grammer is simpler!)
var data = JSON.parse('{{ data }}');
var barHeight = 20;
var axisHeight = 40;
var square_x = parseInt(500 * devicePixelRatio);
var square_size = 10;
var square_spacing = 2;
var margin = {top: barHeight/2 + axisHeight, right: 0, bottom: 0, left: barHeight/2},
    width = parseInt(960 * devicePixelRatio) - margin.left - margin.right,
    barWidth = width * 0.9;

var i = 0,<commit_msg>Fix tree view if config contains " (#9250)<commit_after>{#
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
#}

{% extends "airflow/dag.html" %}
{% block page_title %}{{ dag.dag_id }} - Tree - Airflow{% endblock %}

{% block head_css %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/tree.css') }}">
{% endblock %}

{% block content %}
{{ super() }}
<div style="float: left" class="form-inline">
  <form method="get" style="float:left;">
    Base date: {{ form.base_date(class_="form-control") }}
    Number of runs: {{ form.num_runs(class_="form-control") }}
    <input type="hidden" name="root" value="{{ root if root else '' }}">
    <input type="hidden" value="{{ dag.dag_id }}" name="dag_id">
    <input type="submit" value="Go" class="btn btn-default">
    <input name="_csrf_token" type="hidden" value="{{ csrf_token() }}">
  </form>
</div>
<div style="clear: both;"></div>
<hr/>
<div>
  <div class="legend_item" style="border: none;">no_status</div>
  <div class="square" style="background: white;"></div>
  <div class="legend_item" style="border: none;">queued</div>
  <div class="square" style="background: grey;"></div>
  <div class="legend_item" style="border: none;">up_for_retry</div>
  <div class="square" style="background: gold;"></div>
  <div class="legend_item" style="border: none;">up_for_reschedule</div>
  <div class="square" style="background: turquoise;"></div>
  <div class="legend_item" style="border: none;">upstream_failed</div>
  <div class="square" style="background: orange;"></div>
  <div class="legend_item" style="border: none;">skipped</div>
  <div class="square" style="background: pink;"></div>
  <div class="legend_item" style="border: none;">failed</div>
  <div class="square" style="background: red;"></div>
  <div class="legend_item" style="border: none;">running</div>
  <div class="square" style="background: lime;"></div>
  <div class="legend_item" style="border: none;">success</div>
  <div class="square" style="background: green;"></div>
  {% for op in operators %}
  <div class="legend_circle" style="background:{{ op.ui_color }};">
  </div>
  <div class="legend_item" style="float:left;border-color:white;">{{ op.task_type }}</div>
  {% endfor %}
  <div style="clear:both;"></div>
</div>
<hr/>
<div id="svg_container">
  <img id='loading' width="50" src="{{ url_for('static', filename='loading.gif') }}">
  <svg class='tree' width="100%">
    <filter id="blur-effect-1">
      <feGaussianBlur stdDeviation="3"></feGaussianBlur>
    </filter>
  </svg>
</div>
{% endblock %}

{% block tail %}
{{ super() }}
<script src="{{ url_for_asset('d3.min.js') }}"></script>
<script src="{{ url_for_asset('d3-tip.js') }}"></script>
<script>
$('span.status_square').tooltip({html: true});

function ts_to_dtstr(ts) {
  var dt = new Date(ts * 1000);
  return dt.toISOString();
}

function is_dag_run(d) {
  return d.run_id != undefined;
}

var now_ts = Date.now()/1000;

function populate_taskinstance_properties(node) {
  // populate task instance properties for display purpose
  var j;
  for (j=0; j<node.instances.length; j++) {
    var dr_instance = data.instances[j];
    var row = node.instances[j];

    if (row === null) {
      node.instances[j] = {
        task_id: node.name,
        execution_date: dr_instance.execution_date,
      };
      continue;
    }

    var task_instance = {
      state: row[0],
      try_number: row[1],
      start_ts: row[2],
      duration: row[3],
    };
    node.instances[j] = task_instance;

    task_instance.task_id = node.name;
    task_instance.operator = node.operator;
    task_instance.execution_date = dr_instance.execution_date;
    task_instance.external_trigger = dr_instance.external_trigger;

    // compute start_date and end_date if applicable
    if (task_instance.start_ts !== null) {
      task_instance.start_date = ts_to_dtstr(task_instance.start_ts);
      if (task_instance.state === "running") {
        task_instance.duration = now_ts - task_instance.start_ts;
      } else if (task_instance.duration !== null) {
        task_instance.end_date = ts_to_dtstr(task_instance.start_ts + task_instance.duration);
      }
    }
  }
}

var devicePixelRatio = window.devicePixelRatio || 1;
// JSON.parse is faster for large payloads than an object literal (because the JSON grammer is simpler!)
var data = JSON.parse({{ data|tojson }});
var barHeight = 20;
var axisHeight = 40;
var square_x = parseInt(500 * devicePixelRatio);
var square_size = 10;
var square_spacing = 2;
var margin = {top: barHeight/2 + axisHeight, right: 0, bottom: 0, left: barHeight/2},
    width = parseInt(960 * devicePixelRatio) - margin.left - margin.right,
    barWidth = width * 0.9;

var i = 0,
{'fraction_non_alphanumeric': 0.16405385466617484, 'fraction_numerical': 0.009037255625230542, 'mean_word_length': 4.471745711402623, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3298060', 'n_tokens_mistral': 3615, 'n_tokens_neox': 3448, 'n_words': 915}