LinearB metrics comparison

Add metrics WW is striving for

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         LinearB metrics comparison
// @author       Rolandas Valantinas
// @description  Add metrics WW is striving for
// @include      *app.linearb.io/performance*
// @namespace    https://greasyfork.org/users/157178
// @require      https://code.jquery.com/jquery-3.2.1.min.js
// @supportURL   https://github.com/rolandas-valantinas/gists/issues
// @version      1.6
// ==/UserScript==

(function () {
    var metricsButton = `<input type="button" id="add-ww-metrics" value="Add WW Metrics">`;
    var intervalButton = setInterval(addButton, 2000);
    var attempts = 0;

    function appendData(title, value) {
        $("p[data-cy='"+title+"']").append(value);
    };

    function addMetrics() {
        console.log('add addMetrics');

        appendData('coding-time-graph-value', ' / <24h');
        appendData('pickup-time-graph-value', ' / <12h');
        appendData('review-time-graph-value', ' / <4h');
        appendData('prs-opened-graph-value', ' / >2 per day');
        appendData('pr-size-graph-value', ' / <500');
        appendData('review-depth-graph-value', ' / 2-4');
        appendData('new-code-graph-value', ' / >70%');
        appendData('refactor-graph-value', ' / <25%');
        appendData('rework-graph-value', ' / <5%');

        appendData('cycle-time-graph-value', ' / <2 days');
        appendData('deploy-frequency-graph-value', ' / >1 per day');
        appendData('deploy-time-graph-value', ' / <6h');
        appendData('mttr-graph-value', ' / <4h');
    }


    function addButton() {
        console.log('add button');
        attempts++;
        var toolbar = $("div[data-cy='Dashboard-data-cy']");
        console.log(toolbar);

        if (toolbar.length > 0) {
            toolbar.append(metricsButton);
            $('#add-ww-metrics').click(addMetrics);
            attempts = 10;
            console.log('button added');
        }

        if (attempts > 5) {
            clearInterval(intervalButton);
        }
    }
})();