new
This commit is contained in:
@@ -61,6 +61,8 @@
|
|||||||
"totalFilesAndFolders": "Files and Folders",
|
"totalFilesAndFolders": "Files and Folders",
|
||||||
"shareLinks": "Share links",
|
"shareLinks": "Share links",
|
||||||
"totalBlobs": "Blobs",
|
"totalBlobs": "Blobs",
|
||||||
|
"storagePolicies": "Storage Policies Usage",
|
||||||
|
"noStoragePolicies": "No storage policies available",
|
||||||
"homepage": "Homepage",
|
"homepage": "Homepage",
|
||||||
"github": "GitHub",
|
"github": "GitHub",
|
||||||
"documents": "Documents",
|
"documents": "Documents",
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
"totalFilesAndFolders": "文件与目录",
|
"totalFilesAndFolders": "文件与目录",
|
||||||
"shareLinks": "分享链接",
|
"shareLinks": "分享链接",
|
||||||
"totalBlobs": "文件 Blob",
|
"totalBlobs": "文件 Blob",
|
||||||
|
"storagePolicies": "存储策略空间使用",
|
||||||
|
"noStoragePolicies": "暂无存储策略",
|
||||||
"homepage": "主页",
|
"homepage": "主页",
|
||||||
"github": "GitHub",
|
"github": "GitHub",
|
||||||
"documents": "文档",
|
"documents": "文档",
|
||||||
|
|||||||
@@ -20,10 +20,19 @@ export interface Version {
|
|||||||
commit: string;
|
commit: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StoragePolicySpace {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
used: number;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface HomepageSummary {
|
export interface HomepageSummary {
|
||||||
metrics_summary?: MetricsSummary;
|
metrics_summary?: MetricsSummary;
|
||||||
site_urls: string[];
|
site_urls: string[];
|
||||||
version: Version;
|
version: Version;
|
||||||
|
storage_policies?: StoragePolicySpace[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ManualRefreshLicenseService {
|
export interface ManualRefreshLicenseService {
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ import SparkleFilled from "../../Icons/SparkleFilled.tsx";
|
|||||||
import Telegram from "../../Icons/Telegram.tsx";
|
import Telegram from "../../Icons/Telegram.tsx";
|
||||||
import PageContainer from "../../Pages/PageContainer.tsx";
|
import PageContainer from "../../Pages/PageContainer.tsx";
|
||||||
import PageHeader from "../../Pages/PageHeader.tsx";
|
import PageHeader from "../../Pages/PageHeader.tsx";
|
||||||
import ProDialog from "../Common/ProDialog.tsx";
|
import ProDialog from "../../Admin/Common/ProDialog.tsx";
|
||||||
import SiteUrlWarning from "./SiteUrlWarning.tsx";
|
import SiteUrlWarning from "./SiteUrlWarning.tsx";
|
||||||
import CommentMultiple from "../../Icons/CommentMultiple.tsx";
|
import CommentMultiple from "../../Icons/CommentMultiple.tsx";
|
||||||
|
import LinearProgress from "@mui/material/LinearProgress";
|
||||||
|
|
||||||
const StyledPaper = styled(Paper)(({ theme }) => ({
|
const StyledPaper = styled(Paper)(({ theme }) => ({
|
||||||
padding: theme.spacing(3),
|
padding: theme.spacing(3),
|
||||||
@@ -306,6 +307,67 @@ const Home = () => {
|
|||||||
</SwitchTransition>
|
</SwitchTransition>
|
||||||
</StyledPaper>
|
</StyledPaper>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid item xs={12}>
|
||||||
|
<StyledPaper>
|
||||||
|
<Typography variant="subtitle1" fontWeight={500}>
|
||||||
|
{t("summary.storagePolicies")}
|
||||||
|
</Typography>
|
||||||
|
<Divider sx={{ mb: 2, mt: 1 }} />
|
||||||
|
<Box>
|
||||||
|
{summary?.storage_policies && summary.storage_policies.length > 0 ? (
|
||||||
|
<Box sx={{ gap: 3, display: "flex", flexDirection: "column" }}>
|
||||||
|
{summary.storage_policies.map((policy) => {
|
||||||
|
const percentage = policy.total > 0 ? (policy.used / policy.total) * 100 : 0;
|
||||||
|
const formatSize = (bytes: number) => {
|
||||||
|
if (bytes === 0) return "0 B";
|
||||||
|
const k = 1024;
|
||||||
|
const sizes = ["B", "KB", "MB", "GB", "TB", "PB"];
|
||||||
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||||
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box key={policy.id}>
|
||||||
|
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 0.5 }}>
|
||||||
|
<Typography variant="subtitle2">{policy.name}</Typography>
|
||||||
|
<Typography variant="caption" color="text.secondary">
|
||||||
|
{formatSize(policy.used)} / {formatSize(policy.total)}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 1 }}>
|
||||||
|
<Typography variant="caption" color="text.secondary">
|
||||||
|
{policy.type}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="caption" color="text.secondary">
|
||||||
|
{percentage.toFixed(1)}%
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<LinearProgress
|
||||||
|
variant="determinate"
|
||||||
|
value={percentage}
|
||||||
|
sx={{
|
||||||
|
height: 8,
|
||||||
|
borderRadius: 4,
|
||||||
|
backgroundColor: theme.palette.divider,
|
||||||
|
"& .MuiLinearProgress-bar": {
|
||||||
|
borderRadius: 4,
|
||||||
|
backgroundColor:
|
||||||
|
percentage > 90 ? red[500] : percentage > 70 ? yellow[500] : green[500],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Box>
|
||||||
|
) : (
|
||||||
|
<Box sx={{ py: 2, textAlign: "center", color: "text.secondary" }}>
|
||||||
|
{t("summary.noStoragePolicies")}
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</StyledPaper>
|
||||||
|
</Grid>
|
||||||
<Grid item xs={12} md={5} lg={4}>
|
<Grid item xs={12} md={5} lg={4}>
|
||||||
<StyledPaper sx={{ p: 0 }}>
|
<StyledPaper sx={{ p: 0 }}>
|
||||||
<Box sx={{ p: 3, display: "flex", alignItems: "center" }}>
|
<Box sx={{ p: 3, display: "flex", alignItems: "center" }}>
|
||||||
|
|||||||
Reference in New Issue
Block a user