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",
"Fiji": "Fiji",
"File": "File",
"File System Free Space": "File System Free Space",
"File System Used Space": "File System Used Space",
"File URL": "File URL",
"Filename": "Filename",
"Files: {names}": "Files: {names}",

View File

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

View File

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

View File

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

View File

@ -1000,7 +1000,7 @@
"Fedora": "",
"Fiji": "斐济",
"File": "文件",
"File System Free Space": "文件系统可用空间",
"File System Used Space": "文件系统已用空间",
"File URL": "文件URL",
"Filename": "文件名",
"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,
createFetchParams: {
metricKey: 'physicalNode.fileSystemFreeSpace',
@ -78,11 +78,17 @@ export const topCardList = [
const { data: { result } = { result: [] } } = avail;
const temp = [];
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({
mountpoint:
get(item, `metric.${deviceKey}`) + get(item, `metric.${typeKey}`),
avail: parseFloat(get(item, 'value[1]', 0)),
total: parseFloat(get(size, `data.result[${index}].value[1]`, 0)),
avail: availValue,
total,
used,
});
});
return temp;
@ -98,7 +104,7 @@ export const topCardList = [
}}
>
{(value.data || []).map((item, index) => {
const percentage = computePercentage(item.avail, item.total);
const percentage = computePercentage(item.used, item.total);
const percentageColor =
percentage > 80 ? globalCSS.warnDarkColor : globalCSS.primaryColor;
return (
@ -109,16 +115,16 @@ export const topCardList = [
<div>
<div style={{ float: 'left' }}>{item.mountpoint}</div>
<div style={{ float: 'right' }}>
{`${formatSize(parseInt(item.avail, 10))} / ${formatSize(
{`${formatSize(parseInt(item.used, 10))} / ${formatSize(
parseInt(item.total, 10)
)}`}
</div>
</div>
<Progress
style={{ width: '95%' }}
style={{ width: '90%' }}
percent={Number(
(
(parseInt(item.avail, 10) / parseInt(item.total, 10)) *
(parseInt(item.used, 10) / parseInt(item.total, 10)) *
100
).toFixed(3)
)}