Skip to content

Commit 953d97f

Browse files
CopilotCommanderStormautofix-ci[bot]
authored
fix: Setting Status Page Analytics Type to "None" fails with SQLite constraint violation (louislam#7043)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: CommanderStorm <26258709+CommanderStorm@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 0ce2ebb commit 953d97f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

server/socket-handlers/status-page-socket-handler.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ module.exports.statusPageSocketHandler = (socket) => {
338338
statusPage.modified_date = R.isoDateTime();
339339
statusPage.analytics_id = config.analyticsId;
340340
statusPage.analytics_script_url = config.analyticsScriptUrl;
341+
const validAnalyticsTypes = ["google", "umami", "plausible", "matomo"];
342+
if (config.analyticsType !== null && !validAnalyticsTypes.includes(config.analyticsType)) {
343+
throw new Error("Invalid analytics type");
344+
}
341345
statusPage.analytics_type = config.analyticsType;
342346

343347
await R.store(statusPage);

src/pages/StatusPage.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
class="form-select"
157157
data-testid="analytics-type-select"
158158
>
159-
<option>{{ $t("None") }}</option>
159+
<option :value="null">{{ $t("None") }}</option>
160160
<option value="google">{{ $t("Google") }}</option>
161161
<option value="umami">{{ $t("Umami") }}</option>
162162
<option value="plausible">{{ $t("Plausible") }}</option>
@@ -688,7 +688,9 @@ export default {
688688
enableEditMode: false,
689689
enableEditIncidentMode: false,
690690
hasToken: false,
691-
config: {},
691+
config: {
692+
analyticsType: null,
693+
},
692694
selectedMonitor: null,
693695
incident: null,
694696
previousIncident: null,

0 commit comments

Comments
 (0)