feat: update file system space info

The file system free space is changed to used space, which is easier to understand.

Change-Id: Iaf96a4b584124671c937491c64a044546b26ce3a
This commit is contained in:
zhangjingwei 2024-03-28 15:35:00 +08:00
parent ac660be722
commit 4cc407f740
6 changed files with 18 additions and 12 deletions

View File

@ -1000,7 +1000,7 @@
"Fedora": "Fedora", "Fedora": "Fedora",
"Fiji": "Fiji", "Fiji": "Fiji",
"File": "File", "File": "File",
"File System Free Space": "File System Free Space", "File System Used Space": "File System Used Space",
"File URL": "File URL", "File URL": "File URL",
"Filename": "Filename", "Filename": "Filename",
"Files: {names}": "Files: {names}", "Files: {names}": "Files: {names}",

View File

@ -1000,7 +1000,7 @@
"Fedora": "", "Fedora": "",
"Fiji": "", "Fiji": "",
"File": "파일", "File": "파일",
"File System Free Space": "파일 시스템 Free 공간", "File System Used Space": "파일 시스템 사용 공간",
"File URL": "파일 URL", "File URL": "파일 URL",
"Filename": "파일 이름", "Filename": "파일 이름",
"Files: {names}": "파일: {names}", "Files: {names}": "파일: {names}",

View File

@ -1000,7 +1000,7 @@
"Fedora": "Fedora", "Fedora": "Fedora",
"Fiji": "Fiji", "Fiji": "Fiji",
"File": "File", "File": "File",
"File System Free Space": "Свободное место в файловой системе", "File System Used Space": "Используемое пространство файловой системы",
"File URL": "URL файла", "File URL": "URL файла",
"Filename": "Имя файла", "Filename": "Имя файла",
"Files: {names}": "Файлы: {names}", "Files: {names}": "Файлы: {names}",

View File

@ -1000,7 +1000,7 @@
"Fedora": "Fedora", "Fedora": "Fedora",
"Fiji": "Fiji", "Fiji": "Fiji",
"File": "Dosya", "File": "Dosya",
"File System Free Space": "Dosya Sistemi Boş Alanı", "File System Used Space": "Dosya Sistemi Kullanılan Alan",
"File URL": "Dosya URL'si", "File URL": "Dosya URL'si",
"Filename": "Dosya Adı", "Filename": "Dosya Adı",
"Files: {names}": "Dosyalar: {names}", "Files: {names}": "Dosyalar: {names}",

View File

@ -1000,7 +1000,7 @@
"Fedora": "", "Fedora": "",
"Fiji": "斐济", "Fiji": "斐济",
"File": "文件", "File": "文件",
"File System Free Space": "文件系统可用空间", "File System Used Space": "文件系统已用空间",
"File URL": "文件URL", "File URL": "文件URL",
"Filename": "文件名", "Filename": "文件名",
"Files: {names}": "文件:{names}", "Files: {names}": "文件:{names}",

View File

@ -66,7 +66,7 @@ export const topCardList = [
), ),
}, },
{ {
title: t('File System Free Space'), title: t('File System Used Space'),
span: 9, span: 9,
createFetchParams: { createFetchParams: {
metricKey: 'physicalNode.fileSystemFreeSpace', metricKey: 'physicalNode.fileSystemFreeSpace',
@ -78,11 +78,17 @@ export const topCardList = [
const { data: { result } = { result: [] } } = avail; const { data: { result } = { result: [] } } = avail;
const temp = []; const temp = [];
result.forEach((item, index) => { result.forEach((item, index) => {
const availValue = parseFloat(get(item, 'value[1]', 0));
const total = parseFloat(
get(size, `data.result[${index}].value[1]`, 0)
);
const used = total - availValue;
temp.push({ temp.push({
mountpoint: mountpoint:
get(item, `metric.${deviceKey}`) + get(item, `metric.${typeKey}`), get(item, `metric.${deviceKey}`) + get(item, `metric.${typeKey}`),
avail: parseFloat(get(item, 'value[1]', 0)), avail: availValue,
total: parseFloat(get(size, `data.result[${index}].value[1]`, 0)), total,
used,
}); });
}); });
return temp; return temp;
@ -98,7 +104,7 @@ export const topCardList = [
}} }}
> >
{(value.data || []).map((item, index) => { {(value.data || []).map((item, index) => {
const percentage = computePercentage(item.avail, item.total); const percentage = computePercentage(item.used, item.total);
const percentageColor = const percentageColor =
percentage > 80 ? globalCSS.warnDarkColor : globalCSS.primaryColor; percentage > 80 ? globalCSS.warnDarkColor : globalCSS.primaryColor;
return ( return (
@ -109,16 +115,16 @@ export const topCardList = [
<div> <div>
<div style={{ float: 'left' }}>{item.mountpoint}</div> <div style={{ float: 'left' }}>{item.mountpoint}</div>
<div style={{ float: 'right' }}> <div style={{ float: 'right' }}>
{`${formatSize(parseInt(item.avail, 10))} / ${formatSize( {`${formatSize(parseInt(item.used, 10))} / ${formatSize(
parseInt(item.total, 10) parseInt(item.total, 10)
)}`} )}`}
</div> </div>
</div> </div>
<Progress <Progress
style={{ width: '95%' }} style={{ width: '90%' }}
percent={Number( percent={Number(
( (
(parseInt(item.avail, 10) / parseInt(item.total, 10)) * (parseInt(item.used, 10) / parseInt(item.total, 10)) *
100 100
).toFixed(3) ).toFixed(3)
)} )}