diff --git a/webextension/js/popup.js b/webextension/js/popup.js index 5cb0980..0fdc0d1 100644 --- a/webextension/js/popup.js +++ b/webextension/js/popup.js @@ -33,13 +33,7 @@ let Logic = { init() { // Retrieve the list of identities. - browser.runtime.sendMessage({ - method: "queryIdentities" - }) - - .then(identities => { - this._identities = identities; - }) + this.refreshIdentities() // Routing to the correct panel. .then(() => { @@ -53,6 +47,15 @@ let Logic = { }); }, + refreshIdentities() { + return browser.runtime.sendMessage({ + method: "queryIdentities" + }) + .then(identities => { + this._identities = identities; + }); + }, + showPanel(panel, currentIdentity = null) { // Invalid panel... ?!? if (!(panel in this._panels)) { @@ -391,6 +394,17 @@ Logic.registerPanel(P_CONTAINER_DELETE, { document.querySelector("#delete-container-cancel-link").addEventListener("click", () => { Logic.showPanel(P_CONTAINERS_EDIT); }); + + document.querySelector("#delete-container-ok-link").addEventListener("click", () => { + browser.runtime.sendMessage({ + method: "removeIdentity", + userContextId: Logic.currentIdentity().userContextId, + }).then(() => { + return Logic.refreshIdentities(); + }).then(() => { + Logic.showPanel(P_CONTAINERS_EDIT); + }); + }); }, // This method is called when the panel is shown. diff --git a/webextension/popup.html b/webextension/popup.html index 85a9346..e3dbf2c 100644 --- a/webextension/popup.html +++ b/webextension/popup.html @@ -149,7 +149,7 @@ Cancel