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
a9d2b71c
Commit
a9d2b71c
authored
Aug 12, 2021
by
Illya Klymov
Committed by
Jacques Erasmus
Sep 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update import table component to use cell components
* switch to fresh cell components
parent
717ff458
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
40 deletions
+27
-40
app/assets/javascripts/import_entities/import_groups/components/import_table.vue
...import_entities/import_groups/components/import_table.vue
+24
-35
spec/frontend/import_entities/import_groups/components/import_table_spec.js
...rt_entities/import_groups/components/import_table_spec.js
+3
-5
No files found.
app/assets/javascripts/import_entities/import_groups/components/import_table.vue
View file @
a9d2b71c
...
@@ -9,19 +9,19 @@ import {
...
@@ -9,19 +9,19 @@ import {
GlLoadingIcon
,
GlLoadingIcon
,
GlSearchBoxByClick
,
GlSearchBoxByClick
,
GlSprintf
,
GlSprintf
,
GlSafeHtmlDirective
as
SafeHtml
,
GlTable
,
GlTable
,
GlFormCheckbox
,
GlFormCheckbox
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
{
s__
,
__
,
n__
}
from
'
~/locale
'
;
import
{
s__
,
__
,
n__
}
from
'
~/locale
'
;
import
PaginationLinks
from
'
~/vue_shared/components/pagination_links.vue
'
;
import
PaginationLinks
from
'
~/vue_shared/components/pagination_links.vue
'
;
import
ImportStatus
from
'
../../components/import_status.vue
'
;
import
ImportStatusCell
from
'
../../components/import_status.vue
'
;
import
{
STATUSES
}
from
'
../../constants
'
;
import
importGroupsMutation
from
'
../graphql/mutations/import_groups.mutation.graphql
'
;
import
importGroupsMutation
from
'
../graphql/mutations/import_groups.mutation.graphql
'
;
import
setImportTargetMutation
from
'
../graphql/mutations/set_import_target.mutation.graphql
'
;
import
setImportTargetMutation
from
'
../graphql/mutations/set_import_target.mutation.graphql
'
;
import
availableNamespacesQuery
from
'
../graphql/queries/available_namespaces.query.graphql
'
;
import
availableNamespacesQuery
from
'
../graphql/queries/available_namespaces.query.graphql
'
;
import
bulkImportSourceGroupsQuery
from
'
../graphql/queries/bulk_import_source_groups.query.graphql
'
;
import
bulkImportSourceGroupsQuery
from
'
../graphql/queries/bulk_import_source_groups.query.graphql
'
;
import
{
isInvalid
}
from
'
../utils
'
;
import
{
isInvalid
,
isFinished
,
isAvailableForImport
}
from
'
../utils
'
;
import
ImportActionsCell
from
'
./import_actions_cell.vue
'
;
import
ImportSourceCell
from
'
./import_source_cell.vue
'
;
import
ImportTargetCell
from
'
./import_target_cell.vue
'
;
import
ImportTargetCell
from
'
./import_target_cell.vue
'
;
const
PAGE_SIZES
=
[
20
,
50
,
100
];
const
PAGE_SIZES
=
[
20
,
50
,
100
];
...
@@ -43,13 +43,12 @@ export default {
...
@@ -43,13 +43,12 @@ export default {
GlFormCheckbox
,
GlFormCheckbox
,
GlSprintf
,
GlSprintf
,
GlTable
,
GlTable
,
ImportS
tatus
,
ImportS
ourceCell
,
ImportTargetCell
,
ImportTargetCell
,
ImportStatusCell
,
ImportActionsCell
,
PaginationLinks
,
PaginationLinks
,
},
},
directives
:
{
SafeHtml
,
},
props
:
{
props
:
{
sourceUrl
:
{
sourceUrl
:
{
...
@@ -136,7 +135,7 @@ export default {
...
@@ -136,7 +135,7 @@ export default {
},
},
availableGroupsForImport
()
{
availableGroupsForImport
()
{
return
this
.
groups
.
filter
((
g
)
=>
g
.
progress
.
status
===
STATUSES
.
NONE
&&
!
this
.
isInvalid
(
g
));
return
this
.
groups
.
filter
((
g
)
=>
isAvailableForImport
(
g
)
&&
!
this
.
isInvalid
(
g
));
},
},
humanizedTotal
()
{
humanizedTotal
()
{
...
@@ -201,10 +200,8 @@ export default {
...
@@ -201,10 +200,8 @@ export default {
return
{};
return
{};
},
},
isAlreadyImported
(
group
)
{
isAvailableForImport
,
return
group
.
progress
.
status
!==
STATUSES
.
NONE
;
isFinished
,
},
isInvalid
(
group
)
{
isInvalid
(
group
)
{
return
isInvalid
(
group
,
this
.
groupPathRegex
);
return
isInvalid
(
group
,
this
.
groupPathRegex
);
},
},
...
@@ -253,7 +250,10 @@ export default {
...
@@ -253,7 +250,10 @@ export default {
const
table
=
this
.
getTableRef
();
const
table
=
this
.
getTableRef
();
this
.
groups
.
forEach
((
group
,
idx
)
=>
{
this
.
groups
.
forEach
((
group
,
idx
)
=>
{
if
(
table
.
isRowSelected
(
idx
)
&&
(
this
.
isAlreadyImported
(
group
)
||
this
.
isInvalid
(
group
)))
{
if
(
table
.
isRowSelected
(
idx
)
&&
(
!
this
.
isAvailableForImport
(
group
)
||
this
.
isInvalid
(
group
))
)
{
table
.
unselectRow
(
idx
);
table
.
unselectRow
(
idx
);
}
}
});
});
...
@@ -291,7 +291,7 @@ export default {
...
@@ -291,7 +291,7 @@ export default {
<strong>
{{
filter
}}
</strong>
<strong>
{{
filter
}}
</strong>
</
template
>
</
template
>
<
template
#link
>
<
template
#link
>
<gl-link
class=
"gl-display-inline-block"
:href=
"sourceUrl"
target=
"_blank"
>
<gl-link
:href=
"sourceUrl"
target=
"_blank"
>
{{
sourceUrl
}}
<gl-icon
name=
"external-link"
class=
"vertical-align-middle"
/>
{{
sourceUrl
}}
<gl-icon
name=
"external-link"
class=
"vertical-align-middle"
/>
</gl-link>
</gl-link>
</
template
>
</
template
>
...
@@ -360,18 +360,12 @@ export default {
...
@@ -360,18 +360,12 @@ export default {
<gl-form-checkbox
<gl-form-checkbox
class=
"gl-h-7 gl-pt-3"
class=
"gl-h-7 gl-pt-3"
:checked=
"rowSelected"
:checked=
"rowSelected"
:disabled=
"
isAlreadyImported
(group) || isInvalid(group)"
:disabled=
"
!isAvailableForImport
(group) || isInvalid(group)"
@
change=
"rowSelected ? unselectRow() : selectRow()"
@
change=
"rowSelected ? unselectRow() : selectRow()"
/>
/>
</
template
>
</
template
>
<
template
#cell(web_url)=
"{ value: web_url, item: { full_path } }"
>
<
template
#cell(web_url)=
"{ item: group }"
>
<gl-link
<import-source-cell
:group=
"group"
/>
:href=
"web_url"
target=
"_blank"
class=
"gl-display-inline-flex gl-align-items-center gl-h-7"
>
{{
full_path
}}
<gl-icon
name=
"external-link"
/>
</gl-link>
</
template
>
</
template
>
<
template
#cell(import_target)=
"{ item: group }"
>
<
template
#cell(import_target)=
"{ item: group }"
>
<import-target-cell
<import-target-cell
...
@@ -388,19 +382,14 @@ export default {
...
@@ -388,19 +382,14 @@ export default {
/>
/>
</
template
>
</
template
>
<
template
#cell(progress)=
"{ value: { status } }"
>
<
template
#cell(progress)=
"{ value: { status } }"
>
<import-status
:status=
"status"
class=
"gl-line-height-32"
/>
<import-status
-cell
:status=
"status"
class=
"gl-line-height-32"
/>
</
template
>
</
template
>
<
template
#cell(actions)=
"{ item: group }"
>
<
template
#cell(actions)=
"{ item: group }"
>
<gl-button
<import-actions-cell
v-if=
"!isAlreadyImported(group)"
:group=
"group"
:disabled=
"isInvalid(group)"
:group-path-regex=
"groupPathRegex"
variant=
"confirm"
@
import-group=
"importGroups([group.id])"
category=
"secondary"
/>
data-qa-selector=
"import_group_button"
@
click=
"importGroups([group.id])"
>
{{
__
(
'
Import
'
)
}}
</gl-button>
</
template
>
</
template
>
</gl-table>
</gl-table>
<div
v-if=
"hasGroups"
class=
"gl-display-flex gl-mt-3 gl-align-items-center"
>
<div
v-if=
"hasGroups"
class=
"gl-display-flex gl-mt-3 gl-align-items-center"
>
...
...
spec/frontend/import_entities/import_groups/components/import_table_spec.js
View file @
a9d2b71c
...
@@ -15,6 +15,7 @@ import stubChildren from 'helpers/stub_children';
...
@@ -15,6 +15,7 @@ import stubChildren from 'helpers/stub_children';
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
STATUSES
}
from
'
~/import_entities/constants
'
;
import
{
STATUSES
}
from
'
~/import_entities/constants
'
;
import
ImportActionsCell
from
'
~/import_entities/import_groups/components/import_actions_cell.vue
'
;
import
ImportTable
from
'
~/import_entities/import_groups/components/import_table.vue
'
;
import
ImportTable
from
'
~/import_entities/import_groups/components/import_table.vue
'
;
import
ImportTargetCell
from
'
~/import_entities/import_groups/components/import_target_cell.vue
'
;
import
ImportTargetCell
from
'
~/import_entities/import_groups/components/import_target_cell.vue
'
;
import
importGroupsMutation
from
'
~/import_entities/import_groups/graphql/mutations/import_groups.mutation.graphql
'
;
import
importGroupsMutation
from
'
~/import_entities/import_groups/graphql/mutations/import_groups.mutation.graphql
'
;
...
@@ -163,11 +164,8 @@ describe('import table', () => {
...
@@ -163,11 +164,8 @@ describe('import table', () => {
it
(
'
invokes importGroups mutation when row button is clicked
'
,
async
()
=>
{
it
(
'
invokes importGroups mutation when row button is clicked
'
,
async
()
=>
{
jest
.
spyOn
(
apolloProvider
.
defaultClient
,
'
mutate
'
);
jest
.
spyOn
(
apolloProvider
.
defaultClient
,
'
mutate
'
);
const
triggerImportButton
=
wrapper
.
findAllComponents
(
GlButton
)
.
wrappers
.
find
((
w
)
=>
w
.
text
()
===
'
Import
'
);
triggerImportButton
.
vm
.
$emit
(
'
click
'
);
wrapper
.
findComponent
(
ImportActionsCell
).
vm
.
$emit
(
'
import-group
'
);
await
waitForPromises
();
await
waitForPromises
();
expect
(
apolloProvider
.
defaultClient
.
mutate
).
toHaveBeenCalledWith
({
expect
(
apolloProvider
.
defaultClient
.
mutate
).
toHaveBeenCalledWith
({
mutation
:
importGroupsMutation
,
mutation
:
importGroupsMutation
,
...
@@ -329,7 +327,7 @@ describe('import table', () => {
...
@@ -329,7 +327,7 @@ describe('import table', () => {
});
});
it
(
'
does not allow selecting already started groups
'
,
async
()
=>
{
it
(
'
does not allow selecting already started groups
'
,
async
()
=>
{
const
NEW_GROUPS
=
[
generateFakeEntry
({
id
:
1
,
status
:
STATUSES
.
FINISH
ED
})];
const
NEW_GROUPS
=
[
generateFakeEntry
({
id
:
1
,
status
:
STATUSES
.
START
ED
})];
createComponent
({
createComponent
({
bulkImportSourceGroups
:
()
=>
({
bulkImportSourceGroups
:
()
=>
({
...
...
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