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
b3d15ebd
Commit
b3d15ebd
authored
Jul 21, 2021
by
Jacques Erasmus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix aux viewers
This fixes the Auxiliary viewers on the refactored blob view
parent
c83cf1f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
143 deletions
+151
-143
app/assets/javascripts/pages/projects/blob/show/index.js
app/assets/javascripts/pages/projects/blob/show/index.js
+3
-1
spec/features/projects/blobs/blob_show_spec.rb
spec/features/projects/blobs/blob_show_spec.rb
+148
-142
No files found.
app/assets/javascripts/pages/projects/blob/show/index.js
View file @
b3d15ebd
...
...
@@ -2,7 +2,7 @@ import Vue from 'vue';
import
VueApollo
from
'
vue-apollo
'
;
import
TableOfContents
from
'
~/blob/components/table_contents.vue
'
;
import
PipelineTourSuccessModal
from
'
~/blob/pipeline_tour_success_modal.vue
'
;
import
{
BlobViewer
}
from
'
~/blob/viewer/index
'
;
import
{
BlobViewer
,
initAuxiliaryViewer
}
from
'
~/blob/viewer/index
'
;
import
GpgBadges
from
'
~/gpg_badges
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
initBlob
from
'
~/pages/projects/init_blob
'
;
...
...
@@ -39,6 +39,8 @@ if (viewBlobEl) {
});
},
});
initAuxiliaryViewer
();
}
else
{
new
BlobViewer
();
// eslint-disable-line no-new
initBlob
();
...
...
spec/features/projects/blobs/blob_show_spec.rb
View file @
b3d15ebd
...
...
@@ -584,199 +584,205 @@ RSpec.describe 'File blob', :js do
end
end
describe
'.gitlab-ci.yml
'
do
context
'files with auxiliary viewers
'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add .gitlab-ci.yml"
,
file_path:
'.gitlab-ci.yml'
,
file_content:
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/gitlab_ci.yml'
))
).
execute
visit_blob
(
'.gitlab-ci.yml'
)
stub_feature_flags
(
refactor_blob_viewer:
true
)
end
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that configuration is valid
expect
(
page
).
to
have_content
(
'This GitLab CI configuration is valid.'
)
describe
'.gitlab-ci.yml'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add .gitlab-ci.yml"
,
file_path:
'.gitlab-ci.yml'
,
file_content:
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/gitlab_ci.yml'
))
).
execute
describe
'.gitlab/route-map.yml'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
visit_blob
(
'.gitlab-ci.yml'
)
end
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add .gitlab/route-map.yml"
,
file_path:
'.gitlab/route-map.yml'
,
file_content:
<<-
MAP
.
strip_heredoc
# Team data
- source: 'data/team.yml'
public: 'team/'
MAP
).
execute
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that configuration is valid
expect
(
page
).
to
have_content
(
'This GitLab CI configuration is valid.'
)
visit_blob
(
'.gitlab/route-map.yml'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that map is valid
expect
(
page
).
to
have_content
(
'This Route Map is valid.'
)
describe
'.gitlab/route-map.yml'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add .gitlab/route-map.yml"
,
file_path:
'.gitlab/route-map.yml'
,
file_content:
<<-
MAP
.
strip_heredoc
# Team data
- source: 'data/team.yml'
public: 'team/'
MAP
).
execute
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
visit_blob
(
'.gitlab/route-map.yml'
)
end
end
end
describe
'.gitlab/dashboards/custom-dashboard.yml'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that map is valid
expect
(
page
).
to
have_content
(
'This Route Map is valid.'
)
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add .gitlab/dashboards/custom-dashboard.yml"
,
file_path:
'.gitlab/dashboards/custom-dashboard.yml'
,
file_content:
file_content
).
execute
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
context
'with metrics_dashboard_exhaustive_validations feature flag off
'
do
describe
'.gitlab/dashboards/custom-dashboard.yml
'
do
before
do
stub_feature_flags
(
metrics_dashboard_exhaustive_validations:
false
)
visit_blob
(
'.gitlab/dashboards/custom-dashboard.yml'
)
project
.
add_maintainer
(
project
.
creator
)
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add .gitlab/dashboards/custom-dashboard.yml"
,
file_path:
'.gitlab/dashboards/custom-dashboard.yml'
,
file_content:
file_content
).
execute
end
context
'valid dashboard file'
do
let
(
:file_content
)
{
File
.
read
(
Rails
.
root
.
join
(
'config/prometheus/common_metrics.yml'
))
}
context
'with metrics_dashboard_exhaustive_validations feature flag off'
do
before
do
stub_feature_flags
(
metrics_dashboard_exhaustive_validations:
false
)
visit_blob
(
'.gitlab/dashboards/custom-dashboard.yml'
)
end
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is valid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is valid.'
)
context
'valid dashboard file'
do
let
(
:file_content
)
{
File
.
read
(
Rails
.
root
.
join
(
'config/prometheus/common_metrics.yml'
))
}
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is valid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is valid.'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
end
context
'invalid dashboard file'
do
let
(
:file_content
)
{
"dashboard: 'invalid'"
}
context
'invalid dashboard file'
do
let
(
:file_content
)
{
"dashboard: 'invalid'"
}
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is invalid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is invalid:'
)
expect
(
page
).
to
have_content
(
"panel_groups: should be an array of panel_groups objects"
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is invalid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is invalid:'
)
expect
(
page
).
to
have_content
(
"panel_groups: should be an array of panel_groups objects"
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
end
end
context
'with metrics_dashboard_exhaustive_validations feature flag on'
do
before
do
stub_feature_flags
(
metrics_dashboard_exhaustive_validations:
true
)
visit_blob
(
'.gitlab/dashboards/custom-dashboard.yml'
)
end
context
'with metrics_dashboard_exhaustive_validations feature flag on'
do
before
do
stub_feature_flags
(
metrics_dashboard_exhaustive_validations:
true
)
visit_blob
(
'.gitlab/dashboards/custom-dashboard.yml'
)
end
context
'valid dashboard file'
do
let
(
:file_content
)
{
File
.
read
(
Rails
.
root
.
join
(
'config/prometheus/common_metrics.yml'
))
}
context
'valid dashboard file'
do
let
(
:file_content
)
{
File
.
read
(
Rails
.
root
.
join
(
'config/prometheus/common_metrics.yml'
))
}
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is valid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is valid.'
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is valid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is valid.'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
end
context
'invalid dashboard file'
do
let
(
:file_content
)
{
"dashboard: 'invalid'"
}
context
'invalid dashboard file'
do
let
(
:file_content
)
{
"dashboard: 'invalid'"
}
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is invalid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is invalid:'
)
expect
(
page
).
to
have_content
(
"root is missing required keys: panel_groups"
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows that dashboard yaml is invalid
expect
(
page
).
to
have_content
(
'Metrics Dashboard YAML definition is invalid:'
)
expect
(
page
).
to
have_content
(
"root is missing required keys: panel_groups"
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
)
end
end
end
end
end
end
context
'LICENSE'
do
before
do
visit_blob
(
'LICENSE'
)
end
context
'LICENSE'
do
before
do
visit_blob
(
'LICENSE'
)
end
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows license
expect
(
page
).
to
have_content
(
'This project is licensed under the MIT License.'
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows license
expect
(
page
).
to
have_content
(
'This project is licensed under the MIT License.'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
,
href:
'http://choosealicense.com/licenses/mit/'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
,
href:
'http://choosealicense.com/licenses/mit/'
)
end
end
end
end
context
'*.gemspec'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
context
'*.gemspec'
do
before
do
project
.
add_maintainer
(
project
.
creator
)
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add activerecord.gemspec"
,
file_path:
'activerecord.gemspec'
,
file_content:
<<-
SPEC
.
strip_heredoc
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "activerecord"
end
SPEC
).
execute
Files
::
CreateService
.
new
(
project
,
project
.
creator
,
start_branch:
'master'
,
branch_name:
'master'
,
commit_message:
"Add activerecord.gemspec"
,
file_path:
'activerecord.gemspec'
,
file_content:
<<-
SPEC
.
strip_heredoc
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = "activerecord"
end
SPEC
).
execute
visit_blob
(
'activerecord.gemspec'
)
end
visit_blob
(
'activerecord.gemspec'
)
end
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows names of dependency manager and package
expect
(
page
).
to
have_content
(
'This project manages its dependencies using RubyGems.'
)
it
'displays an auxiliary viewer'
do
aggregate_failures
do
# shows names of dependency manager and package
expect
(
page
).
to
have_content
(
'This project manages its dependencies using RubyGems.'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
,
href:
'https://rubygems.org/'
)
# shows a learn more link
expect
(
page
).
to
have_link
(
'Learn more'
,
href:
'https://rubygems.org/'
)
end
end
end
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