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
2 changes: 1 addition & 1 deletion src/engineering_platform/assets/dashboard.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/engineering_platform/assets/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -5832,6 +5832,20 @@ document.addEventListener("pointerdown", (event) => {
const workspaceLocation = document.querySelector('[data-workspace-label="ui.workspace_location"] + pre');
replaceWithLocalFilesystemLink(workspaceLocation);
replaceWithLocalFilesystemLink($("rateLimitProviderPath"));
const noProjectDismissalStorageKey = "engineering-platform.no-project-selected.dismissed.v1";
function initializeNoProjectSelectedBanner() {
const banner = $("noProjectSelected"), dismiss = $("noProjectSelectedDismiss");
if (!banner || !dismiss || dismiss.dataset.dismissBound) return;
dismiss.dataset.dismissBound = "true";
try {
banner.hidden = localStorage.getItem(noProjectDismissalStorageKey) === "true";
} catch {}
dismiss.addEventListener("click", () => {
banner.hidden = true;
try { localStorage.setItem(noProjectDismissalStorageKey, "true"); } catch {}
});
}
initializeNoProjectSelectedBanner();
applyDashboardLocale();
let dashboardConfiguration = {}, dashboardConfigurationLoaded = false;
const configurationFields = Object.freeze({
Expand Down
2 changes: 1 addition & 1 deletion src/engineering_platform/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ def _no_project_console_document(projects: list[dict[str, str]], data_root: Path
options = _console_project_options(None, projects)
selector = f'''<label class="dashboard-project" for="dashboardProject"><span data-i18n="project.label"></span><select id="dashboardProject" data-i18n-aria-label="project.label">{options}</select></label>'''
boundary = '''<script>window.ENGINEERING_PLATFORM_NO_PROJECT=true;(function(){const select=document.getElementById('dashboardProject');if(select)select.addEventListener('change',()=>{const url=new URL(window.location.href);if(select.value)url.searchParams.set('project',select.value);else url.searchParams.delete('project');window.location.assign(url)});$CENTRAL_DATABASE_SCRIPT})();</script>'''.replace("$CENTRAL_DATABASE_SCRIPT", _central_database_script())
empty_state = '''<aside class="dashboard-status-banner dashboard-status-banner--no-project" id="noProjectSelected" role="status" aria-live="polite" data-testid="no-project-selected"><strong data-i18n="central.no_project_selected_title"></strong><span data-i18n="central.no_project_selected_body"></span></aside>'''
empty_state = '''<aside class="dashboard-status-banner dashboard-status-banner--no-project" id="noProjectSelected" role="status" aria-live="polite" data-testid="no-project-selected"><strong data-i18n="central.no_project_selected_title"></strong><span data-i18n="central.no_project_selected_body"></span><button class="no-project-selected__dismiss" id="noProjectSelectedDismiss" type="button" data-i18n-aria-label="action.close" data-i18n-title="action.close"><span aria-hidden="true">×</span></button></aside>'''
scoped_style = '''<style>
body[data-project-id="none"] #queueItems,
body[data-project-id="none"] #promptHistory,
Expand Down
14 changes: 14 additions & 0 deletions tests/engineering/dashboard.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ test.beforeEach(async ({ page }) => {
await page.route("**/api/events", (route) => route.abort());
});

test("dismisses the no-project banner for the current browser", async ({ page }) => {
const noProjectUrl = new URL(dashboardUrl);
noProjectUrl.search = "";
await page.goto(noProjectUrl.href, { waitUntil: "domcontentloaded" });
const banner = page.getByTestId("no-project-selected");
await expect(banner).toBeVisible();
const dismiss = page.locator("#noProjectSelectedDismiss");
await expect(dismiss).toHaveAttribute("aria-label", DASHBOARD_MESSAGES.en["action.close"]);
await dismiss.click();
await expect(banner).toBeHidden();
await page.reload({ waitUntil: "domcontentloaded" });
await expect(banner).toBeHidden();
});

test.afterAll(async () => {
if (dashboard && dashboard.exitCode === null && dashboard.signalCode === null) {
const exited = new Promise((resolve) => dashboard.once("exit", resolve));
Expand Down
1 change: 1 addition & 0 deletions tests/engineering/test_server_foundation.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ def test_no_project_console_never_resolves_a_checkout_for_shell_assets_or_platfo
document = response.read().decode("utf-8")
self.assertIn('data-project-id="none"', document)
self.assertIn('id="noProjectSelected"', document)
self.assertIn('id="noProjectSelectedDismiss"', document)
self.assertIn('data-i18n="central.no_project_selected_title"', document)
self.assertIn('data-i18n="central.no_project_selected_body"', document)
self.assertNotIn('Geen project gekozen', document)
Expand Down
Loading