blob: ad1e3e94befb4698b64cafbdc3af2b59112122a0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<script setup lang="ts">
import db from 'oui-data';
import { macAddressValidationRules } from '@/utils/macAddress';
import { useCopy } from '@/composable/copy';
const getVendorValue = (address: string) => address.trim().replace(/[.:-]/g, '').toUpperCase().substring(0, 6);
const macAddress = ref('20:37:06:12:34:56');
const details = computed<string | undefined>(() => (db as Record<string, string>)[getVendorValue(macAddress.value)]);
const { copy } = useCopy({ source: () => details.value ?? '', text: 'Vendor info copied to the clipboard' });
</script>
<template>
<div>
<c-input-text
v-model:value="macAddress"
label="MAC address:"
size="large"
placeholder="Type a MAC address"
clearable
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
:validation-rules="macAddressValidationRules"
mb-5
/>
<div mb-5px>
Vendor info:
</div>
<c-card mb-5>
<div v-if="details">
<div v-for="(detail, index) of details.split('\n')" :key="index">
{{ detail }}
</div>
</div>
<div v-else italic op-60>
Unknown vendor for this address
</div>
</c-card>
<div flex justify-center>
<c-button :disabled="!details" @click="copy()">
Copy vendor info
</c-button>
</div>
</div>
</template>
|