:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(personhog): keep the changelog seed form across refreshes (#120641)
Zach Brown56996dbbdf4d
diff --git a/rust/ingestion-control-plane/src/ui/index.html b/rust/ingestion-control-plane/src/ui/index.htmlindex fa1679fbdde0..2affd1bcc63c 100644--- a/rust/ingestion-control-plane/src/ui/index.html+++ b/rust/ingestion-control-plane/src/ui/index.html@@ -1340,7 +1340,10 @@mount(root) {this.ui = {summary: el("div", { class: "row", style: "padding: 0 0 10px" }),- changelogBody: el("div", {}, el("div", { class: "empty" }, "Loading…")),+ changelogStatus: el("div", {}, el("div", { class: "empty" }, "Loading…")),+ // Rebuilt only when the config's presence changes, so a refresh keeps what is typed.+ changelogForm: el("div"),+ changelogFormKey: null,issuesBody: el("div", {}, el("div", { class: "empty" }, "Loading…")),partitionsBody: el("div", {}, el("div", { class: "empty" }, "Loading…")),podsBody: el("div", {}, el("div", { class: "empty" }, "Loading…")),@@ -1358,7 +1361,7 @@});root.append(this.ui.summary,- el("div", { class: "panel" }, el("h2", {}, "Changelog"), this.ui.changelogBody),+ el("div", { class: "panel" }, el("h2", {}, "Changelog"), this.ui.changelogStatus, this.ui.changelogForm),el("div", { class: "panel" }, el("h2", {}, "Issues"), this.ui.issuesBody),el("div", { class: "panel" }, el("h2", {}, "Partitions"), this.ui.partitionsBody),el("div", { class: "panel" }, el("h2", {}, "Pods"), this.ui.podsBody),@@ -1383,47 +1386,22 @@// The lag scan talks to Kafka, so it never blocks the topology render.fetchJSON("api/personhog/changelog").then((view) => { if (seq === this.refreshSeq) this.renderChangelog(view); },- (e) => { if (seq === this.refreshSeq) this.ui.changelogBody.replaceChildren(el("div", { class: "error-box" }, String(e))); });+ (e) => { if (seq === this.refreshSeq) this.ui.changelogStatus.replaceChildren(el("div", { class: "error-box" }, String(e))); });},renderChangelog(view) {+ const formKey = view.config ? "seeded" : "unseeded";+ if (this.ui.changelogFormKey !== formKey) {+ this.ui.changelogFormKey = formKey;+ this.ui.changelogForm.replaceChildren(...(view.config ? [] : [this.seedForm()]));+ }if (!view.config) {- const topicInput = el("input", { type: "text", placeholder: "changelog topic, e.g. personhog_updates_64", style: "width: 360px" });- const groupInput = el("input", { type: "text", placeholder: "writer consumer group, e.g. personhog-writer", style: "width: 280px" });- const error = el("div");- const button = el("button", {}, "Seed config/changelog");- button.onclick = async () => {- const topic = topicInput.value.trim();- const writer_group = groupInput.value.trim();- if (!topic || !writer_group) {- error.replaceChildren(el("div", { class: "error-box" }, "Enter the topic and the writer's consumer group."));- return;- }- if (!window.confirm(`Seed config/changelog with topic ${topic}, with writer group ${writer_group}?\n\nThe partition count is read from the topic's metadata.`)) return;- button.disabled = true;- try {- await fetchJSON("api/personhog/changelog/seed", {- method: "POST",- headers: { "content-type": "application/json" },- body: JSON.stringify({ topic, writer_group }),- });- this.refresh();- } catch (e) {- error.replaceChildren(el("div", { class: "error-box" }, String(e)));- } finally {- button.disabled = false;- }- };- this.ui.changelogBody.replaceChildren(- el("div", { style: "padding: 6px 14px" },- el("div", { class: "muted", style: "padding-bottom: 8px" },- "Not seeded."),- el("div", { class: "row" }, topicInput, groupInput, button),- error));+ this.ui.changelogStatus.replaceChildren(+ el("div", { class: "muted", style: "padding: 6px 14px 8px" }, "Not seeded."));return;}const c = view.config;- this.ui.changelogBody.replaceChildren(+ this.ui.changelogStatus.replaceChildren(el("div", { class: "row", style: "padding: 6px 14px" },el("span", { class: "pill accent mono" }, c.topic),el("span", { class: "pill muted" }, `${fmtInt(c.partitions)} partitions`),@@ -1443,6 +1421,38 @@el("td", { class: "mono" }, g.error ? "–" : fmtInt(g.max_partition_lag)))))));},+ seedForm() {+ const topicInput = el("input", { type: "text", placeholder: "changelog topic, e.g. personhog_updates_64", style: "width: 360px" });+ const groupInput = el("input", { type: "text", placeholder: "writer consumer group, e.g. personhog-writer", style: "width: 280px" });+ const error = el("div");+ const button = el("button", {}, "Seed config/changelog");+ button.onclick = async () => {+ const topic = topicInput.value.trim();+ const writer_group = groupInput.value.trim();+ if (!topic || !writer_group) {+ error.replaceChildren(el("div", { class: "error-box" }, "Enter the topic and the writer's consumer group."));+ return;+ }+ if (!window.confirm(`Seed config/changelog with topic ${topic}, with writer group ${writer_group}?\n\nThe partition count is read from the topic's metadata.`)) return;+ button.disabled = true;+ try {+ await fetchJSON("api/personhog/changelog/seed", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ topic, writer_group }),+ });+ this.refresh();+ } catch (e) {+ error.replaceChildren(el("div", { class: "error-box" }, String(e)));+ } finally {+ button.disabled = false;+ }+ };+ return el("div", { style: "padding: 0 14px 6px" },+ el("div", { class: "row" }, topicInput, groupInput, button),+ error);+ },+render(data) {const readyPods = data.pods.filter((p) => p.status === "Ready").length;const errors = data.issues.filter((issue) => issue.severity === "error").length;