-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
959 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 39 additions & 29 deletions
68
dashboard/src/main/home/app-dashboard/expanded-app/status/LogsModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,50 @@ | ||
import React, { useEffect, useRef } from "react"; | ||
|
||
import Modal from "components/porter/Modal"; | ||
import TitleSection from "components/TitleSection"; | ||
import Text from "components/porter/Text"; | ||
import TitleSection from "components/TitleSection"; | ||
|
||
import danger from "assets/danger.svg"; | ||
|
||
import { type PorterLog } from "../logs/types"; | ||
import ExpandedIncidentLogs from "./ExpandedIncidentLogs"; | ||
import { PorterLog } from "../logs/types"; | ||
|
||
interface LogsModalProps { | ||
logs: PorterLog[]; | ||
setModalVisible: (x: boolean) => void; | ||
logsName: string; | ||
} | ||
const LogsModal: React.FC<LogsModalProps> = ({ logs, logsName, setModalVisible }) => { | ||
const scrollToBottomRef = useRef<HTMLDivElement>(null); | ||
const scrollToBottom = () => { | ||
if (scrollToBottomRef.current) { | ||
scrollToBottomRef.current.scrollIntoView({ | ||
behavior: "smooth", | ||
block: "end", | ||
}); | ||
} | ||
type LogsModalProps = { | ||
logs: PorterLog[]; | ||
setModalVisible: (x: boolean) => void; | ||
logsName: string; | ||
}; | ||
const LogsModal: React.FC<LogsModalProps> = ({ | ||
logs, | ||
logsName, | ||
setModalVisible, | ||
}) => { | ||
const scrollToBottomRef = useRef<HTMLDivElement>(null); | ||
const scrollToBottom = () => { | ||
if (scrollToBottomRef.current) { | ||
scrollToBottomRef.current.scrollIntoView({ | ||
behavior: "smooth", | ||
block: "end", | ||
}); | ||
} | ||
useEffect(() => { | ||
scrollToBottom(); | ||
}, [scrollToBottomRef]); | ||
|
||
}; | ||
useEffect(() => { | ||
scrollToBottom(); | ||
}, [scrollToBottomRef]); | ||
|
||
return ( | ||
<Modal closeModal={() => setModalVisible(false)} width={"800px"}> | ||
<TitleSection icon={danger}> | ||
<Text size={16}>Logs for {logsName}</Text> | ||
</TitleSection> | ||
<ExpandedIncidentLogs logs={logs} /> | ||
</Modal> | ||
); | ||
return ( | ||
<Modal | ||
closeModal={() => { | ||
setModalVisible(false); | ||
}} | ||
width={"800px"} | ||
> | ||
<TitleSection icon={danger}> | ||
<Text size={16}>Logs for {logsName}</Text> | ||
</TitleSection> | ||
<ExpandedIncidentLogs logs={logs} /> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default LogsModal; | ||
export default LogsModal; |
Oops, something went wrong.