delete containers

This commit is contained in:
baku 2017-01-13 14:40:27 +01:00
parent c66fb33583
commit b2bd693e81
2 changed files with 22 additions and 8 deletions

View file

@ -33,13 +33,7 @@ let Logic = {
init() { init() {
// Retrieve the list of identities. // Retrieve the list of identities.
browser.runtime.sendMessage({ this.refreshIdentities()
method: "queryIdentities"
})
.then(identities => {
this._identities = identities;
})
// Routing to the correct panel. // Routing to the correct panel.
.then(() => { .then(() => {
@ -53,6 +47,15 @@ let Logic = {
}); });
}, },
refreshIdentities() {
return browser.runtime.sendMessage({
method: "queryIdentities"
})
.then(identities => {
this._identities = identities;
});
},
showPanel(panel, currentIdentity = null) { showPanel(panel, currentIdentity = null) {
// Invalid panel... ?!? // Invalid panel... ?!?
if (!(panel in this._panels)) { if (!(panel in this._panels)) {
@ -391,6 +394,17 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
document.querySelector("#delete-container-cancel-link").addEventListener("click", () => { document.querySelector("#delete-container-cancel-link").addEventListener("click", () => {
Logic.showPanel(P_CONTAINERS_EDIT); 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. // This method is called when the panel is shown.

View file

@ -149,7 +149,7 @@
<a class="button expanded secondary footer-button cancel-button" id="delete-container-cancel-link">Cancel</a> <a class="button expanded secondary footer-button cancel-button" id="delete-container-cancel-link">Cancel</a>
</div> </div>
<div class="small-6 columns footer-columns"> <div class="small-6 columns footer-columns">
<a class="button expanded footer-button">OK</a> <a class="button expanded footer-button" id="delete-container-ok-link">OK</a>
</div> </div>
</div> </div>
</div> </div>