gaard-client 0.2.12__tar.gz → 0.2.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gaard_client-0.2.12 → gaard_client-0.2.17}/PKG-INFO +2 -2
- {gaard_client-0.2.12 → gaard_client-0.2.17}/pyproject.toml +2 -2
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/client-web/assets/main.js +132 -57
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/client-web/assets/styles.css +44 -31
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/main.py +295 -655
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client.egg-info/PKG-INFO +2 -2
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client.egg-info/requires.txt +1 -1
- {gaard_client-0.2.12 → gaard_client-0.2.17}/tests/test_client_app.py +700 -106
- {gaard_client-0.2.12 → gaard_client-0.2.17}/README.md +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/setup.cfg +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/__init__.py +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/cli.py +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/cli_commands.py +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/client-web/assets/getgaard.svg +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client/client-web/index.html +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client.egg-info/SOURCES.txt +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client.egg-info/dependency_links.txt +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client.egg-info/entry_points.txt +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/src/gaard_client.egg-info/top_level.txt +0 -0
- {gaard_client-0.2.12 → gaard_client-0.2.17}/tests/test_cli.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gaard-client
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.17
|
|
4
4
|
Summary: GAARD frontend web services providing client interface
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.
|
|
7
|
+
Requires-Dist: gaard-plugin-api<0.3.0,>=0.2.17
|
|
8
8
|
Requires-Dist: fastapi>=0.111.0
|
|
9
9
|
Requires-Dist: uvicorn[standard]>=0.30.0
|
|
10
10
|
Requires-Dist: pydantic>=2.7.0
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "gaard-client"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.17"
|
|
8
8
|
description = "GAARD frontend web services providing client interface"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
|
|
12
12
|
dependencies = [
|
|
13
|
-
"gaard-plugin-api>=0.2.
|
|
13
|
+
"gaard-plugin-api>=0.2.17,<0.3.0",
|
|
14
14
|
"fastapi>=0.111.0",
|
|
15
15
|
"uvicorn[standard]>=0.30.0",
|
|
16
16
|
"pydantic>=2.7.0",
|
|
@@ -40,6 +40,7 @@ var state = {
|
|
|
40
40
|
datasourceError: "",
|
|
41
41
|
datasourceUploadPending: false,
|
|
42
42
|
excelUploadAllowed: false,
|
|
43
|
+
csvUploadAllowed: false,
|
|
43
44
|
datasourceSelectionPending: false,
|
|
44
45
|
selectedDatasourceIds: [],
|
|
45
46
|
multipleDatasourceSelectionAllowed: false,
|
|
@@ -406,7 +407,7 @@ function renderSourcesPanel() {
|
|
|
406
407
|
return `
|
|
407
408
|
<div class="sources-panel">
|
|
408
409
|
<div class="source-actions">
|
|
409
|
-
<button class="source-add" type="button" data-
|
|
410
|
+
<button class="source-add" type="button" data-view="datasources" aria-label="Manage data sources" title="Manage data sources">
|
|
410
411
|
<span aria-hidden="true">+</span>
|
|
411
412
|
</button>
|
|
412
413
|
</div>
|
|
@@ -440,6 +441,16 @@ function renderAuthControls() {
|
|
|
440
441
|
}
|
|
441
442
|
return `<button class="primary auth-button" type="button" data-open-login>Log in</button>`;
|
|
442
443
|
}
|
|
444
|
+
function renderTopbar(options = {}) {
|
|
445
|
+
return `
|
|
446
|
+
<header class="topbar ${options.chat ? "chat-toolbar" : ""} ${state.activeView === "analysis" ? "analysis-topbar" : ""}">
|
|
447
|
+
${renderViewHeading()}
|
|
448
|
+
<div class="header-actions">
|
|
449
|
+
${renderAnalysisTopbarActions()}
|
|
450
|
+
${renderAuthControls()}
|
|
451
|
+
</div>
|
|
452
|
+
</header>`;
|
|
453
|
+
}
|
|
443
454
|
function renderEmptyState() {
|
|
444
455
|
if (!state.token) {
|
|
445
456
|
return `
|
|
@@ -542,6 +553,7 @@ function renderApiErrorBanner() {
|
|
|
542
553
|
function renderHomeView() {
|
|
543
554
|
return `
|
|
544
555
|
<section class="chat-shell" aria-label="GAARD chat">
|
|
556
|
+
${renderTopbar({ chat: true })}
|
|
545
557
|
<section class="history" aria-live="polite">
|
|
546
558
|
${state.messages.length ? state.messages.map(renderMessage).join("") : renderEmptyState()}
|
|
547
559
|
</section>
|
|
@@ -594,44 +606,47 @@ function canDeleteDashboard(dashboard) {
|
|
|
594
606
|
function dashboardSharingAvailable() {
|
|
595
607
|
return Number(state.dashboardShareUserCount || 0) > 1 || state.dashboardShareUsers.length > 1;
|
|
596
608
|
}
|
|
597
|
-
function
|
|
609
|
+
function renderAnalysisTopbarActions() {
|
|
610
|
+
if (state.activeView !== "analysis") return "";
|
|
598
611
|
const dashboard = getActiveDashboard();
|
|
599
612
|
const editable = canEditDashboard(dashboard);
|
|
600
613
|
const shareable = canShareDashboard(dashboard) && dashboardSharingAvailable();
|
|
614
|
+
return `
|
|
615
|
+
<div class="analysis-topbar-actions">
|
|
616
|
+
${dashboard && state.token && shareable ? `
|
|
617
|
+
<button
|
|
618
|
+
class="dashboard-edit-mode-button"
|
|
619
|
+
type="button"
|
|
620
|
+
data-open-dashboard-share
|
|
621
|
+
aria-label="Share dashboard"
|
|
622
|
+
title="Share dashboard"
|
|
623
|
+
${state.dashboardSharesLoading ? "disabled" : ""}
|
|
624
|
+
>
|
|
625
|
+
${state.dashboardSharesLoading ? `<span class="dashboard-edit-saving-spinner" aria-hidden="true"></span>` : renderIcon("share")}
|
|
626
|
+
</button>` : ""}
|
|
627
|
+
${dashboard && state.token && editable ? `
|
|
628
|
+
<button
|
|
629
|
+
class="dashboard-edit-mode-button ${state.dashboardEditMode ? "active" : ""} ${state.dashboardLayoutSaving ? "saving" : ""}"
|
|
630
|
+
type="button"
|
|
631
|
+
data-toggle-dashboard-edit
|
|
632
|
+
aria-pressed="${state.dashboardEditMode ? "true" : "false"}"
|
|
633
|
+
aria-label="${state.dashboardLayoutSaving ? "Saving dashboard layout" : state.dashboardEditMode ? "Finish editing dashboard layout" : "Edit dashboard layout"}"
|
|
634
|
+
title="${state.dashboardLayoutSaving ? "Saving..." : state.dashboardEditMode ? "Finish editing" : "Edit layout"}"
|
|
635
|
+
${state.dashboardLayoutSaving ? "disabled" : ""}
|
|
636
|
+
>
|
|
637
|
+
${state.dashboardLayoutSaving ? `<span class="dashboard-edit-saving-spinner" aria-hidden="true"></span>` : renderIcon("edit")}
|
|
638
|
+
${state.dashboardLayoutSaving ? `<span>Saving...</span>` : ""}
|
|
639
|
+
</button>` : ""}
|
|
640
|
+
${dashboard && state.token && state.dashboardEditMode && editable ? `
|
|
641
|
+
<button class="dashboard-add-widget-button" type="button" data-open-widget-dialog aria-label="Add widget" title="Add widget">
|
|
642
|
+
${renderIcon("plus")}
|
|
643
|
+
</button>` : ""}
|
|
644
|
+
</div>`;
|
|
645
|
+
}
|
|
646
|
+
function renderAnalysisView() {
|
|
647
|
+
const dashboard = getActiveDashboard();
|
|
601
648
|
return `
|
|
602
649
|
<section class="dashboard-view" aria-label="Dashboard Analysis">
|
|
603
|
-
<div class="dashboard-toolbar dashboard-toolbar-compact">
|
|
604
|
-
<div class="dashboard-toolbar-actions">
|
|
605
|
-
${dashboard && state.token && shareable ? `
|
|
606
|
-
<button
|
|
607
|
-
class="dashboard-edit-mode-button"
|
|
608
|
-
type="button"
|
|
609
|
-
data-open-dashboard-share
|
|
610
|
-
aria-label="Share dashboard"
|
|
611
|
-
title="Share dashboard"
|
|
612
|
-
${state.dashboardSharesLoading ? "disabled" : ""}
|
|
613
|
-
>
|
|
614
|
-
${state.dashboardSharesLoading ? `<span class="dashboard-edit-saving-spinner" aria-hidden="true"></span>` : renderIcon("share")}
|
|
615
|
-
</button>` : ""}
|
|
616
|
-
${dashboard && state.token && editable ? `
|
|
617
|
-
<button
|
|
618
|
-
class="dashboard-edit-mode-button ${state.dashboardEditMode ? "active" : ""} ${state.dashboardLayoutSaving ? "saving" : ""}"
|
|
619
|
-
type="button"
|
|
620
|
-
data-toggle-dashboard-edit
|
|
621
|
-
aria-pressed="${state.dashboardEditMode ? "true" : "false"}"
|
|
622
|
-
aria-label="${state.dashboardLayoutSaving ? "Saving dashboard layout" : state.dashboardEditMode ? "Finish editing dashboard layout" : "Edit dashboard layout"}"
|
|
623
|
-
title="${state.dashboardLayoutSaving ? "Saving..." : state.dashboardEditMode ? "Finish editing" : "Edit layout"}"
|
|
624
|
-
${state.dashboardLayoutSaving ? "disabled" : ""}
|
|
625
|
-
>
|
|
626
|
-
${state.dashboardLayoutSaving ? `<span class="dashboard-edit-saving-spinner" aria-hidden="true"></span>` : renderIcon("edit")}
|
|
627
|
-
${state.dashboardLayoutSaving ? `<span>Saving...</span>` : ""}
|
|
628
|
-
</button>` : ""}
|
|
629
|
-
${dashboard && state.token && state.dashboardEditMode && editable ? `
|
|
630
|
-
<button class="dashboard-add-widget-button" type="button" data-open-widget-dialog aria-label="Add widget" title="Add widget">
|
|
631
|
-
${renderIcon("plus")}
|
|
632
|
-
</button>` : ""}
|
|
633
|
-
</div>
|
|
634
|
-
</div>
|
|
635
650
|
${state.dashboardsError ? `<div class="source-error datasource-error" role="alert">${escapeHtml(state.dashboardsError)}</div>` : ""}
|
|
636
651
|
${state.dashboardWidgetsError ? `<div class="source-error datasource-error" role="alert">${escapeHtml(state.dashboardWidgetsError)}</div>` : ""}
|
|
637
652
|
${renderAnalysisDashboardBody(dashboard)}
|
|
@@ -1045,7 +1060,7 @@ function renderDashboardWidgetContent(widget) {
|
|
|
1045
1060
|
return `<div class="dashboard-widget-error">${escapeHtml(result.message || result.error || "Widget data could not be loaded.")}</div>`;
|
|
1046
1061
|
}
|
|
1047
1062
|
if (widget.visualization_type === "table") {
|
|
1048
|
-
return `<div class="dashboard-table-widget">${renderDataTable(getRowsFromResult(result))}</div>`;
|
|
1063
|
+
return `<div class="dashboard-table-widget">${renderDataTable(getRowsFromResult(result), { allowHtml: true })}</div>`;
|
|
1049
1064
|
}
|
|
1050
1065
|
if (widget.visualization_type === "number") {
|
|
1051
1066
|
return renderDashboardNumberWidget(result);
|
|
@@ -1261,6 +1276,7 @@ function renderSavedMetricCard(metric) {
|
|
|
1261
1276
|
function renderDatasourcesView() {
|
|
1262
1277
|
const visibleSources = state.datasources.filter((item) => item.connector_key !== "metadata-db");
|
|
1263
1278
|
const uploadAllowed = Boolean(state.token && state.excelUploadAllowed);
|
|
1279
|
+
const csvUploadAllowed = Boolean(state.token && state.csvUploadAllowed);
|
|
1264
1280
|
const uploadLabel = state.datasourceUploadPending
|
|
1265
1281
|
? "Uploading..."
|
|
1266
1282
|
: uploadAllowed
|
|
@@ -1268,17 +1284,24 @@ function renderDatasourcesView() {
|
|
|
1268
1284
|
: state.token
|
|
1269
1285
|
? "Enterprise access required"
|
|
1270
1286
|
: "Log in to upload .xlsx workbook";
|
|
1287
|
+
const csvUploadLabel = state.datasourceUploadPending
|
|
1288
|
+
? "Uploading..."
|
|
1289
|
+
: csvUploadAllowed
|
|
1290
|
+
? "Upload .csv file"
|
|
1291
|
+
: state.token
|
|
1292
|
+
? "Enterprise access required"
|
|
1293
|
+
: "Log in to upload .csv file";
|
|
1271
1294
|
return `
|
|
1272
1295
|
<section class="datasources-view placeholder-view">
|
|
1273
1296
|
<div class="datasource-actions-grid">
|
|
1274
|
-
<button class="placeholder-item datasource-upload-card" type="button" data-add-source ${state.datasourceUploadPending || !uploadAllowed ? "disabled" : ""}>
|
|
1297
|
+
<button class="placeholder-item datasource-upload-card" type="button" data-add-source="excel" ${state.datasourceUploadPending || !uploadAllowed ? "disabled" : ""}>
|
|
1275
1298
|
${renderIcon("plus")}
|
|
1276
1299
|
<span><strong>Excel workbooks</strong><small>${escapeHtml(uploadLabel)}</small></span>
|
|
1277
1300
|
</button>
|
|
1278
|
-
<
|
|
1301
|
+
<button class="placeholder-item datasource-upload-card" type="button" data-add-source="csv" ${state.datasourceUploadPending || !csvUploadAllowed ? "disabled" : ""}>
|
|
1279
1302
|
${renderIcon("plus")}
|
|
1280
|
-
<span><strong>CSV uploads</strong><small
|
|
1281
|
-
</
|
|
1303
|
+
<span><strong>CSV uploads</strong><small>${escapeHtml(csvUploadLabel)}</small></span>
|
|
1304
|
+
</button>
|
|
1282
1305
|
<div class="placeholder-item muted">
|
|
1283
1306
|
${renderIcon("plus")}
|
|
1284
1307
|
<span><strong>Connected databases</strong><small>Coming soon</small></span>
|
|
@@ -1343,17 +1366,13 @@ function render(options = {}) {
|
|
|
1343
1366
|
app.innerHTML = `
|
|
1344
1367
|
<main class="app-shell ${state.sidebarCollapsed ? "sidebar-collapsed" : ""}">
|
|
1345
1368
|
${renderSidebar()}
|
|
1346
|
-
<section class="workspace-shell" aria-label="GAARD workspace">
|
|
1347
|
-
|
|
1348
|
-
${renderViewHeading()}
|
|
1349
|
-
<div class="header-actions">
|
|
1350
|
-
${renderAuthControls()}
|
|
1351
|
-
</div>
|
|
1352
|
-
</header>
|
|
1369
|
+
<section class="workspace-shell ${state.activeView === "home" ? "home-workspace" : ""}" aria-label="GAARD workspace">
|
|
1370
|
+
${state.activeView === "home" ? "" : renderTopbar()}
|
|
1353
1371
|
<div class="api-error-slot">${renderApiErrorBanner()}</div>
|
|
1354
1372
|
${renderActiveView()}
|
|
1355
1373
|
</section>
|
|
1356
1374
|
<input id="excel-source-input" type="file" accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" hidden />
|
|
1375
|
+
<input id="csv-source-input" type="file" accept=".csv,text/csv" hidden />
|
|
1357
1376
|
${state.loginOpen ? renderLoginDialog() : ""}
|
|
1358
1377
|
${state.mustChangePassword ? renderPasswordChangeDialog() : ""}
|
|
1359
1378
|
${state.dashboardCreateOpen ? renderDashboardCreateDialog() : ""}
|
|
@@ -1378,7 +1397,9 @@ function render(options = {}) {
|
|
|
1378
1397
|
document.querySelector("[data-close-login]")?.addEventListener("click", closeLogin);
|
|
1379
1398
|
document.querySelector("[data-dismiss-api-error]")?.addEventListener("click", dismissApiError);
|
|
1380
1399
|
document.querySelector("[data-toggle-sources]")?.addEventListener("click", toggleSources);
|
|
1381
|
-
document.
|
|
1400
|
+
document.querySelectorAll("[data-add-source]").forEach((button) => {
|
|
1401
|
+
button.addEventListener("click", openSourcePicker);
|
|
1402
|
+
});
|
|
1382
1403
|
document.querySelector("[data-refresh-sources]")?.addEventListener("click", () => loadDatasources());
|
|
1383
1404
|
document.querySelectorAll("[data-source-selected]").forEach((input2) => {
|
|
1384
1405
|
input2.addEventListener("change", updateSelectedSources);
|
|
@@ -1423,6 +1444,7 @@ function render(options = {}) {
|
|
|
1423
1444
|
button.addEventListener("click", deleteDashboardWidget);
|
|
1424
1445
|
});
|
|
1425
1446
|
document.querySelector("#excel-source-input")?.addEventListener("change", uploadSelectedSource);
|
|
1447
|
+
document.querySelector("#csv-source-input")?.addEventListener("change", uploadSelectedSource);
|
|
1426
1448
|
document.querySelector("#login-form")?.addEventListener("submit", login);
|
|
1427
1449
|
document.querySelector("#password-change-form")?.addEventListener("submit", changePassword);
|
|
1428
1450
|
document.querySelectorAll('input[name="mode"]').forEach((input2) => {
|
|
@@ -2521,14 +2543,16 @@ function collectDashboardLayout() {
|
|
|
2521
2543
|
function canPersistDashboardLayout(grid = state.dashboardGrid) {
|
|
2522
2544
|
return Boolean(grid) && Number(grid.getColumn?.()) === 12;
|
|
2523
2545
|
}
|
|
2524
|
-
function openSourcePicker() {
|
|
2546
|
+
function openSourcePicker(event) {
|
|
2525
2547
|
if (state.datasourceUploadPending) return;
|
|
2526
2548
|
if (!state.token) {
|
|
2527
2549
|
openLogin();
|
|
2528
2550
|
return;
|
|
2529
2551
|
}
|
|
2530
|
-
|
|
2531
|
-
const
|
|
2552
|
+
const sourceType = event?.currentTarget?.dataset?.addSource || "excel";
|
|
2553
|
+
const allowed = sourceType === "csv" ? state.csvUploadAllowed : state.excelUploadAllowed;
|
|
2554
|
+
if (!allowed) return;
|
|
2555
|
+
const input = document.querySelector(`#${sourceType}-source-input`);
|
|
2532
2556
|
if (!input) return;
|
|
2533
2557
|
input.value = "";
|
|
2534
2558
|
input.click();
|
|
@@ -2570,6 +2594,7 @@ async function loadDatasources(options = {}) {
|
|
|
2570
2594
|
state.selectedDatasourceIds = (payload.selected_datasource_ids || []).filter((id) => availableDatasourceIds.has(id));
|
|
2571
2595
|
state.multipleDatasourceSelectionAllowed = Boolean(payload.multiple_selection_allowed);
|
|
2572
2596
|
state.excelUploadAllowed = Boolean(payload.excel_upload_allowed);
|
|
2597
|
+
state.csvUploadAllowed = Boolean(payload.csv_upload_allowed);
|
|
2573
2598
|
state.datasourcesLoaded = true;
|
|
2574
2599
|
} catch (error) {
|
|
2575
2600
|
state.datasourceError = error.message || "Could not load data sources.";
|
|
@@ -2584,8 +2609,10 @@ async function uploadSelectedSource(event) {
|
|
|
2584
2609
|
const input = event.currentTarget;
|
|
2585
2610
|
const file = input.files?.[0];
|
|
2586
2611
|
if (!file) return;
|
|
2587
|
-
|
|
2588
|
-
|
|
2612
|
+
const sourceType = input.id === "csv-source-input" ? "csv" : "excel";
|
|
2613
|
+
const expectedSuffix = sourceType === "csv" ? ".csv" : ".xlsx";
|
|
2614
|
+
if (!file.name.toLowerCase().endsWith(expectedSuffix)) {
|
|
2615
|
+
state.datasourceError = `Choose a ${expectedSuffix} file.`;
|
|
2589
2616
|
render();
|
|
2590
2617
|
return;
|
|
2591
2618
|
}
|
|
@@ -2599,7 +2626,7 @@ async function uploadSelectedSource(event) {
|
|
|
2599
2626
|
backend_url: state.backendUrl,
|
|
2600
2627
|
active: "true"
|
|
2601
2628
|
});
|
|
2602
|
-
const response = await fetch(`/api/datasources
|
|
2629
|
+
const response = await fetch(`/api/datasources/${sourceType}?${params.toString()}`, {
|
|
2603
2630
|
method: "POST",
|
|
2604
2631
|
headers: authHeaders(),
|
|
2605
2632
|
body: formData
|
|
@@ -2681,7 +2708,10 @@ function friendlyDatasourceError(message) {
|
|
|
2681
2708
|
}
|
|
2682
2709
|
async function changeView(event) {
|
|
2683
2710
|
const view = normalizeView(event.currentTarget.dataset.view);
|
|
2684
|
-
if (state.activeView === view)
|
|
2711
|
+
if (state.activeView === view) {
|
|
2712
|
+
if (view === "home") scrollToLatest();
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2685
2715
|
if (state.activeView === "analysis" && state.dashboardEditMode) {
|
|
2686
2716
|
await flushPendingDashboardLayoutSave();
|
|
2687
2717
|
}
|
|
@@ -2695,7 +2725,7 @@ async function changeView(event) {
|
|
|
2695
2725
|
state.dashboardEditId = "";
|
|
2696
2726
|
state.dashboardShareOpen = false;
|
|
2697
2727
|
state.dashboardShareDashboardId = "";
|
|
2698
|
-
render();
|
|
2728
|
+
render({ scrollToLatest: view === "home" });
|
|
2699
2729
|
}
|
|
2700
2730
|
function openConversation(event) {
|
|
2701
2731
|
const conversationId = event.currentTarget.dataset.openConversation || "";
|
|
@@ -4210,7 +4240,46 @@ function getColumns(rows) {
|
|
|
4210
4240
|
});
|
|
4211
4241
|
return columns;
|
|
4212
4242
|
}
|
|
4213
|
-
|
|
4243
|
+
const TABLE_CELL_ALLOWED_TAGS = new Set([
|
|
4244
|
+
"A", "B", "BR", "CODE", "EM", "I", "LI", "OL", "P", "SMALL", "SPAN", "STRONG", "SUB", "SUP", "U", "UL"
|
|
4245
|
+
]);
|
|
4246
|
+
const TABLE_CELL_ALLOWED_LINK_PROTOCOLS = new Set(["http:", "https:", "mailto:", "tel:"]);
|
|
4247
|
+
function sanitizeTableCellHtml(value) {
|
|
4248
|
+
const template = document.createElement("template");
|
|
4249
|
+
template.innerHTML = String(value ?? "");
|
|
4250
|
+
Array.from(template.content.querySelectorAll("*")).forEach((element) => {
|
|
4251
|
+
if (!TABLE_CELL_ALLOWED_TAGS.has(element.tagName)) {
|
|
4252
|
+
element.replaceWith(...element.childNodes);
|
|
4253
|
+
return;
|
|
4254
|
+
}
|
|
4255
|
+
Array.from(element.attributes).forEach((attribute) => {
|
|
4256
|
+
if (element.tagName !== "A" || !["href", "target", "title"].includes(attribute.name.toLowerCase())) {
|
|
4257
|
+
element.removeAttribute(attribute.name);
|
|
4258
|
+
}
|
|
4259
|
+
});
|
|
4260
|
+
if (element.tagName !== "A") return;
|
|
4261
|
+
const href = element.getAttribute("href")?.trim() || "";
|
|
4262
|
+
if (href) {
|
|
4263
|
+
try {
|
|
4264
|
+
const url = new URL(href, window.location.origin);
|
|
4265
|
+
if (!TABLE_CELL_ALLOWED_LINK_PROTOCOLS.has(url.protocol)) {
|
|
4266
|
+
element.removeAttribute("href");
|
|
4267
|
+
}
|
|
4268
|
+
} catch {
|
|
4269
|
+
element.removeAttribute("href");
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
const target = element.getAttribute("target");
|
|
4273
|
+
if (target && !["_blank", "_self"].includes(target)) {
|
|
4274
|
+
element.removeAttribute("target");
|
|
4275
|
+
}
|
|
4276
|
+
if (element.getAttribute("target") === "_blank") {
|
|
4277
|
+
element.setAttribute("rel", "noopener noreferrer");
|
|
4278
|
+
}
|
|
4279
|
+
});
|
|
4280
|
+
return template.innerHTML;
|
|
4281
|
+
}
|
|
4282
|
+
function renderDataTable(rows, options = {}) {
|
|
4214
4283
|
const columns = getColumns(rows);
|
|
4215
4284
|
if (!rows.length) {
|
|
4216
4285
|
return `<div class="data-table-empty">No rows returned.</div>`;
|
|
@@ -4227,7 +4296,13 @@ function renderDataTable(rows) {
|
|
|
4227
4296
|
<tbody>
|
|
4228
4297
|
${rows.map((row) => `
|
|
4229
4298
|
<tr>
|
|
4230
|
-
${columns.map((column) =>
|
|
4299
|
+
${columns.map((column) => {
|
|
4300
|
+
const value = row?.[column];
|
|
4301
|
+
const rendered = options.allowHtml && typeof value === "string"
|
|
4302
|
+
? sanitizeTableCellHtml(value)
|
|
4303
|
+
: escapeHtml(formatCellValue(value));
|
|
4304
|
+
return `<td>${rendered}</td>`;
|
|
4305
|
+
}).join("")}
|
|
4231
4306
|
</tr>`).join("")}
|
|
4232
4307
|
</tbody>
|
|
4233
4308
|
</table>
|
|
@@ -1604,23 +1604,28 @@ button.primary {
|
|
|
1604
1604
|
display: none;
|
|
1605
1605
|
}
|
|
1606
1606
|
|
|
1607
|
-
.workspace-shell
|
|
1608
|
-
.chat-shell {
|
|
1607
|
+
.workspace-shell {
|
|
1609
1608
|
min-width: 0;
|
|
1610
1609
|
height: 100vh;
|
|
1611
1610
|
height: 100dvh;
|
|
1612
1611
|
display: grid;
|
|
1613
|
-
grid-template-rows: auto minmax(0, 1fr);
|
|
1612
|
+
grid-template-rows: auto auto minmax(0, 1fr);
|
|
1614
1613
|
overflow: hidden;
|
|
1615
1614
|
background: var(--surface);
|
|
1616
1615
|
}
|
|
1617
1616
|
|
|
1618
|
-
.workspace-shell {
|
|
1619
|
-
grid-template-rows: auto
|
|
1617
|
+
.workspace-shell.home-workspace {
|
|
1618
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
1620
1619
|
}
|
|
1621
1620
|
|
|
1622
1621
|
.chat-shell {
|
|
1623
|
-
|
|
1622
|
+
min-width: 0;
|
|
1623
|
+
min-height: 0;
|
|
1624
|
+
height: 100%;
|
|
1625
|
+
display: grid;
|
|
1626
|
+
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
1627
|
+
overflow: hidden;
|
|
1628
|
+
background: var(--surface);
|
|
1624
1629
|
}
|
|
1625
1630
|
|
|
1626
1631
|
.topbar {
|
|
@@ -1737,6 +1742,21 @@ button.primary {
|
|
|
1737
1742
|
gap: 8px;
|
|
1738
1743
|
}
|
|
1739
1744
|
|
|
1745
|
+
.analysis-topbar-actions {
|
|
1746
|
+
display: flex;
|
|
1747
|
+
align-items: center;
|
|
1748
|
+
justify-content: flex-end;
|
|
1749
|
+
gap: 8px;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
.analysis-topbar-actions:empty {
|
|
1753
|
+
display: none;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
.chat-toolbar {
|
|
1757
|
+
flex: 0 0 auto;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1740
1760
|
.ghost-button,
|
|
1741
1761
|
.auth-button,
|
|
1742
1762
|
.user-chip {
|
|
@@ -1757,6 +1777,18 @@ button.primary {
|
|
|
1757
1777
|
#ffffff;
|
|
1758
1778
|
}
|
|
1759
1779
|
|
|
1780
|
+
.dashboard-table-widget .data-table a {
|
|
1781
|
+
color: var(--accent);
|
|
1782
|
+
font-weight: 600;
|
|
1783
|
+
text-decoration: underline;
|
|
1784
|
+
text-underline-offset: 2px;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
.dashboard-table-widget .data-table a:hover,
|
|
1788
|
+
.dashboard-table-widget .data-table a:focus-visible {
|
|
1789
|
+
color: var(--accent-strong);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1760
1792
|
.empty-state {
|
|
1761
1793
|
gap: 12px;
|
|
1762
1794
|
}
|
|
@@ -1826,26 +1858,6 @@ button.primary {
|
|
|
1826
1858
|
background: #fbfcfd;
|
|
1827
1859
|
}
|
|
1828
1860
|
|
|
1829
|
-
.dashboard-toolbar {
|
|
1830
|
-
display: flex;
|
|
1831
|
-
align-items: start;
|
|
1832
|
-
justify-content: space-between;
|
|
1833
|
-
gap: 24px;
|
|
1834
|
-
margin-bottom: 24px;
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
.dashboard-toolbar-compact {
|
|
1838
|
-
justify-content: flex-end;
|
|
1839
|
-
margin-bottom: 18px;
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
.dashboard-toolbar-actions {
|
|
1843
|
-
display: flex;
|
|
1844
|
-
align-items: center;
|
|
1845
|
-
justify-content: flex-end;
|
|
1846
|
-
gap: 8px;
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
1861
|
.dashboard-edit-mode-button {
|
|
1850
1862
|
min-height: 36px;
|
|
1851
1863
|
display: inline-flex;
|
|
@@ -1923,7 +1935,6 @@ button.primary {
|
|
|
1923
1935
|
stroke-width: 1.9;
|
|
1924
1936
|
}
|
|
1925
1937
|
|
|
1926
|
-
.dashboard-toolbar h1,
|
|
1927
1938
|
.placeholder-intro h1 {
|
|
1928
1939
|
margin: 0;
|
|
1929
1940
|
color: #111a24;
|
|
@@ -2483,7 +2494,6 @@ button.primary {
|
|
|
2483
2494
|
background: rgba(143, 37, 43, 0.08);
|
|
2484
2495
|
}
|
|
2485
2496
|
|
|
2486
|
-
.dashboard-toolbar p,
|
|
2487
2497
|
.placeholder-intro p {
|
|
2488
2498
|
margin: 8px 0 0;
|
|
2489
2499
|
color: #6d7a86;
|
|
@@ -3352,12 +3362,15 @@ button.placeholder-item.active {
|
|
|
3352
3362
|
font-size: 18px;
|
|
3353
3363
|
}
|
|
3354
3364
|
|
|
3355
|
-
.
|
|
3356
|
-
|
|
3365
|
+
.analysis-topbar {
|
|
3366
|
+
align-items: flex-start;
|
|
3367
|
+
flex-wrap: wrap;
|
|
3357
3368
|
}
|
|
3358
3369
|
|
|
3359
|
-
.
|
|
3370
|
+
.analysis-topbar .header-actions {
|
|
3371
|
+
flex: 1 1 auto;
|
|
3360
3372
|
flex-wrap: wrap;
|
|
3373
|
+
justify-content: flex-end;
|
|
3361
3374
|
}
|
|
3362
3375
|
|
|
3363
3376
|
.widget-type-grid {
|