Skip to content

Commit e097cee

Browse files
committed
Release 0.11.1: keep configurator errors visible across tabs
1 parent 147ef56 commit e097cee

10 files changed

Lines changed: 23 additions & 46 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ const result = pgc.generate({ cpu_cores: 8, ram_value: '16Gi', pg_version: '18'
889889

890890
result.config.shared_buffers; // '3622MB'
891891
result.advisories.filter((a) => a.severity === 'warning');
892-
renderConf(result, { version: '0.11.0', host: 'db-1' });
892+
renderConf(result, { version: '0.11.1', host: 'db-1' });
893893
```
894894

895895
`createConfigurator()` reads the bundled rule data from disk, which needs Node.
@@ -959,7 +959,7 @@ python -m twine check dist/*
959959
```
960960

961961
Tagged releases are built and published through PyPI Trusted Publishing. A tag
962-
must match the package version, for example `v0.11.0`.
962+
must match the package version, for example `v0.11.1`.
963963

964964
## License and provenance
965965

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pg-configurator-web",
33
"private": true,
4-
"version": "0.11.0",
4+
"version": "0.11.1",
55
"description": "Browser and Node port of the pg-configurator calculation; the Python package in this repository is the reference implementation",
66
"type": "module",
77
"license": "MIT",

‎src/pg_configurator/version.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""pg_configurator version information."""
22

3-
__version__ = "0.11.0"
3+
__version__ = "0.11.1"

‎web/configurator.template.html‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</head>
1414
<body class="pv">
1515
<div class="pc-wrap">
16+
<div class="pc-error pc-error-quiet" id="error" role="alert"></div>
1617
<div class="pc-top">
1718
<div>
1819
<h1 class="pc-title">pg-configurator<small>Explainable, hardware-aware PostgreSQL configuration</small></h1>
@@ -57,9 +58,6 @@ <h1 class="pc-title">pg-configurator<small>Explainable, hardware-aware PostgreSQ
5758
<div class="pc-actions" id="actions"></div>
5859
</div>
5960
<div id="panels"></div>
60-
<!-- The form moves this into the Main panel, between the fields and the
61-
settings they produce; it lives here only so the markup stays declarative. -->
62-
<div class="pc-error pc-error-quiet" id="error" role="alert"></div>
6361
</div>
6462

6563
<script type="application/json" id="pgc-rules">{}</script><!--PC:DATA-RULES-->

‎web/css/pgc.css‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,7 @@ body {
591591
/* ---------------------------------------------------------------- output */
592592

593593
.pc-error {
594-
/* The message sits between the fields and the settings, so it needs air on
595-
both sides. `.pc-form` ends flush with its last group, contributing no
596-
bottom margin of its own, and the gap below collapses to the section's
597-
own top margin — so both sides are set to the same step here. */
598-
margin: var(--pc-sp-6) 0 var(--pc-sp-4);
594+
margin: 0 0 var(--pc-sp-4);
599595
padding: 10px 14px;
600596
border: 1px solid var(--vw-border-strong);
601597
border-radius: 10px;
@@ -605,14 +601,10 @@ body {
605601
font-size: var(--pv-fs-sm);
606602
line-height: 1.5;
607603
white-space: pre-wrap;
608-
/* One line of text plus the padding and border above and below it. The slot
609-
is held open whether or not there is a message, so the panels below do not
610-
move as input goes in and out of range. Box-sizing is border-box here. */
611-
min-height: calc(1.5em + 22px);
612604
}
613605

614606
.pc-error-quiet {
615-
visibility: hidden;
607+
display: none;
616608
}
617609

618610
.pc-code {

‎web/data/input-schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"generator": "tools/export_web_data.py",
3-
"package_version": "0.11.0",
3+
"package_version": "0.11.1",
44
"payload": {
55
"counts": {
66
"calculation": 35,

‎web/data/pg_settings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"generator": "tools/export_web_data.py",
3-
"package_version": "0.11.0",
3+
"package_version": "0.11.1",
44
"payload": {
55
"base": {
66
"DateStyle": [

‎web/data/rules.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"generator": "tools/export_web_data.py",
3-
"package_version": "0.11.0",
3+
"package_version": "0.11.1",
44
"payload": {
55
"counts": {
66
"deprecated_sentinels": 3,

‎web/src/render.js‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ const MAIN_OUTPUT_TABS = [
198198
*/
199199
const HIDES_STALE_OUTPUT = new Set(['conf', 'settings', 'patroni', 'diff']);
200200

201-
const STALE_NOTICE = 'Not shown while the input is invalid — see the message on the Main tab.';
201+
const STALE_NOTICE = 'Not shown while the input is invalid — see the message above.';
202202

203203
const el = (tag, className, text) => {
204204
const node = document.createElement(tag);
@@ -429,11 +429,6 @@ export class ConfiguratorPage {
429429
this.syncGroups();
430430
panel.append(form);
431431

432-
// The message belongs with the fields that cause it, not above the tab row:
433-
// it reports on the values just entered, and it sits directly over the
434-
// settings it is suppressing.
435-
panel.append(this.errorBox);
436-
437432
// Deployable output sits right below the form. These views share the same
438433
// calculation and stay inside Main so changing an input and copying its
439434
// result no longer requires a trip through the page-wide navigation.
@@ -833,9 +828,7 @@ export class ConfiguratorPage {
833828
}
834829

835830
renderError() {
836-
// The box keeps its place whether or not it says anything: hiding it
837-
// outright made every panel below jump on each keystroke that fixed or
838-
// broke the input.
831+
// The shared banner stays visible when switching between tabs.
839832
this.errorBox.textContent = this.error ?? '';
840833
this.errorBox.classList.toggle('pc-error-quiet', this.error === null);
841834
for (const [, node] of this.fieldNodes) node.wrap.classList.remove('pc-invalid');

‎web/tools/browser-smoke.py‎

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -760,30 +760,22 @@ def drag(dest, position):
760760
# --- invalid input reports without blanking the page ---------------
761761
page.click("#tab-main")
762762

763-
def form_top():
764-
return page.evaluate(
765-
"() => Math.round("
766-
"document.querySelector('#panel-main .pc-section').getBoundingClientRect().top)"
767-
)
768-
769-
settled = form_top()
770763
fill("#readout-db_ram", "32Zi")
771764
check(page.locator("#error").is_visible(), "an invalid size produced no error")
772-
# The slot is reserved: a message may not shove the page around.
773765
check(
774-
form_top() == settled,
775-
f"the settings moved by {form_top() - settled}px when the message appeared",
766+
page.locator("#error").evaluate("el => el.closest('[role=tabpanel]') === null"),
767+
"the shared error banner is inside a tab panel",
776768
)
777769
error_text = page.locator("#error").inner_text()
778770
check("Unknown size unit" in error_text, f"unexpected error text: {error_text}")
779771
check(
780772
page.evaluate(
781773
"() => Math.round("
782-
"document.querySelector('#panel-main .pc-section').getBoundingClientRect().top"
774+
"document.querySelector('.pc-top').getBoundingClientRect().top"
783775
" - document.querySelector('#error').getBoundingClientRect().bottom)"
784776
)
785777
>= 8,
786-
"the message sits flush against the settings below it",
778+
"the error banner is not above the page header with a gap",
787779
)
788780
# A result the current input did not produce must not stay on offer.
789781
check(
@@ -806,14 +798,16 @@ def form_top():
806798
page.locator("#panel-calculation tbody tr").count() > 0,
807799
"the calculation was blanked as well",
808800
)
801+
for tab in ("calculation", "advisories", "overrides", "diff", "main"):
802+
page.click(f"#tab-{tab}")
803+
check(page.locator("#error").is_visible(), f"the error disappeared on {tab}")
804+
check(
805+
page.locator("[role=alert]:visible").count() == 1,
806+
f"the error banner is duplicated on {tab}",
807+
)
809808

810-
page.click("#tab-main")
811809
fill("#readout-db_ram", "32Gi")
812810
check(not page.locator("#error").is_visible(), "the error stayed after a fix")
813-
check(
814-
form_top() == settled,
815-
f"the settings moved by {form_top() - settled}px when the message went away",
816-
)
817811
check(
818812
page.locator("#main-output-panel-settings tbody tr").count() > 100,
819813
"the settings table did not come back after a fix",

0 commit comments

Comments
 (0)