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
49cdcec4
Commit
49cdcec4
authored
Nov 12, 2019
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect from nil and small refactor
parent
74b97377
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
app/controllers/concerns/metrics_dashboard.rb
app/controllers/concerns/metrics_dashboard.rb
+12
-9
No files found.
app/controllers/concerns/metrics_dashboard.rb
View file @
49cdcec4
...
@@ -34,19 +34,22 @@ module MetricsDashboard
...
@@ -34,19 +34,22 @@ module MetricsDashboard
def
all_dashboards
def
all_dashboards
dashboards
=
dashboard_finder
.
find_all_paths
(
project_for_dashboard
)
dashboards
=
dashboard_finder
.
find_all_paths
(
project_for_dashboard
)
dashboards
.
each
do
|
dashboard
|
dashboards
.
map
do
|
dashboard
|
dashboard
[
:can_edit
]
=
false
amend_dashboard
(
dashboard
)
dashboard
[
:project_blob_path
]
=
nil
if
project_for_dashboard
&&
!
dashboard
[
:system_dashboard
]
dashboard
[
:can_edit
]
=
can_edit?
(
dashboard
)
dashboard
[
:project_blob_path
]
=
dashboard_project_blob_path
(
dashboard
)
end
end
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
end
def
dashboard_project_blob_path
(
dashboard
)
def
dashboard_project_blob_path
(
dashboard
)
project_blob_path
(
project_for_dashboard
,
File
.
join
(
project_for_dashboard
.
default_branch
,
dashboard
[
:path
]
))
project_blob_path
(
project_for_dashboard
,
File
.
join
(
project_for_dashboard
.
default_branch
,
dashboard
.
fetch
(
:path
,
""
)
))
end
end
def
can_edit?
(
dashboard
)
def
can_edit?
(
dashboard
)
...
...
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