|
|
@@ -11,6 +11,8 @@ import { Context } from "shared/Context";
|
|
|
import * as Anser from "anser";
|
|
|
import api from "shared/api";
|
|
|
import { NewWebsocketOptions, useWebsockets } from "shared/hooks/useWebsockets";
|
|
|
+import CommandLineIcon from "assets/command-line-icon";
|
|
|
+import ConnectToLogsInstructionModal from "./ConnectToLogsInstructionModal";
|
|
|
|
|
|
const MAX_LOGS = 250;
|
|
|
|
|
|
@@ -25,6 +27,9 @@ type SelectedPodType = {
|
|
|
metadata: {
|
|
|
name: string;
|
|
|
namespace: string;
|
|
|
+ labels: {
|
|
|
+ [key: string]: string;
|
|
|
+ };
|
|
|
};
|
|
|
status: {
|
|
|
phase: string;
|
|
|
@@ -49,6 +54,8 @@ const LogsFC: React.FC<{
|
|
|
|
|
|
const [isScrollToBottomEnabled, setIsScrollToBottomEnabled] = useState(true);
|
|
|
|
|
|
+ const [showConnectionModal, setShowConnectionModal] = useState(false);
|
|
|
+
|
|
|
const wrapperRef = useRef<HTMLDivElement>();
|
|
|
|
|
|
const scrollToBottom = (smooth: boolean) => {
|
|
|
@@ -151,6 +158,21 @@ const LogsFC: React.FC<{
|
|
|
|
|
|
const renderContent = () => (
|
|
|
<>
|
|
|
+ <ConnectToLogsInstructionModal
|
|
|
+ show={showConnectionModal}
|
|
|
+ onClose={() => setShowConnectionModal(false)}
|
|
|
+ chartName={selectedPod?.metadata?.labels["app.kubernetes.io/instance"]}
|
|
|
+ namespace={selectedPod?.metadata?.namespace}
|
|
|
+ />
|
|
|
+ <CLIModalIconWrapper
|
|
|
+ onClick={(e) => {
|
|
|
+ e.preventDefault();
|
|
|
+ setShowConnectionModal(true);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <CLIModalIcon />
|
|
|
+ Shell logs livestream
|
|
|
+ </CLIModalIconWrapper>
|
|
|
<Wrapper ref={wrapperRef}>{renderLogs()}</Wrapper>
|
|
|
<LogTabs>
|
|
|
{containers.map((containerName, _i, arr) => {
|
|
|
@@ -572,3 +594,42 @@ const LogSpan = styled.span`
|
|
|
background-color: ${(props: { ansi: Anser.AnserJsonEntry }) =>
|
|
|
props.ansi?.bg ? `rgb(${props.ansi?.bg})` : "transparent"};
|
|
|
`;
|
|
|
+
|
|
|
+const CLIModalIconWrapper = styled.div`
|
|
|
+ max-width: 200px;
|
|
|
+ height: 35px;
|
|
|
+ font-size: 13px;
|
|
|
+ font-weight: 500;
|
|
|
+ font-family: "Work Sans", sans-serif;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 6px 20px 6px 10px;
|
|
|
+ text-align: left;
|
|
|
+ border: 1px solid #ffffff55;
|
|
|
+ border-radius: 8px;
|
|
|
+ background: #ffffff11;
|
|
|
+ color: #ffffffdd;
|
|
|
+ cursor: pointer;
|
|
|
+ :hover {
|
|
|
+ cursor: pointer;
|
|
|
+ background: #ffffff22;
|
|
|
+ > path {
|
|
|
+ fill: #ffffff77;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ > path {
|
|
|
+ fill: #ffffff99;
|
|
|
+ }
|
|
|
+`;
|
|
|
+
|
|
|
+const CLIModalIcon = styled(CommandLineIcon)`
|
|
|
+ width: 32px;
|
|
|
+ height: 32px;
|
|
|
+ padding: 8px;
|
|
|
+
|
|
|
+ > path {
|
|
|
+ fill: #ffffff99;
|
|
|
+ }
|
|
|
+`;
|