Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0487769e
Commit
0487769e
authored
Nov 05, 2019
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add edit_path to metrics_dashboard endpoint
parent
2554bdc0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
app/controllers/concerns/metrics_dashboard.rb
app/controllers/concerns/metrics_dashboard.rb
+19
-1
app/services/metrics/dashboard/project_dashboard_service.rb
app/services/metrics/dashboard/project_dashboard_service.rb
+2
-1
app/services/metrics/dashboard/system_dashboard_service.rb
app/services/metrics/dashboard/system_dashboard_service.rb
+2
-1
No files found.
app/controllers/concerns/metrics_dashboard.rb
View file @
0487769e
...
...
@@ -4,6 +4,8 @@
# to the parameters specified by the controller.
module
MetricsDashboard
include
RenderServiceResults
include
ChecksCollaboration
extend
ActiveSupport
::
Concern
def
metrics_dashboard
...
...
@@ -14,7 +16,7 @@ module MetricsDashboard
)
if
include_all_dashboards?
&&
result
result
[
:all_dashboards
]
=
dashboard_finder
.
find_all_paths
(
project_for_dashboard
)
result
[
:all_dashboards
]
=
all_dashboards
end
respond_to
do
|
format
|
...
...
@@ -30,6 +32,22 @@ module MetricsDashboard
private
def
all_dashboards
dashboards
=
dashboard_finder
.
find_all_paths
(
project_for_dashboard
)
dashboards
.
map
do
|
dashboard
|
dashboard
[
:edit_path
]
=
edit_path
(
dashboard
)
dashboard
end
end
def
edit_path
(
dashboard
)
return
unless
project_for_dashboard
return
if
dashboard
[
:system_dashboard
]
return
unless
can_collaborate_with_project?
(
project_for_dashboard
,
ref:
project_for_dashboard
.
default_branch
)
Gitlab
::
Routing
.
url_helpers
.
project_blob_path
(
project_for_dashboard
,
File
.
join
(
project_for_dashboard
.
default_branch
,
dashboard
[
:path
]))
end
# Override in class to provide arguments to the finder.
def
metrics_dashboard_params
{}
...
...
app/services/metrics/dashboard/project_dashboard_service.rb
View file @
0487769e
...
...
@@ -16,7 +16,8 @@ module Metrics
{
path:
filepath
,
display_name:
name_for_path
(
filepath
),
default:
false
default:
false
,
system_dashboard:
false
}
end
end
...
...
app/services/metrics/dashboard/system_dashboard_service.rb
View file @
0487769e
...
...
@@ -20,7 +20,8 @@ module Metrics
[{
path:
SYSTEM_DASHBOARD_PATH
,
display_name:
SYSTEM_DASHBOARD_NAME
,
default:
true
default:
true
,
system_dashboard:
true
}]
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment