diff --git a/app/assets/javascripts/application/issues_by_category.coffee b/app/assets/javascripts/application/issues_by_category.coffee new file mode 100644 index 0000000000000000000000000000000000000000..c13e5c88210df4648e8b457029114864a2d46ea7 --- /dev/null +++ b/app/assets/javascripts/application/issues_by_category.coffee @@ -0,0 +1,19 @@ +IssuesByCategoryPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.EveryIssuablesCreatedPerMonthQuery( + @query_strings.IssueCategories, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) +OpenIssuesByCategoryPerMonthChart = (element) -> + query = @queries.ScopedQuery(@queries.UnfilteredIssuablesCreatedPerMonthQuery( + 'Open', + @query_strings.IssueCategories, + @query_strings.IssuesScope + )) + @charts.StackedBarChart(element, query.query_string, query.view_string) + +$(document).ready () -> + if document.getElementById('issues-by-category') + IssuesByCategoryPerMonthChart(document.getElementById('issues-by-category')) + if document.getElementById('open-issues-by-category') + OpenIssuesByCategoryPerMonthChart(document.getElementById('open-issues-by-category')) diff --git a/app/assets/javascripts/application/queries.coffee b/app/assets/javascripts/application/queries.coffee index c1895ad93c649854e667ae5a3888d786e3c0b614..fce4a0eeedd0429ebe265e590999ccd6016abf85 100644 --- a/app/assets/javascripts/application/queries.coffee +++ b/app/assets/javascripts/application/queries.coffee @@ -52,6 +52,32 @@ project_query = (group_path, project_path, view_string, inner_query) -> } } ' + UnfilteredIssuablesCreatedPerMonthQuery: (state_string, collection_labels_string, issuable_scope) -> + view_string: 'issuables_created_per_month', + query_string: ' + issuables_created_per_month(state:' + state_string + ', collection_labels: ' + collection_labels_string + ', issuable_scope: ' + issuable_scope + ') { + labels + datasets { + label + data + borderColor + backgroundColor + } + } + ' + EveryIssuablesCreatedPerMonthQuery: (collection_labels_string, issuable_scope) -> + view_string: 'issuables_created_per_month', + query_string: ' + issuables_created_per_month(collection_labels: ' + collection_labels_string + ', issuable_scope: ' + issuable_scope + ') { + labels + datasets { + label + data + borderColor + backgroundColor + } + } + ' IssuablesClosedPerMonthQuery: (state_string, filter_labels_string, collection_labels_string, issuable_scope) -> view_string: 'issuables_closed_per_month', query_string: ' diff --git a/app/assets/javascripts/application/query_strings.coffee b/app/assets/javascripts/application/query_strings.coffee index 465c2dc06f7d3d38f5332d84522909c112c7b352..425afad85c68d762418ba83e450a158a510470c1 100644 --- a/app/assets/javascripts/application/query_strings.coffee +++ b/app/assets/javascripts/application/query_strings.coffee @@ -13,5 +13,6 @@ MissedDeliverable: '["missed-deliverable"]', MissedDeliverableMilestones: '["missed:11.0","missed:11.1","missed:11.2","missed:11.3","missed:11.4","missed:11.5", "missed:11.6", "missed:11.7", "missed:11.8", "missed:11.9", "missed:11.10", "missed:11.11", "missed:12.0"]' MergeRequestCategories: '["Community contribution","security","bug","feature","backstage"]' + IssueCategories: '["bug","feature","support request","backstage"]' TeamMRWeeks: 12 TeamMRMonths: 24 diff --git a/app/views/groups/issues_by_category.html.haml b/app/views/groups/issues_by_category.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..7b479b3fb8f17fc3c588d338169e9f042da5af1e --- /dev/null +++ b/app/views/groups/issues_by_category.html.haml @@ -0,0 +1,2 @@ += render partial: 'shared/issues_by_category', locals: { source: @group } += render partial: 'shared/project_level_links', locals: { group: @group, name: 'issues by category', link: method(:group_project_issues_by_category_path) } diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 33d1a32f1a0dfe9fea002f56a6f10c39780c10c9..ad7f353f9a3751fa1d41c61348713e63dd0c4099 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -26,6 +26,7 @@ = link_to 'Time to Close Bugs', group_time_to_close_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 'Issues by Category', group_issues_by_category_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' = link_to 'Missed Deliverables', group_missed_deliverables_path(@group.path), class: 'list-group-item' diff --git a/app/views/projects/issues_by_category.html.haml b/app/views/projects/issues_by_category.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..d270236b7437046377fd8197291ff8b79e5bdcff --- /dev/null +++ b/app/views/projects/issues_by_category.html.haml @@ -0,0 +1 @@ += render partial: 'shared/issues_by_category', locals: { source: @project } diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index bf50cc8a3e9df48e9ea6e41a624afe66a9712c90..fa24158a25564edc35fe82e27c7efd12e90e5e7f 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -24,6 +24,7 @@ = link_to 'Time to Close Bugs', group_project_time_to_close_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 'Issues by Category', group_project_issues_by_category_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' = link_to 'Missed Deliverables', group_project_missed_deliverables_path(@group.path, @project.path), class: 'list-group-item' diff --git a/app/views/shared/_issues_by_category.html.haml b/app/views/shared/_issues_by_category.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..59872252fc7c90e7836d37bdf5cba5f990a8de36 --- /dev/null +++ b/app/views/shared/_issues_by_category.html.haml @@ -0,0 +1,27 @@ +.container + .page-header + %h1.page-title= "Dashboard: #{source.path}" + .page-header + %h2.page-title Issues by Category Per Month + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title All Issues by Category + .card-body + %canvas#issues-by-category + .card-body + %div + %div.text-wrap + %p Issues in all states (Open/Closed) split by main type labels, `bug`, `feature`, `support request`, `backstage` + .row.row-cards + .col-lg-12 + .card + .card-header + %h3.card-title Open Issues by Category + .card-body + %canvas#open-issues-by-category + .card-body + %div + %div.text-wrap + %p Issues that remain open split by main type labels, `bug`, `feature`, `support request`, `backstage` diff --git a/config/routes.rb b/config/routes.rb index 7ee4a53710a8a6df4e33fafb15d8d80e91f8d0f3..26f5aa16aee1bd78b0436863435292c9c8c7818e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ Rails.application.routes.draw do get :bugs_past_slo get :feature_proposals_by_team get :issues_by_state + get :issues_by_category get :mrs_by_state get :regressions get :missed_deliverables @@ -28,6 +29,7 @@ Rails.application.routes.draw do get :bugs_past_slo get :feature_proposals_by_team get :issues_by_state + get :issues_by_category get :mrs_by_state get :regressions get :missed_deliverables diff --git a/lib/gitlab_insights.rb b/lib/gitlab_insights.rb index 70593b50858c3551c32346edbed8c01b81a3e274..3e235c551c37847a8d5e511dafe9b8975541ae08 100644 --- a/lib/gitlab_insights.rb +++ b/lib/gitlab_insights.rb @@ -31,6 +31,7 @@ module GitlabInsights BUG_COLOR = "#ff0000" SECURITY_COLOR = "#d9534f" COMMUNITY_CONTRIBUTION_COLOR = "#a8d695" + SUPPORT_COLOR = "#ad8d43" DEFAULT_COLOR = "#428bca" LINE_COLOR = COLOR_SCHEME[:red] @@ -54,6 +55,7 @@ module GitlabInsights "security" => SECURITY_COLOR, "Community contribution" => COMMUNITY_CONTRIBUTION_COLOR, "backstage" => DEFAULT_COLOR, + 'support request' => SUPPORT_COLOR, "Manage" => COLOR_SCHEME[:orange], "Plan" => COLOR_SCHEME[:green], "Create" => COLOR_SCHEME[:yellow], @@ -74,7 +76,7 @@ module GitlabInsights 'avg' => AVG_COLOR, '85' => PERCENTILE_85_COLOR, '95' => PERCENTILE_95_COLOR, - 'closed' => CLOSED_ISSUES_COLOR + 'closed' => CLOSED_ISSUES_COLOR, } TEAMS = [