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
db75e4e8
Commit
db75e4e8
authored
Jun 01, 2021
by
Nicolò Maria Mezzopera
Committed by
charlie ablett
Jun 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dedicated details page for terraform registry
parent
e882868e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
1 deletion
+119
-1
app/assets/javascripts/packages_and_registries/infrastructure_registry/details_app_bundle.js
..._registries/infrastructure_registry/details_app_bundle.js
+29
-0
app/assets/javascripts/pages/projects/packages/infrastructure_registry/show/index.js
...s/projects/packages/infrastructure_registry/show/index.js
+3
-0
app/controllers/projects/packages/infrastructure_registry_controller.rb
...s/projects/packages/infrastructure_registry_controller.rb
+12
-0
app/views/projects/packages/infrastructure_registry/show.html.haml
.../projects/packages/infrastructure_registry/show.html.haml
+13
-0
config/routes/project.rb
config/routes/project.rb
+1
-1
spec/features/projects/infrastructure_registry_spec.rb
spec/features/projects/infrastructure_registry_spec.rb
+61
-0
No files found.
app/assets/javascripts/packages_and_registries/infrastructure_registry/details_app_bundle.js
0 → 100644
View file @
db75e4e8
import
Vue
from
'
vue
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
PackagesApp
from
'
~/packages/details/components/app.vue
'
;
import
createStore
from
'
~/packages/details/store
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
Vue
.
use
(
Translate
);
export
default
()
=>
{
const
el
=
document
.
querySelector
(
'
#js-vue-packages-detail
'
);
const
{
package
:
packageJson
,
canDelete
:
canDeleteStr
,
...
rest
}
=
el
.
dataset
;
const
packageEntity
=
JSON
.
parse
(
packageJson
);
const
canDelete
=
parseBoolean
(
canDeleteStr
);
const
store
=
createStore
({
packageEntity
,
packageFiles
:
packageEntity
.
package_files
,
canDelete
,
...
rest
,
});
return
new
Vue
({
el
,
store
,
render
(
createElement
)
{
return
createElement
(
PackagesApp
);
},
});
};
app/assets/javascripts/pages/projects/packages/infrastructure_registry/show/index.js
0 → 100644
View file @
db75e4e8
import
initDetails
from
'
~/packages_and_registries/infrastructure_registry/details_app_bundle
'
;
initDetails
();
app/controllers/projects/packages/infrastructure_registry_controller.rb
View file @
db75e4e8
...
...
@@ -3,7 +3,19 @@
module
Projects
module
Packages
class
InfrastructureRegistryController
<
Projects
::
ApplicationController
before_action
:verify_feature_enabled!
feature_category
:infrastructure_as_code
def
show
@package
=
project
.
packages
.
find
(
params
[
:id
])
@package_files
=
@package
.
package_files
.
recent
end
private
def
verify_feature_enabled!
render_404
unless
Feature
.
enabled?
(
:infrastructure_registry_page
)
end
end
end
end
app/views/projects/packages/infrastructure_registry/show.html.haml
0 → 100644
View file @
db75e4e8
-
add_to_breadcrumbs
_
(
"Infrastructure Registry"
),
project_packages_path
(
@project
)
-
add_to_breadcrumbs
@package
.
name
,
project_packages_path
(
@project
)
-
breadcrumb_title
@package
.
version
-
page_title
_
(
"Infrastructure Registry"
)
-
@content_class
=
"limit-container-width"
unless
fluid_layout
.row
.col-12
#js-vue-packages-detail
{
data:
{
package:
package_from_presenter
(
@package
),
can_delete:
can?
(
current_user
,
:destroy_package
,
@project
).
to_s
,
svg_path:
image_path
(
'illustrations/no-packages.svg'
),
project_name:
@project
.
name
,
project_list_url:
project_infrastructure_registry_index_path
(
@project
)}
}
config/routes/project.rb
View file @
db75e4e8
...
...
@@ -50,7 +50,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
resources
:infrastructure_registry
,
only:
[
:index
],
module: :packages
resources
:infrastructure_registry
,
only:
[
:index
,
:show
],
module: :packages
resources
:jobs
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
collection
do
...
...
spec/features/projects/infrastructure_registry_spec.rb
0 → 100644
View file @
db75e4e8
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Infrastructure Registry'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
before
do
sign_in
(
user
)
project
.
add_maintainer
(
user
)
end
context
'when feature is not available'
do
before
do
stub_feature_flags
(
infrastructure_registry_page:
false
)
end
it
'gives 404'
do
visit_project_infrastructure_registry
expect
(
status_code
).
to
eq
(
404
)
end
end
context
'when feature is available'
,
:js
do
before
do
visit_project_infrastructure_registry
end
context
'when there are packages'
do
let_it_be
(
:terraform_module
)
{
create
(
:terraform_module_package
,
project:
project
,
created_at:
1
.
day
.
ago
,
version:
'1.0.0'
)
}
let_it_be
(
:terraform_module2
)
{
create
(
:terraform_module_package
,
project:
project
,
created_at:
2
.
days
.
ago
,
version:
'2.0.0'
)
}
let_it_be
(
:packages
)
{
[
terraform_module
,
terraform_module2
]
}
it_behaves_like
'packages list'
context
'deleting a package'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:terraform_module
)
{
create
(
:terraform_module_package
,
project:
project
)
}
it
'allows you to delete a module'
,
:aggregate_failures
do
# this is still using the package copy in the UI too
click_button
(
'Remove package'
)
click_button
(
'Delete package'
)
expect
(
page
).
to
have_content
'Package deleted successfully'
expect
(
page
).
not_to
have_content
(
terraform_module
.
name
)
end
end
end
it
'displays the empty message'
do
expect
(
page
).
to
have_content
(
'You have no Terraform modules in your project'
)
end
end
def
visit_project_infrastructure_registry
visit
project_infrastructure_registry_index_path
(
project
)
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