Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:二进制页面修改 #1012 #1102

Merged
merged 4 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
19 changes: 14 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,17 @@ export default {
return Vue.prototype.$ajax.get(
`generic/compressed/preview/${projectId}/${repoName}${path}?filePath=${filePath}`
)
},
getProjectMetrics (_, { projectId }) {
return Vue.prototype.$ajax.get(
'/opdata/api/project/metrics/list',
{
params: {
pageNumber: 1,
pageSize: 1,
projectId: 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
Loading