[bugfix]: actually implement size column
This commit is contained in:
parent
6bc778fa53
commit
2854a91700
16 changed files with 50 additions and 13 deletions
|
@ -365,7 +365,8 @@
|
||||||
"albumArtist": "umělec alba",
|
"albumArtist": "umělec alba",
|
||||||
"path": "cesta",
|
"path": "cesta",
|
||||||
"discNumber": "disk",
|
"discNumber": "disk",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
|
|
@ -310,7 +310,8 @@
|
||||||
"discNumber": "Disk",
|
"discNumber": "Disk",
|
||||||
"genre": "$t(entity.genre_one)",
|
"genre": "$t(entity.genre_one)",
|
||||||
"songCount": "$t(entity.track_other)",
|
"songCount": "$t(entity.track_other)",
|
||||||
"trackNumber": "Nr."
|
"trackNumber": "Nr.",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"page": {
|
"page": {
|
||||||
|
|
|
@ -610,6 +610,7 @@
|
||||||
"rating": "rating",
|
"rating": "rating",
|
||||||
"releaseDate": "release date",
|
"releaseDate": "release date",
|
||||||
"releaseYear": "year",
|
"releaseYear": "year",
|
||||||
|
"size": "$t(common.size)",
|
||||||
"songCount": "$t(entity.track_other)",
|
"songCount": "$t(entity.track_other)",
|
||||||
"title": "title",
|
"title": "title",
|
||||||
"trackNumber": "track"
|
"trackNumber": "track"
|
||||||
|
|
|
@ -541,7 +541,8 @@
|
||||||
"albumArtist": "artista de álbum",
|
"albumArtist": "artista de álbum",
|
||||||
"path": "ruta",
|
"path": "ruta",
|
||||||
"discNumber": "disco",
|
"discNumber": "disco",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"label": {
|
"label": {
|
||||||
|
|
|
@ -625,7 +625,8 @@
|
||||||
"artist": "$t(entity.artist_one)",
|
"artist": "$t(entity.artist_one)",
|
||||||
"genre": "$t(entity.genre_one)",
|
"genre": "$t(entity.genre_one)",
|
||||||
"songCount": "$t(entity.track_other)",
|
"songCount": "$t(entity.track_other)",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,7 +572,8 @@
|
||||||
"albumArtist": "artista album",
|
"albumArtist": "artista album",
|
||||||
"path": "percorso",
|
"path": "percorso",
|
||||||
"discNumber": "disco",
|
"discNumber": "disco",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
|
|
|
@ -353,7 +353,8 @@
|
||||||
"albumArtist": "アルバムアーティスト",
|
"albumArtist": "アルバムアーティスト",
|
||||||
"path": "パス",
|
"path": "パス",
|
||||||
"discNumber": "ディスク",
|
"discNumber": "ディスク",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
|
|
@ -249,7 +249,8 @@
|
||||||
},
|
},
|
||||||
"table": {
|
"table": {
|
||||||
"column": {
|
"column": {
|
||||||
"rating": "rating"
|
"rating": "rating",
|
||||||
|
"size": "$t(common.size)"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"label": {
|
"label": {
|
||||||
|
|
|
@ -625,7 +625,8 @@
|
||||||
"albumArtist": "artysta albumu",
|
"albumArtist": "artysta albumu",
|
||||||
"path": "ścieżka",
|
"path": "ścieżka",
|
||||||
"discNumber": "płyta",
|
"discNumber": "płyta",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,8 @@
|
||||||
},
|
},
|
||||||
"column": {
|
"column": {
|
||||||
"title": "titulo",
|
"title": "titulo",
|
||||||
"discNumber": "disco"
|
"discNumber": "disco",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"page": {
|
"page": {
|
||||||
|
|
|
@ -204,7 +204,8 @@
|
||||||
"trackNumber": "трек",
|
"trackNumber": "трек",
|
||||||
"genre": "$t(entity.genre_one)",
|
"genre": "$t(entity.genre_one)",
|
||||||
"path": "путь",
|
"path": "путь",
|
||||||
"discNumber": "диск"
|
"discNumber": "диск",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
|
|
@ -359,7 +359,8 @@
|
||||||
"albumArtist": "album artist",
|
"albumArtist": "album artist",
|
||||||
"path": "putanja",
|
"path": "putanja",
|
||||||
"discNumber": "disk",
|
"discNumber": "disk",
|
||||||
"channels": "$t(common.channel_other)"
|
"channels": "$t(common.channel_other)",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
|
|
@ -595,7 +595,8 @@
|
||||||
"albumArtist": "专辑艺术家",
|
"albumArtist": "专辑艺术家",
|
||||||
"path": "路径",
|
"path": "路径",
|
||||||
"channels": "$t(common.channel_other)",
|
"channels": "$t(common.channel_other)",
|
||||||
"discNumber": "盘"
|
"discNumber": "盘",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -463,7 +463,8 @@
|
||||||
"bpm": "bpm",
|
"bpm": "bpm",
|
||||||
"songCount": "$t(entity.track_other)",
|
"songCount": "$t(entity.track_other)",
|
||||||
"title": "標題",
|
"title": "標題",
|
||||||
"trackNumber": "音軌編號"
|
"trackNumber": "音軌編號",
|
||||||
|
"size": "$t(common.size)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
|
|
|
@ -43,6 +43,7 @@ import { useFixedTableHeader } from '/@/renderer/components/virtual-table/hooks/
|
||||||
import { NoteCell } from '/@/renderer/components/virtual-table/cells/note-cell';
|
import { NoteCell } from '/@/renderer/components/virtual-table/cells/note-cell';
|
||||||
import { RowIndexCell } from '/@/renderer/components/virtual-table/cells/row-index-cell';
|
import { RowIndexCell } from '/@/renderer/components/virtual-table/cells/row-index-cell';
|
||||||
import i18n from '/@/i18n/i18n';
|
import i18n from '/@/i18n/i18n';
|
||||||
|
import { formatSizeString } from '/@/renderer/utils/format-size-string';
|
||||||
|
|
||||||
export * from './table-config-dropdown';
|
export * from './table-config-dropdown';
|
||||||
export * from './table-pagination';
|
export * from './table-pagination';
|
||||||
|
@ -320,6 +321,16 @@ const tableColumns: { [key: string]: ColDef } = {
|
||||||
},
|
},
|
||||||
width: 65,
|
width: 65,
|
||||||
},
|
},
|
||||||
|
size: {
|
||||||
|
cellRenderer: (params: ICellRendererParams) => GenericCell(params, { position: 'center' }),
|
||||||
|
colId: TableColumn.SIZE,
|
||||||
|
headerComponent: (params: IHeaderParams) =>
|
||||||
|
GenericTableHeader(params, { position: 'center' }),
|
||||||
|
headerName: i18n.t('table.column.size'),
|
||||||
|
valueGetter: (params: ValueGetterParams) =>
|
||||||
|
params.data ? formatSizeString(params.data.size) : undefined,
|
||||||
|
width: 60,
|
||||||
|
},
|
||||||
songCount: {
|
songCount: {
|
||||||
cellRenderer: (params: ICellRendererParams) => GenericCell(params, { position: 'center' }),
|
cellRenderer: (params: ICellRendererParams) => GenericCell(params, { position: 'center' }),
|
||||||
colId: TableColumn.SONG_COUNT,
|
colId: TableColumn.SONG_COUNT,
|
||||||
|
|
12
src/renderer/utils/format-size-string.ts
Normal file
12
src/renderer/utils/format-size-string.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
const SIZES = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
|
||||||
|
|
||||||
|
export const formatSizeString = (size: number): string => {
|
||||||
|
let count = 0;
|
||||||
|
let finalSize = size;
|
||||||
|
while (finalSize > 1024) {
|
||||||
|
finalSize /= 1024;
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${finalSize.toFixed(2)} ${SIZES[count]}`;
|
||||||
|
};
|
Reference in a new issue