Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasQ committed Nov 16, 2023
1 parent d4ab37c commit 594ed11
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
47 changes: 29 additions & 18 deletions web-client/src/components/span/SpanDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@ export function SpanDetail() {
rootSpan: monitorData.spans.find((s) => s.id === spanId())!,

Check warning on line 22 in web-client/src/components/span/SpanDetail.tsx

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
})("ipc::request::response")?.fields[0]?.response;
return field ? processFieldValue(field) : null;
}
};

const args = () => getIpcRequestValues({
metadata: monitorData.metadata,
rootSpan: monitorData.spans.find((s) => s.id === spanId())!,
})("ipc::request")!.fields.map((f) => processFieldValue(f.request));
const args = () =>
getIpcRequestValues({

Check warning on line 28 in web-client/src/components/span/SpanDetail.tsx

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
metadata: monitorData.metadata,
rootSpan: monitorData.spans.find((s) => s.id === spanId())!,

Check warning on line 30 in web-client/src/components/span/SpanDetail.tsx

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
})("ipc::request")!.fields.map((f) => processFieldValue(f.request));

const [responseHtml] = createResource(
() => [responseCode()] as const,
async ([code]) => {
return code === null ? null : (await getHighlightedCode({ lang: "rust" }))(code).replace(
/\\n/gim,
"\n"
);
return code === null
? null
: (await getHighlightedCode({ lang: "rust" }))(code).replace(
/\\n/gim,
"\n"
);
}
);

Expand All @@ -60,7 +63,7 @@ export function SpanDetail() {
<div
class={"absolute bg-teal-500 top-0 left-0 h-full"}
style={slice}
/>
/>
)}
</For>
</div>
Expand All @@ -80,12 +83,20 @@ export function SpanDetail() {
{(arg) => {
return (
<For each={Object.entries(JSON.parse(arg))}>
{([k, v]) => ["cmd", "callback", "error", "__tauriModule"].includes(k) ? null : (
<tr class="even:bg-[#ffffff09]">
<td class="py-1 px-4 font-bold">{k}</td>
<td class="py-1 px-4">{typeof v === 'object' ? JSON.stringify(v) : String(v)}</td>
</tr>
)}
{([k, v]) =>
["cmd", "callback", "error", "__tauriModule"].includes(
k
) ? null : (
<tr class="even:bg-[#ffffff09]">
<td class="py-1 px-4 font-bold">{k}</td>
<td class="py-1 px-4">
{typeof v === "object"
? JSON.stringify(v)
: String(v)}
</td>
</tr>
)
}
</For>
);
}}
Expand All @@ -94,7 +105,7 @@ export function SpanDetail() {
</table>
</div>
<Show when={responseHtml()}>
{(html) =>
{(html) => (
<div class="grid gap-2">
<h2 class="text-xl p-4">Response</h2>
<pre class="bg-black rounded max-w-full overflow-auto">
Expand All @@ -104,7 +115,7 @@ export function SpanDetail() {
/>
</pre>
</div>
}
)}
</Show>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion web-client/src/lib/span/getIpcRequestName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function getIpcRequestName({ metadata, span }: Options) {
} else if (meta?.name === "ipc::request::deserialize_arg") {
const argField = span.fields.find((f) => f.name === "arg");
if (argField) {
return `deserialize arg ${processFieldValue(argField.value)}`
return `deserialize arg ${processFieldValue(argField.value)}`;
}
}
return meta?.name ?? null;
Expand Down

0 comments on commit 594ed11

Please sign in to comment.