Skip to content

Commit

Permalink
feat:节点清理显示清理详情 #1499
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 committed Dec 1, 2023
1 parent 76035e0 commit 2e12c64
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
14 changes: 12 additions & 2 deletions src/frontend/devops-repository/src/components/Loading/loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
v-model="isShow">
<slot></slot>
<div v-if="backUp" class="mainBackUpBody">
<div>
<div class="iconBackUpBody">
<Icon v-if="!complete && !backUp" name="loading" size="20" class="svg-loading" />
<Icon v-else-if="!complete && backUp" name="circle-2-1" size="20" style="color: #3a84ff" class="svg-loading" />
<Icon v-else name="check" size="20" class="svg-complete" />
Expand All @@ -17,7 +17,7 @@
<span class="subMessage">{{ subMessage }}</span>
</div>
<div v-else class="mainBody">
<div>
<div class="iconBody">
<Icon v-if="!complete && !backUp" name="loading" size="20" class="svg-loading" />
<Icon v-else-if="!complete && backUp" name="circle-2-1" size="20" style="color: #3a84ff" class="svg-loading" />
<Icon v-else name="check" size="20" class="svg-complete" />
Expand Down Expand Up @@ -98,6 +98,11 @@ body .bk-dialog-wrapper .bk-dialog-body {
.svg-complete {
margin-right: 10px;
}
.iconBody{
display: flex;
align-items: center;
justify-content: center;
}
.mainMessage{
font-size: 16px;
}
Expand Down Expand Up @@ -128,6 +133,11 @@ body .bk-dialog-wrapper .bk-dialog-body {
.svg-complete {
margin-right: 10px;
}
.iconBackUpBody{
display: flex;
align-items: center;
justify-content: center;
}
.mainMessage{
font-size: 16px;
font-weight: bold;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@
<bk-form-item :label="$t('cleanNode')" :required="true" property="path" error-display-type="normal">
<div v-if="displayPaths.length">
<div v-for="(item,index) in displayPaths " :key="index">
<bk-input v-model="item.path" style="margin-bottom: 10px; width: 260px" disabled="true" />
<bk-input v-if="item.isComplete" v-model="item.path" style="width: 260px" disabled="true" />
<bk-input v-else v-model="item.path" style="margin-bottom: 10px;width: 260px" disabled="true" />
<Icon name="right" v-if="item.isComplete" size="14" />
<div class="form-tip" v-if="item.isComplete" style="margin-bottom: 5px">{{ item.tip }}</div>
</div>
</div>
<div v-else>
<div v-for="(item,index) in paths " :key="index">
<bk-input v-model="item.path" style="margin-bottom: 10px; width: 260px" disabled="true" />
<bk-input v-if="item.isComplete" v-model="item.path" style="width: 260px" disabled="true" />
<bk-input v-else v-model="item.path" style="margin-bottom: 10px;width: 260px" disabled="true" />
<Icon name="right" v-if="item.isComplete" size="14" />
<div class="form-tip" v-if="item.isComplete" style="margin-bottom: 5px">{{ item.tip }}</div>
</div>
</div>
</bk-form-item>
<bk-form-item :label="$t('deadline')" :required="true" property="date" error-display-type="normal">
<bk-date-picker v-model="date" :clearable="false" :type="'datetime'"></bk-date-picker>
<bk-date-picker v-model="date" :clearable="false" :type="'datetime'" @change="resetStatus" :disabled="doing && !isComplete"></bk-date-picker>
<div class="form-tip">{{$t('cleanFolderTip')}}</div>
</bk-form-item>
</bk-form>
Expand All @@ -35,6 +39,7 @@

<script>
import { mapActions } from 'vuex'
import { convertFileSize } from '@repository/utils'
export default {
name: 'genericCleanDialog',
data () {
Expand Down Expand Up @@ -72,10 +77,12 @@
await this.cleanNode({
path: path,
date: this.date instanceof Date ? this.date.toISOString() : undefined
}).then(() => {
}).then((res) => {
this.paths[i].isComplete = true
this.paths[i].tip = this.$t('cleanDetail', { 0: res.deletedNumber, 1: convertFileSize(res.deletedSize) })
if (this.displayPaths.length === this.paths.length) {
this.displayPaths[i].isComplete = true
this.displayPaths[i].tip = this.$t('cleanDetail', { 0: res.deletedNumber, 1: convertFileSize(res.deletedSize) })
}
completeNum++
})
Expand All @@ -89,6 +96,18 @@
this.show = false
this.$emit('refresh')
this.doing = false
},
resetStatus () {
if (this.doing === true && this.isComplete === true) {
this.doing = false
this.isComplete = false
for (let i = 0; i < this.paths.length; i++) {
this.paths[i].isComplete = false
if (this.displayPaths.length === this.paths.length) {
this.displayPaths[i].isComplete = false
}
}
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/locale/repository/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,10 @@
"backUpMessage": "{0} is an internal testing version and is being downloaded, please wait.",
"deadline": "Deadline",
"clean": "Clean",
"cleanNode": "Clean Folder",
"cleanNode": "Folders",
"cleanNodeTitle": "Clean Folder",
"complete": "Done",
"cleanFolderTip": "Files uploaded before the deadline will be cleared",
"cleanRepo": "Clean"
"cleanRepo": "Clean",
"cleanDetail": "Cleaned {0} files in total, size {1}"
}
3 changes: 2 additions & 1 deletion src/frontend/locale/repository/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -805,5 +805,6 @@
"cleanNodeTitle": "清理目录节点",
"complete": "完成",
"cleanFolderTip": "截止时间之前上传的文件将被清理",
"cleanRepo": "清理"
"cleanRepo": "清理",
"cleanDetail": "共清理文件{0}个,大小{1}"
}

0 comments on commit 2e12c64

Please sign in to comment.