Greasy Fork is available in English.

new airflow TreeView 界面替换DAG的-为_

airflow TreeView 界面替换DAG的-为_,方便🔍

// ==UserScript==
// @name         new airflow TreeView 界面替换DAG的-为_
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  airflow TreeView 界面替换DAG的-为_,方便🔍
// @author       SunnyBean
// @match        http://airflow.yimian.com.cn/tree*
// @match        http://172.16.24.11:18080/admin/airflow/tree*
// @icon         https://www.google.com/s2/favicons?domain=yimian.com.cn
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let all_dags = document.querySelectorAll('.node.parent.expanded > text, .node.leaf > text');
    for (let i = 0; i < all_dags.length; i++) {
        let n = all_dags[i];
        let content_arr = n.textContent.split('.');
        // console.info(n);
        // console.info(content_arr);
        if(content_arr.length >= 2 && content_arr[0] != 'dummy'){
            for (let j = 0 ; j < content_arr.length - 1; j++) {
                content_arr[j] = content_arr[j].replaceAll('-', '_');
            }
            // console.info(content_arr);
            let txt = content_arr.join('.');
            // console.info(txt);
            n.textContent = txt;
            // console.info(n.textContent);
        }
    }

    //Make the UI wider so I can see all dags

    /*
    function get_and_set_attr_int(element, atrribute, incre){
        element.setAttribute(atrribute, parseInt(element.getAttribute(atrribute)) + incre)
    }


    get_and_set_attr_int($('#tree-svg')[0], 'width', 2000)


    var rects = $('rect')
    for(let i = 0; i < rects.length; i++){
        get_and_set_attr_int(rects[i], 'x', 200)
    }
    */
    // Your code here...
})();