Skip to content
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
19 changes: 19 additions & 0 deletions src/components/InstallationWizard/CodeSnippet/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import copy from "copy-to-clipboard";
import { CopyIcon } from "../../common/icons/CopyIcon";
import * as s from "./styles";
import { CodeSnippetProps } from "./types";

export const CodeSnippet = (props: CodeSnippetProps) => {
const handleCopyButtonClick = () => {
copy(props.text);
};

return (
<s.Container disabled={props.disabled}>
<s.Code>{props.text}</s.Code>
<s.CopyButton onClick={handleCopyButtonClick}>
<CopyIcon color={"#dadada"} />
</s.CopyButton>
</s.Container>
);
};
33 changes: 33 additions & 0 deletions src/components/InstallationWizard/CodeSnippet/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import styled from "styled-components";
import { getCodeFont } from "../../common/App/styles";
import { ContainerProps } from "./types";

export const Container = styled.div<ContainerProps>`
background: #0c0b0b;
padding: 8px 12px;
border-radius: 2px;
margin: 8px 0 12px;
display: flex;
gap: 27px;
align-items: flex-start;
justify-content: space-between;

${({ disabled }) => (disabled ? "opacity: 0.5;" : "")}
`;

export const Code = styled.code`
${({ theme }) => getCodeFont(theme.codeFont)}
font-weight: 500;
font-size: 9px;
line-height: 20px;
letter-spacing: -0.1px;
color: #dadada;
white-space: pre-wrap;
`;

export const CopyButton = styled.button`
padding: 0;
background: transparent;
border: none;
cursor: pointer;
`;
8 changes: 8 additions & 0 deletions src/components/InstallationWizard/CodeSnippet/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface CodeSnippetProps {
disabled?: boolean;
text: string;
}

export interface ContainerProps {
disabled?: boolean;
}
83 changes: 30 additions & 53 deletions src/components/InstallationWizard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import copy from "copy-to-clipboard";
import { useEffect, useState } from "react";
import { dispatcher } from "../../dispatcher";
import { getActions } from "../../utils/getActions";
import { actions as globalActions } from "../common/App";
import { CheckmarkCircleIcon } from "../common/icons/CheckmarkCircleIcon";
import { CheckmarkCircleInvertedIcon } from "../common/icons/CheckmarkCircleInvertedIcon";
import { CopyIcon } from "../common/icons/CopyIcon";
import { CrossCircleIcon } from "../common/icons/CrossCircleIcon";
import { Loader } from "../common/Loader";
import { Button } from "./Button";
import { CodeSnippet } from "./CodeSnippet";
import * as s from "./styles";
import { ConnectionCheckResultData, ConnectionCheckStatus } from "./types";

Expand Down Expand Up @@ -47,23 +46,15 @@ export const InstallationWizard = () => {
};
}, []);

const handleCopyButtonClick = (text: string) => {
copy(text);
};

