-
Notifications
You must be signed in to change notification settings - Fork 0
feat: device fingerprinting icons in network graph nodes #5
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
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <template> | ||
| <div> | ||
| <div class="table-wrapper"> | ||
| <table class="trames"> | ||
| <thead> | ||
| <tr> | ||
|
|
@@ -17,7 +17,7 @@ | |
| <th>Heure</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tbody ref="tbodyEl"> | ||
| <tr v-for="(packet, index) in safePackets" :key="index"> | ||
| <td>{{ packet?.flow?.source_mac ?? '-' }}</td> | ||
| <td>{{ packet?.flow?.destination_mac ?? '-' }}</td> | ||
|
|
@@ -48,9 +48,15 @@ export default defineComponent({ | |
| packets: [] as PacketMinimal[], | ||
| offPacket: null as null | (() => void), | ||
| resetHandler: null as null | (() => void), | ||
| MAX_ROWS: 5, // ajuste si besoin | ||
| MAX_ROWS: 500, | ||
| autoScroll: true, | ||
| } | ||
| }, | ||
| watch: { | ||
| safePackets() { | ||
| this.$nextTick(() => this.scrollToBottom()) | ||
| }, | ||
| }, | ||
| computed: { | ||
| captureStore() { | ||
| return useCaptureStore() | ||
|
|
@@ -69,9 +75,17 @@ export default defineComponent({ | |
| // garde une taille raisonnable même en interne | ||
| if (this.packets.length > 200) this.packets.shift() | ||
| } | ||
| // Si ton store renvoie une fonction d’unsubscribe, garde-la | ||
| const maybeOff = this.captureStore.onPacket(onPacket) | ||
| if (typeof maybeOff === 'function') this.offPacket = maybeOff | ||
| if (typeof maybeOff === ‘function’) this.offPacket = maybeOff | ||
|
|
||
| // Pause auto-scroll si l’utilisateur remonte | ||
| const tbody = this.$refs.tbodyEl as HTMLElement | undefined | ||
| if (tbody) { | ||
| tbody.addEventListener(‘scroll’, () => { | ||
|
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. |
||
| const atBottom = tbody.scrollHeight - tbody.scrollTop - tbody.clientHeight < 32 | ||
| this.autoScroll = atBottom | ||
| }) | ||
| } | ||
|
Comment on lines
+82
to
+88
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. An event listener is added to the |
||
|
|
||
| // Handler reset conservé pour off() symétrique si nécessaire | ||
| const reset = () => { this.packets = [] } | ||
|
|
@@ -90,6 +104,11 @@ export default defineComponent({ | |
| } | ||
| }, | ||
| methods: { | ||
| scrollToBottom() { | ||
| if (!this.autoScroll) return | ||
| const tbody = this.$refs.tbodyEl as HTMLElement | undefined | ||
| if (tbody) tbody.scrollTop = tbody.scrollHeight | ||
| }, | ||
| formatTimestamp(sec?: number, usec?: number): string { | ||
| if (typeof sec !== 'number' || typeof usec !== 'number') return '-' | ||
| const date = new Date(sec * 1000 + Math.floor(usec / 1000)) | ||
|
|
@@ -112,19 +131,48 @@ export default defineComponent({ | |
| </script> | ||
|
|
||
| <style scoped> | ||
| .trames { | ||
| display: block; | ||
| .table-wrapper { | ||
| height: 190px; | ||
| flex-shrink: 0; | ||
| display: flex; | ||
| flex-direction: column; | ||
| background-color: #2c2c3a; | ||
| font-family: 'Courier New', Courier, monospace; | ||
| border-top: 1px solid #383850; | ||
| overflow: hidden; | ||
| } | ||
| table { | ||
|
|
||
| .trames { | ||
| width: 100%; | ||
| border-collapse: collapse; | ||
| table-layout: fixed; | ||
| display: flex; | ||
| flex-direction: column; | ||
| flex: 1; | ||
| min-height: 0; | ||
| font-family: 'Courier New', Courier, monospace; | ||
| } | ||
|
|
||
| thead { | ||
| display: table; | ||
| width: 100%; | ||
| table-layout: fixed; | ||
| flex-shrink: 0; | ||
| } | ||
|
|
||
| tbody { | ||
| display: block; | ||
| overflow-y: auto; | ||
| flex: 1; | ||
| min-height: 0; | ||
| } | ||
|
|
||
| tbody tr { | ||
| display: table; | ||
| width: 100%; | ||
| table-layout: fixed; | ||
| animation: row-in 0.18s cubic-bezier(0.25, 1, 0.5, 1); | ||
| } | ||
|
|
||
| td, th { | ||
| padding: 6px 8px; | ||
| text-align: center; | ||
|
|
@@ -135,24 +183,25 @@ td, th { | |
| text-overflow: ellipsis; | ||
| font-size: 11px; | ||
| } | ||
|
|
||
| th { | ||
| color: #687888; | ||
| font-weight: 500; | ||
| } | ||
| tbody { | ||
| display: block; | ||
| overflow-y: auto; | ||
|
|
||
| tbody::-webkit-scrollbar { | ||
| width: 4px; | ||
| } | ||
| tbody tr { | ||
| animation: row-in 0.18s cubic-bezier(0.25, 1, 0.5, 1); | ||
| tbody::-webkit-scrollbar-track { | ||
| background: #23232f; | ||
| } | ||
| tbody::-webkit-scrollbar-thumb { | ||
| background: #3c3c50; | ||
| border-radius: 2px; | ||
| } | ||
|
|
||
| @keyframes row-in { | ||
| from { opacity: 0; transform: translateY(-4px); } | ||
| to { opacity: 1; transform: translateY(0); } | ||
| } | ||
| thead, tbody tr { | ||
| display: table; | ||
| width: 100%; | ||
| table-layout: fixed; | ||
| } | ||
| </style> | ||
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.
This line uses typographic quotes (
‘and’) instead of standard single quotes ('). This will cause a JavaScript syntax error and prevent the component from working correctly. The same issue is present on line 84.