Skip to content

Commit f7da5a5

Browse files
KobzolJamesbarford
authored andcommitted
Use JSX to render PR links
1 parent 8989d0e commit f7da5a5

File tree

1 file changed

+10
-6
lines changed
  • site/frontend/src/pages/status_new

1 file changed

+10
-6
lines changed

site/frontend/src/pages/status_new/page.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script setup lang="ts">
1+
<script setup lang="tsx">
22
import {ref, Ref} from "vue";
33
44
import {getJson} from "../../utils/requests";
@@ -28,11 +28,15 @@ const dataNew: Ref<
2828
(StatusResponse & {collectorJobMap: CollectorJobMap}) | null
2929
> = ref(null);
3030
31-
function pullRequestUrlAsHtml(reqType: BenchmarkRequestType): string {
32-
if (reqType.type === ReleaseCommit) {
31+
function PullRequestLink({request}: {request: BenchmarkRequestType}) {
32+
if (request.type === ReleaseCommit) {
3333
return "";
3434
}
35-
return `<a href="https://github.com/rust-lang/rust/pull/${reqType.pr}">#${reqType.pr}</a>`;
35+
return (
36+
<a href={`https://github.com/rust-lang/rust/pull/${request.pr}`}>
37+
#{request.pr}
38+
</a>
39+
);
3640
}
3741
3842
function formatDuration(milliseconds: number): string {
@@ -77,7 +81,7 @@ loadStatusNew(loading);
7781
<tbody>
7882
<template v-for="req in dataNew.completed">
7983
<tr>
80-
<td v-html="pullRequestUrlAsHtml(req.requestType)"></td>
84+
<td><PullRequestLink :request="req.requestType" /></td>
8185
<td>{{ req.requestType.type }}</td>
8286
<td>{{ req.requestType.tag }}</td>
8387
<td>{{ req.status.state }}</td>
@@ -103,7 +107,7 @@ loadStatusNew(loading);
103107
<tbody>
104108
<template v-for="req in dataNew.queue">
105109
<tr>
106-
<td v-html="pullRequestUrlAsHtml(req.requestType)"></td>
110+
<td><PullRequestLink :request="req.requestType" /></td>
107111
<td>{{ req.requestType.type }}</td>
108112
<td>{{ req.requestType.tag }}</td>
109113
<td>{{ req.status.state }}</td>

0 commit comments

Comments
 (0)