Skip to content

Commit

Permalink
Merge pull request TencentBlueKing#1102 from lannoy0523/issue_1012
Browse files Browse the repository at this point in the history
feat:二进制页面修改 TencentBlueKing#1012
  • Loading branch information
owenlxu authored Sep 11, 2023
2 parents eff8d65 + 126c874 commit ad43ec8
Show file tree
Hide file tree
Showing 9 changed files with 401 additions and 27 deletions.
88 changes: 88 additions & 0 deletions src/frontend/devops-repository/src/components/Loading/loading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>
<bk-dialog
:position="{ top }"
header-position="left"
:title="title"
width="600"
v-model="isShow">
<slot></slot>
<div class="message">
<Icon v-if="!complete" name="loading" size="20" class="svg-loading" />
<Icon v-if="complete" name="check" size="20" class="svg-complete" />
<span>{{ message }}</span>
</div>
<template #footer>
<slot name="footer">
<bk-button @click="isShow = false" v-if="!complete">{{$t('cancel')}}</bk-button>
<bk-button theme="primary" @click="isShow = false" v-if="complete">{{$t('confirm')}}</bk-button>
</slot>
</template>
</bk-dialog>
</template>
<script>
import { debounce } from '@repository/utils'
export default {
name: 'loadingDialog',
props: {
heightNum: {
type: [String, Number],
default: 600
}
},
data () {
return {
MODE_CONFIG,
title: '',
isShow: false,
message: this.$t('loadingMsg'),
complete: false
}
},
computed: {
top () {
return 300
}
},
mounted () {
this.resizeFn = debounce(this.getBodyHeight, 1000)
window.addEventListener('resize', this.resizeFn)
},
beforeDestroy () {
this.message = this.$t('loadingMsg')
window.removeEventListener('resize', this.resizeFn)
},
methods: {
getBodyHeight () {
this.bodyHeight = document.body.getBoundingClientRect().height
}
}
}
</script>
<style lang="scss" scoped>
.bk-dialog-content bk-dialog-content-drag{
width: 500px !important;
}
.message {
display: flex;
align-items: center;
justify-content: center;
height: 200px;
font-size: 16px;
.svg-loading {
margin-right: 10px;
animation: rotate-loading 1s linear infinite;
}
.svg-complete {
margin-right: 10px;
}
@keyframes rotate-loading {
0% {
transform: rotateZ(0);
}
100% {
transform: rotateZ(360deg);
}
}
}
</style>
96 changes: 96 additions & 0 deletions src/frontend/devops-repository/src/images/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/frontend/devops-repository/src/images/loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions src/frontend/devops-repository/src/store/actions/repoGeneric.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default {
)
},
// 仓库内自定义查询
getArtifactoryList (_, { projectId, repoName, name, fullPath, current, limit, isPipeline = false, sortType = 'lastModifiedDate', searchFlag }) {
getArtifactoryList (_, { projectId, repoName, name, fullPath, current, limit, isPipeline = false, sortType, searchFlag }) {
if (isPipeline && !fullPath && !name) {
return Vue.prototype.$ajax.get(
`${prefix}/pipeline/list/${projectId}`
Expand All @@ -140,10 +140,7 @@ export default {
pageNumber: current,
pageSize: limit
},
sort: {
properties: ['folder', sortType],
direction: 'DESC'
},
sort: sortType,
rule: {
rules: [
{
Expand Down Expand Up @@ -315,5 +312,10 @@ export default {
return Vue.prototype.$ajax.get(
`generic/compressed/preview/${projectId}/${repoName}${path}?filePath=${filePath}`
)
},
getProjectMetrics (_, { projectId }) {
return Vue.prototype.$ajax.get(
`${prefix}/project/metrics/${projectId}`
)
}
}
8 changes: 6 additions & 2 deletions src/frontend/devops-repository/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import createLocale from '@locale'
* 转换文件大小
*/
export function convertFileSize (size, unit = 'B') {
const arr = ['B', 'KB', 'MB', 'GB', 'TB']
const arr = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
const index = arr.findIndex(v => v === unit)
if (size > 1024) {
return convertFileSize(size / 1024, arr[index + 1])
if (arr[index + 1]) {
return convertFileSize(size / 1024, arr[index + 1])
} else {
return `${index ? size.toFixed(2) : size}${unit}`
}
} else {
return `${index ? size.toFixed(2) : size}${unit}`
}
Expand Down
Loading

0 comments on commit ad43ec8

Please sign in to comment.