Kill Application

Automatically append user.name=root to Kill Application requests in YARN Web UI

ของเมื่อวันที่ 30-08-2023 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Kill Application
// @namespace    http://candao.com/
// @version      1.4
// @description  Automatically append user.name=root to Kill Application requests in YARN Web UI
// @author       Bruce Lu
// @match        http://node02:8088/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function interceptRequests() {
        const userName = 'root';
        const originalOpen = XMLHttpRequest.prototype.open;
        const baseUri = 'http://node02:8088'

        XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
            if (method.toLowerCase() === 'put' && url.includes('/ws/v1/cluster/apps/')) {
                url = baseUri + url;
                url += (url.includes('?') ? '&' : '?') + 'user.name=' + userName;
                console.log('Modified request URL:', url);
            }

            return originalOpen.apply(this, [method, url, async, user, password]);
        };
    }

    const script = document.createElement('script');
    script.textContent = `(${interceptRequests.toString()})();`;
    document.head.appendChild(script);
})();