Skip to content

Commit 8f96314

Browse files
author
waleed
committed
cleanup
1 parent 721ea0b commit 8f96314

4 files changed

Lines changed: 0 additions & 26 deletions

File tree

apps/sim/app/api/workspaces/[id]/metrics/executions/route.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
2828
}
2929
const userId = session.user.id
3030

31-
// Resolve time range
3231
const end = qp.endTime ? new Date(qp.endTime) : new Date()
3332
const start = qp.startTime
3433
? new Date(qp.startTime)
@@ -41,7 +40,6 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
4140
const totalMs = Math.max(1, end.getTime() - start.getTime())
4241
const segmentMs = Math.max(1, Math.floor(totalMs / Math.max(1, segments)))
4342

44-
// Resolve workflows in scope (respecting permissions)
4543
const [permission] = await db
4644
.select()
4745
.from(permissions)
@@ -92,7 +90,6 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
9290
logWhere.push(inArray(workflowExecutionLogs.trigger, t))
9391
}
9492

95-
// Select only the columns we need
9693
const logs = await db
9794
.select({
9895
workflowId: workflowExecutionLogs.workflowId,
@@ -103,7 +100,6 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
103100
.from(workflowExecutionLogs)
104101
.where(and(...logWhere))
105102

106-
// Group and bin logs by workflow and segment
107103
type Bucket = {
108104
timestamp: string
109105
totalExecutions: number

apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/line-chart.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ export function LineChart({
125125
: scaledSeries
126126
const orderedSeries = (() => {
127127
if (!activeSeriesId) return visibleSeries
128-
// Only the active series is visible; keep as-is and render last by definition
129128
return visibleSeries
130129
})()
131130

@@ -241,7 +240,6 @@ export function LineChart({
241240
const i = Math.round(ratio * (scaledPoints.length - 1))
242241
setHoverIndex(i)
243242
setHoverPos({ x: clamped, y: e.clientY - rect.top })
244-
// determine nearest series by Y distance
245243
const cursorY = e.clientY - rect.top
246244
if (activeSeriesId) {
247245
setHoverSeriesId(activeSeriesId)
@@ -514,7 +512,6 @@ export function LineChart({
514512
{hoverIndex !== null &&
515513
scaledPoints[hoverIndex] &&
516514
(() => {
517-
// Tooltip shows selected series value; if none selected, shows multiple series values
518515
const active =
519516
getSeriesById(activeSeriesId) || getSeriesById(hoverSeriesId) || scaledSeries[0]
520517
const pt = active.pts[hoverIndex] || scaledPoints[hoverIndex]
@@ -533,7 +530,6 @@ export function LineChart({
533530
return `${Math.round(v)}${u}`
534531
}
535532

536-
// Estimate tooltip width from content length so we flip only when necessary
537533
const longest = toDisplay.reduce((m, s) => {
538534
const seriesIndex = allSeries.findIndex((x) => x.id === s.id)
539535
const v = allSeries[seriesIndex]?.data?.[hoverIndex]?.value

apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/workflow-details.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ export function WorkflowDetails({
7777
const listRef = useRef<HTMLDivElement | null>(null)
7878
const loaderRef = useRef<HTMLDivElement | null>(null)
7979

80-
// Attach an IntersectionObserver to the sentinel at the bottom of the list.
81-
// The root must be the scrollable container itself, otherwise intersections
82-
// are computed against the viewport and never fire for inner scrolling.
8380
useEffect(() => {
8481
const rootEl = listRef.current
8582
const sentinel = loaderRef.current
@@ -91,7 +88,6 @@ export function WorkflowDetails({
9188
const entry = entries[0]
9289
if (entry?.isIntersecting && hasMore && !ticking && !isLoadingMore) {
9390
ticking = true
94-
// Small delay to batch rapid intersections while scrolling
9591
setTimeout(() => {
9692
onLoadMore()
9793
ticking = false

apps/sim/app/workspace/[workspaceId]/logs/executions-dashboard.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export default function ExecutionsDashboard() {
116116
const [searchQuery, setSearchQuery] = useState('')
117117
const [segmentCount, setSegmentCount] = useState<number>(DEFAULT_SEGMENTS)
118118
const barsAreaRef = useRef<HTMLDivElement | null>(null)
119-
// Removed external sentinels; WorkflowDetails now owns its infinite scroll
120119

121120
const {
122121
workflowIds,
@@ -129,9 +128,6 @@ export default function ExecutionsDashboard() {
129128

130129
const timeFilter = getTimeFilterFromRange(sidebarTimeRange)
131130

132-
// buildSeriesFromLogs removed — now using aggregated server metrics
133-
134-
// Persist view mode to the URL and restore it on refresh
135131
useEffect(() => {
136132
const urlView = searchParams.get('view')
137133
if (urlView === 'dashboard' || urlView === 'logs') {
@@ -143,13 +139,11 @@ export default function ExecutionsDashboard() {
143139
useEffect(() => {
144140
if (typeof window === 'undefined') return
145141
const sp = new URLSearchParams(Array.from(searchParams.entries()))
146-
// If no view is present on first mount, set it once to persist on refresh
147142
if (!sp.get('view')) {
148143
sp.set('view', viewMode as string)
149144
router.replace(`${window.location.pathname}?${sp.toString()}`, { scroll: false })
150145
return
151146
}
152-
// Keep view param in sync when it changes
153147
if (sp.get('view') !== (viewMode as string)) {
154148
sp.set('view', viewMode as string)
155149
router.replace(`${window.location.pathname}?${sp.toString()}`, { scroll: false })
@@ -306,7 +300,6 @@ export default function ExecutionsDashboard() {
306300
})
307301
setExecutions(sortedWorkflows)
308302

309-
// Build aggregate segments across workflows from server segments
310303
const segmentsCount: number = Number(params.get('segments') || DEFAULT_SEGMENTS)
311304
const agg: { timestamp: string; totalExecutions: number; successfulExecutions: number }[] =
312305
Array.from({ length: segmentsCount }, (_, i) => {
@@ -374,7 +367,6 @@ export default function ExecutionsDashboard() {
374367
? Number.parseInt(l.duration.replace(/[^0-9]/g, ''), 10)
375368
: null
376369
let output: any = null
377-
// Prefer finalOutput if present
378370
if (l.executionData?.finalOutput !== undefined) {
379371
output = l.executionData.finalOutput
380372
}
@@ -491,7 +483,6 @@ export default function ExecutionsDashboard() {
491483
else if (typeof l.duration === 'string')
492484
durationCandidate = Number.parseInt(String(l.duration).replace(/[^0-9]/g, ''), 10)
493485

494-
// Robust output extraction: prefer finalOutput, then string output, then traceSpans, then executionData.output, then blockExecutions
495486
let output: any = null
496487
if (l.executionData?.finalOutput !== undefined) {
497488
output = l.executionData.finalOutput
@@ -601,7 +592,6 @@ export default function ExecutionsDashboard() {
601592
)
602593
else if (typeof l.duration === 'string')
603594
durationCandidate = Number.parseInt(String(l.duration).replace(/[^0-9]/g, ''), 10)
604-
// Prefer finalOutput, then spans, then executionData.output, then blockExecutions
605595
let output: any = null
606596
if (l.executionData?.finalOutput !== undefined) {
607597
output = l.executionData.finalOutput
@@ -652,7 +642,6 @@ export default function ExecutionsDashboard() {
652642

653643
setWorkflowDetails((prev) => {
654644
const cur = prev[workflowId]
655-
// Deduplicate by id to avoid React key duplicates when multiple triggers fire
656645
const seen = new Set<string>()
657646
const dedup = [...(cur?.allLogs || []), ...more].filter((x) => {
658647
const id = x.id
@@ -675,7 +664,6 @@ export default function ExecutionsDashboard() {
675664
}
676665
})
677666
} catch {
678-
// ignore errors for background loads
679667
setWorkflowDetails((prev) => ({
680668
...prev,
681669
[workflowId]: { ...(prev as any)[workflowId], __loading: false },
@@ -685,7 +673,6 @@ export default function ExecutionsDashboard() {
685673
[workspaceId, endTime, getStartTime, triggers, workflowDetails]
686674
)
687675

688-
// Infinite scroll for All workflows (no expanded workflow)
689676
const loadMoreGlobalLogs = useCallback(async () => {
690677
if (!globalDetails || !globalLogsMeta.hasMore) return
691678
if (globalLoadingMore) return
@@ -1209,7 +1196,6 @@ export default function ExecutionsDashboard() {
12091196
)
12101197
}
12111198

1212-
// Aggregate view for all workflows
12131199
if (!globalDetails) return null
12141200
const totals = aggregateSegments.reduce(
12151201
(acc, s) => {

0 commit comments

Comments
 (0)