Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit e28ae02

Browse files
committed
Connector metrics and warnings around why can't create Bootstrap API
Product
1 parent 94bc623 commit e28ae02

2 files changed

Lines changed: 8 additions & 31 deletions

File tree

src/routes/(protected)/connector-metrics/+page.svelte

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,36 +110,15 @@
110110
return date.toISOString();
111111
}
112112
113-
function updateDates() {
114-
if (autoRefresh === "none") return;
115-
116-
const now = new Date();
117-
queryForm.to_date = now.toISOString().slice(0, 19);
118-
119-
const refreshSeconds = parseInt(autoRefresh);
120-
const fromDate = new Date(now);
121-
fromDate.setSeconds(fromDate.getSeconds() - refreshSeconds);
122-
queryForm.from_date = fromDate.toISOString().slice(0, 19);
123-
}
124-
125113
async function refreshMetrics() {
126-
if (autoRefresh !== "none") {
127-
updateDates();
128-
}
129-
130114
isLoading = true;
131115
lastRefreshTime = new Date().toLocaleString();
132116
timestampColorIndex = (timestampColorIndex + 1) % 2;
133117
134118
try {
135119
const response = await trackedFetch(`/api/connector-metrics?${currentQueryString}`);
136-
const correlationId =
137-
response.headers.get("X-Correlation-Id") ||
138-
response.headers.get("x-correlation-id") ||
139-
"N/A";
140-
lastCorrelationId = correlationId;
141-
142120
const responseData = await response.json();
121+
lastCorrelationId = responseData.correlation_id || "N/A";
143122
144123
// Always store the raw response for debugging
145124
rawResponse = responseData;
@@ -264,10 +243,8 @@
264243
if (typeof window !== "undefined" && !initialized && check.hasAllRoles) {
265244
initialized = true;
266245
267-
// Set default from_date to 5 minutes ago
268-
const fiveMinutesAgo = new Date();
269-
fiveMinutesAgo.setMinutes(fiveMinutesAgo.getMinutes() - 5);
270-
queryForm.from_date = fiveMinutesAgo.toISOString().slice(0, 16);
246+
// Set default from_date to current time
247+
queryForm.from_date = new Date().toISOString().slice(0, 16);
271248
272249
refreshMetrics();
273250
startAutoRefresh();

src/routes/(protected)/products/bootstrap/+page.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
}
113113
114114
// Step 2: Add endpoints
115-
let endpointWarnings = 0;
115+
let failedEndpoints: string[] = [];
116116
for (const ep of collection.endpoints) {
117117
try {
118118
const epRes = await trackedFetch(
@@ -123,18 +123,18 @@
123123
body: JSON.stringify({ operation_id: ep.operation_id }),
124124
},
125125
);
126-
if (!epRes.ok) endpointWarnings++;
126+
if (!epRes.ok) failedEndpoints.push(ep.operation_id);
127127
} catch {
128-
endpointWarnings++;
128+
failedEndpoints.push(ep.operation_id);
129129
}
130130
}
131131
132132
collectionStatus[collection.id] = "created";
133133
134-
if (endpointWarnings > 0) {
134+
if (failedEndpoints.length > 0) {
135135
toast.warning(
136136
`Collection "${collection.collection_name}" created`,
137-
`${endpointWarnings} of ${collection.endpoints.length} endpoints could not be added`,
137+
`${failedEndpoints.length} of ${collection.endpoints.length} endpoints could not be added: ${failedEndpoints.join(", ")}`,
138138
);
139139
} else {
140140
toast.success(

0 commit comments

Comments
 (0)