Skip to content

Commit

Permalink
feat: modify failure report (#240)
Browse files Browse the repository at this point in the history
* feat: modify failure report

Signed-off-by: Guilhem Barthes <[email protected]>

* docs: changelog

Signed-off-by: Guilhem Barthes <[email protected]>
Signed-off-by: SdgJlbl <[email protected]>

---------

Signed-off-by: Guilhem Barthes <[email protected]>
Signed-off-by: SdgJlbl <[email protected]>
  • Loading branch information
guilhem-barthes authored Oct 25, 2023
1 parent 573209b commit ce8fbd5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- LogsModal now use a key so we can use logs not linked with a compute task (#270)

## [0.46.0] - 2023-10-18

### Added
Expand Down
12 changes: 10 additions & 2 deletions src/routes/tasks/components/ErrorAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ const ErrorAlert = ({ task }: { task: TaskT }): JSX.Element | null => {
</>
}
/>
<LogsModal isOpen={isOpen} onClose={onClose} task={task} />
<LogsModal
isOpen={isOpen}
onClose={onClose}
reportKey={task.function.key}
/>
</>
);
}
Expand Down Expand Up @@ -139,7 +143,11 @@ const ErrorAlert = ({ task }: { task: TaskT }): JSX.Element | null => {
</>
}
/>
<LogsModal isOpen={isOpen} onClose={onClose} task={task} />
<LogsModal
isOpen={isOpen}
onClose={onClose}
reportKey={task.key}
/>
</>
);
}
Expand Down
13 changes: 6 additions & 7 deletions src/routes/tasks/components/LogsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {

import CopyIconButton from '@/features/copy/CopyIconButton';
import { API_PATHS, compilePath } from '@/paths';
import { TaskT } from '@/types/TasksTypes';

import DownloadIconButton from '@/components/DownloadIconButton';

Expand All @@ -27,16 +26,16 @@ const CodeHighlighter = React.lazy(
type LogsModalProps = {
isOpen: boolean;
onClose: () => void;
task: TaskT;
reportKey: string;
};
const LogsModal = ({ isOpen, onClose, task }: LogsModalProps) => {
const LogsModal = ({ isOpen, onClose, reportKey }: LogsModalProps) => {
const initialFocusRef = useRef(null);

const { logs, fetchingLogs, fetchLogs } = useTaskStore();

useEffect(() => {
fetchLogs(task.key);
}, [fetchLogs, task.key]);
fetchLogs(reportKey);
}, [fetchLogs, reportKey]);

return (
<Modal
Expand Down Expand Up @@ -73,9 +72,9 @@ const LogsModal = ({ isOpen, onClose, task }: LogsModalProps) => {
/>
<DownloadIconButton
storageAddress={compilePath(API_PATHS.LOGS, {
key: task.key,
key: reportKey,
})}
filename={`logs_${task.key}`}
filename={`logs_${reportKey}`}
aria-label="Download logs"
variant="ghost"
/>
Expand Down

0 comments on commit ce8fbd5

Please sign in to comment.