formatting

This commit is contained in:
Kohaku-Blueleaf
2025-10-07 19:34:17 +08:00
parent 9d335bc747
commit c84554f48c
9 changed files with 58 additions and 26 deletions

View File

@@ -27,8 +27,12 @@ const menuItems = [
<!-- Sidebar -->
<el-aside width="250px" class="sidebar">
<div class="sidebar-header">
<div class="i-carbon-security text-2xl text-blue-600 dark:text-blue-400" />
<h2 class="text-xl font-bold ml-2 text-gray-900 dark:text-gray-100">Admin Portal</h2>
<div
class="i-carbon-security text-2xl text-blue-600 dark:text-blue-400"
/>
<h2 class="text-xl font-bold ml-2 text-gray-900 dark:text-gray-100">
Admin Portal
</h2>
</div>
<el-menu
@@ -55,7 +59,9 @@ const menuItems = [
<!-- Header -->
<el-header class="header">
<div class="header-title">
<h1 class="text-xl font-semibold text-gray-900 dark:text-gray-100">KohakuHub Administration</h1>
<h1 class="text-xl font-semibold text-gray-900 dark:text-gray-100">
KohakuHub Administration
</h1>
</div>
<div class="header-actions">

View File

@@ -152,8 +152,12 @@ watch(
<div v-if="quotaInfo && !editing">
<!-- Private Quota Section -->
<div class="quota-section">
<h3 class="text-lg font-semibold mb-3 flex items-center text-gray-900 dark:text-gray-100">
<div class="i-carbon-locked mr-2 text-orange-600 dark:text-orange-400" />
<h3
class="text-lg font-semibold mb-3 flex items-center text-gray-900 dark:text-gray-100"
>
<div
class="i-carbon-locked mr-2 text-orange-600 dark:text-orange-400"
/>
Private Repositories
</h3>
@@ -190,8 +194,12 @@ watch(
<!-- Public Quota Section -->
<div class="quota-section">
<h3 class="text-lg font-semibold mb-3 flex items-center text-gray-900 dark:text-gray-100">
<div class="i-carbon-unlocked mr-2 text-cyan-600 dark:text-cyan-400" />
<h3
class="text-lg font-semibold mb-3 flex items-center text-gray-900 dark:text-gray-100"
>
<div
class="i-carbon-unlocked mr-2 text-cyan-600 dark:text-cyan-400"
/>
Public Repositories
</h3>
@@ -228,8 +236,12 @@ watch(
<!-- Total Usage -->
<div class="quota-section">
<h3 class="text-lg font-semibold mb-3 flex items-center text-gray-900 dark:text-gray-100">
<div class="i-carbon-data-volume mr-2 text-blue-600 dark:text-blue-400" />
<h3
class="text-lg font-semibold mb-3 flex items-center text-gray-900 dark:text-gray-100"
>
<div
class="i-carbon-data-volume mr-2 text-blue-600 dark:text-blue-400"
/>
Total Storage
</h3>

View File

@@ -44,7 +44,9 @@ onMounted(() => {
<template>
<AdminLayout>
<div class="page-container">
<h1 class="text-3xl font-bold mb-6 text-gray-900 dark:text-gray-100">Dashboard</h1>
<h1 class="text-3xl font-bold mb-6 text-gray-900 dark:text-gray-100">
Dashboard
</h1>
<div v-loading="loading" class="stats-grid">
<!-- Users Card -->
@@ -103,7 +105,9 @@ onMounted(() => {
<!-- Quick Actions -->
<div class="mt-8">
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-gray-100">Quick Actions</h2>
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-gray-100">
Quick Actions
</h2>
<div class="flex gap-4">
<el-button
type="primary"

View File

@@ -41,8 +41,12 @@ async function handleLogin() {
<div class="login-container">
<div class="login-card">
<div class="login-header">
<div class="i-carbon-security text-4xl text-blue-600 dark:text-blue-400 mb-4" />
<h1 class="text-3xl font-bold mb-2 text-gray-900 dark:text-gray-100">KohakuHub Admin</h1>
<div
class="i-carbon-security text-4xl text-blue-600 dark:text-blue-400 mb-4"
/>
<h1 class="text-3xl font-bold mb-2 text-gray-900 dark:text-gray-100">
KohakuHub Admin
</h1>
<p class="text-gray-600 dark:text-gray-400">
Enter your admin token to continue
</p>

View File

@@ -39,10 +39,14 @@ watch(
<template>
<AdminLayout>
<div class="page-container">
<h1 class="text-3xl font-bold mb-6 text-gray-900 dark:text-gray-100">Quota Management</h1>
<h1 class="text-3xl font-bold mb-6 text-gray-900 dark:text-gray-100">
Quota Management
</h1>
<el-card class="mb-6">
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-gray-100">Select Namespace</h2>
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-gray-100">
Select Namespace
</h2>
<div class="flex gap-4 items-end">
<el-form-item label="Namespace" class="flex-1">

View File

@@ -269,7 +269,9 @@ onMounted(() => {
<AdminLayout>
<div class="page-container">
<div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold text-gray-900 dark:text-gray-100">User Management</h1>
<h1 class="text-3xl font-bold text-gray-900 dark:text-gray-100">
User Management
</h1>
<el-button type="primary" @click="dialogVisible = true" :icon="'Plus'">
Create User
</el-button>

View File

@@ -177,7 +177,7 @@ export async function verifyAdminToken(token) {
// ===== Utility Functions =====
/**
* Format bytes to human-readable size
* Format bytes to human-readable size (decimal units: 1000 bytes = 1 KB)
* @param {number} bytes - Bytes
* @param {number} decimals - Decimal places
* @returns {string} Formatted size
@@ -186,7 +186,7 @@ export function formatBytes(bytes, decimals = 2) {
if (bytes === null || bytes === undefined) return "Unlimited";
if (bytes === 0) return "0 Bytes";
const k = 1024;
const k = 1000;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
@@ -196,7 +196,7 @@ export function formatBytes(bytes, decimals = 2) {
}
/**
* Parse human-readable size to bytes
* Parse human-readable size to bytes (decimal units: 1 KB = 1000 bytes)
* @param {string} sizeStr - Size string (e.g., "10GB", "500MB")
* @returns {number|null} Bytes, or null for unlimited
*/
@@ -205,11 +205,11 @@ export function parseSize(sizeStr) {
const units = {
b: 1,
kb: 1024,
mb: 1024 ** 2,
gb: 1024 ** 3,
tb: 1024 ** 4,
pb: 1024 ** 5,
kb: 1000,
mb: 1000 ** 2,
gb: 1000 ** 3,
tb: 1000 ** 4,
pb: 1000 ** 5,
};
const match = sizeStr.match(/^(\d+(?:\.\d+)?)\s*([a-z]+)$/i);

View File

@@ -506,7 +506,7 @@ function formatDate(date) {
function formatBytes(bytes) {
if (bytes === null || bytes === undefined) return "Unlimited";
if (bytes === 0) return "0 B";
const k = 1024;
const k = 1000;
const sizes = ["B", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];

View File

@@ -523,7 +523,7 @@ function formatDate(date) {
function formatBytes(bytes) {
if (bytes === null || bytes === undefined) return "Unlimited";
if (bytes === 0) return "0 B";
const k = 1024;
const k = 1000;
const sizes = ["B", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];