1-click Pipeline to Cloudwatch

Iterates through child elements of liveDataSamplesDiv

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        1-click Pipeline to Cloudwatch
// @version     1.0
// @description Iterates through child elements of liveDataSamplesDiv
// @author      Syed Shuaib Zaidi (zidisz@)
// @require     https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
// @include     https://pipelines.amazon.com/*
// @grant       GM_setClipboard
// @namespace https://greasyfork.org/users/1467838
// ==/UserScript==


$(document).ready(function() {
    'use strict';

    // Select all divs with class naws-detail and title AWS Account
    const awsAccountDivs = document.querySelectorAll('div.naws-detail[title="AWS Account"]');

    awsAccountDivs.forEach(div => {
        const originalLink = div.querySelector('a');
        originalLink.className = "button";
        originalLink.title = "Conduit";

        // Create a fresh div
        const cwDashboardLink = document.createElement('div');
        cwDashboardLink.className = 'naws-detail';
        cwDashboardLink.title = 'Dashboard link';

        // Create a hyperlink for the account
        const hyperlink1 = document.createElement('a');
        hyperlink1.className = "button";
        hyperlink1.href = "https://cw-dashboards.aka.amazon.com/cloudwatch/dashboardInternal?accountId=" + div.textContent.trim();
        hyperlink1.textContent = 'Dashboard link';
        hyperlink1.style.marginLeft = '10px';

        // Append the hyperlink to the new div
        cwDashboardLink.appendChild(hyperlink1);

        // Insert the cloned div after the original
        div.parentNode.insertBefore(cwDashboardLink, div.nextSibling);

        // Create a fresh div
        const cwMetricsLink = document.createElement('div');
        cwMetricsLink.className = 'naws-detail';
        cwMetricsLink.title = 'Metrics link';

        // Create a hyperlink for the account
        const hyperlink2 = document.createElement('a');
        hyperlink2.className = "button";
        hyperlink2.href = "https://cw-dashboards.aka.amazon.com/?accountId=" + div.textContent.trim() + "#metricsV2" ;
        hyperlink2.textContent = 'Metrics link';
        hyperlink2.style.marginLeft = '10px';

        // Append the hyperlink to the new div
        cwMetricsLink.appendChild(hyperlink2);

        // Insert the cloned div after the original
        div.parentNode.insertBefore(cwMetricsLink, div.nextSibling);
    });
})();