Files
MyIP/frontend/components/ip-infos/AsnTrafficShares.vue
T
jason5ng32andClaude Opus 5.5 c29e48687b Refactor(layout): split backend-only code out of common/, group frontend utils
common/ had become the backend's library: 30 of its 41 modules were
imported by nothing in the frontend, so the name no longer said what
belonged there. It now holds only what the frontend or the build imports
too; backend-only code moved to server/, flat except for datasets/ (the
dataset engine and its readers). The *-db/ dataset directories stay in
common/: self-hosting docs and Docker volumes mount those paths.

frontend/utils/ keeps its app-wide modules at the root and gains ip/
(IP / ASN shaping and validation), report/ (the report pipeline) and
features/ (the pure layer of a single feature). Paths only — no logic
changes. The Dockerfile copies server/, and the AGENTS.md files say where
a new module goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 13:10:02 +08:00

29 lines
1.0 KiB
Vue

<!-- Traffic shares of an AS: a titled stack of DataPairBar rows (IPv4/IPv6,
HTTP/HTTPS, desktop/mobile, human/bot). `info` is the Radar ASN summary
(`/api/cfradar?view=asn`); a pair shows only when both sides parse, and
nothing renders when none does. -->
<template>
<div v-if="pairDataList.length" class="space-y-2.5 pt-1">
<div class="text-xs text-muted-foreground">
{{ t('ipInfos.ASNInfo.trafficPercentage') }}
</div>
<DataPairBar v-for="pair in pairDataList" :key="pair.leftLabel" :leftLabel="pair.leftLabel"
:leftValue="pair.leftValue" :rightLabel="pair.rightLabel" :rightValue="pair.rightValue" />
</div>
</template>
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { buildTrafficPairs } from '@/utils/ip/asn-metrics.js';
import DataPairBar from './DataPairBar.vue';
const props = defineProps({
info: { type: Object, default: null },
});
const { t } = useI18n();
const pairDataList = computed(() => buildTrafficPairs(props.info));
</script>