working on info panel

This commit is contained in:
Kendall Werts 2020-02-18 15:11:24 -06:00
parent 2656cb1af7
commit 081d8a506a
6 changed files with 31 additions and 31 deletions

View file

@ -474,7 +474,6 @@ window.assignManager = {
}, },
async _setOrRemoveAssignment(tabId, pageUrl, userContextId, remove) { async _setOrRemoveAssignment(tabId, pageUrl, userContextId, remove) {
console.log(userContextId)
let actionName; let actionName;
// https://github.com/mozilla/testpilot-containers/issues/626 // https://github.com/mozilla/testpilot-containers/issues/626

View file

@ -22,21 +22,7 @@ async function init() {
tr.appendChild(td); tr.appendChild(td);
Utils.addEnterHandler(tr, async () => { Utils.addEnterHandler(tr, async () => {
const currentTab = await Utils.currentTab(); Utils.alwaysOpenInContainer(identity);
const assignedUserContextId = Utils.userContextId(identity.cookieStoreId);
Utils.setOrRemoveAssignment(
currentTab.id,
currentTab.url,
assignedUserContextId,
false
);
Utils.reloadInContainer(
currentTab.url,
false,
assignedUserContextId,
currentTab.index + 1,
currentTab.active
);
window.close(); window.close();
}); });
}); });

View file

@ -740,8 +740,6 @@ Logic.registerPanel(P_CONTAINER_INFO, {
// This method is called when the object is registered. // This method is called when the object is registered.
async initialize() { async initialize() {
const closeContEl = document.querySelector("#close-container-info-panel"); const closeContEl = document.querySelector("#close-container-info-panel");
closeContEl.setAttribute("tabindex", "0");
closeContEl.classList.add("firstTabindex");
Utils.addEnterHandler(closeContEl, () => { Utils.addEnterHandler(closeContEl, () => {
Logic.showPreviousPanel(); Logic.showPreviousPanel();
}); });
@ -777,7 +775,12 @@ Logic.registerPanel(P_CONTAINER_INFO, {
// Populating the panel: name and icon // Populating the panel: name and icon
document.getElementById("container-info-title").textContent = identity.name; document.getElementById("container-info-title").textContent = identity.name;
const alwaysOpen = document.querySelector("#always-open-in-info-panel");
Utils.addEnterHandler(alwaysOpen, async () => {
Utils.alwaysOpenInContainer(identity);
window.close();
});
// Show or not the has-tabs section. // Show or not the has-tabs section.
for (let trHasTabs of document.getElementsByClassName("container-info-has-tabs")) { // eslint-disable-line prefer-const for (let trHasTabs of document.getElementsByClassName("container-info-has-tabs")) { // eslint-disable-line prefer-const
trHasTabs.style.display = !identity.hasHiddenTabs && !identity.hasOpenTabs ? "none" : ""; trHasTabs.style.display = !identity.hasHiddenTabs && !identity.hasOpenTabs ? "none" : "";
@ -894,7 +897,6 @@ Logic.registerPanel(P_CONTAINERS_EDIT, {
pickedFunction = async function (identity) { pickedFunction = async function (identity) {
const currentTab = await Utils.currentTab(); const currentTab = await Utils.currentTab();
const newUserContextId = Utils.userContextId(identity.cookieStoreId); const newUserContextId = Utils.userContextId(identity.cookieStoreId);
console.log(currentTab);
Utils.reloadInContainer( Utils.reloadInContainer(
currentTab.url, currentTab.url,
false, false,
@ -909,14 +911,7 @@ Logic.registerPanel(P_CONTAINERS_EDIT, {
default: default:
document.getElementById("picker-title").textContent = "Always Open This Site in"; document.getElementById("picker-title").textContent = "Always Open This Site in";
pickedFunction = async function (identity) { pickedFunction = async function (identity) {
const currentTab = await Utils.currentTab(); Utils.alwaysOpenInContainer(identity);
const assignedUserContextId = Utils.userContextId(identity.cookieStoreId);
Utils.setOrRemoveAssignment(
currentTab.id,
currentTab.url,
assignedUserContextId,
false
);
window.close(); window.close();
}; };
break; break;

View file

@ -99,6 +99,26 @@ const Utils = {
tabIndex, tabIndex,
active active
}); });
},
async alwaysOpenInContainer(identity) {
const currentTab = await this.currentTab();
const assignedUserContextId = this.userContextId(identity.cookieStoreId);
Utils.setOrRemoveAssignment(
currentTab.id,
currentTab.url,
assignedUserContextId,
false
);
if (currentTab.cookieStoreId !== identity.cookieStoreId) {
Utils.reloadInContainer(
currentTab.url,
false,
assignedUserContextId,
currentTab.index + 1,
currentTab.active
);
}
} }
}; };

View file

@ -9,7 +9,7 @@
<div class="page-action-container-picker" id="container-picker-panel"> <div class="page-action-container-picker" id="container-picker-panel">
<h3 class="title"> <h3 class="title">
Reopen and Always Open this Site in... Always Open this Site in...
</h3> </h3>
<hr> <hr>
<div class="scrollable identities-list"> <div class="scrollable identities-list">

View file

@ -202,7 +202,7 @@
<h3 class="title" id="container-info-title"> <h3 class="title" id="container-info-title">
Personal Personal
</h3> </h3>
<button class="btn-return arrow-left" id="close-container-info-panel"></button> <button class="btn-return arrow-left" id="close-container-info-panel" tabindex="0"></button>
<hr> <hr>
<table class="menu"> <table class="menu">
<tr class="menu-item" id="hide-container"> <tr class="menu-item" id="hide-container">
@ -224,7 +224,7 @@
<tr class="menu-item" id="always-open"> <tr class="menu-item" id="always-open">
<td> <td>
<img class="menu-icon" alt="Always Open Site in Container" src="/img/open-in-new-16.svg" /> <img class="menu-icon" alt="Always Open Site in Container" src="/img/open-in-new-16.svg" />
<span class="menu-text">Always Open Site in Container</span> <span class="menu-text" id="always-open-in-info-panel">Always Open Site in Container</span>
<span class="menu-arrow"> <span class="menu-arrow">
</span> </span>
</td> </td>