Kill Application2

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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://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);
})();