Kill Application2

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

Pada tanggal 30 Agustus 2023. Lihat %(latest_version_link).

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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 Application2
// @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://node01: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);
})();