Skip to content

Commit

Permalink
Merge pull request #7523 from normal-wls/release_V3.33.1
Browse files Browse the repository at this point in the history
release v3.33.1
  • Loading branch information
normal-wls authored Jul 24, 2024
2 parents c1ab7a9 + 3e42b48 commit dc7a4d7
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 100 deletions.
2 changes: 1 addition & 1 deletion app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ is_use_celery: True
author: 蓝鲸智云
introduction: 标准运维是通过一套成熟稳定的任务调度引擎,把在多系统间的工作整合到一个流程,助力运维实现跨系统调度自动化的SaaS应用。
introduction_en: SOPS is a SaaS application that utilizes a set of mature and stable task scheduling engines to help realize cross-system scheduling automation, and integrates the work among multiple systems into a single process.
version: 3.33.0
version: 3.33.1
category: 运维工具
language_support: 中文
desktop:
Expand Down
2 changes: 1 addition & 1 deletion app_desc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spec_version: 2
app_version: "3.33.0"
app_version: "3.33.1"
app:
region: default
bk_app_code: bk_sops
Expand Down
8 changes: 7 additions & 1 deletion config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
# mako模板中:<script src="/a.js?v=${ STATIC_VERSION }"></script>
# 如果静态资源修改了以后,上线前改这个版本号即可

STATIC_VERSION = "3.33.0"
STATIC_VERSION = "3.33.1"
DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S")

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
Expand Down Expand Up @@ -887,3 +887,9 @@ def check_engine_admin_permission(request, *args, **kwargs):
"ot_endpoint": env.BK_AUDIT_ENDPOINT,
"bk_data_token": env.BK_AUDIT_DATA_TOKEN,
}


