您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add the story points to the "Two Dimensional Filter Statistics" dashboard gadget. You can not add custom external gadgets to Jira cloud. This works around the issue. See also
当前为
//The MIT License (MIT) //Copyright (c) 2016 Jeff Wilde //Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: //The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ==UserScript== // @name Add Story Points to Jira Dashboard // @namespace http://vivintsolar.com/ // @version 0.1 // @description Add the story points to the "Two Dimensional Filter Statistics" dashboard gadget. You can not add custom external gadgets to Jira cloud. This works around the issue. See also // https://answers.atlassian.com/questions/85876/two-dimensional-filter-statistics-summing-story-point // @author Jeff Wilde // @match https://*.atlassian.net/secure/Dashboard.jspa* // @grant none // ==/UserScript== /* jshint -W097 */ /* globals $, _ */ /* jshint esnext: true */ (function () { 'use strict'; const getStoryPointField = () => { const deferred = $.Deferred(); $ .get(window.location.origin + "/rest/api/2/field") .then((data) => { var storyPointFields = _.where(data, { name: "Story Points" }); if (storyPointFields.length === 1) { deferred.resolve(storyPointFields[0]); } else { deferred.reject(); } }) .fail(() => { deferred.reject(); }); return deferred.promise(); }; var storyPointField = getStoryPointField(); const jqlSearch = (jql) => { const deferred = $.Deferred(); let url = window.location.origin; url += "/rest/api/2/search"; url += jql; $.get(url, function (data) { if (data && data.issues) { storyPointField.then((field) => { let storyPoints = data.issues.map((issue) => { return issue.fields[field.id]; }); let storyPointSum = storyPoints.reduce((prev, curr) => prev + curr, 0); deferred.resolve(storyPointSum); }); } }); return deferred.promise(); }; const parseJqlParameter = (url, link) => { let jqlIndex = url.indexOf("?jql"); let jql = url.substring(jqlIndex); jqlSearch(jql).then((points) => { link.text(points); }); }; const getStoryPoints = (td) => { const links = td.find("a"); links.each(function () { let link = $(this); let href = link.attr("href"); let jqlIndex = href.indexOf("?jql"); let fliterIndex = href.indexOf("?filter"); if (jqlIndex < 0 && fliterIndex >= 0) { let filter = href.substring(fliterIndex + 8); let url = window.location.origin; url += "/rest/api/2/filter/"; url += filter; $.get(url, function (data) { parseJqlParameter(data.searchUrl, link); }); } else if (jqlIndex >= 0) { parseJqlParameter(href, link); } }); }; const changeTableHead = (table) => { const headTrs = table.find('thead tr'); const gadgetHeads = headTrs.find("th:not(.axis)"); gadgetHeads.each(function () { let head = $(this); let clone = head.clone(); head.after(clone); clone.html(clone.html() + "<br/> Story Points"); }); }; const changeTablebody = (table) => { var headTrs = table.find('tbody tr'); var gadgetHeads = headTrs.find("td:not(.scope)"); gadgetHeads.each(function () { let cell = $(this); let clone = cell.clone(); clone.find('a').text(""); cell.after(clone); getStoryPoints(clone); }); }; const addPointsToTable = (table) => { changeTableHead(table); changeTablebody(table); }; $(document).ready(function () { $(".two-d-container .aui").each(function () { addPointsToTable($(this)); }); document.addEventListener("DOMNodeInserted", function (e) { const tables = $(e.target).find(".aui"); if ($(e.target).is(".two-d-container") && tables.length > 0) { console.log(tables); tables.each(function () { addPointsToTable($(this)); }); } }, false); }); }());
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址