Skip to content

Commit

Permalink
feat:流水线支持归档目录 TencentBlueKing#9320
Browse files Browse the repository at this point in the history
  • Loading branch information
vhwweng committed Sep 5, 2023
1 parent 9ae8694 commit a43d8cf
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
</template>
</bk-table-column>
<bk-table-column :label="$t('details.path')" prop="fullName" show-overflow-tooltip></bk-table-column>
<bk-table-column :label="$t('details.filesize')" width="150" prop="size" :formatter="sizeFormatter" show-overflow-tooltip></bk-table-column>
<bk-table-column :label="$t('details.filesize')" width="150" prop="size" show-overflow-tooltip>
<template slot-scope="props">
{{ !props.row.folder ? sizeFormatter(props.row.size) : sizeFormatter(getFolderSize(props.row)) }}
</template>
</bk-table-column>
<bk-table-column :label="$t('details.repoType')" width="150" prop="artifactoryType" :formatter="repoTypeFormatter" show-overflow-tooltip></bk-table-column>
<bk-table-column :label="$t('operate')" width="150">
<template slot-scope="props">
Expand Down Expand Up @@ -91,7 +95,7 @@
]).then(([res, permission]) => {
this.artifactories = res.records.map(item => ({
...item,
icon: extForFile(item.name)
icon: item.folder ? 'folder' : extForFile(item.name)
})) || []
this.hasPermission = permission
if (this.artifactories.length <= 0) {
Expand Down Expand Up @@ -127,8 +131,21 @@
return typeMap[cellValue]
},
sizeFormatter (row, column, cellValue, index) {
sizeFormatter (cellValue) {
return (cellValue >= 0 && convertFileSize(cellValue, 'B')) || ''
},
getFolderSize (payload) {
if (!payload.folder) return '0'
return this.getValuesByKey(payload.properties, 'size')
},
getValuesByKey (data, key) {
for (const item of data) {
if (key.includes(item.key)) {
return item.value
}
}
}
}
}
Expand Down

0 comments on commit a43d8cf

Please sign in to comment.