diff --git a/app/assets/javascripts/application/customer_bugs.coffee b/app/assets/javascripts/application/customer_bugs.coffee new file mode 100644 index 0000000000000000000000000000000000000000..d3025ac1b7a1eb3a69a26de89a8e1967733a088b --- /dev/null +++ b/app/assets/javascripts/application/customer_bugs.coffee @@ -0,0 +1,45 @@ +CustomerBugsNumber = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesPerLabelPercentageQuery( + 'Open', + @query_strings.Bugs, + '["customer","customer+"]', + @query_strings.IssuesScope + )) + @charts.BigNumberPercentage(element, query.query_string, query.view_string) + +CustomerBugsPie = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesPerLabelQuery( + 'Open', + @query_strings.Bugs, + '["customer","customer+"]', + @query_strings.IssuesScope + )) + @charts.PieChart(element, query.query_string, query.view_string) + +CustomerBugsCreatedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesCreatedPerMonthQuery( + 'Open', + '["bug", "customer"]', + @query_strings.Teams, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +CustomerPlusBugsCreatedPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.IssuablesCreatedPerMonthQuery( + 'Open', + '["bug", "customer+"]', + @query_strings.Teams, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +$(document).ready () -> + if document.getElementById('customer-bugs-number') + CustomerBugsNumber(document.getElementById('customer-bugs-number')) + if document.getElementById('customer-bugs-pie') + CustomerBugsPie(document.getElementById('customer-bugs-pie')) + if document.getElementById('customer-bugs-created-per-month') + CustomerBugsCreatedPerMonthChart(document.getElementById('customer-bugs-created-per-month')) + if document.getElementById('customer-plus-bugs-created-per-month') + CustomerPlusBugsCreatedPerMonthChart(document.getElementById('customer-plus-bugs-created-per-month')) diff --git a/app/assets/javascripts/application/teams.coffee b/app/assets/javascripts/application/teams.coffee index 991d437eb1ad096bd063a414345f44386f7a7f70..1b8f12d423340710b7f5300c53cdaa1ec027508e 100644 --- a/app/assets/javascripts/application/teams.coffee +++ b/app/assets/javascripts/application/teams.coffee @@ -2,27 +2,19 @@ team_label_query_segment = (label_json) -> label_array = if label_json then JSON.parse(label_json) else [] label_array.push($('#team-label').val()) JSON.stringify(label_array) -TeamBugsSeverityNumber = (element) -> +CustomerBugsNumber = (element) -> query = @queries.ScopedQuery(@queries.IssuablesPerLabelPercentageQuery( 'Open', - team_label_query_segment(@query_strings.Bugs), - @query_strings.Severities, + @query_strings.Bugs, + "['customer','customer+']", @query_strings.IssuesScope )) @charts.BigNumberPercentage(element, query.query_string, query.view_string) -TeamBugsPriorityNumber = (element) -> - query = @queries.ScopedQuery(@queries.IssuablesPerLabelPercentageQuery( - 'Open', - team_label_query_segment(@query_strings.Bugs), - @query_strings.Priorities, - @query_strings.IssuesScope - )) - @charts.BigNumberPercentage(element, query.query_string, query.view_string) -TeamBugsSeverityPie = (element) -> +CustomerBugsPie = (element) -> query = @queries.ScopedQuery(@queries.IssuablesPerLabelQuery( 'Open', - team_label_query_segment(@query_strings.Bugs), - @query_strings.Severities, + @query_strings.Bugs, + "['customer','customer+']", @query_strings.IssuesScope )) @charts.PieChart(element, query.query_string, query.view_string) diff --git a/app/views/groups/customer_bugs.html.haml b/app/views/groups/customer_bugs.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..379af90ae926d85398e96c08effa639b278a58bc --- /dev/null +++ b/app/views/groups/customer_bugs.html.haml @@ -0,0 +1,2 @@ += render partial: 'shared/customer_bugs', locals: { source: @group } += render partial: 'shared/project_level_links', locals: { group: @group, name: 'customer bugs', link: method(:group_project_customer_bugs_path) } diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 4d9a69577af56d06f1552e947fdcbf6c00db7182..593715c759997555e98d93974bdceb20701b61d8 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -35,6 +35,7 @@ = 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' = link_to 'Bug Classification', group_bug_classification_path(@group.path), class: 'list-group-item' + = link_to 'Customer Bugs', group_customer_bugs_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 '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' diff --git a/app/views/projects/customer_bugs.html.haml b/app/views/projects/customer_bugs.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..636868bf7aa50a14dcf6746989d5a3b7178280b6 --- /dev/null +++ b/app/views/projects/customer_bugs.html.haml @@ -0,0 +1 @@ += render partial: 'shared/customer_bugs', locals: { source: @project } diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index e21449f336792af91ef307e666dc065914946c97..e310f0aca285aa541bd3bbbd78823d488df839cb 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -33,6 +33,7 @@ = 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' = link_to 'Bug Classification', group_project_bug_classification_path(@group.path, @project.path), class: 'list-group-item' + = link_to 'Customer Bugs', group_project_customer_bugs_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 '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' diff --git a/app/views/shared/_customer_bugs.html.haml b/app/views/shared/_customer_bugs.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..6c0317f9007c8bbcd592511693c9ed64f32ab1b1 --- /dev/null +++ b/app/views/shared/_customer_bugs.html.haml @@ -0,0 +1,40 @@ +.container + .page-header + %h1.page-title= "Dashboard: #{source.path}" + .page-header + %h2.page-title Customer Bugs + .row.row-cards + .col-6.col-sm-4.col-lg-2 + .card + .card-body.p-3.text-center + #customer-bugs-number + .total.h1.m-0 0 + .text-muted.mb-4 Percentage Bugs Customer + .col-4 + .card + .card-header + %h3.card-title Open Bugs by Customer Label + .card-body + %canvas#customer-bugs-pie + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Customer Bugs Created Per Month + .card-body + %canvas#customer-bugs-created-per-month + .card-body + %div + %div.text-wrap + %p Displays number of remaining, open, customer bugs created over time grouped by Team + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Customer+ Bugs Created Per Month + .card-body + %canvas#customer-plus-bugs-created-per-month + .card-body + %div + %div.text-wrap + %p Displays number of remaining, open, customer+ bugs created over time grouped by Team diff --git a/config/routes.rb b/config/routes.rb index aafa3326a9b3c4a0d351ef76d34e5d3bdd05f899..0385d3c204b4db5ff262b0ef074f5ed0ee9bbc27 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,6 +4,7 @@ Rails.application.routes.draw do get :bugs_by_team get :bugs_by_severity get :bugs_by_priority + get :customer_bugs get :feature_proposals_by_team get :issues_by_state get :mrs_by_state @@ -21,6 +22,7 @@ Rails.application.routes.draw do get :bugs_by_team get :bugs_by_severity get :bugs_by_priority + get :customer_bugs get :feature_proposals_by_team get :issues_by_state get :mrs_by_state diff --git a/lib/gitlab_insights.rb b/lib/gitlab_insights.rb index d0264d3e75c2f8c4fd2b056d778a32323899d401..2f1ced90af5f3939b71a80f7b5aa7ca03775a6e4 100644 --- a/lib/gitlab_insights.rb +++ b/lib/gitlab_insights.rb @@ -32,6 +32,7 @@ module GitlabInsights COMMUNITY_CONTRIBUTION_COLOR = "#a8d695" DEFAULT_COLOR = "#428bca" LINE_COLOR = COLOR_SCHEME[:red] + CUSTOMER_COLOR = "#ad4363" STATIC_COLOR_MAP = { UNCATEGORIZED => UNCATEGORIZED_COLOR, @@ -64,6 +65,7 @@ module GitlabInsights "Geo" => COLOR_SCHEME[:lavender], "Quality" => COLOR_SCHEME[:maroon], "gitter" => COLOR_SCHEME[:brown], - "frontend" => COLOR_SCHEME[:mint] + "frontend" => COLOR_SCHEME[:mint], + "customer" => CUSTOMER_COLOR } end