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
128a04ef
Commit
128a04ef
authored
Jul 30, 2019
by
Nick Kipling
Committed by
Nathan Friend
Jul 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjustments to event removal and modal description
parent
918e7d43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
app/assets/javascripts/registry/components/table_registry.vue
...assets/javascripts/registry/components/table_registry.vue
+13
-16
spec/javascripts/registry/components/table_registry_spec.js
spec/javascripts/registry/components/table_registry_spec.js
+1
-0
No files found.
app/assets/javascripts/registry/components/table_registry.vue
View file @
128a04ef
...
@@ -59,14 +59,17 @@ export default {
...
@@ -59,14 +59,17 @@ export default {
);
);
},
},
},
},
mounted
()
{
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$on
(
'
hide
'
,
this
.
removeModalEvents
);
},
methods
:
{
methods
:
{
...
mapActions
([
'
fetchList
'
,
'
deleteItem
'
,
'
multiDeleteItems
'
]),
...
mapActions
([
'
fetchList
'
,
'
deleteItem
'
,
'
multiDeleteItems
'
]),
setModalDescription
(
item
sToDeleteLength
,
itemIndex
)
{
setModalDescription
(
item
Index
=
-
1
)
{
if
(
item
sToDeleteLength
)
{
if
(
item
Index
===
-
1
)
{
this
.
modalDescription
=
sprintf
(
this
.
modalDescription
=
sprintf
(
s__
(
`ContainerRegistry|You are about to delete <b>%{count}</b> images. This will
s__
(
`ContainerRegistry|You are about to delete <b>%{count}</b> images. This will
delete the images and all tags pointing to them.`
),
delete the images and all tags pointing to them.`
),
{
count
:
itemsToDeleteL
ength
},
{
count
:
this
.
itemsToBeDeleted
.
l
ength
},
);
);
}
else
{
}
else
{
const
{
tag
}
=
this
.
repo
.
list
[
itemIndex
];
const
{
tag
}
=
this
.
repo
.
list
[
itemIndex
];
...
@@ -86,25 +89,26 @@ export default {
...
@@ -86,25 +89,26 @@ export default {
},
},
removeModalEvents
()
{
removeModalEvents
()
{
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$off
(
'
ok
'
);
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$off
(
'
ok
'
);
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$off
(
'
hide
'
);
},
},
deleteSingleItem
(
index
)
{
deleteSingleItem
(
index
)
{
this
.
setModalDescription
(
0
,
index
);
this
.
setModalDescription
(
index
);
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$once
(
'
ok
'
,
()
=>
{
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$once
(
'
ok
'
,
()
=>
{
this
.
removeModalEvents
();
this
.
removeModalEvents
();
this
.
handleSingleDelete
(
this
.
repo
.
list
[
index
]);
this
.
handleSingleDelete
(
this
.
repo
.
list
[
index
]);
});
});
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$once
(
'
hide
'
,
this
.
removeModalEvents
);
},
},
deleteMultipleItems
()
{
deleteMultipleItems
()
{
if
(
this
.
itemsToBeDeleted
.
length
===
1
)
{
this
.
setModalDescription
(
this
.
itemsToBeDeleted
[
0
]);
}
else
if
(
this
.
itemsToBeDeleted
.
length
>
1
)
{
this
.
setModalDescription
();
}
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$once
(
'
ok
'
,
()
=>
{
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$once
(
'
ok
'
,
()
=>
{
this
.
removeModalEvents
();
this
.
removeModalEvents
();
this
.
handleMultipleDelete
();
this
.
handleMultipleDelete
();
});
});
this
.
$refs
.
deleteModal
.
$refs
.
modal
.
$once
(
'
hide
'
,
this
.
removeModalEvents
);
},
},
handleSingleDelete
(
itemToDelete
)
{
handleSingleDelete
(
itemToDelete
)
{
this
.
deleteItem
(
itemToDelete
)
this
.
deleteItem
(
itemToDelete
)
...
@@ -144,7 +148,6 @@ export default {
...
@@ -144,7 +148,6 @@ export default {
selectAll
()
{
selectAll
()
{
this
.
itemsToBeDeleted
=
this
.
repo
.
list
.
map
((
x
,
index
)
=>
index
);
this
.
itemsToBeDeleted
=
this
.
repo
.
list
.
map
((
x
,
index
)
=>
index
);
this
.
selectAllChecked
=
true
;
this
.
selectAllChecked
=
true
;
this
.
setModalDescription
(
this
.
itemsToBeDeleted
.
length
);
},
},
deselectAll
()
{
deselectAll
()
{
this
.
itemsToBeDeleted
=
[];
this
.
itemsToBeDeleted
=
[];
...
@@ -163,12 +166,6 @@ export default {
...
@@ -163,12 +166,6 @@ export default {
this
.
selectAllChecked
=
true
;
this
.
selectAllChecked
=
true
;
}
}
}
}
if
(
this
.
itemsToBeDeleted
.
length
===
1
)
{
this
.
setModalDescription
(
0
,
this
.
itemsToBeDeleted
[
0
]);
}
else
if
(
this
.
itemsToBeDeleted
.
length
>
1
)
{
this
.
setModalDescription
(
this
.
itemsToBeDeleted
.
length
);
}
},
},
},
},
};
};
...
...
spec/javascripts/registry/components/table_registry_spec.js
View file @
128a04ef
...
@@ -177,6 +177,7 @@ describe('table registry', () => {
...
@@ -177,6 +177,7 @@ describe('table registry', () => {
it
(
'
should show the plural title and image count when deleting more than one image
'
,
done
=>
{
it
(
'
should show the plural title and image count when deleting more than one image
'
,
done
=>
{
selectAllCheckboxes
();
selectAllCheckboxes
();
vm
.
setModalDescription
();
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
modalTitle
).
toBe
(
'
Remove images
'
);
expect
(
vm
.
modalTitle
).
toBe
(
'
Remove images
'
);
...
...
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