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
e2564101
Commit
e2564101
authored
Nov 05, 2019
by
Nicolò Maria Mezzopera
Committed by
Kamil Trzciński
Nov 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable feature flag and add vue app mountpoint
for project package list
parent
35e9c021
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
187 additions
and
158 deletions
+187
-158
ee/app/helpers/ee/packages_helper.rb
ee/app/helpers/ee/packages_helper.rb
+4
-0
ee/app/views/projects/packages/packages/_legacy_package_list.html.haml
...projects/packages/packages/_legacy_package_list.html.haml
+60
-0
ee/app/views/projects/packages/packages/index.html.haml
ee/app/views/projects/packages/packages/index.html.haml
+5
-57
ee/spec/features/projects/packages_spec.rb
ee/spec/features/projects/packages_spec.rb
+117
-100
qa/qa/ee/page/project/packages/index.rb
qa/qa/ee/page/project/packages/index.rb
+1
-1
No files found.
ee/app/helpers/ee/packages_helper.rb
View file @
e2564101
...
@@ -5,5 +5,9 @@ module EE
...
@@ -5,5 +5,9 @@ module EE
def
package_sort_path
(
options
=
{})
def
package_sort_path
(
options
=
{})
"
#{
request
.
path
}
?
#{
options
.
to_param
}
"
"
#{
request
.
path
}
?
#{
options
.
to_param
}
"
end
end
def
vue_package_list_enabled_for?
(
subject
)
::
Feature
.
enabled?
(
:vue_package_list
,
subject
)
end
end
end
end
end
ee/app/views/projects/packages/packages/_legacy_package_list.html.haml
0 → 100644
View file @
e2564101
-
sort_value
=
@sort
-
sort_title
=
packages_sort_option_title
(
sort_value
)
-
if
@packages
.
any?
.d-flex.justify-content-end
.dropdown.inline.prepend-top-default.append-bottom-default.package-sort-dropdown
.btn-group
{
role:
'group'
}
.btn-group
{
role:
'group'
}
%button
.dropdown-menu-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
,
display:
'static'
},
class:
'btn btn-default'
}
=
sort_title
=
icon
(
'chevron-down'
)
%ul
.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li
=
sortable_item
(
sort_title_created_date
,
package_sort_path
(
sort:
sort_value_recently_created
),
sort_title
)
=
sortable_item
(
sort_title_name
,
package_sort_path
(
sort:
sort_value_name_desc
),
sort_title
)
=
sortable_item
(
sort_title_version
,
package_sort_path
(
sort:
sort_value_version_desc
),
sort_title
)
=
sortable_item
(
sort_title_type
,
package_sort_path
(
sort:
sort_value_type_desc
),
sort_title
)
=
packages_sort_direction_button
(
sort_value
)
.table-holder
.gl-responsive-table-row.table-row-header.bg-secondary-50.px-2.border-top
{
role:
'row'
}
.table-section.section-30
{
role:
'rowheader'
}
=
_
(
'Name'
)
.table-section.section-20
{
role:
'rowheader'
}
=
_
(
'Version'
)
.table-section.section-20
{
role:
'rowheader'
}
=
_
(
'Type'
)
.table-section.section-20
{
role:
'rowheader'
}
=
_
(
'Created'
)
.table-section.section-10
{
role:
'rowheader'
}
-
@packages
.
each
do
|
package
|
.gl-responsive-table-row.package-row.px-2
{
data:
{
qa_selector:
"package_row"
}
}
.table-section.section-30
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Name"
)
.table-mobile-content.flex-truncate-parent
=
link_to
package
.
name
,
project_package_path
(
@project
,
package
),
class:
'flex-truncate-child'
,
data:
{
qa_selector:
"package_link"
}
.table-section.section-20
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Version"
)
.table-mobile-content
=
package
.
version
.table-section.section-20
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Type"
)
.table-mobile-content
=
package
.
package_type
.table-section.section-20
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Created"
)
.table-mobile-content
=
time_ago_with_tooltip
(
package
.
created_at
)
.table-section.section-10
.table-mobile-header
{
role:
"rowheader"
}
.table-mobile-content
-
if
can_destroy_package
.pull-right
=
link_to
project_package_path
(
@project
,
package
),
method: :delete
,
data:
{
confirm:
_
(
"Are you sure?"
)
},
class:
"btn btn-grouped btn-remove"
,
title:
_
(
'Delete Package'
)
do
=
icon
(
'trash'
)
=
paginate
@packages
,
theme:
"gitlab"
-
else
.row.empty-state
.col-12
=
render
'shared/packages/no_packages'
ee/app/views/projects/packages/packages/index.html.haml
View file @
e2564101
-
sort_value
=
@sort
-
sort_title
=
packages_sort_option_title
(
sort_value
)
-
page_title
_
(
"Packages"
)
-
page_title
_
(
"Packages"
)
-
can_destroy_package
=
can?
(
current_user
,
:destroy_package
,
@project
)
-
can_destroy_package
=
can?
(
current_user
,
:destroy_package
,
@project
)
-
if
@packages
.
any?
-
if
vue_package_list_enabled_for?
(
@project
)
.d-flex.justify-content-end
.row
.dropdown.inline.prepend-top-default.append-bottom-default.package-sort-dropdown
.col-12
.btn-group
{
role:
'group'
}
#js-vue-packages-list
{
data:
{
project_id:
@project
.
id
,
'can_destroy_package'
=>
can_destroy_package
}
}
.btn-group
{
role:
'group'
}
%button
.dropdown-menu-toggle
{
type:
'button'
,
data:
{
toggle:
'dropdown'
,
display:
'static'
},
class:
'btn btn-default'
}
=
sort_title
=
icon
(
'chevron-down'
)
%ul
.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
%li
=
sortable_item
(
sort_title_created_date
,
package_sort_path
(
sort:
sort_value_recently_created
),
sort_title
)
=
sortable_item
(
sort_title_name
,
package_sort_path
(
sort:
sort_value_name_desc
),
sort_title
)
=
sortable_item
(
sort_title_version
,
package_sort_path
(
sort:
sort_value_version_desc
),
sort_title
)
=
sortable_item
(
sort_title_type
,
package_sort_path
(
sort:
sort_value_type_desc
),
sort_title
)
=
packages_sort_direction_button
(
sort_value
)
.table-holder
.gl-responsive-table-row.table-row-header.bg-secondary-50.px-2.border-top
{
role:
'row'
}
.table-section.section-30
{
role:
'rowheader'
}
=
_
(
'Name'
)
.table-section.section-20
{
role:
'rowheader'
}
=
_
(
'Version'
)
.table-section.section-20
{
role:
'rowheader'
}
=
_
(
'Type'
)
.table-section.section-20
{
role:
'rowheader'
}
=
_
(
'Created'
)
.table-section.section-10
{
role:
'rowheader'
}
-
@packages
.
each
do
|
package
|
.gl-responsive-table-row.package-row.px-2
{
data:
{
qa_selector:
"package_row"
}
}
.table-section.section-30
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Name"
)
.table-mobile-content.flex-truncate-parent
=
link_to
package
.
name
,
project_package_path
(
@project
,
package
),
class:
'flex-truncate-child'
,
data:
{
qa_selector:
"package_link"
}
.table-section.section-20
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Version"
)
.table-mobile-content
=
package
.
version
.table-section.section-20
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Type"
)
.table-mobile-content
=
package
.
package_type
.table-section.section-20
.table-mobile-header
{
role:
"rowheader"
}=
_
(
"Created"
)
.table-mobile-content
=
time_ago_with_tooltip
(
package
.
created_at
)
.table-section.section-10
.table-mobile-header
{
role:
"rowheader"
}
.table-mobile-content
-
if
can_destroy_package
.pull-right
=
link_to
project_package_path
(
@project
,
package
),
method: :delete
,
data:
{
confirm:
_
(
"Are you sure?"
)
},
class:
"btn btn-grouped btn-remove"
,
title:
_
(
'Delete Package'
)
do
=
icon
(
'trash'
)
=
paginate
@packages
,
theme:
"gitlab"
-
else
-
else
.row.empty-state
=
render
"legacy_package_list"
,
can_destroy_package:
can_destroy_package
.col-12
=
render
'shared/packages/no_packages'
ee/spec/features/projects/packages_spec.rb
View file @
e2564101
...
@@ -14,145 +14,162 @@ describe 'Packages' do
...
@@ -14,145 +14,162 @@ describe 'Packages' do
stub_licensed_features
(
packages:
true
)
stub_licensed_features
(
packages:
true
)
end
end
context
'
packages feature is not available because of license
'
do
context
'
with vue_package_list feature flag disabled
'
do
before
do
before
do
stub_
licensed_features
(
packages
:
false
)
stub_
feature_flags
(
vue_package_list
:
false
)
end
end
it
'gives 404'
do
context
'packages feature is not available because of license'
do
visit_project_packages
before
do
stub_licensed_features
(
packages:
false
)
end
expect
(
status_code
).
to
eq
(
404
)
it
'gives 404'
do
end
visit_project_packages
end
context
'packages feature is disabled by config'
do
expect
(
status_code
).
to
eq
(
404
)
before
do
end
allow
(
Gitlab
.
config
.
packages
).
to
receive
(
:enabled
).
and_return
(
false
)
end
end
it
'gives 404'
do
context
'packages feature is disabled by config'
do
visit_project_packages
before
do
allow
(
Gitlab
.
config
.
packages
).
to
receive
(
:enabled
).
and_return
(
false
)
end
it
'gives 404'
do
visit_project_packages
expect
(
status_code
).
to
eq
(
404
)
expect
(
status_code
).
to
eq
(
404
)
end
end
end
end
context
'when there are no packages'
do
context
'when there are no packages'
do
it
'shows no packages message'
do
it
'shows no packages message'
do
visit_project_packages
visit_project_packages
expect
(
page
).
to
have_content
'There are no packages yet'
expect
(
page
).
to
have_content
'There are no packages yet'
end
end
end
end
context
'when there are packages'
do
context
'when there are packages'
do
let!
(
:package
)
{
create
(
:maven_package
,
project:
project
)
}
let!
(
:package
)
{
create
(
:maven_package
,
project:
project
)
}
before
do
before
do
visit_project_packages
visit_project_packages
end
end
it
'shows list of packages'
do
it
'shows list of packages'
do
expect
(
page
).
to
have_content
(
package
.
name
)
expect
(
page
).
to
have_content
(
package
.
name
)
expect
(
page
).
to
have_content
(
package
.
version
)
expect
(
page
).
to
have_content
(
package
.
version
)
end
end
it
'hides a package without a version from the list'
do
it
'hides a package without a version from the list'
do
package
.
update!
(
version:
nil
)
package
.
update!
(
version:
nil
)
visit_project_packages
visit_project_packages
expect
(
page
).
not_to
have_content
(
package
.
name
)
expect
(
page
).
not_to
have_content
(
package
.
name
)
end
end
it
'shows a single package'
,
:js
do
it
'shows a single package'
,
:js
do
click_on
package
.
name
click_on
package
.
name
expect
(
page
).
to
have_content
(
package
.
name
)
expect
(
page
).
to
have_content
(
package
.
name
)
expect
(
page
).
to
have_content
(
package
.
version
)
expect
(
page
).
to
have_content
(
package
.
version
)
package
.
package_files
.
each
do
|
package_file
|
package
.
package_files
.
each
do
|
package_file
|
expect
(
page
).
to
have_content
(
package_file
.
file_name
)
expect
(
page
).
to
have_content
(
package_file
.
file_name
)
end
end
end
end
it
'removes package'
do
it
'removes package'
do
click_link
'Delete Package'
click_link
'Delete Package'
expect
(
page
).
to
have_content
'Package was removed'
expect
(
page
).
to
have_content
'Package was removed'
expect
(
page
).
not_to
have_content
(
package
.
name
)
expect
(
page
).
not_to
have_content
(
package
.
name
)
end
end
end
end
context
'sorting when there are packages'
do
context
'sorting when there are packages'
do
let!
(
:aaa_package
)
do
let!
(
:aaa_package
)
do
create
(
create
(
:maven_package
,
:maven_package
,
name:
'aaa/company/app/my-app'
,
name:
'aaa/company/app/my-app'
,
version:
'1.0-SNAPSHOT'
,
version:
'1.0-SNAPSHOT'
,
project:
project
)
project:
project
)
end
end
let!
(
:bbb_package
)
do
let!
(
:bbb_package
)
do
create
(
create
(
:maven_package
,
:maven_package
,
name:
'bbb/company/app/my-app'
,
name:
'bbb/company/app/my-app'
,
version:
'1.1-SNAPSHOT'
,
version:
'1.1-SNAPSHOT'
,
project:
project
)
project:
project
)
end
end
it
'sorts by created date descending'
do
it
'sorts by created date descending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_created_date
)
visit
project_packages_path
(
project
,
sort:
sort_value_created_date
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
end
end
it
'sorts by created date ascending'
do
it
'sorts by created date ascending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_oldest_created
)
visit
project_packages_path
(
project
,
sort:
sort_value_oldest_created
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
end
end
it
'sorts by name descending'
do
it
'sorts by name descending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_name_desc
)
visit
project_packages_path
(
project
,
sort:
sort_value_name_desc
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
end
end
it
'sorts by name ascending'
do
it
'sorts by name ascending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_name
)
visit
project_packages_path
(
project
,
sort:
sort_value_name
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
end
end
it
'sorts by version descending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_version_desc
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
end
it
'sorts by version descending'
do
it
'sorts by version ascending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_version_desc
)
visit
project_packages_path
(
project
,
sort:
sort_value_version_asc
)
expect
(
first_package
).
to
include
(
bbb_package
.
name
)
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
aaa_package
.
name
)
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
end
end
end
it
'sorts by version ascending'
do
context
'sorting different types of packages'
do
visit
project_packages_path
(
project
,
sort:
sort_value_version_asc
)
let!
(
:maven_package
)
{
create
(
:maven_package
,
project:
project
)
}
expect
(
first_package
).
to
include
(
aaa_package
.
name
)
let!
(
:npm_package
)
{
create
(
:npm_package
,
project:
project
)
}
expect
(
last_package
).
to
include
(
bbb_package
.
name
)
it
'sorts by type descending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_type_desc
)
expect
(
first_package
).
to
include
(
npm_package
.
name
)
expect
(
last_package
).
to
include
(
maven_package
.
name
)
end
it
'sorts by type ascending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_type_asc
)
expect
(
first_package
).
to
include
(
maven_package
.
name
)
expect
(
last_package
).
to
include
(
npm_package
.
name
)
end
end
end
end
end
context
'sorting different types of packages'
do
context
'wtih vue_package_list ff enabled'
do
let!
(
:maven_package
)
{
create
(
:maven_package
,
project:
project
)
}
before
do
let!
(
:npm_package
)
{
create
(
:npm_package
,
project:
project
)
}
stub_feature_flags
(
vue_package_list:
true
)
visit_project_packages
it
'sorts by type descending'
do
visit
project_packages_path
(
project
,
sort:
sort_value_type_desc
)
expect
(
first_package
).
to
include
(
npm_package
.
name
)
expect
(
last_package
).
to
include
(
maven_package
.
name
)
end
end
it
'sorts by type ascending'
do
it
'load an empty placeholder'
do
visit
project_packages_path
(
project
,
sort:
sort_value_type_asc
)
expect
(
page
.
has_selector?
(
'#js-vue-packages-list'
)).
to
be_truthy
expect
(
first_package
).
to
include
(
maven_package
.
name
)
expect
(
last_package
).
to
include
(
npm_package
.
name
)
end
end
end
end
...
...
qa/qa/ee/page/project/packages/index.rb
View file @
e2564101
...
@@ -6,7 +6,7 @@ module QA
...
@@ -6,7 +6,7 @@ module QA
module
Project
module
Project
module
Packages
module
Packages
class
Index
<
QA
::
Page
::
Base
class
Index
<
QA
::
Page
::
Base
view
'ee/app/views/projects/packages/packages/
index
.html.haml'
do
view
'ee/app/views/projects/packages/packages/
_legacy_package_list
.html.haml'
do
element
:package_row
element
:package_row
element
:package_link
element
:package_link
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