-
Notifications
You must be signed in to change notification settings - Fork 2
feat: show real time probe logs on the probe page #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2ad9273
c6b4017
61d0b81
1b8e5a3
3a63260
a37eee3
978aab6
83e2794
eaa29d3
f7460ff
cc27a9a
e0c06cd
b47a8da
ebc675f
8c7cb9c
4ee061f
09c537e
a4d42fd
e48c599
8a5e4f1
4e01b17
0982587
b021380
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,7 +14,7 @@ | |||||||||||||||||||||||||||||
<p>Are you sure you want to delete these probes? You will not be able to undo this action.</p> | ||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||
<div v-else class="flex flex-col"> | ||||||||||||||||||||||||||||||
<p>You are about to delete the probe <span class="font-bold">{{ probes[0].name || probes[0].city }}</span> ({{ probes[0].ip }}).</p> | ||||||||||||||||||||||||||||||
<p>You are about to delete the probe <span class="font-bold">{{ probes[0]!.name || probes[0]!.city }}</span> ({{ probes[0]!.ip }}).</p> | ||||||||||||||||||||||||||||||
<p>Are you sure you want to delete this probe? You will not be able to undo this action.</p> | ||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||
Comment on lines
+17
to
19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix potential crash when
- <div v-else class="flex flex-col">
- <p>You are about to delete the probe <span class="font-bold">{{ probes[0]!.name || probes[0]!.city }}</span> ({{ probes[0]!.ip }}).</p>
- <p>Are you sure you want to delete this probe? You will not be able to undo this action.</p>
- </div>
+ <div v-else-if="probes.length === 1" class="flex flex-col">
+ <p>
+ You are about to delete the probe
+ <span class="font-bold">{{ (probes[0]?.name || probes[0]?.city) ?? 'Unnamed' }}</span>
+ ({{ probes[0]?.ip ?? 'unknown IP' }}).
+ </p>
+ <p>Are you sure you want to delete this probe? You will not be able to undo this action.</p>
+ </div>
+ <div v-else class="flex flex-col">
+ <p>No probes selected.</p>
+ </div> 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,59 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
<!-- This component is a copy of nuxt-icons lib, but with fixed "noUncheckedIndexedAccess" errors. Source: https://github.com/gitFoxCode/nuxt-icons/issues/60 --> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
<template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
<!-- eslint-disable-next-line vue/no-v-html --> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
<span class="nuxt-icon" :class="{ 'nuxt-icon--fill': !filled, 'nuxt-icon--stroke': hasStroke && !filled }" v-html="icon"/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
</template> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
<script setup lang="ts"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { ref, watchEffect } from '#imports'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
const props = withDefaults(defineProps<{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
name: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
filled?: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
}>(), { filled: false }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
const icon = ref<string | Record<string, any>>(''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
let hasStroke = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
async function getIcon () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
const iconsImport = import.meta.glob('assets/icons/**/**.svg', { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
eager: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
query: '?raw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
import: 'default', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
const iconPath = `/assets/icons/${props.name}.svg`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
const rawIcon = await iconsImport[iconPath]!() as string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (rawIcon.includes('stroke')) { hasStroke = true; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
icon.value = rawIcon; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+22
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix icon path mismatch and stale hasStroke.
- const iconsImport = import.meta.glob('assets/icons/**/**.svg', {
+ const iconsImport = import.meta.glob('/assets/icons/**/**.svg', {
eager: false,
query: '?raw',
import: 'default',
});
const iconPath = `/assets/icons/${props.name}.svg`;
- const rawIcon = await iconsImport[iconPath]!() as string;
+ const loader = iconsImport[iconPath];
+ if (!loader) { throw new Error('not found'); }
+ const rawIcon = await loader() as string;
-
- if (rawIcon.includes('stroke')) { hasStroke = true; }
+ hasStroke = rawIcon.includes('stroke');
icon.value = rawIcon; 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.error(`[nuxt-icons] Icon '${props.name}' doesn't exist in 'assets/icons'`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
await getIcon(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
watchEffect(getIcon); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
</script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
<style> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
.nuxt-icon svg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
width: 1em; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
height: 1em; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
vertical-align: middle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
.nuxt-icon.nuxt-icon--fill, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
.nuxt-icon.nuxt-icon--fill * { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
fill: currentColor !important; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
.nuxt-icon.nuxt-icon--stroke, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
.nuxt-icon.nuxt-icon--stroke * { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
stroke: currentColor !important; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<template> | ||
<span class="flex flex-nowrap gap-1"> | ||
<span class="size-1.5 animate-dot-pulse rounded-full bg-gray-500 opacity-50"/> | ||
<span class="size-1.5 animate-dot-pulse rounded-full bg-gray-500 opacity-50 animate-delay-200"/> | ||
<span class="size-1.5 animate-dot-pulse rounded-full bg-gray-500 opacity-50 animate-delay-400"/> | ||
</span> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surface a clean error message for invalid IP.
e.errors may be an array/object; rendering it directly yields “[object Object]”.
📝 Committable suggestion
🤖 Prompt for AI Agents