Add delete numbered containers button
This commit is contained in:
parent
f512473986
commit
c47f493a33
3 changed files with 36 additions and 0 deletions
|
@ -467,6 +467,24 @@ manage things like container crud */
|
|||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
#edit-containers-panel #delete-numbered-link {
|
||||
align-items: center;
|
||||
block-size: var(--block-url-label-size);
|
||||
border: 1px solid #d8d8d8;
|
||||
border-radius: var(--small-radius);
|
||||
color: var(--title-text-color);
|
||||
display: flex;
|
||||
font-size: var(--small-text-size);
|
||||
inline-size: var(--inline-button-size);
|
||||
justify-content: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#edit-containers-panel #delete-numbered-link:hover,
|
||||
#edit-containers-panel #delete-numbered-link:focus {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
span ~ .panel-header-text {
|
||||
padding-block-end: 0;
|
||||
padding-block-start: 0;
|
||||
|
|
|
@ -840,6 +840,21 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||
Logic.showPreviousPanel();
|
||||
});
|
||||
|
||||
Logic.addEnterHandler(document.querySelector("#delete-numbered-link"), async function () {
|
||||
try {
|
||||
const promises = Logic.identities().map(identity => {
|
||||
if (identity.name.match(/^Container #\d+$/)) {
|
||||
return Logic.removeIdentity(Logic.userContextId(identity.cookieStoreId));
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
await Logic.refreshIdentities();
|
||||
Logic.showPreviousPanel();
|
||||
} catch (e) {
|
||||
Logic.showPanel(P_CONTAINERS_LIST);
|
||||
}
|
||||
});
|
||||
|
||||
this._editForm = document.getElementById("edit-container-panel-form");
|
||||
const editLink = document.querySelector("#edit-container-ok-link");
|
||||
Logic.addEnterHandler(editLink, () => {
|
||||
|
|
|
@ -126,6 +126,9 @@
|
|||
<div class="panel-header">
|
||||
<h3 class="panel-header-text">Edit Containers</h3>
|
||||
</div>
|
||||
<div class="container-panel-controls">
|
||||
<a href="#" class="action-link" id="delete-numbered-link" title="Delete numbered containers">Delete #</a>
|
||||
</div>
|
||||
<div class="scrollable panel-content">
|
||||
<table class="unstriped">
|
||||
<tbody id="edit-identities-list"></tbody>
|
||||
|
|
Loading…
Add table
Reference in a new issue