Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1f1bdf54
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f1bdf54
编写于
10月 04, 2019
作者:
G
GitLab Bot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add latest changes from gitlab-org/gitlab@master
上级
535d167d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
177 addition
and
46 deletion
+177
-46
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+4
-1
app/controllers/concerns/metrics_dashboard.rb
app/controllers/concerns/metrics_dashboard.rb
+63
-0
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+9
-40
changelogs/unreleased/31030-when-viewing-comments-occasionally-the-users-profile-picture-will-b.yml
...omments-occasionally-the-users-profile-picture-will-b.yml
+5
-0
danger/specs/Dangerfile
danger/specs/Dangerfile
+1
-1
doc/topics/git/troubleshooting_git.md
doc/topics/git/troubleshooting_git.md
+7
-2
lib/gitlab/metrics/dashboard/finder.rb
lib/gitlab/metrics/dashboard/finder.rb
+6
-2
locale/gitlab.pot
locale/gitlab.pot
+24
-0
spec/controllers/concerns/metrics_dashboard_spec.rb
spec/controllers/concerns/metrics_dashboard_spec.rb
+58
-0
未找到文件。
app/assets/stylesheets/pages/notes.scss
浏览文件 @
1f1bdf54
...
...
@@ -355,10 +355,13 @@ $note-form-margin-left: 72px;
}
}
.timeline-icon
{
float
:
left
;
}
.system-note
,
.discussion-filter-note
{
.timeline-icon
{
float
:
left
;
display
:
flex
;
align-items
:
center
;
background-color
:
$white-light
;
...
...
app/controllers/concerns/metrics_dashboard.rb
0 → 100644
浏览文件 @
1f1bdf54
# frozen_string_literal: true
# Provides an action which fetches a metrics dashboard according
# to the parameters specified by the controller.
module
MetricsDashboard
extend
ActiveSupport
::
Concern
def
metrics_dashboard
result
=
dashboard_finder
.
find
(
project_for_dashboard
,
current_user
,
metrics_dashboard_params
)
if
include_all_dashboards?
result
[
:all_dashboards
]
=
dashboard_finder
.
find_all_paths
(
project_for_dashboard
)
end
respond_to
do
|
format
|
if
result
[
:status
]
==
:success
format
.
json
{
render
dashboard_success_response
(
result
)
}
else
format
.
json
{
render
dashboard_error_response
(
result
)
}
end
end
end
private
# Override in class to provide arguments to the finder.
def
metrics_dashboard_params
{}
end
# Override in class if response requires complete list of
# dashboards in addition to requested dashboard body.
def
include_all_dashboards?
false
end
def
dashboard_finder
::
Gitlab
::
Metrics
::
Dashboard
::
Finder
end
# Project is not defined for group and admin level clusters.
def
project_for_dashboard
defined?
(
project
)
?
project
:
nil
end
def
dashboard_success_response
(
result
)
{
status: :ok
,
json:
result
.
slice
(
:all_dashboards
,
:dashboard
,
:status
)
}
end
def
dashboard_error_response
(
result
)
{
status:
result
[
:http_status
],
json:
result
.
slice
(
:all_dashboards
,
:message
,
:status
)
}
end
end
app/controllers/projects/environments_controller.rb
浏览文件 @
1f1bdf54
# frozen_string_literal: true
class
Projects::EnvironmentsController
<
Projects
::
ApplicationController
include
MetricsDashboard
layout
'project'
before_action
:authorize_read_environment!
before_action
:authorize_create_environment!
,
only:
[
:new
,
:create
]
...
...
@@ -158,42 +160,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
end
def
metrics_dashboard
if
params
[
:embedded
]
result
=
dashboard_finder
.
find
(
project
,
current_user
,
environment:
environment
,
dashboard_path:
params
[
:dashboard
],
**
dashboard_params
.
to_h
.
symbolize_keys
)
else
result
=
dashboard_finder
.
find
(
project
,
current_user
,
environment:
environment
,
dashboard_path:
params
[
:dashboard
]
)
result
[
:all_dashboards
]
=
dashboard_finder
.
find_all_paths
(
project
)
end
respond_to
do
|
format
|
if
result
[
:status
]
==
:success
format
.
json
do
render
status: :ok
,
json:
result
.
slice
(
:all_dashboards
,
:dashboard
,
:status
)
end
else
format
.
json
do
render
(
status:
result
[
:http_status
],
json:
result
.
slice
(
:all_dashboards
,
:message
,
:status
)
)
end
end
end
end
def
search
respond_to
do
|
format
|
format
.
json
do
...
...
@@ -231,12 +197,15 @@ class Projects::EnvironmentsController < Projects::ApplicationController
params
.
require
([
:start
,
:end
])
end
def
dashboard_params
params
.
permit
(
:embedded
,
:group
,
:title
,
:y_label
)
def
metrics_dashboard_params
params
.
permit
(
:embedded
,
:group
,
:title
,
:y_label
)
.
to_h
.
symbolize_keys
.
merge
(
dashboard_path:
params
[
:dashboard
],
environment:
environment
)
end
def
dashboard_finder
Gitlab
::
Metrics
::
Dashboard
::
Finder
def
include_all_dashboards?
!
params
[
:embedded
]
end
def
search_environment_names
...
...
changelogs/unreleased/31030-when-viewing-comments-occasionally-the-users-profile-picture-will-b.yml
0 → 100644
浏览文件 @
1f1bdf54
---
title
:
Fix broken notes avatar rendering in Chrome
77
merge_request
:
18110
author
:
type
:
fixed
danger/specs/Dangerfile
浏览文件 @
1f1bdf54
# frozen_string_literal: true
NO_SPECS_LABELS
=
%w[backstage
D
ocumentation QA]
.
freeze
NO_SPECS_LABELS
=
%w[backstage
d
ocumentation QA]
.
freeze
NO_NEW_SPEC_MESSAGE
=
<<~
MSG
.
freeze
You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
...
...
doc/topics/git/troubleshooting_git.md
浏览文件 @
1f1bdf54
...
...
@@ -22,8 +22,13 @@ To fix this issue, here are some possible solutions.
### Increase the POST buffer size in Git
**If pushing over HTTP**
, you can try increasing the POST buffer size in Git's
configuration. Open a terminal and enter:
**If you're using Git over HTTP instead of SSH**
, you can try increasing the POST buffer size in Git's
configuration.
Example of an error during a clone:
`fatal: pack has bad object at offset XXXXXXXXX: inflate returned -5`
Open a terminal and enter:
```
sh
git config http.postBuffer 52428800
...
...
lib/gitlab/metrics/dashboard/finder.rb
浏览文件 @
1f1bdf54
...
...
@@ -20,13 +20,17 @@ module Gitlab
# @param options - dashboard_path [String] Path at which the
# dashboard can be found. Nil values will
# default to the system dashboard.
# @param options - group [String] Title of the group
# @param options - group [String
, Group
] Title of the group
# to which a panel might belong. Used by
# embedded dashboards.
# embedded dashboards. If cluster dashboard,
# refers to the Group corresponding to the cluster.
# @param options - title [String] Title of the panel.
# Used by embedded dashboards.
# @param options - y_label [String] Y-Axis label of
# a panel. Used by embedded dashboards.
# @param options - cluster [Cluster]
# @param options - cluster_type [Symbol] The level of
# cluster, one of [:admin, :project, :group]
# @return [Hash]
def
find
(
project
,
user
,
options
=
{})
service_for
(
options
)
...
...
locale/gitlab.pot
浏览文件 @
1f1bdf54
...
...
@@ -14063,15 +14063,30 @@ msgstr ""
msgid "SecurityDashboard|%{firstProject}, %{secondProject}, and %{rest}"
msgstr ""
msgid "SecurityDashboard|Add a project to your dashboard"
msgstr ""
msgid "SecurityDashboard|Add or remove projects from your dashboard"
msgstr ""
msgid "SecurityDashboard|Add projects"
msgstr ""
msgid "SecurityDashboard|Confidence"
msgstr ""
msgid "SecurityDashboard|Edit dashboard"
msgstr ""
msgid "SecurityDashboard|Hide dismissed"
msgstr ""
msgid "SecurityDashboard|Monitor vulnerabilities in your code"
msgstr ""
msgid "SecurityDashboard|More information"
msgstr ""
msgid "SecurityDashboard|Pipeline %{pipelineLink} triggered"
msgstr ""
...
...
@@ -14081,9 +14096,18 @@ msgstr ""
msgid "SecurityDashboard|Report type"
msgstr ""
msgid "SecurityDashboard|Return to dashboard"
msgstr ""
msgid "SecurityDashboard|Security Dashboard"
msgstr ""
msgid "SecurityDashboard|Severity"
msgstr ""
msgid "SecurityDashboard|The security dashboard displays the latest security findings for projects you wish to monitor. Select \"Edit dashboard\" to add and remove projects."
msgstr ""
msgid "SecurityDashboard|Unable to add %{invalidProjects}"
msgstr ""
...
...
spec/controllers/concerns/metrics_dashboard_spec.rb
0 → 100644
浏览文件 @
1f1bdf54
# frozen_string_literal: true
require
'spec_helper'
describe
MetricsDashboard
do
describe
'GET #metrics_dashboard'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
before
do
sign_in
(
user
)
project
.
add_maintainer
(
user
)
end
controller
(
::
ApplicationController
)
do
include
MetricsDashboard
# rubocop:disable RSpec/DescribedClass
end
let
(
:json_response
)
do
routes
.
draw
{
get
"metrics_dashboard"
=>
"anonymous#metrics_dashboard"
}
response
=
get
:metrics_dashboard
,
format: :json
JSON
.
parse
(
response
.
parsed_body
)
end
context
'when no parameters are provided'
do
it
'returns an error json_response'
do
expect
(
json_response
[
'status'
]).
to
eq
(
'error'
)
end
end
context
'when params are provided'
do
before
do
allow
(
controller
).
to
receive
(
:project
).
and_return
(
project
)
allow
(
controller
)
.
to
receive
(
:metrics_dashboard_params
)
.
and_return
(
environment:
environment
)
end
it
'returns the specified dashboard'
do
expect
(
json_response
[
'dashboard'
][
'dashboard'
]).
to
eq
(
'Environment metrics'
)
expect
(
json_response
).
not_to
have_key
(
'all_dashboards'
)
end
context
'when parameters are provided and the list of all dashboards is required'
do
before
do
allow
(
controller
).
to
receive
(
:include_all_dashboards?
).
and_return
(
true
)
end
it
'returns a dashboard in addition to the list of dashboards'
do
expect
(
json_response
[
'dashboard'
][
'dashboard'
]).
to
eq
(
'Environment metrics'
)
expect
(
json_response
).
to
have_key
(
'all_dashboards'
)
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录