const startConnectionCheck = () => {
const handleDigmaIsInstalledButtonClick = () => {
setConnectionCheckStatus("pending");
window.sendMessageToDigma({
action: actions.checkConnection
});
};

const handleDigmaIsInstalledButtonClick = () => {
startConnectionCheck();
};

const handleRetryButtonClick = () => {
startConnectionCheck();
setConnectionCheckStatus(undefined);
};

const handleInstallDigmaButtonClick = () => {
Expand Down Expand Up @@ -157,36 +148,21 @@ export const InstallationWizard = () => {
installed)
</s.SectionDescription>
<s.SectionDescription>Linux & MacOS:</s.SectionDescription>
<s.CodeSnippetContainer disabled={Boolean(connectionCheckStatus)}>
<s.Code>{getDigmaDockerComposeCommandLinux}</s.Code>
<s.CopyButton
onClick={() =>
handleCopyButtonClick(getDigmaDockerComposeCommandLinux)
}
>
<CopyIcon color={"#dadada"} />
</s.CopyButton>
</s.CodeSnippetContainer>
<CodeSnippet
disabled={Boolean(connectionCheckStatus)}
text={getDigmaDockerComposeCommandLinux}
/>

<s.SectionDescription>Windows (PowerShell):</s.SectionDescription>
<s.CodeSnippetContainer disabled={Boolean(connectionCheckStatus)}>
<s.Code>{getDigmaDockerComposeCommandWindows}</s.Code>
<s.CopyButton
onClick={() =>
handleCopyButtonClick(getDigmaDockerComposeCommandWindows)
}
>
<CopyIcon color={"#dadada"} />
</s.CopyButton>
</s.CodeSnippetContainer>
<CodeSnippet
disabled={Boolean(connectionCheckStatus)}
text={getDigmaDockerComposeCommandWindows}
/>
<s.SectionDescription>Then run:</s.SectionDescription>
<s.CodeSnippetContainer disabled={Boolean(connectionCheckStatus)}>
<s.Code>{runDockerComposeCommand}</s.Code>
<s.CopyButton
onClick={() => handleCopyButtonClick(runDockerComposeCommand)}
>
<CopyIcon color={"#dadada"} />
</s.CopyButton>
</s.CodeSnippetContainer>
<CodeSnippet
disabled={Boolean(connectionCheckStatus)}
text={runDockerComposeCommand}
/>
<s.SectionDescription>
Prefer to use a helm file? Check out{" "}
<s.Link
Expand Down Expand Up @@ -263,17 +239,13 @@ service:
<>
<s.SectionTitle>Add Digma to your collector:</s.SectionTitle>
<s.SectionDescription>
Modify your collector configuration file to add Digmas backend as a
target. For example:
Modify your collector configuration file to add Digma&apos;s backend
as a target. For example:
</s.SectionDescription>
<s.CodeSnippetContainer disabled={isCollectorModified}>
<s.Code>{collectorConfigurationSnippet}</s.Code>
<s.CopyButton
onClick={() => handleCopyButtonClick(collectorConfigurationSnippet)}
>
<CopyIcon color={"#dadada"} />
</s.CopyButton>
</s.CodeSnippetContainer>
<CodeSnippet
disabled={isCollectorModified}
text={collectorConfigurationSnippet}
/>
{isCollectorModified ? (
<Button
buttonType={"success"}
Expand Down Expand Up @@ -307,9 +279,14 @@ service:
<>
<s.SectionTitle>How to get started?</s.SectionTitle>
<s.SectionDescription>
Press in three dots icon and enable &quot;Observability&quot; toggle
To quickly collect data from your application in IntelliJ, expand the
Digma side-panel and open the settings menu as seen below.
</s.SectionDescription>
<s.Illustration src={"/images/navigation.png"} />
<s.SectionDescription>
Click the &quot;Observability&quot; toggle button to automatically
collect data each time you run or debug via the IDE.
</s.SectionDescription>
<s.Footer>
<Button buttonType={"primary"} onClick={handleContinueButtonClick}>
Finish
Expand All @@ -336,10 +313,10 @@ service:
},
{
shortTitle: isAlreadyUsingOtel
? "If youre already using OpenTelemetry… "
? "If you're already using OpenTelemetry…"
: "Observe your application",
title: isAlreadyUsingOtel
? "If youre already using OpenTelemetry… "
? "If you're already using OpenTelemetry…"
: "Observe your application",
content: renderObservabilityContent(isAlreadyUsingOtel),
link: {
Expand Down
33 changes: 2 additions & 31 deletions src/components/InstallationWizard/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from "styled-components";
import { getCodeFont } from "../common/App/styles";

export const Container = styled.div`
background: #5a5a5a;
Expand Down Expand Up @@ -27,6 +26,7 @@ export const StepShortTitle = styled.span`

export const Header = styled.div`
display: flex;
text-align: center;
justify-content: center;
// TODO: check font
/* font-family: "Nunito"; */
Expand Down Expand Up @@ -99,36 +99,6 @@ export const SectionDescription = styled.span`
margin-bottom: 6px;
`;

export const CodeSnippetContainer = styled.div<{ disabled: boolean }>`
background: #0c0b0b;
padding: 8px 12px;
border-radius: 2px;
margin: 8px 0 12px;
display: flex;
gap: 27px;
align-items: flex-start;
justify-content: space-between;

${({ disabled }) => (disabled ? "opacity: 0.5;" : "")}
`;

export const Code = styled.code`
${({ theme }) => getCodeFont(theme.codeFont)}
font-weight: 500;
font-size: 9px;
line-height: 20px;
letter-spacing: -0.1px;
color: #dadada;
white-space: pre;
`;

export const CopyButton = styled.button`
padding: 0;
background: transparent;
border: none;
cursor: pointer;
`;

export const LoaderContainer = styled.div`
margin-top: 23;
align-self: center;
Expand All @@ -143,6 +113,7 @@ export const Footer = styled.div`
flex-direction: column;
align-items: center;
margin-top: auto;
padding-top: 8px;
gap: 8px;
`;

Expand Down
2 changes: 2 additions & 0 deletions src/containers/Assets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { Assets } from "../../components/Assets";
import { App } from "../../components/common/App";
import { dispatcher } from "../../dispatcher";
import { GlobalStyle } from "./styles";

initializeDigmaMessageListener(dispatcher);

Expand All @@ -19,6 +20,7 @@ if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<GlobalStyle />
<Assets />
</App>
);
Expand Down
7 changes: 7 additions & 0 deletions src/containers/Assets/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createGlobalStyle } from "styled-components";

export const GlobalStyle = createGlobalStyle`
body {
background: #3d3f41;
}
`;
2 changes: 2 additions & 0 deletions src/containers/InstallationWizard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { App } from "../../components/common/App";
import { InstallationWizard } from "../../components/InstallationWizard";
import { dispatcher } from "../../dispatcher";
import { GlobalStyle } from "./styles";

initializeDigmaMessageListener(dispatcher);

Expand All @@ -19,6 +20,7 @@ if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<GlobalStyle />
<InstallationWizard />
</App>
);
Expand Down
7 changes: 7 additions & 0 deletions src/containers/InstallationWizard/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { createGlobalStyle } from "styled-components";

export const GlobalStyle = createGlobalStyle`
body {
background: #5a5a5a;
}
`;
2 changes: 2 additions & 0 deletions src/containers/RecentActivity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { App } from "../../components/common/App";
import { RecentActivity } from "../../components/RecentActivity";
import { dispatcher } from "../../dispatcher";
import { GlobalStyle } from "./styles";

initializeDigmaMessageListener(dispatcher);

Expand All @@ -19,6 +20,7 @@ if (rootElement) {
const root = createRoot(rootElement);
root.render(
<App>
<GlobalStyle />
<RecentActivity />
</App>
);
Expand Down
16 changes: 16 additions & 0 deletions src/containers/RecentActivity/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createGlobalStyle } from "styled-components";

export const GlobalStyle = createGlobalStyle`
body {
background: ${({ theme }) => {
switch (theme.mode) {
case "light":
return "#f1f5fa";
case "dark":
return "#0f0f0f";
case "dark-jetbrains":
return "#383838";
}
}};
}
`;