Commit 243177f3 authored by David Fernandez's avatar David Fernandez

Merge branch '334786-feature-flag-rollout-of-package_details_apollo' into 'master'

Remove`package_details_apollo` feature flag

See merge request gitlab-org/gitlab!69649
parents 4e01681d 6e659c7a
(async function initPackage() {
let app;
if (document.getElementById('js-vue-packages-detail-new')) {
app = await import(
/* webpackChunkName: 'new_package_app' */ `~/packages_and_registries/package_registry/pages/details.js`
);
} else {
app = await import('~/packages/details/');
}
app.default();
})();
import initPackageDetails from '~/packages_and_registries/package_registry/pages/details';
initPackageDetails();
......@@ -64,9 +64,8 @@ module PackagesHelper
project.container_repositories.exists?
end
def package_details_data(project, package, use_presenter = false)
def package_details_data(project, package)
{
package: use_presenter ? package_from_presenter(package) : nil,
package_id: package.id,
can_delete: can?(current_user, :destroy_package, project).to_s,
svg_path: image_path('illustrations/no-packages.svg'),
......
......@@ -6,7 +6,4 @@
.row
.col-12
- if Feature.enabled?(:package_details_apollo, default_enabled: :yaml)
#js-vue-packages-detail-new{ data: package_details_data(@project, @package) }
- else
#js-vue-packages-detail{ data: package_details_data(@project, @package, true) }
#js-vue-packages-detail-new{ data: package_details_data(@project, @package) }
---
name: package_details_apollo
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64939
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334786
milestone: '14.1'
type: development
group: group::package
default_enabled: true
......@@ -44,14 +44,6 @@ RSpec.describe 'Group Packages' do
it_behaves_like 'packages list', check_project_name: true
context 'when package_details_apollo feature flag is off' do
before do
stub_feature_flags(package_details_apollo: false)
end
it_behaves_like 'package details link'
end
it_behaves_like 'package details link'
it 'allows you to navigate to the project page' do
......
......@@ -23,20 +23,6 @@ RSpec.describe 'PackageFiles' do
expect(status_code).to eq(200)
end
context 'when package_details_apollo feature flag is off' do
before do
stub_feature_flags(package_details_apollo: false)
end
it 'renders the download link with the correct url', :js do
visit project_package_path(project, package)
download_url = download_project_package_file_path(project, package_file)
expect(page).to have_link(package_file.file_name, href: download_url)
end
end
it 'does not allow download of package belonging to different project' do
another_package = create(:maven_package)
another_file = another_package.package_files.first
......
......@@ -37,14 +37,6 @@ RSpec.describe 'Packages' do
it_behaves_like 'packages list'
context 'when package_details_apollo feature flag is off' do
before do
stub_feature_flags(package_details_apollo: false)
end
it_behaves_like 'package details link'
end
it_behaves_like 'package details link'
context 'deleting a package' do
......
......@@ -223,21 +223,41 @@ RSpec.describe PackagesHelper do
describe '#package_details_data' do
let_it_be(:package) { create(:package) }
let(:expected_result) do
{
package_id: package.id,
can_delete: 'true',
project_name: project.name,
group_list_url: ''
}
end
before do
allow(helper).to receive(:current_user) { project.owner }
allow(helper).to receive(:can?) { true }
end
it 'when use_presenter is true populate the package key' do
result = helper.package_details_data(project, package, true)
context 'in a project without a group' do
it 'populates presenter data' do
result = helper.package_details_data(project, package)
expect(result[:package]).not_to be_nil
expect(result).to match(hash_including(expected_result))
end
end
it 'when use_presenter is false the package key is nil' do
result = helper.package_details_data(project, package, false)
context 'in a project with a group' do
let_it_be(:group) { create(:group) }
let_it_be(:project_with_group) { create(:project, group: group) }
expect(result[:package]).to be_nil
it 'populates presenter data' do
result = helper.package_details_data(project_with_group, package)
expected = expected_result.merge({
group_list_url: group_packages_path(project_with_group.group),
project_name: project_with_group.name
})
expect(result).to match(hash_including(expected))
end
end
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