Skip to content

Commit

Permalink
feat: 增加制品预加载功能管理页面 #2683
Browse files Browse the repository at this point in the history
  • Loading branch information
lannoy0523 committed Nov 5, 2024
1 parent 175d9fe commit 8c78e55
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@
</template>
</el-autocomplete>
</el-form-item>
<el-form-item label="文件路径" prop="fullPathRegex" :rules="[{ required: true, message: '文件路径不能为空'}]">
<el-input v-model="strategy.fullPathRegex" style="height: 40px ; width: 500px;" />
</el-form-item>
<el-form-item label="最小大小" prop="minSize">
<el-input-number v-model="strategy.minSize" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="最近时间内(秒)" prop="recentSeconds">
<el-input-number v-model="strategy.recentSeconds" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="预加载时间(cron表达式)" prop="preloadCron">
<el-input v-model="strategy.preloadCron" style="height: 40px ; width: 500px;" />
</el-form-item>
<el-form-item label="策略类型" prop="type">
<el-select
v-model="strategy.type"
Expand All @@ -57,9 +45,22 @@
:key="item.value"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
<el-form-item label="文件路径" prop="fullPathRegex" :rules="[{ required: true, message: '文件路径不能为空'}]">
<el-input v-model="strategy.fullPathRegex" style="height: 40px ; width: 500px;" />
</el-form-item>
<el-form-item label="最小大小" prop="minSize">
<el-input-number v-model="strategy.minSize" controls-position="right" :min="1" />
</el-form-item>
<el-form-item label="最近时间内(秒)" prop="recentSeconds">
<el-input-number v-model="strategy.recentSeconds" controls-position="right" :min="1" />
</el-form-item>
<el-form-item v-if="strategy.type !== 'INTELLIGENT'" label="预加载时间(cron表达式)" prop="preloadCron">
<el-input v-model="strategy.preloadCron" style="height: 40px ; width: 500px;" />
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="close">取 消</el-button>
Expand Down Expand Up @@ -98,7 +99,9 @@ export default {
{ value: 'CUSTOM',
label: '自定义' },
{ value: 'CUSTOM_GENERATED',
label: '系统自定义类型' },
label: '系统自定义类型',
disabled: true
},
{ value: 'INTELLIGENT',
label: '智能预加载策略' }
]
Expand Down Expand Up @@ -177,7 +180,7 @@ export default {
this.$emit('update:visible', false)
},
handleUpdate() {
this.$refs['form'].validate((valid) =>{
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.strategy.preloadCron === '') {
this.strategy.preloadCron = null
Expand Down
38 changes: 10 additions & 28 deletions src/frontend/devops-op/src/views/preload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="app-container node-container">
<el-form ref="form" :inline="true" :model="clientQuery">
<el-form-item label="配置类型" style="margin-left: 15px">
<el-select v-model="clientQuery.type" placeholder="请选择" @change="typeChanged">
<el-select v-model="clientQuery.type" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
Expand Down Expand Up @@ -57,7 +57,7 @@
<el-form-item v-if="clientQuery.type === 'plan'">
<el-button
size="mini"
type="primary"
type="danger"
:disabled="!clientQuery.projectId"
@click="handleDeleteAll()"
>删除全部</el-button>
Expand All @@ -66,20 +66,6 @@
<el-table v-loading="loading" :data="preloadData" style="width: 100%">
<el-table-column prop="projectId" label="项目ID" align="center" />
<el-table-column prop="repoName" label="仓库名称" align="center" />
<el-table-column prop="createdDate" label="创建时间" align="center">
<template slot-scope="scope">
<span>
{{ formatNormalDate(scope.row.createdDate) }}
</span>
</template>
</el-table-column>
<el-table-column prop="lastModifiedDate" label="修改时间" align="center">
<template slot-scope="scope">
<span>
{{ formatNormalDate(scope.row.lastModifiedDate) }}
</span>
</template>
</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="文件大小" align="center">
Expand All @@ -97,8 +83,6 @@
</span>
</template>
</el-table-column>
<el-table-column v-if="clientQuery.type==='strategy'" key="createdBy" prop="createdBy" label="创建人" align="center" />
<el-table-column v-if="clientQuery.type==='strategy'" key="lastModifiedBy" prop="lastModifiedBy" label="修改人" align="center" />
<el-table-column v-if="clientQuery.type==='strategy'" key="fullPathRegex" prop="fullPathRegex" label="文件路径" align="center" />
<el-table-column v-if="clientQuery.type==='strategy'" key="minSize" prop="minSize" label="最小大小" align="center" />
<el-table-column v-if="clientQuery.type==='strategy'" key="recentSeconds" prop="recentSeconds" label="最近时间内(秒)" align="center" />
Expand Down Expand Up @@ -190,20 +174,18 @@ export default {
createMode: false
}
},
mounted() {
this.onRouteUpdate(this.$route)
},
methods: {
typeChanged() {
watch: {
'clientQuery.type'(newType) {
this.preloadData = []
this.total = 0
this.clientQuery.pageNumber = 1
this.clientQuery.currentPage = 1
const query = {
type: this.clientQuery.type
}
this.$router.push({ name: 'PreloadConfig', query: query })
},
}
},
mounted() {
this.onRouteUpdate(this.$route)
},
methods: {
queryProjects(queryStr, cb) {
searchProjects(queryStr).then(res => {
this.projects = res.data.records
Expand Down

0 comments on commit 8c78e55

Please sign in to comment.