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
c0192281
Commit
c0192281
authored
Nov 10, 2021
by
Nicolò Maria Mezzopera
Committed by
David Fernandez
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable by default new refactored page
- tests - feature flag definition Changelog: changed
parent
c8d65dda
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
45 additions
and
72 deletions
+45
-72
app/assets/javascripts/packages_and_registries/package_registry/components/list/app.vue
...s_and_registries/package_registry/components/list/app.vue
+3
-2
app/assets/javascripts/packages_and_registries/package_registry/constants.js
...pts/packages_and_registries/package_registry/constants.js
+0
-1
app/assets/javascripts/pages/groups/packages/index/index.js
app/assets/javascripts/pages/groups/packages/index/index.js
+2
-9
app/assets/javascripts/pages/projects/packages/packages/index/index.js
...vascripts/pages/projects/packages/packages/index/index.js
+2
-9
app/controllers/groups/packages_controller.rb
app/controllers/groups/packages_controller.rb
+0
-4
app/controllers/projects/packages/packages_controller.rb
app/controllers/projects/packages/packages_controller.rb
+0
-4
config/feature_flags/development/package_list_apollo.yml
config/feature_flags/development/package_list_apollo.yml
+0
-8
spec/features/groups/packages_spec.rb
spec/features/groups/packages_spec.rb
+0
-4
spec/features/projects/packages_spec.rb
spec/features/projects/packages_spec.rb
+0
-4
spec/frontend/packages_and_registries/package_registry/components/list/app_spec.js
...d_registries/package_registry/components/list/app_spec.js
+22
-15
spec/support/shared_examples/features/packages_shared_examples.rb
...port/shared_examples/features/packages_shared_examples.rb
+16
-12
No files found.
app/assets/javascripts/packages_and_registries/package_registry/components/list/app.vue
View file @
c0192281
...
@@ -8,7 +8,6 @@ import { SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants';
...
@@ -8,7 +8,6 @@ import { SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants';
import
{
import
{
PROJECT_RESOURCE_TYPE
,
PROJECT_RESOURCE_TYPE
,
GROUP_RESOURCE_TYPE
,
GROUP_RESOURCE_TYPE
,
LIST_QUERY_DEBOUNCE_TIME
,
GRAPHQL_PAGE_SIZE
,
GRAPHQL_PAGE_SIZE
,
}
from
'
~/packages_and_registries/package_registry/constants
'
;
}
from
'
~/packages_and_registries/package_registry/constants
'
;
import
getPackagesQuery
from
'
~/packages_and_registries/package_registry/graphql/queries/get_packages.query.graphql
'
;
import
getPackagesQuery
from
'
~/packages_and_registries/package_registry/graphql/queries/get_packages.query.graphql
'
;
...
@@ -52,7 +51,9 @@ export default {
...
@@ -52,7 +51,9 @@ export default {
update
(
data
)
{
update
(
data
)
{
return
data
[
this
.
graphqlResource
].
packages
;
return
data
[
this
.
graphqlResource
].
packages
;
},
},
debounce
:
LIST_QUERY_DEBOUNCE_TIME
,
skip
()
{
return
!
this
.
sort
;
},
},
},
},
},
computed
:
{
computed
:
{
...
...
app/assets/javascripts/packages_and_registries/package_registry/constants.js
View file @
c0192281
...
@@ -83,5 +83,4 @@ export const INSTANCE_PACKAGE_ENDPOINT_TYPE = 'instance';
...
@@ -83,5 +83,4 @@ export const INSTANCE_PACKAGE_ENDPOINT_TYPE = 'instance';
export
const
PROJECT_RESOURCE_TYPE
=
'
project
'
;
export
const
PROJECT_RESOURCE_TYPE
=
'
project
'
;
export
const
GROUP_RESOURCE_TYPE
=
'
group
'
;
export
const
GROUP_RESOURCE_TYPE
=
'
group
'
;
export
const
LIST_QUERY_DEBOUNCE_TIME
=
50
;
export
const
GRAPHQL_PAGE_SIZE
=
20
;
export
const
GRAPHQL_PAGE_SIZE
=
20
;
app/assets/javascripts/pages/groups/packages/index/index.js
View file @
c0192281
(
async
function
packageApp
()
{
import
packageList
from
'
~/packages_and_registries/package_registry/pages/list
'
;
if
(
window
.
gon
.
features
.
packageListApollo
)
{
const
newPackageList
=
await
import
(
'
~/packages_and_registries/package_registry/pages/list
'
);
newPackageList
.
default
();
packageList
();
}
else
{
const
packageList
=
await
import
(
'
~/packages/list/packages_list_app_bundle
'
);
packageList
.
default
();
}
})();
app/assets/javascripts/pages/projects/packages/packages/index/index.js
View file @
c0192281
(
async
function
packageApp
()
{
import
packageList
from
'
~/packages_and_registries/package_registry/pages/list
'
;
if
(
window
.
gon
.
features
.
packageListApollo
)
{
const
newPackageList
=
await
import
(
'
~/packages_and_registries/package_registry/pages/list
'
);
newPackageList
.
default
();
packageList
();
}
else
{
const
packageList
=
await
import
(
'
~/packages/list/packages_list_app_bundle
'
);
packageList
.
default
();
}
})();
app/controllers/groups/packages_controller.rb
View file @
c0192281
...
@@ -6,10 +6,6 @@ module Groups
...
@@ -6,10 +6,6 @@ module Groups
feature_category
:package_registry
feature_category
:package_registry
before_action
do
push_frontend_feature_flag
(
:package_list_apollo
,
default_enabled: :yaml
)
end
private
private
def
verify_packages_enabled!
def
verify_packages_enabled!
...
...
app/controllers/projects/packages/packages_controller.rb
View file @
c0192281
...
@@ -7,10 +7,6 @@ module Projects
...
@@ -7,10 +7,6 @@ module Projects
feature_category
:package_registry
feature_category
:package_registry
before_action
do
push_frontend_feature_flag
(
:package_list_apollo
,
default_enabled: :yaml
)
end
def
show
def
show
@package
=
project
.
packages
.
find
(
params
[
:id
])
@package
=
project
.
packages
.
find
(
params
[
:id
])
end
end
...
...
config/feature_flags/development/package_list_apollo.yml
deleted
100644 → 0
View file @
c8d65dda
---
name
:
package_list_apollo
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70598
rollout_issue_url
:
milestone
:
'
14.3'
type
:
development
group
:
group::package
default_enabled
:
false
spec/features/groups/packages_spec.rb
View file @
c0192281
...
@@ -28,10 +28,6 @@ RSpec.describe 'Group Packages' do
...
@@ -28,10 +28,6 @@ RSpec.describe 'Group Packages' do
context
'when feature is available'
,
:js
do
context
'when feature is available'
,
:js
do
before
do
before
do
# we are simply setting the featrure flag to false because the new UI has nothing to test yet
# when the refactor is complete or almost complete we will turn on the feature tests
# see https://gitlab.com/gitlab-org/gitlab/-/issues/330846 for status of this work
stub_feature_flags
(
package_list_apollo:
false
)
visit_group_packages
visit_group_packages
end
end
...
...
spec/features/projects/packages_spec.rb
View file @
c0192281
...
@@ -27,10 +27,6 @@ RSpec.describe 'Packages' do
...
@@ -27,10 +27,6 @@ RSpec.describe 'Packages' do
context
'when feature is available'
,
:js
do
context
'when feature is available'
,
:js
do
before
do
before
do
# we are simply setting the featrure flag to false because the new UI has nothing to test yet
# when the refactor is complete or almost complete we will turn on the feature tests
# see https://gitlab.com/gitlab-org/gitlab/-/issues/330846 for status of this work
stub_feature_flags
(
package_list_apollo:
false
)
visit_project_packages
visit_project_packages
end
end
...
...
spec/frontend/packages_and_registries/package_registry/components/list/app_spec.js
View file @
c0192281
...
@@ -15,7 +15,6 @@ import DeletePackage from '~/packages_and_registries/package_registry/components
...
@@ -15,7 +15,6 @@ import DeletePackage from '~/packages_and_registries/package_registry/components
import
{
import
{
PROJECT_RESOURCE_TYPE
,
PROJECT_RESOURCE_TYPE
,
GROUP_RESOURCE_TYPE
,
GROUP_RESOURCE_TYPE
,
LIST_QUERY_DEBOUNCE_TIME
,
GRAPHQL_PAGE_SIZE
,
GRAPHQL_PAGE_SIZE
,
}
from
'
~/packages_and_registries/package_registry/constants
'
;
}
from
'
~/packages_and_registries/package_registry/constants
'
;
...
@@ -86,15 +85,24 @@ describe('PackagesListApp', () => {
...
@@ -86,15 +85,24 @@ describe('PackagesListApp', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
const
waitForDebouncedApollo
=
()
=>
{
const
waitForFirstRequest
=
()
=>
{
jest
.
advanceTimersByTime
(
LIST_QUERY_DEBOUNCE_TIME
);
// emit a search update so the query is executed
findSearch
().
vm
.
$emit
(
'
update
'
,
{
sort
:
'
NAME_DESC
'
,
filters
:
[]
});
return
waitForPromises
();
return
waitForPromises
();
};
};
it
(
'
does not execute the query without sort being set
'
,
()
=>
{
const
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
());
mountComponent
({
resolver
});
expect
(
resolver
).
not
.
toHaveBeenCalled
();
});
it
(
'
renders
'
,
async
()
=>
{
it
(
'
renders
'
,
async
()
=>
{
mountComponent
();
mountComponent
();
await
waitFor
DebouncedApollo
();
await
waitFor
FirstRequest
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
});
...
@@ -102,7 +110,7 @@ describe('PackagesListApp', () => {
...
@@ -102,7 +110,7 @@ describe('PackagesListApp', () => {
it
(
'
has a package title
'
,
async
()
=>
{
it
(
'
has a package title
'
,
async
()
=>
{
mountComponent
();
mountComponent
();
await
waitFor
DebouncedApollo
();
await
waitFor
FirstRequest
();
expect
(
findPackageTitle
().
exists
()).
toBe
(
true
);
expect
(
findPackageTitle
().
exists
()).
toBe
(
true
);
expect
(
findPackageTitle
().
props
(
'
count
'
)).
toBe
(
2
);
expect
(
findPackageTitle
().
props
(
'
count
'
)).
toBe
(
2
);
...
@@ -121,8 +129,7 @@ describe('PackagesListApp', () => {
...
@@ -121,8 +129,7 @@ describe('PackagesListApp', () => {
findSearch
().
vm
.
$emit
(
'
update
'
,
searchPayload
);
findSearch
().
vm
.
$emit
(
'
update
'
,
searchPayload
);
await
waitForDebouncedApollo
();
await
waitForPromises
();
jest
.
advanceTimersByTime
(
LIST_QUERY_DEBOUNCE_TIME
);
expect
(
resolver
).
toHaveBeenCalledWith
(
expect
(
resolver
).
toHaveBeenCalledWith
(
expect
.
objectContaining
({
expect
.
objectContaining
({
...
@@ -140,7 +147,7 @@ describe('PackagesListApp', () => {
...
@@ -140,7 +147,7 @@ describe('PackagesListApp', () => {
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
());
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
());
mountComponent
({
resolver
});
mountComponent
({
resolver
});
return
waitFor
DebouncedApollo
();
return
waitFor
FirstRequest
();
});
});
it
(
'
exists and has the right props
'
,
()
=>
{
it
(
'
exists and has the right props
'
,
()
=>
{
...
@@ -182,7 +189,7 @@ describe('PackagesListApp', () => {
...
@@ -182,7 +189,7 @@ describe('PackagesListApp', () => {
provide
=
{
...
defaultProvide
,
isGroupPage
};
provide
=
{
...
defaultProvide
,
isGroupPage
};
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
({
type
}));
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
({
type
}));
mountComponent
({
provide
,
resolver
});
mountComponent
({
provide
,
resolver
});
return
waitFor
DebouncedApollo
();
return
waitFor
FirstRequest
();
});
});
it
(
'
succeeds
'
,
()
=>
{
it
(
'
succeeds
'
,
()
=>
{
...
@@ -191,7 +198,7 @@ describe('PackagesListApp', () => {
...
@@ -191,7 +198,7 @@ describe('PackagesListApp', () => {
it
(
'
calls the resolver with the right parameters
'
,
()
=>
{
it
(
'
calls the resolver with the right parameters
'
,
()
=>
{
expect
(
resolver
).
toHaveBeenCalledWith
(
expect
(
resolver
).
toHaveBeenCalledWith
(
expect
.
objectContaining
({
isGroupPage
,
[
sortType
]:
''
}),
expect
.
objectContaining
({
isGroupPage
,
[
sortType
]:
'
NAME_DESC
'
}),
);
);
});
});
});
});
...
@@ -201,7 +208,7 @@ describe('PackagesListApp', () => {
...
@@ -201,7 +208,7 @@ describe('PackagesListApp', () => {
const
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
({
extend
:
{
nodes
:
[]
}
}));
const
resolver
=
jest
.
fn
().
mockResolvedValue
(
packagesListQuery
({
extend
:
{
nodes
:
[]
}
}));
mountComponent
({
resolver
});
mountComponent
({
resolver
});
return
waitFor
DebouncedApollo
();
return
waitFor
FirstRequest
();
});
});
it
(
'
generate the correct empty list link
'
,
()
=>
{
it
(
'
generate the correct empty list link
'
,
()
=>
{
const
link
=
findListComponent
().
findComponent
(
GlLink
);
const
link
=
findListComponent
().
findComponent
(
GlLink
);
...
@@ -219,7 +226,7 @@ describe('PackagesListApp', () => {
...
@@ -219,7 +226,7 @@ describe('PackagesListApp', () => {
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
mountComponent
();
mountComponent
();
await
waitFor
DebouncedApollo
();
await
waitFor
FirstRequest
();
findSearch
().
vm
.
$emit
(
'
update
'
,
searchPayload
);
findSearch
().
vm
.
$emit
(
'
update
'
,
searchPayload
);
...
@@ -236,7 +243,7 @@ describe('PackagesListApp', () => {
...
@@ -236,7 +243,7 @@ describe('PackagesListApp', () => {
it
(
'
exists and has the correct props
'
,
async
()
=>
{
it
(
'
exists and has the correct props
'
,
async
()
=>
{
mountComponent
();
mountComponent
();
await
waitFor
DebouncedApollo
();
await
waitFor
FirstRequest
();
expect
(
findDeletePackage
().
props
()).
toMatchObject
({
expect
(
findDeletePackage
().
props
()).
toMatchObject
({
refetchQueries
:
[{
query
:
getPackagesQuery
,
variables
:
{}
}],
refetchQueries
:
[{
query
:
getPackagesQuery
,
variables
:
{}
}],
...
@@ -247,7 +254,7 @@ describe('PackagesListApp', () => {
...
@@ -247,7 +254,7 @@ describe('PackagesListApp', () => {
it
(
'
deletePackage is bound to package-list package:delete event
'
,
async
()
=>
{
it
(
'
deletePackage is bound to package-list package:delete event
'
,
async
()
=>
{
mountComponent
();
mountComponent
();
await
waitFor
DebouncedApollo
();
await
waitFor
FirstRequest
();
findListComponent
().
vm
.
$emit
(
'
package:delete
'
,
{
id
:
1
});
findListComponent
().
vm
.
$emit
(
'
package:delete
'
,
{
id
:
1
});
...
@@ -257,7 +264,7 @@ describe('PackagesListApp', () => {
...
@@ -257,7 +264,7 @@ describe('PackagesListApp', () => {
it
(
'
start and end event set loading correctly
'
,
async
()
=>
{
it
(
'
start and end event set loading correctly
'
,
async
()
=>
{
mountComponent
();
mountComponent
();
await
waitFor
DebouncedApollo
();
await
waitFor
FirstRequest
();
findDeletePackage
().
vm
.
$emit
(
'
start
'
);
findDeletePackage
().
vm
.
$emit
(
'
start
'
);
...
...
spec/support/shared_examples/features/packages_shared_examples.rb
View file @
c0192281
...
@@ -21,10 +21,6 @@ end
...
@@ -21,10 +21,6 @@ end
RSpec
.
shared_examples
'package details link'
do
|
property
|
RSpec
.
shared_examples
'package details link'
do
|
property
|
let
(
:package
)
{
packages
.
first
}
let
(
:package
)
{
packages
.
first
}
before
do
stub_feature_flags
(
packages_details_one_column:
false
)
end
it
'navigates to the correct url'
do
it
'navigates to the correct url'
do
page
.
within
(
packages_table_selector
)
do
page
.
within
(
packages_table_selector
)
do
click_link
package
.
name
click_link
package
.
name
...
@@ -94,16 +90,24 @@ def packages_table_selector
...
@@ -94,16 +90,24 @@ def packages_table_selector
end
end
def
click_sort_option
(
option
,
ascending
)
def
click_sort_option
(
option
,
ascending
)
page
.
within
(
'.gl-sorting'
)
do
wait_for_requests
# Reset the sort direction
click_button
'Sort direction'
if
page
.
has_selector?
(
'svg[aria-label="Sorting Direction: Ascending"]'
,
wait:
0
)
find
(
'button.gl-dropdown-toggle'
).
click
# Reset the sort direction
if
page
.
has_selector?
(
'button[aria-label="Sorting Direction: Ascending"]'
,
wait:
0
)
&&
!
ascending
click_button
'Sort direction'
page
.
within
(
'.dropdown-menu'
)
do
wait_for_requests
click_button
option
end
end
find
(
'button.gl-dropdown-toggle'
).
click
page
.
within
(
'.dropdown-menu'
)
do
click_button
option
end
if
ascending
wait_for_requests
click_button
'Sort direction'
if
ascending
click_button
'Sort direction'
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