diff --git a/CHANGELOG.md b/CHANGELOG.md index 285550f56..dbbc951e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - `stacked` is now ignored on chart types that cannot stack, instead of displaying an empty chart. - Screen readers now announce the title of the modal component instead of an unnamed dialog. - `sqlpage.request_body` and `sqlpage.request_body_base64` now return NULL when the request has no body. A body that cannot be read, such as one exceeding the payload limit, is now reported as an error instead of being silently replaced with an empty body. + - Datagrid rows with an icon or image no longer display an unnecessary en-dash placeholder, and an explicitly empty description remains empty. - Charts can display reference lines. A row with a `yline` is drawn as a line across the chart at that value of the y axis, with the row's `label` and `color` for its text and its color. Reference lines are rows, so a chart can have as many of them as the query returns. A line follows its axis, so on a `horizontal` bar chart a `yline` is drawn down the chart rather than across it. They are not added to the total of a `stacked` chart, and are not filled in an `area` chart. ## v0.45 diff --git a/docs/screenshots/datagrid-issue-1384-after.png b/docs/screenshots/datagrid-issue-1384-after.png new file mode 100644 index 000000000..1c870eb05 Binary files /dev/null and b/docs/screenshots/datagrid-issue-1384-after.png differ diff --git a/docs/screenshots/datagrid-issue-1384-before.png b/docs/screenshots/datagrid-issue-1384-before.png new file mode 100644 index 000000000..c204b2801 Binary files /dev/null and b/docs/screenshots/datagrid-issue-1384-before.png differ diff --git a/sqlpage/templates/datagrid.handlebars b/sqlpage/templates/datagrid.handlebars index 65e9489d6..ef85a0e46 100644 --- a/sqlpage/templates/datagrid.handlebars +++ b/sqlpage/templates/datagrid.handlebars @@ -42,6 +42,9 @@ {{/if}} {{#if description}} {{description}} + {{else if (eq description "")}} + {{else if icon}} + {{else if image_url}} {{else}} – {{/if}} diff --git a/tests/components/datagrid_icon_only.sql b/tests/components/datagrid_icon_only.sql new file mode 100644 index 000000000..bad2e4e1c --- /dev/null +++ b/tests/components/datagrid_icon_only.sql @@ -0,0 +1,4 @@ +SELECT 'datagrid' AS component; +SELECT 'Facebook' AS title, 'brand-facebook' AS icon; +SELECT 'Empty' AS title, '' AS description; +SELECT 'Missing' AS title; diff --git a/tests/core/mod.rs b/tests/core/mod.rs index 75e9c849d..1845400ef 100644 --- a/tests/core/mod.rs +++ b/tests/core/mod.rs @@ -40,6 +40,20 @@ async fn test_concurrent_requests() { } } +#[actix_web::test] +async fn test_datagrid_description_presence_controls_placeholder() { + let resp = req_path("/tests/components/datagrid_icon_only.sql") + .await + .unwrap(); + assert_eq!(resp.status(), StatusCode::OK); + let body = String::from_utf8(test::read_body(resp).await.to_vec()).unwrap(); + assert!(body.contains("Facebook"), "{body}"); + assert!(body.contains("Empty"), "{body}"); + assert!(body.contains("Missing"), "{body}"); + assert!(body.contains("