forgot to pipe through poll in previous refactor

This commit is contained in:
mbecker20
2025-07-26 22:02:37 -04:00
parent 3c4551ae19
commit 0c34695d1a
5 changed files with 126 additions and 82 deletions

View File

@@ -35,7 +35,8 @@ export const LogSection = ({
regular_logs: (
timestamps: boolean,
stream: LogStream,
tail: number
tail: number,
poll: boolean
) => {
Log: ReactNode;
refetch: () => void;
@@ -44,7 +45,8 @@ export const LogSection = ({
search_logs: (
timestamps: boolean,
terms: string[],
invert: boolean
invert: boolean,
poll: boolean
) => { Log: ReactNode; refetch: () => void; stderr: boolean };
titleOther?: ReactNode;
extraParams?: ReactNode;
@@ -78,8 +80,8 @@ export const LogSection = ({
};
const { Log, refetch, stderr } = terms.length
? search_logs(timestamps, terms, invert)
: regular_logs(timestamps, stream, Number(tail));
? search_logs(timestamps, terms, invert, poll)
: regular_logs(timestamps, stream, Number(tail), poll);
return (
<Section

View File

@@ -31,11 +31,11 @@ const DeploymentLogsInner = ({
}) => {
return (
<LogSection
regular_logs={(timestamps, stream, tail) =>
NoSearchLogs(id, tail, timestamps, stream)
regular_logs={(timestamps, stream, tail, poll) =>
NoSearchLogs(id, tail, timestamps, stream, poll)
}
search_logs={(timestamps, terms, invert) =>
SearchLogs(id, terms, invert, timestamps)
search_logs={(timestamps, terms, invert, poll) =>
SearchLogs(id, terms, invert, timestamps, poll)
}
titleOther={titleOther}
/>
@@ -46,13 +46,18 @@ const NoSearchLogs = (
id: string,
tail: number,
timestamps: boolean,
stream: string
stream: string,
poll: boolean
) => {
const { data: log, refetch } = useRead("GetDeploymentLog", {
deployment: id,
tail,
timestamps,
});
const { data: log, refetch } = useRead(
"GetDeploymentLog",
{
deployment: id,
tail,
timestamps,
},
{ refetchInterval: poll ? 3 : false }
);
return {
Log: (
<div className="relative">
@@ -68,15 +73,20 @@ const SearchLogs = (
id: string,
terms: string[],
invert: boolean,
timestamps: boolean
timestamps: boolean,
poll: boolean
) => {
const { data: log, refetch } = useRead("SearchDeploymentLog", {
deployment: id,
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
});
const { data: log, refetch } = useRead(
"SearchDeploymentLog",
{
deployment: id,
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
},
{ refetchInterval: poll ? 10 : false }
);
return {
Log: (
<div className="h-full relative">

View File

@@ -57,22 +57,24 @@ const StackLogsInner = ({
const selected = services.filter((s) => s.selected);
return (
<LogSection
regular_logs={(timestamps, stream, tail) =>
regular_logs={(timestamps, stream, tail, poll) =>
NoSearchLogs(
id,
services.filter((s) => s.selected).map((s) => s.service),
tail,
timestamps,
stream
stream,
poll
)
}
search_logs={(timestamps, terms, invert) =>
search_logs={(timestamps, terms, invert, poll) =>
SearchLogs(
id,
services.filter((s) => s.selected).map((s) => s.service),
terms,
invert,
timestamps
timestamps,
poll
)
}
titleOther={titleOther}
@@ -120,14 +122,19 @@ const NoSearchLogs = (
services: string[],
tail: number,
timestamps: boolean,
stream: string
stream: string,
poll: boolean
) => {
const { data: log, refetch } = useRead("GetStackLog", {
stack: id,
services,
tail,
timestamps,
});
const { data: log, refetch } = useRead(
"GetStackLog",
{
stack: id,
services,
tail,
timestamps,
},
{ refetchInterval: poll ? 3 : false }
);
return {
Log: (
<div className="relative">
@@ -144,16 +151,21 @@ const SearchLogs = (
services: string[],
terms: string[],
invert: boolean,
timestamps: boolean
timestamps: boolean,
poll: boolean
) => {
const { data: log, refetch } = useRead("SearchStackLog", {
stack: id,
services,
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
});
const { data: log, refetch } = useRead(
"SearchStackLog",
{
stack: id,
services,
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
},
{ refetchInterval: poll ? 10 : false }
);
return {
Log: (
<div className="h-full relative">

View File

@@ -25,11 +25,11 @@ export const ContainerLogs = ({
return (
<LogSection
titleOther={titleOther}
regular_logs={(timestamps, stream, tail) =>
NoSearchLogs(id, container_name, tail, timestamps, stream)
regular_logs={(timestamps, stream, tail, poll) =>
NoSearchLogs(id, container_name, tail, timestamps, stream, poll)
}
search_logs={(timestamps, terms, invert) =>
SearchLogs(id, container_name, terms, invert, timestamps)
search_logs={(timestamps, terms, invert, poll) =>
SearchLogs(id, container_name, terms, invert, timestamps, poll)
}
/>
);
@@ -40,14 +40,19 @@ const NoSearchLogs = (
container: string,
tail: number,
timestamps: boolean,
stream: string
stream: string,
poll: boolean
) => {
const { data: log, refetch } = useRead("GetContainerLog", {
server: id,
container,
tail: Number(tail),
timestamps,
});
const { data: log, refetch } = useRead(
"GetContainerLog",
{
server: id,
container,
tail: Number(tail),
timestamps,
},
{ refetchInterval: poll ? 3 : false }
);
return {
Log: (
<div className="relative">
@@ -64,16 +69,21 @@ const SearchLogs = (
container: string,
terms: string[],
invert: boolean,
timestamps: boolean
timestamps: boolean,
poll: boolean
) => {
const { data: log, refetch } = useRead("SearchContainerLog", {
server: id,
container,
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
});
const { data: log, refetch } = useRead(
"SearchContainerLog",
{
server: id,
container,
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
},
{ refetchInterval: poll ? 10 : false }
);
return {
Log: (
<div className="h-full relative">

View File

@@ -49,11 +49,11 @@ const StackLogsInner = ({
return (
<LogSection
titleOther={titleOther}
regular_logs={(timestamps, stream, tail) =>
NoSearchLogs(id, service, tail, timestamps, stream)
regular_logs={(timestamps, stream, tail, poll) =>
NoSearchLogs(id, service, tail, timestamps, stream, poll)
}
search_logs={(timestamps, terms, invert) =>
SearchLogs(id, service, terms, invert, timestamps)
search_logs={(timestamps, terms, invert, poll) =>
SearchLogs(id, service, terms, invert, timestamps, poll)
}
/>
);
@@ -64,14 +64,19 @@ const NoSearchLogs = (
service: string,
tail: number,
timestamps: boolean,
stream: string
stream: string,
poll: boolean
) => {
const { data: log, refetch } = useRead("GetStackLog", {
stack: id,
services: [service],
tail,
timestamps,
});
const { data: log, refetch } = useRead(
"GetStackLog",
{
stack: id,
services: [service],
tail,
timestamps,
},
{ refetchInterval: poll ? 3 : false }
);
return {
Log: (
<div className="relative">
@@ -88,16 +93,21 @@ const SearchLogs = (
service: string,
terms: string[],
invert: boolean,
timestamps: boolean
timestamps: boolean,
poll: boolean
) => {
const { data: log, refetch } = useRead("SearchStackLog", {
stack: id,
services: [service],
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
});
const { data: log, refetch } = useRead(
"SearchStackLog",
{
stack: id,
services: [service],
terms,
combinator: Types.SearchCombinator.And,
invert,
timestamps,
},
{ refetchInterval: poll ? 10 : false }
);
return {
Log: (
<div className="h-full relative">