Skip to content

Commit 3d60d63

Browse files
committed
fix new lint errors after removing blocks
1 parent 347bd43 commit 3d60d63

14 files changed

Lines changed: 60 additions & 44 deletions

File tree

frontend/interactEM/src/components/agents/tooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ const AgentTooltip = ({ data: unvalidated }: AgentTooltipProps) => {
5353
Recent Errors:
5454
</Typography>
5555
<List dense disablePadding sx={{ mt: 0.5 }}>
56-
{data.error_messages.map((error, index) => (
56+
{data.error_messages.map((error) => (
5757
<ListItem
58-
key={index}
58+
key={`${error.timestamp}-${error.message}`}
5959
sx={{
6060
py: 0.25,
6161
flexDirection: "column",

frontend/interactEM/src/components/nodes/parameterupdater.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ const ParameterUpdater: React.FC<{
117117
name={parameter.name}
118118
label={parameter.label}
119119
value={inputValue}
120-
options={
121-
parameter.type === "str-enum" ? (parameter as any).options : []
122-
}
120+
options={parameter.type === "str-enum" ? parameter.options : []}
123121
disabled={isReadOnly}
124122
error={error ?? null}
125123
onChange={handleValueChange}

frontend/interactEM/src/components/nodes/toolbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ const OperatorToolbar: React.FC<OperatorToolbarProps> = ({
146146
<div>
147147
Tags:
148148
<ul style={{ margin: "5px 0", paddingLeft: "20px" }}>
149-
{nodeTags.map((tag: OperatorSpecTag, index: number) => (
150-
<li key={index}>
149+
{nodeTags.map((tag: OperatorSpecTag) => (
150+
<li key={`${tag.value}-${tag.description ?? ""}`}>
151151
{tag.value}
152152
{tag.description && (
153153
<div>

frontend/interactEM/src/components/pipelines/viewswitcher.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ export const ViewSwitcher: React.FC = () => {
2828
)
2929

3030
if (runningDeployments.length > 0) {
31-
// Sort by created_at descending to get the most recent
32-
const mostRecent = runningDeployments.sort(
33-
(a, b) =>
34-
new Date(b.created_at).getTime() - new Date(a.created_at).getTime(),
35-
)[0]!
31+
const mostRecent = runningDeployments.reduce((latest, deployment) =>
32+
new Date(deployment.created_at).getTime() >
33+
new Date(latest.created_at).getTime()
34+
? deployment
35+
: latest,
36+
)
3637
setSelectedRuntimePipelineId(mostRecent.id)
3738
}
3839
}

frontend/interactEM/src/components/statusdot.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Badge, Tooltip } from "@mui/material"
1+
import { Badge, type BadgeProps, Tooltip } from "@mui/material"
22
import type { AgentStatus } from "../types/gen"
33
import { getAgentStatusColor } from "../utils/statusColor"
44

@@ -9,8 +9,9 @@ type StatusDotProps = {
99

1010
export const StatusDot = ({ status, tooltipContent }: StatusDotProps) => {
1111
const color = getAgentStatusColor(status)
12+
const badgeColor: BadgeProps["color"] = color
1213

13-
const badgeElement = <Badge variant="dot" color={color as any} />
14+
const badgeElement = <Badge variant="dot" color={badgeColor} />
1415

1516
if (tooltipContent) {
1617
return (

frontend/interactEM/src/components/table.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const renderTable = (tableName: string, data: TableRowData[]) => {
6060
)
6161
}
6262
const headers = Object.keys(firstRow)
63+
const getRowKey = (row: TableRowData) =>
64+
headers.map((header) => String(row?.[header] ?? "")).join("|")
6365

6466
return (
6567
<Box key={tableName} mb={2}>
@@ -78,11 +80,14 @@ const renderTable = (tableName: string, data: TableRowData[]) => {
7880
</TableRow>
7981
</TableHead>
8082
<TableBody>
81-
{data.map((row, index) => (
82-
<TableRow key={index} sx={tableRowStyle}>
83+
{data.map((row) => (
84+
<TableRow
85+
key={`${tableName}-${getRowKey(row)}`}
86+
sx={tableRowStyle}
87+
>
8388
{headers.map((header) => (
8489
<TableCell
85-
key={`${index}-${header}`}
90+
key={`${header}`}
8691
component="th"
8792
scope="row"
8893
sx={tableCellStyle}

frontend/interactEM/src/contexts/dnd.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ type DnDContextType<T> = [
1111
React.Dispatch<React.SetStateAction<T | null>> | null,
1212
]
1313

14-
export const DnDContext = createContext<
15-
[any | null, React.Dispatch<React.SetStateAction<any | null>> | null]
16-
>([null, null])
14+
type DnDContextValue = DnDContextType<unknown>
15+
16+
export const DnDContext = createContext<DnDContextValue>([null, null])
1717

1818
interface DnDProviderProps {
1919
children: ReactNode
@@ -25,7 +25,7 @@ export const DnDProvider: FC<{ children: ReactNode }> = <T,>({
2525
const [value, setValue] = useState<T | null>(null)
2626

2727
return (
28-
<DnDContext.Provider value={[value, setValue] as DnDContextType<T>}>
28+
<DnDContext.Provider value={[value, setValue] as DnDContextValue}>
2929
{children}
3030
</DnDContext.Provider>
3131
)

frontend/interactEM/src/hooks/api/useActivePipeline.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ import { useDeployment } from "./useDeploymentsQuery"
88

99
function useComposerPipeline() {
1010
const { currentPipelineId, currentRevisionId } = usePipelineStore()
11+
const pipelineId = currentPipelineId ?? ""
1112

1213
const pipelineQuery = useQuery({
13-
...pipelinesReadPipelineOptions({ path: { id: currentPipelineId! } }),
14+
...pipelinesReadPipelineOptions({ path: { id: pipelineId } }),
1415
enabled: !!currentPipelineId,
1516
})
1617

1718
const revisionId =
1819
currentRevisionId != null
1920
? currentRevisionId
2021
: (pipelineQuery.data?.current_revision_id ?? null)
22+
const revisionIdValue = revisionId ?? 0
2123

2224
const revisionQuery = useQuery({
2325
...pipelinesReadPipelineRevisionOptions({
24-
path: { id: currentPipelineId!, revision_id: revisionId! },
26+
path: { id: pipelineId, revision_id: revisionIdValue },
2527
}),
2628
enabled: !!currentPipelineId && revisionId != null,
2729
})
@@ -42,18 +44,19 @@ function useRuntimePipeline() {
4244
selectedRuntimePipelineId,
4345
)
4446

45-
const canonicalId = deployment?.pipeline_id
47+
const canonicalId = deployment?.pipeline_id ?? ""
4648
const revisionId = deployment?.revision_id
49+
const revisionIdValue = revisionId ?? 0
4750

4851
// Fetch canonical pipeline data based on deployment
4952
const pipelineQuery = useQuery({
50-
...pipelinesReadPipelineOptions({ path: { id: canonicalId! } }),
53+
...pipelinesReadPipelineOptions({ path: { id: canonicalId } }),
5154
enabled: !!canonicalId && !deploymentLoading,
5255
})
5356

5457
const revisionQuery = useQuery({
5558
...pipelinesReadPipelineRevisionOptions({
56-
path: { id: canonicalId!, revision_id: revisionId! },
59+
path: { id: canonicalId, revision_id: revisionIdValue },
5760
}),
5861
enabled: !!canonicalId && revisionId != null && !deploymentLoading,
5962
})

frontend/interactEM/src/hooks/nats/useAgentLogs.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { AckPolicy, DeliverPolicy, ReplayPolicy } from "@nats-io/jetstream"
1+
import {
2+
AckPolicy,
3+
DeliverPolicy,
4+
type JsMsg,
5+
ReplayPolicy,
6+
} from "@nats-io/jetstream"
27
import { useCallback, useEffect, useMemo, useState } from "react"
38
import { STREAM_LOGS, SUBJECT_AGENTS_LOGS } from "../../constants/nats"
49
import type { AgentLog } from "../../types/gen"
@@ -36,7 +41,7 @@ export function useAgentLogs({ id }: UseLogsOptions) {
3641
}
3742
}, [consumer])
3843

39-
const handleMessage = useCallback((msg: any) => {
44+
const handleMessage = useCallback((msg: JsMsg) => {
4045
try {
4146
const data = msg.json() as AgentLog
4247
setLogs((prevLogs) => {

frontend/interactEM/src/hooks/nats/useOperatorLogs.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { AckPolicy, DeliverPolicy, ReplayPolicy } from "@nats-io/jetstream"
1+
import {
2+
AckPolicy,
3+
DeliverPolicy,
4+
type JsMsg,
5+
ReplayPolicy,
6+
} from "@nats-io/jetstream"
27
import { useCallback, useEffect, useMemo, useState } from "react"
38
import {
49
OPERATORS,
@@ -73,7 +78,7 @@ export function useOperatorLogs({
7378
}
7479
}, [consumer])
7580

76-
const handleMessage = useCallback((msg: any) => {
81+
const handleMessage = useCallback((msg: JsMsg) => {
7782
try {
7883
setLogs((prevLogs) => [...prevLogs, msg.json() as OperatorLog])
7984
} catch (error) {

0 commit comments

Comments
 (0)