Commit 4689bac8 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 6e3880e2
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
# to the parameters specified by the controller. # to the parameters specified by the controller.
module MetricsDashboard module MetricsDashboard
include RenderServiceResults include RenderServiceResults
include ChecksCollaboration
extend ActiveSupport::Concern extend ActiveSupport::Concern
def metrics_dashboard def metrics_dashboard
...@@ -14,7 +16,7 @@ module MetricsDashboard ...@@ -14,7 +16,7 @@ module MetricsDashboard
) )
if include_all_dashboards? && result if include_all_dashboards? && result
result[:all_dashboards] = dashboard_finder.find_all_paths(project_for_dashboard) result[:all_dashboards] = all_dashboards
end end
respond_to do |format| respond_to do |format|
...@@ -30,6 +32,30 @@ module MetricsDashboard ...@@ -30,6 +32,30 @@ module MetricsDashboard
private private
def all_dashboards
dashboards = dashboard_finder.find_all_paths(project_for_dashboard)
dashboards.map do |dashboard|
amend_dashboard(dashboard)
end
end
def amend_dashboard(dashboard)
project_dashboard = project_for_dashboard && !dashboard[:system_dashboard]
dashboard[:can_edit] = project_dashboard ? can_edit?(dashboard) : false
dashboard[:project_blob_path] = project_dashboard ? dashboard_project_blob_path(dashboard) : nil
dashboard
end
def dashboard_project_blob_path(dashboard)
project_blob_path(project_for_dashboard, File.join(project_for_dashboard.default_branch, dashboard.fetch(:path, "")))
end
def can_edit?(dashboard)
can_collaborate_with_project?(project_for_dashboard, ref: project_for_dashboard.default_branch)
end
# Override in class to provide arguments to the finder. # Override in class to provide arguments to the finder.
def metrics_dashboard_params def metrics_dashboard_params
{} {}
......
...@@ -16,7 +16,8 @@ module Metrics ...@@ -16,7 +16,8 @@ module Metrics
{ {
path: filepath, path: filepath,
display_name: name_for_path(filepath), display_name: name_for_path(filepath),
default: false default: false,
system_dashboard: false
} }
end end
end end
......
...@@ -20,7 +20,8 @@ module Metrics ...@@ -20,7 +20,8 @@ module Metrics
[{ [{
path: SYSTEM_DASHBOARD_PATH, path: SYSTEM_DASHBOARD_PATH,
display_name: SYSTEM_DASHBOARD_NAME, display_name: SYSTEM_DASHBOARD_NAME,
default: true default: true,
system_dashboard: true
}] }]
end end
......
---
title: Add can_edit and project_blob_path to metrics_dashboard endpoint
merge_request: 19663
author:
type: added
...@@ -666,7 +666,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -666,7 +666,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Legacy routes. # Legacy routes.
# Introduced in 12.0. # Introduced in 12.0.
# Should be removed after 12.1 # Should be removed with https://gitlab.com/gitlab-org/gitlab/issues/28848.
scope(path: '*namespace_id', scope(path: '*namespace_id',
as: :namespace, as: :namespace,
namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do
......
...@@ -271,7 +271,7 @@ sites served under a custom domain. ...@@ -271,7 +271,7 @@ sites served under a custom domain.
To enable it, you'll need to: To enable it, you'll need to:
1. Choose an email on which you will recieve notifications about expiring domains. 1. Choose an email on which you will receive notifications about expiring domains.
1. Navigate to your instance's **Admin Area > Settings > Preferences** and expand **Pages** settings. 1. Navigate to your instance's **Admin Area > Settings > Preferences** and expand **Pages** settings.
1. Enter the email for receiving notifications and accept Let's Encrypt's Terms of Service as shown below. 1. Enter the email for receiving notifications and accept Let's Encrypt's Terms of Service as shown below.
1. Click **Save changes**. 1. Click **Save changes**.
......
...@@ -168,7 +168,7 @@ the [documentation on Cycle Analytics permissions](analytics/cycle_analytics.md# ...@@ -168,7 +168,7 @@ the [documentation on Cycle Analytics permissions](analytics/cycle_analytics.md#
Developers and users with higher permission level can use all Developers and users with higher permission level can use all
the functionality of the Issue Board, that is create/delete lists the functionality of the Issue Board, that is create/delete lists
and drag issues around. Read though the and drag issues around. Read through the
[documentation on Issue Boards permissions](project/issue_board.md#permissions) [documentation on Issue Boards permissions](project/issue_board.md#permissions)
to learn more. to learn more.
......
...@@ -44,3 +44,14 @@ The Error Tracking list may be found at **Operations > Error Tracking** in your ...@@ -44,3 +44,14 @@ The Error Tracking list may be found at **Operations > Error Tracking** in your
Errors can be filtered by title. Errors can be filtered by title.
![Error Tracking list](img/error_tracking_list.png) ![Error Tracking list](img/error_tracking_list.png)
## Error Details
From error list, users can navigate to the error details page by clicking the title of any error.
This page has:
- A link to Sentry issue.
- A full stack trace along with other details.
![Error Details](img/error_details_v12_5.png)
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
require 'spec_helper' require 'spec_helper'
describe MetricsDashboard do describe MetricsDashboard do
include MetricsDashboardHelpers
describe 'GET #metrics_dashboard' do describe 'GET #metrics_dashboard' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { project_with_dashboard('.gitlab/dashboards/test.yml') }
let_it_be(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
before do before do
...@@ -63,6 +65,36 @@ describe MetricsDashboard do ...@@ -63,6 +65,36 @@ describe MetricsDashboard do
expect(json_response['dashboard']['dashboard']).to eq('Environment metrics') expect(json_response['dashboard']['dashboard']).to eq('Environment metrics')
expect(json_response).to have_key('all_dashboards') expect(json_response).to have_key('all_dashboards')
end end
context 'in all_dashboard list' do
let(:system_dashboard) { json_response['all_dashboards'].find { |dashboard| dashboard["system_dashboard"] == true } }
let(:project_dashboard) { json_response['all_dashboards'].find { |dashboard| dashboard["system_dashboard"] == false } }
it 'includes project_blob_path only for project dashboards' do
expect(system_dashboard['project_blob_path']).to be_nil
expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/blob/master/.gitlab/dashboards/test.yml")
end
describe 'project permissions' do
using RSpec::Parameterized::TableSyntax
where(:can_collaborate, :system_can_edit, :project_can_edit) do
false | false | false
true | false | true
end
with_them do
before do
allow(controller).to receive(:can_collaborate_with_project?).and_return(can_collaborate)
end
it "sets can_edit appropriately" do
expect(system_dashboard["can_edit"]).to eq(system_can_edit)
expect(project_dashboard["can_edit"]).to eq(project_can_edit)
end
end
end
end
end end
end end
end end
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Email::Hook::SmimeSignatureInterceptor do describe Gitlab::Email::Hook::SmimeSignatureInterceptor do
......
...@@ -136,7 +136,7 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi ...@@ -136,7 +136,7 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi
describe '.find_all_paths' do describe '.find_all_paths' do
let(:all_dashboard_paths) { described_class.find_all_paths(project) } let(:all_dashboard_paths) { described_class.find_all_paths(project) }
let(:system_dashboard) { { path: system_dashboard_path, display_name: 'Default', default: true } } let(:system_dashboard) { { path: system_dashboard_path, display_name: 'Default', default: true, system_dashboard: true } }
it 'includes only the system dashboard by default' do it 'includes only the system dashboard by default' do
expect(all_dashboard_paths).to eq([system_dashboard]) expect(all_dashboard_paths).to eq([system_dashboard])
...@@ -147,7 +147,7 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi ...@@ -147,7 +147,7 @@ describe Gitlab::Metrics::Dashboard::Finder, :use_clean_rails_memory_store_cachi
let(:project) { project_with_dashboard(dashboard_path) } let(:project) { project_with_dashboard(dashboard_path) }
it 'includes system and project dashboards' do it 'includes system and project dashboards' do
project_dashboard = { path: dashboard_path, display_name: 'test.yml', default: false } project_dashboard = { path: dashboard_path, display_name: 'test.yml', default: false, system_dashboard: false }
expect(all_dashboard_paths).to contain_exactly(system_dashboard, project_dashboard) expect(all_dashboard_paths).to contain_exactly(system_dashboard, project_dashboard)
end end
......
...@@ -80,7 +80,8 @@ describe Metrics::Dashboard::ProjectDashboardService, :use_clean_rails_memory_st ...@@ -80,7 +80,8 @@ describe Metrics::Dashboard::ProjectDashboardService, :use_clean_rails_memory_st
[{ [{
path: dashboard_path, path: dashboard_path,
display_name: 'test.yml', display_name: 'test.yml',
default: false default: false,
system_dashboard: false
}] }]
) )
end end
......
...@@ -44,7 +44,8 @@ describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_sto ...@@ -44,7 +44,8 @@ describe Metrics::Dashboard::SystemDashboardService, :use_clean_rails_memory_sto
[{ [{
path: described_class::SYSTEM_DASHBOARD_PATH, path: described_class::SYSTEM_DASHBOARD_PATH,
display_name: described_class::SYSTEM_DASHBOARD_NAME, display_name: described_class::SYSTEM_DASHBOARD_NAME,
default: true default: true,
system_dashboard: true
}] }]
) )
end end
......
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