Commit 9f1e89ae authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch '296125-show-timeline-for-devops-score' into 'master'

Add last updated time to devops score page

See merge request gitlab-org/gitlab!55357
parents 9ba76acf b14c6de8
......@@ -2,6 +2,8 @@
module DevOpsReport
class MetricPresenter < Gitlab::View::Presenter::Simple
delegate :created_at, to: :subject
def cards
[
Card.new(
......
......@@ -9,6 +9,8 @@
= render 'no_data'
- else
.devops
.gl-my-3.gl-text-gray-400{ data: { testid: 'devops-score-note-text' } }
= s_('DevopsReport|DevOps score metrics are based on usage over the last 30 days. Last updated: %{timestamp}.').html_safe % { timestamp: @metric.created_at.strftime('%Y-%m-%d %H:%M') }
.devops-header
%h2.devops-header-title{ class: "devops-#{score_level(@metric.average_percentage_score)}-score" }
= number_to_percentage(@metric.average_percentage_score, precision: 1)
......
---
title: Add more explanation about the presented data and show the last updated time on the DevOps Score page
merge_request: 55357
author:
type: added
......@@ -27,6 +27,16 @@ RSpec.describe 'admin/dev_ops_report/show.html.haml' do
expect(rendered).not_to have_selector('#devops-adoption')
end
it 'shows the timestamp of the latest record' do
assign(:metric, create(:dev_ops_report_metric, created_at: Time.utc(2012, 5, 1, 14, 30)).present)
render
page = Capybara.string(rendered)
note_node = page.find("div[data-testid='devops-score-note-text']")
expect(note_node.text).to include('Last updated: 2012-05-01 14:30.')
end
end
context 'when show_adoption? returns true' do
......
......@@ -10570,6 +10570,9 @@ msgstr ""
msgid "DevopsReport|DevOps Score"
msgstr ""
msgid "DevopsReport|DevOps score metrics are based on usage over the last 30 days. Last updated: %{timestamp}."
msgstr ""
msgid "DevopsReport|Score"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment