Skip to content

Commit

Permalink
feat: 增加制品预加载功能管理页面 #2683
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 committed Nov 4, 2024
1 parent 57e98c4 commit faf90b2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@
</template>
</el-autocomplete>
</el-form-item>
<el-form-item label="文件路径" prop="fullPath">
<el-input v-model="plan.fullPath" style="height: 40px ; width: 500px;" :rules="[{ required: true, message: '文件路径不能为空'}]" />
<el-form-item label="文件路径" prop="fullPath" :rules="[{ required: true, message: '文件路径不能为空'}]">
<el-input v-model="plan.fullPath" style="height: 40px ; width: 500px;" />
</el-form-item>
<el-form-item label="预加载计划执行毫秒时间戳" prop="executeTime">
<el-input-number v-model="plan.executeTime" controls-position="right" :min="1" />
<el-date-picker
v-model="plan.executeTime"
type="datetime"
placeholder="选择日期时间"
default-time="12:00:00"
/>
</el-form-item>
</el-form>
<div slot="footer">
Expand Down Expand Up @@ -78,7 +83,7 @@ export default {
watch: {
visible: function(newVal) {
if (newVal) {
this.resetFileCache()
this.resetPlan()
this.showDialog = true
} else {
this.close()
Expand Down Expand Up @@ -117,7 +122,7 @@ export default {
return obj.name.toLowerCase().indexOf(queryStr.toLowerCase()) !== -1
}) : arr
},
resetFileCache() {
resetPlan() {
this.plan = this.newPlan()
this.$nextTick(() => {
this.$refs['form'].clearValidate()
Expand All @@ -141,12 +146,15 @@ export default {
this.$emit('update:visible', false)
},
handleUpdate() {
if (this.createMode) {
createPlan(this.plan).then(() => {
this.$message.success('新建配置成功')
this.close(true)
})
}
this.$refs['form'].validate((valid) => {
if (valid) {
this.plan.executeTime = this.plan.executeTime.getTime()
createPlan(this.plan).then(() => {
this.$message.success('新建配置成功')
this.close(true)
})
}
})
}
}
}
Expand Down
15 changes: 12 additions & 3 deletions src/frontend/devops-op/src/views/preload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@
</el-table-column>
<el-table-column v-if="clientQuery.type!=='strategy'" key="fullPath" prop="fullPath" label="文件路径" align="center" />
<el-table-column v-if="clientQuery.type!=='strategy'" key="sha256" prop="sha256" label="SHA256" align="center" />
<el-table-column v-if="clientQuery.type!=='strategy'" key="size" prop="size" label="文件大小(B)" align="center" />
<el-table-column v-if="clientQuery.type!=='strategy'" key="size" prop="size" label="文件大小" align="center">
<template slot-scope="scope">
<span>
{{ convertFileSize(scope.row.size) }}
</span>
</template>
</el-table-column>
<el-table-column v-if="clientQuery.type!=='strategy'" key="credentialsKey" prop="credentialsKey" label="CredentialsKey" align="center" />
<el-table-column v-if="clientQuery.type!=='strategy'" key="executeTime" prop="executeTime" label="预加载计划时间" align="center">
<template slot-scope="scope">
Expand Down Expand Up @@ -193,7 +199,10 @@ export default {
this.total = 0
this.clientQuery.pageNumber = 1
this.clientQuery.currentPage = 1
this.$router.push({ name: 'PreloadConfig' })
const query = {
type: this.clientQuery.type
}
this.$router.push({ name: 'PreloadConfig', query: query })
},
queryProjects(queryStr, cb) {
searchProjects(queryStr).then(res => {
Expand Down Expand Up @@ -242,11 +251,11 @@ export default {
onRouteUpdate(route) {
const query = route.query
const clientQuery = this.clientQuery
this.clientQuery.type = query.type ? query.type : this.clientQuery.type
if (clientQuery.projectId.trim() === '' && (!query.projectId || query.projectId === '' || query.projectId === undefined)) {
return
}
clientQuery.projectId = query.projectId ? query.projectId : ''
clientQuery.type = query.type ? query.type : this.clientQuery.type
clientQuery.repoName = query.repoName ? query.repoName : ''
clientQuery.pageNumber = query.page ? Number(query.page) : 1
this.$nextTick(() => {
Expand Down

0 comments on commit faf90b2

Please sign in to comment.