Skip to content

Commit ba09c5a

Browse files
Merge pull request #1169 from digma-ai/fix/launcher
Update IDE Launcher messages, add Get Digma link
2 parents 88b01b9 + 829c499 commit ba09c5a

File tree

4 files changed

+76
-67
lines changed

4 files changed

+76
-67
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "digma-ui",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "Digma UI",
55
"main": "dist/index.js",
66
"scripts": {

src/components/IdeLauncher/index.tsx

Lines changed: 67 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export const IdeLauncher = () => {
3434
const theme = useTheme();
3535
const themeKind = getThemeKind(theme);
3636
const params = getURLQueryParams(window.location.search);
37-
const { environmentName, spanDisplayName } = params;
3837
const action = params["plugin.action"];
3938
const [selectItems, setSelectItems] = useState<SelectItem[]>();
4039
const isMobile = ["Android", "iPhone", "iPad"].some((x) =>
@@ -108,11 +107,11 @@ export const IdeLauncher = () => {
108107
await tryToShowIdeProject(port, project);
109108
};
110109

111-
const handleRefreshButtonClick = () => {
110+
const handleTryScanningAgainButtonClick = () => {
112111
window.location.reload();
113112
};
114113

115-
const handleTryAgainButtonClick = async () => {
114+
const handleTryShowIdeProjectAgainButtonClick = async () => {
116115
const selectedItemValue = selectItems?.find((item) => item.selected)?.value;
117116
if (!selectedItemValue) {
118117
return;
@@ -122,6 +121,14 @@ export const IdeLauncher = () => {
122121
await tryToShowIdeProject(port, project);
123122
};
124123

124+
const handleGetDigmaButtonClick = () => {
125+
window.open(
126+
"https://plugins.jetbrains.com/plugin/19470-digma-continuous-feedback",
127+
"_blank",
128+
"noopener noreferrer"
129+
);
130+
};
131+
125132
useEffect(() => {
126133
async function initialScan() {
127134
await tryToScanRunningIdeProjects();
@@ -135,57 +142,77 @@ export const IdeLauncher = () => {
135142
const selectedItem = selectItems?.find((item) => item.selected);
136143

137144
const renderContent = () => {
145+
if (!action) {
146+
return (
147+
<s.TextContainer>
148+
<s.Title>Invalid link</s.Title>
149+
<s.Subtitle>Link is partial or invalid</s.Subtitle>
150+
</s.TextContainer>
151+
);
152+
}
153+
138154
if (isMobile) {
139155
return (
140156
<s.TextContainer>
141-
<s.Title>Unsupported platform</s.Title>
142-
<s.Description>
143-
The IDE cannot be opened on this device.
144-
</s.Description>
157+
<s.Title>Can&apos;t open Digma link</s.Title>
158+
<s.Subtitle>
159+
Digma links can only be opened on desktop/laptop
160+
</s.Subtitle>
145161
</s.TextContainer>
146162
);
147163
}
148164

149165
if (isIdeProjectScanningInProgress) {
150166
return (
151167
<s.TextContainer>
152-
<s.Title>Looking for running IDEs...</s.Title>
168+
<s.Title>Searching for a running IDE</s.Title>
169+
<s.Subtitle>
170+
You&apos;ll need an IDE installed with Digma configured to open the
171+
link
172+
</s.Subtitle>
153173
</s.TextContainer>
154174
);
155175
}
156176

157177
if (isShowIdeProjectInProgress) {
158178
return (
159179
<s.TextContainer>
160-
<s.Title>
161-
Opening the {selectedItem?.label ?? "IDE project"}...
162-
</s.Title>
180+
<s.Title>Opening the Digma link in your IDE</s.Title>
163181
</s.TextContainer>
164182
);
165183
}
166184

167-
if (showIdeProjectResult?.error) {
185+
if (showIdeProjectResult?.result === "failure") {
168186
return (
169187
<>
170188
<s.TextContainer>
171-
<s.Title>
172-
Failed to open the {selectedItem?.label ?? "IDE project"}
173-
</s.Title>
174-
<s.Description>
189+
<s.Title>There was an issue opening the link in the IDE</s.Title>
190+
<s.Subtitle>
175191
Please check that IDE is running and click the{" "}
176192
<s.EmphasizedText>Try again</s.EmphasizedText> button below.
177-
</s.Description>
193+
</s.Subtitle>
178194
</s.TextContainer>
179195
<NewButton
180196
label={"Try again"}
181197
onClick={() => {
182-
void handleTryAgainButtonClick();
198+
void handleTryShowIdeProjectAgainButtonClick();
183199
}}
184200
/>
185201
</>
186202
);
187203
}
188204

205+
if (showIdeProjectResult?.result === "success") {
206+
return (
207+
<s.TextContainer>
208+
<s.Title>Opening the Digma link in your IDE</s.Title>
209+
<s.Subtitle>
210+
Switching over to the IDE. You can close this tab.
211+
</s.Subtitle>
212+
</s.TextContainer>
213+
);
214+
}
215+
189216
if (!selectItems) {
190217
return null;
191218
}
@@ -194,60 +221,37 @@ export const IdeLauncher = () => {
194221
return (
195222
<>
196223
<s.TextContainer>
197-
<s.Title>Failed to find IDEs with Digma plugin running</s.Title>
198-
<s.Description>
199-
Please open the IDE with Digma plugin installed, check its
200-
settings and click the{" "}
201-
<s.EmphasizedText>Refresh</s.EmphasizedText> button below.
202-
</s.Description>
203-
</s.TextContainer>
204-
<NewButton label={"Refresh"} onClick={handleRefreshButtonClick} />
205-
</>
206-
);
207-
}
208-
209-
if (selectItems.length === 1) {
210-
return (
211-
<>
212-
<s.TextContainer>
213-
<s.Title>Opening the IDE...</s.Title>
214-
<s.Description>
215-
Your IDE client is opening automatically; you can close this tab.
216-
</s.Description>
224+
<s.Title>Unable to open the Digma link</s.Title>
225+
<s.Subtitle>
226+
Opening this link requires a running IDE with Digma installed and
227+
configured. Launch your IDE and install Digma as needed, then
228+
click the <s.EmphasizedText>Try again</s.EmphasizedText> button.
229+
</s.Subtitle>
217230
</s.TextContainer>
218-
<s.SelectContainer>
219-
<Select
220-
placeholder={selectedItem?.label ?? "Select IDE Project"}
221-
items={selectItems}
222-
onChange={(value) => {
223-
void handleSelectChange(value);
224-
}}
231+
<s.ButtonsContainer>
232+
<NewButton
233+
label={"Try again"}
234+
onClick={handleTryScanningAgainButtonClick}
235+
buttonType={"secondary"}
225236
/>
226-
</s.SelectContainer>
237+
<NewButton
238+
label={"Get Digma"}
239+
onClick={handleGetDigmaButtonClick}
240+
/>
241+
</s.ButtonsContainer>
227242
</>
228243
);
229244
}
230245

231-
if (selectItems.length > 0) {
246+
if (selectItems.length > 1) {
232247
return (
233248
<>
234249
<s.TextContainer>
235-
{action === "OpenReport" ? (
236-
<s.Title>
237-
Select the IDE project to view Metrics report in Digma
238-
</s.Title>
239-
) : (
240-
<s.Title>
241-
Select the IDE project to view{" "}
242-
{spanDisplayName && <>{spanDisplayName} </>}
243-
issues{" "}
244-
{environmentName && <>for {environmentName} environment </>}
245-
in Digma
246-
</s.Title>
247-
)}
248-
<s.Description>
249-
Please select the IDE project you&apos;d like to open.
250-
</s.Description>
250+
<s.Title>Select the IDE project to view the Digma link</s.Title>
251+
<s.Subtitle>
252+
We&apos;ll automatically switch to the IDE once you make a
253+
selection
254+
</s.Subtitle>
251255
</s.TextContainer>
252256
<s.SelectContainer>
253257
<Select

src/components/IdeLauncher/styles.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const Title = styled.h1`
5353
}
5454
`;
5555

56-
export const Description = styled.p`
56+
export const Subtitle = styled.h2`
5757
color: ${({ theme }) => theme.colors.v3.text.tertiary};
5858
margin: 0;
5959
font-size: 24px;
@@ -69,6 +69,11 @@ export const EmphasizedText = styled.span`
6969
color: ${({ theme }) => theme.colors.v3.text.primary};
7070
`;
7171

72+
export const ButtonsContainer = styled.div`
73+
display: flex;
74+
gap: 16px;
75+
`;
76+
7277
export const SelectContainer = styled.div`
7378
width: 560px;
7479
`;

0 commit comments

Comments
 (0)