2023-04-07 00:18:06 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<n-form-item label="MAC address:" v-bind="validationAttrs">
|
|
|
|
<n-input
|
|
|
|
v-model:value="macAddress"
|
|
|
|
size="large"
|
|
|
|
placeholder="Type a MAC address"
|
|
|
|
clearable
|
|
|
|
autocomplete="off"
|
|
|
|
autocorrect="off"
|
|
|
|
autocapitalize="off"
|
|
|
|
spellcheck="false"
|
|
|
|
/>
|
|
|
|
</n-form-item>
|
|
|
|
|
|
|
|
<n-form-item label="Vendor info:">
|
|
|
|
<n-card>
|
|
|
|
<n-text v-if="details">
|
|
|
|
<div v-for="(detail, index) of details.split('\n')" :key="index">{{ detail }}</div>
|
|
|
|
</n-text>
|
|
|
|
|
|
|
|
<n-text v-else depth="3" italic>Unknown vendor for this address</n-text>
|
|
|
|
</n-card>
|
|
|
|
</n-form-item>
|
|
|
|
|
|
|
|
<n-space justify="center">
|
2023-04-19 21:38:59 +02:00
|
|
|
<c-button :disabled="!details"> Copy vendor info </c-button>
|
2023-04-07 00:18:06 +02:00
|
|
|
</n-space>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import db from 'oui/oui.json';
|
2023-04-09 20:58:27 +02:00
|
|
|
import { macAddressValidation } from '@/utils/macAddress';
|
2023-04-07 00:18:06 +02:00
|
|
|
|
|
|
|
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[getVendorValue(macAddress.value)]);
|
|
|
|
|
2023-04-09 20:58:27 +02:00
|
|
|
const { attrs: validationAttrs } = macAddressValidation(macAddress);
|
2023-04-07 00:18:06 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped></style>
|