debian-mirror-gitlab/app/presenters/dev_ops_report/metric_presenter.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

153 lines
4.8 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2020-11-24 15:15:51 +05:30
module DevOpsReport
2017-09-10 17:25:29 +05:30
class MetricPresenter < Gitlab::View::Presenter::Simple
2022-06-21 17:19:12 +05:30
presents ::DevOpsReport::Metric, as: :metric
2021-11-18 22:05:49 +05:30
2022-06-21 17:19:12 +05:30
delegate :created_at, to: :metric
2021-04-17 20:07:23 +05:30
2017-09-10 17:25:29 +05:30
def cards
[
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Issues',
description: 'created per active user',
feature: 'issues',
blog: 'https://www2.deloitte.com/content/dam/Deloitte/se/Documents/technology-media-telecommunications/deloitte-digital-collaboration.pdf'
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Comments',
description: 'created per active user',
feature: 'notes',
blog: 'http://conversationaldevelopment.com/why/'
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Milestones',
description: 'created per active user',
feature: 'milestones',
blog: 'http://conversationaldevelopment.com/shorten-cycle/',
docs: help_page_path('user/project/milestones/index')
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Boards',
description: 'created per active user',
feature: 'boards',
blog: 'http://jpattonassociates.com/user-story-mapping/',
docs: help_page_path('user/project/issue_board')
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2021-04-29 21:17:54 +05:30
title: 'Merge requests',
2017-09-10 17:25:29 +05:30
description: 'per active user',
feature: 'merge_requests',
blog: 'https://8thlight.com/blog/uncle-bob/2013/02/01/The-Humble-Craftsman.html',
docs: help_page_path('user/project/merge_requests/index')
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Pipelines',
description: 'created per active user',
feature: 'ci_pipelines',
blog: 'https://martinfowler.com/bliki/ContinuousDelivery.html',
2021-09-30 23:02:18 +05:30
docs: help_page_path('ci/index')
2017-09-10 17:25:29 +05:30
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Environments',
description: 'created per active user',
feature: 'environments',
blog: 'https://about.gitlab.com/2016/08/26/ci-deployment-and-environments/',
2022-07-16 23:28:13 +05:30
docs: help_page_path('ci/environments/index')
2017-09-10 17:25:29 +05:30
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Deployments',
description: 'created per active user',
feature: 'deployments',
blog: 'https://puppet.com/blog/continuous-delivery-vs-continuous-deployment-what-s-diff'
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Monitoring',
description: 'fraction of all projects',
feature: 'projects_prometheus_active',
blog: 'https://prometheus.io/docs/introduction/overview/',
docs: help_page_path('user/project/integrations/prometheus')
),
Card.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Service Desk',
description: 'issues created per active user',
feature: 'service_desk_issues',
blog: 'http://blogs.forrester.com/kate_leggett/17-01-30-top_trends_for_customer_service_in_2017_operations_become_smarter_and_more_strategic',
docs: 'https://docs.gitlab.com/ee/user/project/service_desk.html'
)
]
end
def idea_to_production_steps
[
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Idea',
features: %w(issues)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Issue',
features: %w(issues notes)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Plan',
features: %w(milestones boards)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Code',
features: %w(merge_requests)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Commit',
features: %w(merge_requests)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Test',
features: %w(ci_pipelines)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Review',
features: %w(ci_pipelines environments)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Staging',
features: %w(environments deployments)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Production',
features: %w(deployments)
),
IdeaToProductionStep.new(
2022-06-21 17:19:12 +05:30
metric: metric,
2017-09-10 17:25:29 +05:30
title: 'Feedback',
features: %w(projects_prometheus_active service_desk_issues)
)
]
end
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2017-09-10 17:25:29 +05:30
def average_percentage_score
cards.sum(&:percentage_score) / cards.size.to_f
end
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2017-09-10 17:25:29 +05:30
end
end