Add confirmation on delete of share-by-token
This commit is contained in:
@@ -29,6 +29,7 @@ def test_create_and_delete_share_by_key(page: Page, radicale_server: str) -> Non
|
|||||||
expect(
|
expect(
|
||||||
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RO']")
|
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RO']")
|
||||||
).to_be_visible()
|
).to_be_visible()
|
||||||
|
page.once("dialog", lambda dialog: dialog.accept())
|
||||||
page.click('tr:not(.hidden) button[data-name="delete"]', strict=True)
|
page.click('tr:not(.hidden) button[data-name="delete"]', strict=True)
|
||||||
expect(
|
expect(
|
||||||
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)")
|
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)")
|
||||||
@@ -40,6 +41,7 @@ def test_create_and_delete_share_by_key(page: Page, radicale_server: str) -> Non
|
|||||||
expect(
|
expect(
|
||||||
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RW']")
|
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden) img[alt='RW']")
|
||||||
).to_be_visible()
|
).to_be_visible()
|
||||||
|
page.once("dialog", lambda dialog: dialog.accept())
|
||||||
page.click('tr:not(.hidden) button[data-name="delete"]', strict=True)
|
page.click('tr:not(.hidden) button[data-name="delete"]', strict=True)
|
||||||
expect(
|
expect(
|
||||||
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)")
|
page.locator("tr[data-name='sharetokenrowtemplate']:not(.hidden)")
|
||||||
|
|||||||
@@ -28,14 +28,6 @@ import { Collection } from "./models.js";
|
|||||||
import { Scene, pop_scene, scene_stack } from "./scene_manager.js";
|
import { Scene, pop_scene, scene_stack } from "./scene_manager.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
|
||||||
* @implements {Scene}
|
|
||||||
* @param {string} user
|
|
||||||
* @param {string} password
|
|
||||||
* @param {Collection} collection The collection on which to edit sharing setting. Must exist.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
* @implements {Scene}
|
* @implements {Scene}
|
||||||
* @param {string} user
|
* @param {string} user
|
||||||
* @param {string} password
|
* @param {string} password
|
||||||
@@ -147,10 +139,13 @@ function add_share_rows(user, password, collection, shares) {
|
|||||||
}
|
}
|
||||||
/** @type {HTMLElement} */ let delete_btn = node.querySelector("[data-name=delete]");
|
/** @type {HTMLElement} */ let delete_btn = node.querySelector("[data-name=delete]");
|
||||||
delete_btn.onclick = function () {
|
delete_btn.onclick = function () {
|
||||||
|
if (!confirm("Are you sure you want to delete share " + pathortoken + "?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
delete_share_by_token(
|
delete_share_by_token(
|
||||||
user,
|
user,
|
||||||
password,
|
password,
|
||||||
share["PathOrToken"],
|
pathortoken,
|
||||||
function () {
|
function () {
|
||||||
update_share_list(user, password, collection);
|
update_share_list(user, password, collection);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user