# 自定义 Broker
if "BKAPP_SOPS_BROKER_URL" in os.environ:
BROKER_URL = os.getenv("BKAPP_SOPS_BROKER_URL")
print(f"BROKER_URL: {BROKER_URL}")
4 changes: 2 additions & 2 deletions frontend/desktop/src/pages/task/PeriodicList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
selectedPeriodicId: undefined,
periodicList: [],
collectingId: '', // 正在被收藏/取消收藏的周期任务id
selectedCron: '*/5 * * * *',
selectedCron: '*/30 * * * *',
constants: {},
modifyDialogLoading: false,
periodEntrance: '',
Expand Down Expand Up @@ -851,7 +851,7 @@
this.curRow = {}
this.constants = {}
this.editTask = false
this.selectedCron = '*/5 * * * *'
this.selectedCron = '*/30 * * * *'
this.isModifyDialogShow = true
},
onCreateTaskCancel () {
Expand Down
227 changes: 132 additions & 95 deletions frontend/desktop/src/pages/task/TaskList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@
<bk-table
ref="templateTable"
:data="taskList"
:pagination="pagination"
:size="setting.size"
:max-height="tableMaxHeight"
:row-class-name="getRowClassName"
:key="listLoading"
v-bkloading="{ isLoading: !firstLoading && listLoading, opacity: !firstLoading && taskList.length ? 0.6 : 1, zIndex: 100 }"
@row-click="selectedTaskId = ''"
@page-change="onPageChange"
@page-limit-change="onPageLimitChange">
@row-click="selectedTaskId = ''">
<bk-table-column
v-for="item in setting.selectedFields"
:key="item.id"
Expand Down Expand Up @@ -170,6 +166,18 @@
</NoData>
</div>
</bk-table>
<bk-pagination
class="bk-table-pagination-wrapper"
v-bkloading="{ isLoading: countLoading || listLoading, zIndex: 100 }"
size="small"
v-bind="pagination"
:location="'left'"
:align="'right'"
:show-limit="true"
:show-total-count="true"
@change="onPageChange"
@limit-change="onPageLimitChange">
</bk-pagination>
</div>
</div>
</skeleton>
Expand Down Expand Up @@ -364,6 +372,7 @@
return {
firstLoading: true,
listLoading: false,
countLoading: false,
templateId: this.$route.query.template_id,
searchStr: '',
executeStatus: {}, // 任务执行状态
Expand Down Expand Up @@ -413,7 +422,7 @@
deletaLoading: false,
initOpenTask: [],
selectedTaskId: '',
tableMaxHeight: window.innerHeight - 180
tableMaxHeight: window.innerHeight - 180 - 63 // 63为分页高度
}
},
computed: {
Expand Down Expand Up @@ -444,7 +453,8 @@
]),
...mapActions('taskList/', [
'loadTaskList',
'deleteTask'
'deleteTask',
'loadTaskCount'
]),
...mapMutations('template/', [
'setProjectBaseInfo'
Expand All @@ -456,102 +466,19 @@
// 空字符串需要转换为undefined,undefined数据在axios请求发送过程中会被删除
this.listLoading = true
try {
const { start_time, create_time, finish_time, creator, executor, statusSync, taskName, task_id, create_method, recorded_executor_proxy } = this.requestData
let pipeline_instance__is_started
let pipeline_instance__is_finished
let pipeline_instance__is_revoked
let task_instance_status
switch (statusSync) {
case 'nonExecution':
pipeline_instance__is_started = false
break
// case 'failed':
// case 'pause':
case 'running':
pipeline_instance__is_started = true
pipeline_instance__is_finished = false
pipeline_instance__is_revoked = false
// task_instance_status = statusSync
break
case 'revoked':
pipeline_instance__is_revoked = true
break
case 'finished':
pipeline_instance__is_finished = true
break
case 'pending_processing':
pipeline_instance__is_started = true
pipeline_instance__is_finished = false
pipeline_instance__is_revoked = false
task_instance_status = 'pending_processing'
break
}
const data = {
limit: this.pagination.limit,
offset: (this.pagination.current - 1) * this.pagination.limit,
template_id: this.templateId || undefined,
pipeline_instance__creator__contains: creator || undefined,
pipeline_instance__executor__contains: executor || undefined,
pipeline_instance__name__icontains: taskName || undefined,
pipeline_instance__is_started,
pipeline_instance__is_finished,
pipeline_instance__is_revoked,
create_info: this.createInfo || undefined,
project__id: this.project_id,
template_source: this.templateSource || undefined,
id: task_id || undefined,
create_method: create_method || undefined,
recorded_executor_proxy: recorded_executor_proxy || undefined,
is_child_taskflow: false,
task_instance_status: task_instance_status || undefined
}
if (start_time && start_time[0] && start_time[1]) {
if (this.template_source === 'common') {
data['pipeline_template__start_time__gte'] = moment(start_time[0]).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_template__start_time__lte'] = moment(start_time[1]).format('YYYY-MM-DD HH:mm:ss')
} else {
data['pipeline_instance__start_time__gte'] = moment.tz(start_time[0], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_instance__start_time__lte'] = moment.tz(start_time[1], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
}
}
if (create_time && create_time[0] && create_time[1]) {
if (this.template_source === 'common') {
data['pipeline_template__create_time__gte'] = moment(create_time[0]).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_template__create_time__lte'] = moment(create_time[1]).format('YYYY-MM-DD HH:mm:ss')
} else {
data['pipeline_instance__create_time__gte'] = moment.tz(create_time[0], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_instance__create_time__lte'] = moment.tz(create_time[1], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
}
}
if (finish_time && finish_time[0] && finish_time[1]) {
if (this.template_source === 'common') {
data['pipeline_template__finish_time__gte'] = moment(finish_time[0]).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_template__finish_time__lte'] = moment(finish_time[1]).format('YYYY-MM-DD HH:mm:ss')
} else {
data['pipeline_instance__finish_time__gte'] = moment.tz(finish_time[0], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_instance__finish_time__lte'] = moment.tz(finish_time[1], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
}
}
const params = this.getQuery()
params.without_count = true
const source = new CancelRequest()
const taskListData = await this.loadTaskList({
params: data,
params,
config: { cancelToken: source.token }
})
const list = taskListData.results
// 设置level初始值
list.forEach(item => {
item.level = 0
})
this.pagination.count = taskListData.count
this.totalCount = taskListData.count
const totalPage = Math.ceil(this.pagination.count / this.pagination.limit)
if (!totalPage) {
this.totalPage = 1
} else {
this.totalPage = totalPage
}
const result = await this.setListHaveChild(list)
// mixins getExecuteStatus
this.getExecuteStatus('executeStatus', result)
Expand All @@ -570,6 +497,111 @@
this.listLoading = false
}
},
async getTaskCount () {
this.countLoading = true
try {
const params = this.getQuery()
const source = new CancelRequest('task-count')
const resp = await this.loadTaskCount({
params,
config: { cancelToken: source.token }
})
this.pagination.count = resp.count
this.totalCount = resp.count
const totalPage = Math.ceil(this.pagination.count / this.pagination.limit)
if (!totalPage) {
this.totalPage = 1
} else {
this.totalPage = totalPage
}
} catch (error) {
this.countLoading = error.message === 'cancelled'
console.warn(error)
} finally {
this.countLoading = false
}
},
getQuery () {
const { start_time, create_time, finish_time, creator, executor, statusSync, taskName, task_id, create_method, recorded_executor_proxy } = this.requestData
let pipeline_instance__is_started
let pipeline_instance__is_finished
let pipeline_instance__is_revoked
let task_instance_status
switch (statusSync) {
case 'nonExecution':
pipeline_instance__is_started = false
break
// case 'failed':
// case 'pause':
case 'running':
pipeline_instance__is_started = true
pipeline_instance__is_finished = false
pipeline_instance__is_revoked = false
// task_instance_status = statusSync
break
case 'revoked':
pipeline_instance__is_revoked = true
break
case 'finished':
pipeline_instance__is_finished = true
break
case 'pending_processing':
pipeline_instance__is_started = true
pipeline_instance__is_finished = false
pipeline_instance__is_revoked = false
task_instance_status = 'pending_processing'
break
}
const data = {
limit: this.pagination.limit,
offset: (this.pagination.current - 1) * this.pagination.limit,
template_id: this.templateId || undefined,
pipeline_instance__creator__contains: creator || undefined,
pipeline_instance__executor__contains: executor || undefined,
pipeline_instance__name__icontains: taskName || undefined,
pipeline_instance__is_started,
pipeline_instance__is_finished,
pipeline_instance__is_revoked,
create_info: this.createInfo || undefined,
project__id: this.project_id,
template_source: this.templateSource || undefined,
id: task_id || undefined,
create_method: create_method || undefined,
recorded_executor_proxy: recorded_executor_proxy || undefined,
is_child_taskflow: false,
task_instance_status: task_instance_status || undefined
}
if (start_time && start_time[0] && start_time[1]) {
if (this.template_source === 'common') {
data['pipeline_template__start_time__gte'] = moment(start_time[0]).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_template__start_time__lte'] = moment(start_time[1]).format('YYYY-MM-DD HH:mm:ss')
} else {
data['pipeline_instance__start_time__gte'] = moment.tz(start_time[0], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_instance__start_time__lte'] = moment.tz(start_time[1], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
}
}
if (create_time && create_time[0] && create_time[1]) {
if (this.template_source === 'common') {
data['pipeline_template__create_time__gte'] = moment(create_time[0]).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_template__create_time__lte'] = moment(create_time[1]).format('YYYY-MM-DD HH:mm:ss')
} else {
data['pipeline_instance__create_time__gte'] = moment.tz(create_time[0], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_instance__create_time__lte'] = moment.tz(create_time[1], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
}
}
if (finish_time && finish_time[0] && finish_time[1]) {
if (this.template_source === 'common') {
data['pipeline_template__finish_time__gte'] = moment(finish_time[0]).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_template__finish_time__lte'] = moment(finish_time[1]).format('YYYY-MM-DD HH:mm:ss')
} else {
data['pipeline_instance__finish_time__gte'] = moment.tz(finish_time[0], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
data['pipeline_instance__finish_time__lte'] = moment.tz(finish_time[1], this.timeZone).format('YYYY-MM-DD HH:mm:ss')
}
}
return data
},
// 设置每条记录是否有子流程
async setListHaveChild (list) {
const ids = list.map(item => item.id)
Expand Down Expand Up @@ -781,7 +813,8 @@
) {
this.pagination.current -= 1
}
await this.getTaskList()
this.getTaskList()
this.getTaskCount()
this.$bkMessage({
message: i18n.t('任务') + i18n.t('删除成功!'),
theme: 'success'
Expand Down Expand Up @@ -949,12 +982,14 @@
this.pagination.current = page
this.updateUrl()
this.getTaskList()
this.getTaskCount()
},
onPageLimitChange (val) {
this.pagination.limit = val
this.pagination.current = 1
this.updateUrl()
this.getTaskList()
this.getTaskCount()
},
updateUrl () {
const { current, limit } = this.pagination
Expand Down Expand Up @@ -1008,6 +1043,7 @@
async getData () {
Promise.all([
this.getTaskList(),
this.getTaskCount(),
this.getCreateMethod(),
this.getBizBaseInfo()
]).catch(e => {
Expand Down Expand Up @@ -1055,6 +1091,7 @@
this.templateSource = ''
this.updateUrl()
this.getTaskList()
this.getTaskCount()
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/desktop/src/store/modules/taskList.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const taskList = {
create_info: app_id
}
return axios.post(`taskflow/api/clone/${projectId}/`, dataJson).then(response => response.data)
},
loadTaskCount ({ commit }, data) {
const { params, config = {} } = data
return axios.get('api/v3/taskflow/task_count/', { params, ...config }).then(response => response.data.data)
}
}
}
Expand Down

0 comments on commit dc7a4d7

Please sign in to comment.