fix: better description and use of units
This commit is contained in:
parent
e46a5ec4d3
commit
ae4baa358b
@ -3,13 +3,20 @@ import InputCopyable from '../../components/InputCopyable.vue';
|
|||||||
import type { Units } from './hdd-calculator.service';
|
import type { Units } from './hdd-calculator.service';
|
||||||
import { getRealSize } from './hdd-calculator.service';
|
import { getRealSize } from './hdd-calculator.service';
|
||||||
|
|
||||||
const units = [
|
const dec_units = [
|
||||||
{ value: 'kb', label: 'KB' },
|
{ value: 'kb', label: 'kB' },
|
||||||
{ value: 'mb', label: 'MB' },
|
{ value: 'mb', label: 'MB' },
|
||||||
{ value: 'gb', label: 'GB' },
|
{ value: 'gb', label: 'GB' },
|
||||||
{ value: 'tb', label: 'TB' },
|
{ value: 'tb', label: 'TB' },
|
||||||
{ value: 'pb', label: 'PB' },
|
{ value: 'pb', label: 'PB' },
|
||||||
];
|
];
|
||||||
|
const bin_units = [
|
||||||
|
{ value: 'kb', label: 'KiB' },
|
||||||
|
{ value: 'mb', label: 'MiB' },
|
||||||
|
{ value: 'gb', label: 'GiB' },
|
||||||
|
{ value: 'tb', label: 'TiB' },
|
||||||
|
{ value: 'pb', label: 'PiB' },
|
||||||
|
];
|
||||||
|
|
||||||
const claimedCapacity = ref(1);
|
const claimedCapacity = ref(1);
|
||||||
const claimedUnit = ref('tb');
|
const claimedUnit = ref('tb');
|
||||||
@ -23,15 +30,15 @@ const claimedUnit = ref('tb');
|
|||||||
<c-select
|
<c-select
|
||||||
v-model:value="claimedUnit"
|
v-model:value="claimedUnit"
|
||||||
label="Unit:"
|
label="Unit:"
|
||||||
:options="units"
|
:options="dec_units"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<n-divider />
|
<n-divider />
|
||||||
|
|
||||||
<InputCopyable
|
<InputCopyable
|
||||||
v-for="({ value, label }) in units"
|
v-for="({ value, label }) in bin_units"
|
||||||
:key="value"
|
:key="value"
|
||||||
:label="`Capacity in ${label}`"
|
:label="`Capacity in ${label}:`"
|
||||||
:value="getRealSize(claimedCapacity, claimedUnit as Units, value as Units).toFixed(5)"
|
:value="getRealSize(claimedCapacity, claimedUnit as Units, value as Units).toFixed(5)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { defineTool } from '../tool';
|
|||||||
export const tool = defineTool({
|
export const tool = defineTool({
|
||||||
name: 'HDD calculator',
|
name: 'HDD calculator',
|
||||||
path: '/hdd-calculator',
|
path: '/hdd-calculator',
|
||||||
description: 'Compute real storage space (binary) from HDD Capacity (decimal)',
|
description: 'Storage device manufacturers report capacities in decimal form (like GB), while operating systems and other software uses binary form (GiB), although still incorrectly using the decimal unit (GiB). This tool converts decimal form capacity into various binary forms.',
|
||||||
keywords: ['hdd', 'calculator', 'size', 'conversion', 'binary', 'decimal',
|
keywords: ['hdd', 'calculator', 'size', 'conversion', 'binary', 'decimal',
|
||||||
'gb', 'mb', 'tb',
|
'gb', 'mb', 'tb',
|
||||||
'gigabyte', 'gibibyte', 'megabyte', 'mebibyte', 'terabyte', 'tebibyte'],
|
'gigabyte', 'gibibyte', 'megabyte', 'mebibyte', 'terabyte', 'tebibyte'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user