LinearB metrics comparison

Add metrics WW is striving for

目前为 2022-02-22 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @author Rolandas Valantinas
  3. // @description Add metrics WW is striving for
  4. // @include *app.linearb.io/performance*
  5. // @name LinearB metrics comparison
  6. // @namespace https://greasyfork.org/users/157178
  7. // @require https://code.jquery.com/jquery-3.2.1.min.js
  8. // @supportURL https://github.com/rolandas-valantinas/gists/issues
  9. // @version 1.1
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. var metricsButton = `<input type="button" id="add-ww-metrics" value="Add WW Metrics">`;
  14. var intervalButton = setInterval(addButton, 2000);
  15. var attempts = 0;
  16.  
  17. function appendData(title, value) {
  18. $("p:contains('"+title+"')").first().parent().siblings().children().first().children().first().append(value);
  19. };
  20.  
  21. function addMetrics() {
  22. console.log('add addMetrics');
  23.  
  24. appendData('CODING TIME', ' / <24h');
  25. appendData('PICKUP TIME', ' / <12h');
  26. appendData('REVIEW TIME', ' / <4h');
  27. appendData('PRS OPENED', ' / <500');
  28. appendData('PR SIZE', ' / <500');
  29. appendData('REVIEW DEPTH', ' / 2-4');
  30. appendData('NEW CODE', ' / >70%');
  31. appendData('REFACTOR', ' / <25%');
  32. appendData('REWORK', ' / <5%');
  33.  
  34. appendData('CYCLE TIME', ' / <2 days');
  35. appendData('DEPLOY FREQUENCY', ' / >1 per day');
  36. appendData('DEPLOY TIME', ' / <6h');
  37. appendData('MTTR', ' / <4h');
  38. }
  39.  
  40.  
  41. function addButton() {
  42. console.log('add button');
  43. attempts++;
  44. var toolbar = $('div.MuiInputBase-root');
  45.  
  46. if (toolbar.length > 0) {
  47. toolbar.parent().parent().append(metricsButton);
  48. $('#add-ww-metrics').click(addMetrics);
  49. attempts = 10;
  50. }
  51.  
  52. if (attempts > 5) {
  53. clearInterval(intervalButton);
  54. }
  55. }
  56. })();