Commit 1e412a2b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove UI related code for packages [ci skip]

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 2f75375f
module Projects
module Packages
class PackagesController < ApplicationController
before_action :verify_packages_enabled!
before_action :authorize_read_packages!
before_action :authorize_admin_project!, only: [:destroy]
def index
@packages = project.packages.all.page(params[:page])
end
def show
@package = project.packages.find(params[:id])
@package_files = @package.package_files.recent
@maven_metadatum = @package.maven_metadatum
end
def destroy
@package = project.packages.find(params[:id])
@package.destroy
redirect_to project_packages_path(@project), notice: _('Package was removed')
end
private
def verify_packages_enabled!
render_404 unless Gitlab.config.packages.enabled
end
end
end
end
...@@ -268,10 +268,6 @@ module ProjectsHelper ...@@ -268,10 +268,6 @@ module ProjectsHelper
nav_tabs << :container_registry nav_tabs << :container_registry
end end
if Gitlab.config.packages.enabled && can?(current_user, :read_packages, project)
nav_tabs << :packages
end
if project.builds_enabled? && can?(current_user, :read_pipeline, project) if project.builds_enabled? && can?(current_user, :read_pipeline, project)
nav_tabs << :pipelines nav_tabs << :pipelines
end end
......
- page_title "Packages"
- if @packages.any?
%table.table
%thead
%tr
%th Name
%th Version
%th Type
%th Created at
%tbody
- @packages.each do |package|
%tr
%td
= link_to package.name, project_package_path(@project, package)
%td
= package.version
%td
= _('Maven package')
%td
= package.created_at
= paginate @packages, theme: "gitlab"
- else
.nothing-here-block
= _('No packages stored for this project.')
- add_to_breadcrumbs _("Packages"), project_packages_path(@project)
- add_to_breadcrumbs @package.name, project_packages_path(@project)
- breadcrumb_title @package.version
- page_title "Packages"
.detail-page-header
.detail-page-header-body
.detail-page-header-actions
- if can?(current_user, :admin_project, @project)
= link_to project_package_path(@project, @package), method: :delete, data: { confirm: _("Are you sure?") }, class: "btn btn-grouped btn-inverted btn-remove", title: _('Delete Package') do
= _('Delete')
.row.prepend-top-default
.col-md-6
.card
.card-header
Package info:
%ul.content-list
%li
%span.light Name:
%strong
= @package.name
%li
%span.light Version:
%strong
= @package.version
%li
%span.light Created at:
%strong
= @package.created_at
- if @maven_metadatum
.card
.card-header
Maven Package info:
%ul.content-list
%li
%span.light App group:
%strong
= @maven_metadatum.app_group
%li
%span.light App name:
%strong
= @maven_metadatum.app_name
%li
%span.light App version:
%strong
= @maven_metadatum.app_version
.col-md-6
.card
.card-header
Package files:
%ul.content-list
- @package_files.each do |package_file|
%li
= package_file.file.identifier
.pull-right.text-muted
= package_file.created_at
require 'spec_helper'
describe 'Packages' do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:package) { create(:maven_package, project: project) }
before do
sign_in(user)
project.add_developer(user)
end
context 'when there are no packages' do
it 'shows no packages message' do
visit_project_packages
expect(page).to have_content 'No packages stored for this project.'
end
end
context 'when there are packages' do
before do
package
end
it 'shows list of packages' do
visit_project_packages
expect(page).to have_content(package.name)
expect(page).to have_content(package.version)
end
it 'shows a single package' do
visit_project_packages
click_on package.name
expect(page).to have_content(package.name)
expect(page).to have_content(package.version)
package.package_files.each do |package_file|
expect(page).to have_content(package_file.file_name)
end
end
end
def visit_project_packages
visit project_packages_path(project)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment