Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc log changes #986

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 92 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"react-select": "^5.8.0",
"react-toastify": "^9.1.3",
"sanitize.css": "^13.0.0",
"strip-ansi": "^7.1.0",
"styled-components": "^6.1.8",
"vite": "^5.0.12"
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/code/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { clsx } from 'clsx';
import { FunctionComponent, UIEvent, useEffect, useRef, useState } from 'react';

import { copyToClipboard, copyToTextFile } from '../../utils/string';
import stripAnsi from 'strip-ansi';

import './style.css';

Expand Down Expand Up @@ -74,7 +75,7 @@ export const Code: FunctionComponent<CodeProps & { children?: string }> = ({
ref={containerRef}
onScroll={handleScroll}
>
{children}
{stripAnsi(children)}
</Card>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from '../../utils/sort-utils';
import { smallGithubCommitHash, smallReplicaName } from '../../utils/string';
import { TableSortIcon, getNewSortDir } from '../../utils/table-sort-utils';
import { addMinutes } from 'date-fns';

interface ComponentNameProps {
appName: string;
Expand Down Expand Up @@ -207,7 +208,14 @@ function ReplicaLogTableRow({
onClick={downloadLazyLogCb(
`${appName}_${envName}_${componentName}_${name}.txt`,
getLog as LazyQueryTriggerPlain<Parameters<typeof getLog>[0]>,
{ appName, envName, componentName, replicaName: name }
{
appName,
envName,
componentName,
replicaName: name,
start: created.toISOString(),
end: addMinutes(ended, 10).toISOString(),
}
)}
disabled={isFetching}
/>
Expand Down Expand Up @@ -262,7 +270,15 @@ function ReplicaContainerTableRow({
onClick={downloadLazyLogCb(
`${appName}_${envName}_${componentName}_${replicaName}_${id}.txt`,
getLog as LazyQueryTriggerPlain<Parameters<typeof getLog>[0]>,
{ appName, envName, componentName, replicaName, containerId: id }
{
appName,
envName,
componentName,
replicaName,
containerId: id,
start: created.toISOString(),
end: addMinutes(ended, 10).toISOString(),
}
)}
disabled={isFetching}
/>
Expand Down
12 changes: 11 additions & 1 deletion src/components/page-scheduled-job/replica-log-accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@ const ReplicaLogTableRow: FunctionComponent<
name
)}.txt`,
getLog as LazyQueryTriggerPlain<Parameters<typeof getLog>[0]>,
{ appName, envName, jobComponentName, jobName, replicaName: name }
{
appName,
envName,
jobComponentName,
jobName,
replicaName: name,
start: created.toISOString(),
end: addMinutes(ended, 10).toISOString(),
}
)}
disabled={isFetching}
/>
Expand Down Expand Up @@ -296,6 +304,8 @@ function ReplicaContainerTableRow({
jobName,
replicaName,
containerId: id,
start: created.toISOString(),
end: addMinutes(ended, 10).toISOString(),
}
)}
disabled={isFetching}
Expand Down
5 changes: 4 additions & 1 deletion src/store/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export function getFetchErrorData(error: FetchQueryError): {
const err = error as FetchBaseQueryError;
if (err.data?.['code'] || err.data?.['message'] || err.data?.['error']) {
// data is an object containing status
errObj.code = err.data['code'];
errObj.code = err.status;
if (err.data['code']) {
errObj.code = err.data['code'];
}
if (typeof err.data['message'] === 'string') {
errObj.message = err.data['message'];
}
Expand Down