Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/engineering_platform/assets/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5854,6 +5854,16 @@ replaceWithLocalFilesystemLink(workspaceLocation);
replaceWithLocalFilesystemLink($("rateLimitProviderPath"));
const noProjectDismissalStorageKey = "engineering-platform.no-project-selected.dismissed.v1";
function initializeNoProjectSelectedBanner() {
const projectSelector = $("dashboardProject");
if (projectSelector && !projectSelector.dataset.noProjectDismissalResetBound) {
projectSelector.dataset.noProjectDismissalResetBound = "true";
projectSelector.addEventListener("change", (event) => {
// Choosing the explicit global/no-project context is a fresh operator
// choice, rather than a continuation of a formerly dismissed notice.
if (event.currentTarget.value !== "") return;
try { localStorage.removeItem(noProjectDismissalStorageKey); } catch {}
});
}
const banner = $("noProjectSelected"), dismiss = $("noProjectSelectedDismiss");
if (!banner || !dismiss || dismiss.dataset.dismissBound) return;
dismiss.dataset.dismissBound = "true";
Expand All @@ -5864,12 +5874,6 @@ function initializeNoProjectSelectedBanner() {
banner.hidden = true;
try { localStorage.setItem(noProjectDismissalStorageKey, "true"); } catch {}
});
$("dashboardProject")?.addEventListener("change", (event) => {
// Choosing the explicit global/no-project context is a fresh operator
// choice, rather than a continuation of a formerly dismissed notice.
if (event.currentTarget.value !== "") return;
try { localStorage.removeItem(noProjectDismissalStorageKey); } catch {}
});
}
initializeNoProjectSelectedBanner();
applyDashboardLocale();
Expand Down
15 changes: 7 additions & 8 deletions tests/engineering/dashboard.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,14 @@ test("dismisses the no-project banner for the current browser", async ({ page })
});

test("shows the no-project banner again after explicitly choosing no project", async ({ page }) => {
const noProjectUrl = new URL(dashboardUrl);
noProjectUrl.search = "";
await page.goto(noProjectUrl.href, { waitUntil: "domcontentloaded" });
await page.goto(dashboardUrl, { waitUntil: "domcontentloaded" });
await page.evaluate(() => {
localStorage.setItem("engineering-platform.no-project-selected.dismissed.v1", "true");
});
const selector = page.locator("#dashboardProject");
await expect(selector).not.toHaveValue("");
await selector.selectOption("");
const banner = page.getByTestId("no-project-selected");
await page.locator("#noProjectSelectedDismiss").click();
await expect(banner).toBeHidden();
const navigation = page.waitForNavigation({ waitUntil: "domcontentloaded" });
await page.locator("#dashboardProject").dispatchEvent("change");
await navigation;
await expect(banner).toBeVisible();
});

Expand Down
Loading