From 2d2c04c59602bcd200d39cb1d3f4238b666b137b Mon Sep 17 00:00:00 2001 From: Mark Fletcher Date: Wed, 29 May 2019 12:24:13 +0100 Subject: [PATCH 1/2] Created Bugs By Stage Dashboard --- .../application/bugs_by_stage.coffee | 56 +++++++++++++++++ .../application/query_strings.coffee | 1 + app/views/groups/bugs_by_stage.html.haml | 2 + app/views/groups/show.html.haml | 1 + app/views/projects/bugs_by_stage.html.haml | 1 + app/views/projects/show.html.haml | 1 + app/views/shared/_bugs_by_stage.html.haml | 60 +++++++++++++++++++ config/routes.rb | 2 + lib/gitlab_insights.rb | 14 ++++- 9 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/application/bugs_by_stage.coffee create mode 100644 app/views/groups/bugs_by_stage.html.haml create mode 100644 app/views/projects/bugs_by_stage.html.haml create mode 100644 app/views/shared/_bugs_by_stage.html.haml diff --git a/app/assets/javascripts/application/bugs_by_stage.coffee b/app/assets/javascripts/application/bugs_by_stage.coffee new file mode 100644 index 0000000..e1edfb4 --- /dev/null +++ b/app/assets/javascripts/application/bugs_by_stage.coffee @@ -0,0 +1,56 @@ +StageCumulativeBugsCreatedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.CumulativeIssuablesCreatedPerMonthQuery( + 'Open', + @query_strings.Bugs, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.LineChart(element, query.query_string, query.view_string) + +StageBugsCreatedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesCreatedPerMonthQuery( + 'Open', + @query_strings.Bugs, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.LineChart(element, query.query_string, query.view_string) + +StageBugsCreatedPerDayChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesCreatedPerDayQuery( + 'Open', + @query_strings.Bugs, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +StageBugsClosedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesClosedPerMonthQuery( + 'Closed', + @query_strings.Bugs, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.LineChart(element, query.query_string, query.view_string) + +StageBugsClosedPerDayChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesClosedPerDayQuery( + 'Closed', + @query_strings.Bugs, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +$(document).ready () -> + if document.getElementById('cumulative-bugs-created-per-month-stage') + StageCumulativeBugsCreatedPerMonthChart(document.getElementById('cumulative-bugs-created-per-month-stage')) + if document.getElementById('bugs-created-per-month-stage') + StageBugsCreatedPerMonthChart(document.getElementById('bugs-created-per-month-stage')) + if document.getElementById('bugs-created-per-day-stage') + StageBugsCreatedPerDayChart(document.getElementById('bugs-created-per-day-stage')) + if document.getElementById('bugs-closed-per-month-stage') + StageBugsClosedPerMonthChart(document.getElementById('bugs-closed-per-month-stage')) + if document.getElementById('bugs-closed-per-day-stage') + StageBugsClosedPerDayChart(document.getElementById('bugs-closed-per-day-stage')) diff --git a/app/assets/javascripts/application/query_strings.coffee b/app/assets/javascripts/application/query_strings.coffee index 3b7f671..131f306 100644 --- a/app/assets/javascripts/application/query_strings.coffee +++ b/app/assets/javascripts/application/query_strings.coffee @@ -2,6 +2,7 @@ IssuesScope: 'Issues', MergeRequestsScope: 'MergeRequests', Teams: '["Manage", "Plan", "Create", "Package", "Serverless", "Fulfillment", "Release", "Verify", "Configure", "Monitor", "Secure", "Distribution", "Gitaly", "Geo", "Quality", "security", "gitter", "frontend"]', + Stages: '["devops::manage", "devops::plan", "devops::create", "devops::package", "devops::release", "devops::verify", "devops::configure", "devops::monitor", "devops::secure", "devops::defend", "devops::growth", "devops::enablement"]', Severities: '["S4", "S3", "S2", "S1"]', Priorities: '["P4", "P3", "P2", "P1"]', Bugs: '["bug"]', diff --git a/app/views/groups/bugs_by_stage.html.haml b/app/views/groups/bugs_by_stage.html.haml new file mode 100644 index 0000000..9630807 --- /dev/null +++ b/app/views/groups/bugs_by_stage.html.haml @@ -0,0 +1,2 @@ += render partial: 'shared/bugs_by_stage', locals: { source: @group } += render partial: 'shared/project_level_links', locals: { group: @group, name: 'bugs by stage', link: method(:group_project_bugs_by_stage_path) } diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 4d9a695..04dbb9c 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -31,6 +31,7 @@ = link_to 'Monthly Merged MRs', group_monthly_merged_mrs_path(@group.path), class: 'list-group-item' = link_to 'Merge Request Throughputs', group_throughputs_path(@group.path), class: 'list-group-item' = link_to 'Average MRs Merged Per Author Per Month', group_average_mrs_per_month_path(@group.path), class: 'list-group-item' + = link_to 'Bugs By Stage', group_bugs_by_stage_path(@group.path), class: 'list-group-item' = link_to 'Bugs By Team', group_bugs_by_team_path(@group.path), class: 'list-group-item' = link_to 'Bugs By Severity', group_bugs_by_severity_path(@group.path), class: 'list-group-item' = link_to 'Bugs By Priority', group_bugs_by_priority_path(@group.path), class: 'list-group-item' diff --git a/app/views/projects/bugs_by_stage.html.haml b/app/views/projects/bugs_by_stage.html.haml new file mode 100644 index 0000000..afabce7 --- /dev/null +++ b/app/views/projects/bugs_by_stage.html.haml @@ -0,0 +1 @@ += render partial: 'shared/bugs_by_stage', locals: { source: @project } diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index e21449f..456b73b 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -29,6 +29,7 @@ = link_to 'Monthly Merged MRs', group_project_monthly_merged_mrs_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Merge Request Throughputs', group_project_throughputs_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Average MRs Merged Per Author Per Month', group_project_average_mrs_per_month_path(@group.path, @project.path), class: 'list-group-item' + = link_to 'Bugs By Stage', group_project_bugs_by_stage_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Bugs By Team', group_project_bugs_by_team_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Bugs By Severity', group_project_bugs_by_severity_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Bugs By Priority', group_project_bugs_by_priority_path(@group.path, @project.path), class: 'list-group-item' diff --git a/app/views/shared/_bugs_by_stage.html.haml b/app/views/shared/_bugs_by_stage.html.haml new file mode 100644 index 0000000..bb8a155 --- /dev/null +++ b/app/views/shared/_bugs_by_stage.html.haml @@ -0,0 +1,60 @@ +.container + .page-header + %h1.page-title= "Dashboard: #{source.path}" + .page-header + %h2.page-title Bugs By Stage + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Cumulative Bugs Created Per Month Per Stage + .card-body + %canvas#cumulative-bugs-created-per-month-stage + .card-body + %div + %div.text-wrap + %p Displays number of open bugs created over time grouped by their stage label + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Bugs Created Per Month Per Stage + .card-body + %canvas#bugs-created-per-month-stage + .card-body + %div + %div.text-wrap + %p Displays number of open bugs created in a particular month grouped by their stage label + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Bugs Closed Per Month Per Stage + .card-body + %canvas#bugs-closed-per-month-stage + .card-body + %div + %div.text-wrap + %p Displays number of closed bugs closed in a particular month grouped by their stage label + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Bugs Created Per Day Per Stage + .card-body + %canvas#bugs-created-per-day-stage + .card-body + %div + %div.text-wrap + %p Displays number of open bugs created on a particular day grouped by their stage label + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Bugs Closed Per Day Per Stage + .card-body + %canvas#bugs-closed-per-day-stage + .card-body + %div + %div.text-wrap + %p Displays number of bugs closed on a particular day grouped by their stage label diff --git a/config/routes.rb b/config/routes.rb index aafa332..e24f38f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ Rails.application.routes.draw do resources :groups, only: [:index, :show], constraints: { id: /[^\/]+/ } do resources :projects, only: [:index, :show], constraints: { id: /\S+/ } do + get :bugs_by_stage get :bugs_by_team get :bugs_by_severity get :bugs_by_priority @@ -18,6 +19,7 @@ Rails.application.routes.draw do resources :teams, only: [:show] end + get :bugs_by_stage get :bugs_by_team get :bugs_by_severity get :bugs_by_priority diff --git a/lib/gitlab_insights.rb b/lib/gitlab_insights.rb index d0264d3..c55f148 100644 --- a/lib/gitlab_insights.rb +++ b/lib/gitlab_insights.rb @@ -64,6 +64,18 @@ module GitlabInsights "Geo" => COLOR_SCHEME[:lavender], "Quality" => COLOR_SCHEME[:maroon], "gitter" => COLOR_SCHEME[:brown], - "frontend" => COLOR_SCHEME[:mint] + "frontend" => COLOR_SCHEME[:mint], + "devops::manage" => COLOR_SCHEME[:orange], + "devops::plan" => COLOR_SCHEME[:green], + "devops::create" => COLOR_SCHEME[:yellow], + "devops::package" => COLOR_SCHEME[:purple], + "devops::release" => COLOR_SCHEME[:beige], + "devops::verify" => COLOR_SCHEME[:blue], + "devops::configure" => COLOR_SCHEME[:cyan], + "devops::monitor" => COLOR_SCHEME[:magenta], + "devops::secure" => COLOR_SCHEME[:lime], + "devops::defend" => COLOR_SCHEME[:pink], + "devops::growth" => COLOR_SCHEME[:teal], + "devops::enablement" => COLOR_SCHEME[:brown] } end -- GitLab From b4da1b61d4a1dbc2171aef1f68e5952e05928163 Mon Sep 17 00:00:00 2001 From: Mark Fletcher Date: Wed, 29 May 2019 12:33:05 +0100 Subject: [PATCH 2/2] Create Feature Proposals per Stage dashboard --- .../feature_proposals_by_stage.coffee | 23 ++++++++++++++++ .../feature_proposals_by_stage.html.haml | 2 ++ app/views/groups/show.html.haml | 1 + .../feature_proposals_by_stage.html.haml | 1 + app/views/projects/show.html.haml | 1 + .../_feature_proposals_by_stage.html.haml | 27 +++++++++++++++++++ config/routes.rb | 2 ++ 7 files changed, 57 insertions(+) create mode 100644 app/assets/javascripts/application/feature_proposals_by_stage.coffee create mode 100644 app/views/groups/feature_proposals_by_stage.html.haml create mode 100644 app/views/projects/feature_proposals_by_stage.html.haml create mode 100644 app/views/shared/_feature_proposals_by_stage.html.haml diff --git a/app/assets/javascripts/application/feature_proposals_by_stage.coffee b/app/assets/javascripts/application/feature_proposals_by_stage.coffee new file mode 100644 index 0000000..596949f --- /dev/null +++ b/app/assets/javascripts/application/feature_proposals_by_stage.coffee @@ -0,0 +1,23 @@ +StageProposalsCreatedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesCreatedPerMonthQuery( + 'Open', + @query_strings.FeatureProposals, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +StageProposalsClosedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesClosedPerMonthQuery( + 'Closed', + @query_strings.FeatureProposals, + @query_strings.Stages, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +$(document).ready () -> + if document.getElementById('proposals-created-per-month-stage') + StageProposalsCreatedPerMonthChart(document.getElementById('proposals-created-per-month-stage')) + if document.getElementById('proposals-closed-per-month-stage') + StageProposalsClosedPerMonthChart(document.getElementById('proposals-closed-per-month-stage')) diff --git a/app/views/groups/feature_proposals_by_stage.html.haml b/app/views/groups/feature_proposals_by_stage.html.haml new file mode 100644 index 0000000..48d24c9 --- /dev/null +++ b/app/views/groups/feature_proposals_by_stage.html.haml @@ -0,0 +1,2 @@ += render partial: 'shared/feature_proposals_by_stage', locals: { source: @group } += render partial: 'shared/project_level_links', locals: { group: @group, name: 'feature proposals by stage', link: method(:group_project_feature_proposals_by_stage_path) } diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 04dbb9c..6b0e0c0 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -37,6 +37,7 @@ = link_to 'Bugs By Priority', group_bugs_by_priority_path(@group.path), class: 'list-group-item' = link_to 'Bug Classification', group_bug_classification_path(@group.path), class: 'list-group-item' = link_to 'Feature Proposals by Team', group_feature_proposals_by_team_path(@group.path), class: 'list-group-item' + = link_to 'Feature Proposals by Stage', group_feature_proposals_by_stage_path(@group.path), class: 'list-group-item' = link_to 'Issues by State', group_issues_by_state_path(@group.path), class: 'list-group-item' = link_to 'EXPERIMENTAL - Merge Requests by State', group_mrs_by_state_path(@group.path), class: 'list-group-item' = link_to 'Regressions', group_regressions_path(@group.path), class: 'list-group-item' diff --git a/app/views/projects/feature_proposals_by_stage.html.haml b/app/views/projects/feature_proposals_by_stage.html.haml new file mode 100644 index 0000000..1c42787 --- /dev/null +++ b/app/views/projects/feature_proposals_by_stage.html.haml @@ -0,0 +1 @@ += render partial: 'shared/feature_proposals_by_stage', locals: { source: @project } diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 456b73b..e872319 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -35,6 +35,7 @@ = link_to 'Bugs By Priority', group_project_bugs_by_priority_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Bug Classification', group_project_bug_classification_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Feature Proposals by Team', group_project_feature_proposals_by_team_path(@group.path, @project.path), class: 'list-group-item' + = link_to 'Feature Proposals by Stage', group_project_feature_proposals_by_stage_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Issues by State', group_project_issues_by_state_path(@group.path, @project.path), class: 'list-group-item' = link_to 'EXPERIMENTAL - Merge Requests by State', group_project_mrs_by_state_path(@group.path, @project.path), class: 'list-group-item' = link_to 'Regressions', group_project_regressions_path(@group.path, @project.path), class: 'list-group-item' diff --git a/app/views/shared/_feature_proposals_by_stage.html.haml b/app/views/shared/_feature_proposals_by_stage.html.haml new file mode 100644 index 0000000..769a717 --- /dev/null +++ b/app/views/shared/_feature_proposals_by_stage.html.haml @@ -0,0 +1,27 @@ +.container + .page-header + %h1.page-title= "Dashboard: #{source.path}" + .page-header + %h2.page-title Feature Proposal by Stage + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Feature Proposal Created Per Month Per Stage + .card-body + %canvas#proposals-created-per-month-stage + .card-body + %div + %div.text-wrap + %p Displays number of open feature proposals created in a particular month grouped by their stage label + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Feature Proposals Closed Per Month Per Stage + .card-body + %canvas#proposals-closed-per-month-stage + .card-body + %div + %div.text-wrap + %p Displays number of closed feature proposals closed in a particular month grouped by their stage label diff --git a/config/routes.rb b/config/routes.rb index e24f38f..dc24fc8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,7 @@ Rails.application.routes.draw do get :bugs_by_severity get :bugs_by_priority get :feature_proposals_by_team + get :feature_proposals_by_stage get :issues_by_state get :mrs_by_state get :regressions @@ -24,6 +25,7 @@ Rails.application.routes.draw do get :bugs_by_severity get :bugs_by_priority get :feature_proposals_by_team + get :feature_proposals_by_stage get :issues_by_state get :mrs_by_state get :regressions -- GitLab