show assigned url after adding

This commit is contained in:
Khansa Kiasatina 2020-03-08 10:39:45 -04:00 committed by Martin D Kealey
parent b93879baab
commit b01145720b

View file

@ -1867,13 +1867,23 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
},
async _addSite() {
// Get URL and container ID from form
const formValues = new FormData(this._editForm);
const url = formValues.get("site-name");
const userContextId = formValues.get("container-id");
const currentTab = await Logic.currentTab();
const tabId = currentTab.id;
const fullURL = this.checkUrl(url);
Logic.setOrRemoveAssignment(tabId, fullURL, userContextId, false);
// Assign URL to container
await Logic.setOrRemoveAssignment(tabId, fullURL, userContextId, false);
// Clear form
document.querySelector("#edit-container-panel-site-input").value = "";
// Show new assignments
const assignments = await Logic.getAssignmentObjectByContainer(userContextId);
this.showAssignedContainers(assignments);
},
checkUrl(url){
@ -1997,7 +2007,8 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
});
// Only show ability to add site if it's an existing container
document.querySelector("#edit-container-panel-add-site").hidden = !userContextId;
// Make site input empty
document.querySelector("#edit-container-panel-site-input").value = "";
document.querySelector("#edit-container-panel-name-input").value = identity.name || "";
document.querySelector("#edit-container-panel-usercontext-input").value = userContextId || NEW_CONTAINER_ID;
const containerName = document.querySelector("#edit-container-panel-name-input");