Skip to content

Commit 9dfa995

Browse files
committed
Test task button working
1 parent 4c2890a commit 9dfa995

File tree

1 file changed

+27
-32
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index

1 file changed

+27
-32
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam._index/route.tsx

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,24 @@ export default function Page() {
203203
const path = v3RunsPath(organization, project, {
204204
tasks: [task.slug],
205205
});
206+
207+
const devYouEnvironment = task.environments.find(
208+
(e) => e.type === "DEVELOPMENT" && !e.userName
209+
);
210+
const firstDeployedEnvironment = task.environments
211+
.filter((e) => e.type !== "DEVELOPMENT")
212+
.at(0);
213+
const testEnvironment = devYouEnvironment ?? firstDeployedEnvironment;
214+
215+
const testPath = testEnvironment
216+
? v3TestTaskPath(
217+
organization,
218+
project,
219+
{ taskIdentifier: task.slug },
220+
testEnvironment.slug
221+
)
222+
: v3TestPath(organization, project);
223+
206224
return (
207225
<TableRow key={task.slug} className="group">
208226
<TableCell to={path}>
@@ -293,41 +311,18 @@ export default function Page() {
293311
title="View runs"
294312
leadingIconClassName="text-teal-500"
295313
/>
296-
<PopoverMenuItem
297-
icon="beaker"
298-
//TODO Get this path working so we can link to the exact task on the test page
299-
// to={v3TestTaskPath(
300-
// organization,
301-
// project,
302-
// task.slug,
303-
// task.environments[0].slug
304-
// )}
305-
to={v3TestPath(organization, project)}
306-
title="Test task"
307-
/>
314+
<PopoverMenuItem icon="beaker" to={testPath} title="Test task" />
308315
</>
309316
}
310317
hiddenButtons={
311-
<SimpleTooltip
312-
button={
313-
<LinkButton
314-
variant="minimal/small"
315-
LeadingIcon={BeakerIcon}
316-
leadingIconClassName="text-text-bright"
317-
//TODO Get this path working so we can link to the exact task on the test page
318-
// to={v3TestTaskPath(
319-
// organization,
320-
// project,
321-
// task.slug,
322-
// task.environments[0].slug
323-
// )}
324-
to={v3TestPath(organization, project)}
325-
/>
326-
}
327-
content="Test task"
328-
side="left"
329-
disableHoverableContent
330-
/>
318+
<LinkButton
319+
variant="minimal/small"
320+
LeadingIcon={BeakerIcon}
321+
leadingIconClassName="text-text-bright"
322+
to={testPath}
323+
>
324+
Test
325+
</LinkButton>
331326
}
332327
/>
333328
</TableRow>

0 commit comments

Comments
 (0)