Skip to content

Commit

Permalink
Merge pull request #7254 from hanshuaikang/merged_hb
Browse files Browse the repository at this point in the history
feat: 任务状态优化
  • Loading branch information
hanshuaikang authored Dec 20, 2023
2 parents 4b813df + 66f6c3d commit a3f2385
Show file tree
Hide file tree
Showing 85 changed files with 1,829 additions and 876 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.31.0
version: 3.32.0-alpha
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.31.0"
app_version: "3.32.0-alpha"
app:
region: default
bk_app_code: bk_sops
Expand Down
13 changes: 6 additions & 7 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ const Configuration = {
2,
'always',
[
'feature',
'bugfix',
'minor',
'optimization',
'sprintfix',
'feat',
'fix',
'docs',
'style',
'refactor',
'test',
'docs',
'merge',
'perf',
'chore',
],
]
},
Expand Down
14 changes: 13 additions & 1 deletion config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
# mako模板中:<script src="/a.js?v=${ STATIC_VERSION }"></script>
# 如果静态资源修改了以后,上线前改这个版本号即可

STATIC_VERSION = "3.31.0"
STATIC_VERSION = "3.32.0-alpha"
DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S")

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
Expand Down Expand Up @@ -460,6 +460,7 @@ def _(s):
"random": "random",
"time": "time",
"os.path": "os.path",
"json": "json",
}

if env.SOPS_MAKO_IMPORT_MODULES:
Expand Down Expand Up @@ -505,6 +506,8 @@ def _(s):
CELERY_QUEUES.extend(taskflow3_celery_settings.CELERY_QUEUES)
CELERY_QUEUES.extend(cleaner_settings.CELERY_QUEUES)

CELERY_ROUTES.update({"gcloud.clocked_task.tasks.clocked_task_start": PIPELINE_ADDITIONAL_PRIORITY_ROUTING})

# CELERY与RabbitMQ增加60秒心跳设置项
BROKER_HEARTBEAT = 60
BROKER_POOL_LIMIT = env.CELERY_BROKER_POOL_LIMIT
Expand Down Expand Up @@ -772,6 +775,8 @@ def monitor_report_config():
V2_TASK_VALIDITY_DAY = env.V2_TASK_VALIDITY_DAY
CLEAN_EXPIRED_V2_TASK_BATCH_NUM = env.CLEAN_EXPIRED_V2_TASK_BATCH_NUM
CLEAN_EXPIRED_V2_TASK_INSTANCE = env.CLEAN_EXPIRED_V2_TASK_INSTANCE
CLEAN_EXPIRED_V2_TASK_CREATE_METHODS = env.CLEAN_EXPIRED_V2_TASK_CREATE_METHODS
CLEAN_EXPIRED_V2_TASK_PROJECTS = env.CLEAN_EXPIRED_V2_TASK_PROJECTS

# 是否启动swagger ui
ENABLE_SWAGGER_UI = env.ENABLE_SWAGGER_UI
Expand Down Expand Up @@ -832,5 +837,12 @@ def check_engine_admin_permission(request, *args, **kwargs):
# 任务列表过滤失败任务最大天数
TASK_LIST_STATUS_FILTER_DAYS = env.BKPAAS_TASK_LIST_STATUS_FILTER_DAYS

# 第三方插件特殊轮询时间配置
REMOTE_PLUGIN_FIX_INTERVAL_CODES = env.REMOTE_PLUGIN_FIX_INTERVAL_CODES
REMOTE_PLUGIN_FIX_INTERVAL = env.REMOTE_PLUGIN_FIX_INTERVAL

# 支持限制接口的 app
ALLOWED_LIMITED_API_APPS = env.ALLOWED_LIMITED_API_APPS

# 报错联系助手链接
MESSAGE_HELPER_URL = env.MESSAGE_HELPER_URL
13 changes: 13 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
V2_TASK_VALIDITY_DAY = int(os.getenv("BKAPP_V2_TASK_VALIDITY_DAY", 730))
CLEAN_EXPIRED_V2_TASK_BATCH_NUM = int(os.getenv("BKAPP_CLEAN_EXPIRED_V2_TASK_BATCH_NUM", 100))
CLEAN_EXPIRED_V2_TASK_INSTANCE = bool(os.getenv("BKAPP_CLEAN_EXPIRED_V2_TASK_INSTANCE", False))
CLEAN_EXPIRED_V2_TASK_CREATE_METHODS = os.getenv("BKAPP_CLEAN_EXPIRED_V2_TASK_CREATE_METHODS", "periodic").split(",")
# 没有配置则默认清除所有项目
CLEAN_EXPIRED_V2_TASK_PROJECTS = json.loads(os.getenv("BKAPP_CLEAN_EXPIRED_V2_TASK_PROJECTS", "[]"))

# 是否启动swagger ui
ENABLE_SWAGGER_UI = os.getenv("BKAPP_ENABLE_SWAGGER_UI", False)
Expand Down Expand Up @@ -121,5 +124,15 @@
# 默认六个月
BKPAAS_TASK_LIST_STATUS_FILTER_DAYS = int(os.getenv("BKPAAS_TASK_LIST_STATUS_FILTER_DAYS", 180))

# 第三方插件特殊轮询时间配置
REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR = os.getenv("BKAPP_REMOTE_PLUGIN_FIX_INTERVAL_CODES", "")
REMOTE_PLUGIN_FIX_INTERVAL_CODES = (
REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR.split(",") if REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR else []
)
REMOTE_PLUGIN_FIX_INTERVAL = int(os.getenv("BKAPP_REMOTE_PLUGIN_FIX_INTERVAL", 60))

# 支持限制接口的 app
ALLOWED_LIMITED_API_APPS = [app for app in os.getenv("BKAPP_ALLOWED_LIMITED_API_APPS", "").split(",") if app]

# 报错联系助手链接
MESSAGE_HELPER_URL = os.getenv("BKAPP_MESSAGE_HELPER_URL", "")
2 changes: 1 addition & 1 deletion frontend/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "ISC",
"dependencies": {
"@blueking/bkcharts": "^2.0.11-alpha.5",
"@blueking/bkui-form": "0.0.35",
"@blueking/bkui-form": "0.0.41",
"@blueking/crypto-js-sdk": "0.0.5",
"@blueking/user-selector": "^1.0.5-beta.2",
"@vue/babel-preset-jsx": "^1.3.0",
Expand Down
14 changes: 10 additions & 4 deletions frontend/desktop/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
})
bus.$on('showErrMessage', info => {
const msg = typeof info.message === 'string' ? info.message : JSON.stringify(info.message)
window.show_msg(msg, 'error', info.traceId, info.errorSource)
window.show_msg(msg, 'error', '', info.traceId, info.errorSource)
})
// 登录成功后使用快照
bus.$on('useSnapshot', data => {
Expand All @@ -135,16 +135,16 @@
/**
* 兼容标准插件配置项里,异步请求用到的全局弹窗提示
*/
window.show_msg = (msg, type = 'error', traceId, errorSource = '') => {
window.show_msg = (msg, type = 'error', title = '', traceId, errorSource = '') => {
const index = window.msg_list.findIndex(item => item.msg === msg)
if (index > -1) {
if (traceId && !window.msg_list[index].traceId) {
window.msg_list[index] = { msg, type, traceId, errorSource }
window.msg_list[index] = { msg, type, title, traceId, errorSource }
} else {
return
}
} else {
window.msg_list.push({ msg, type, traceId, errorSource })
window.msg_list.push({ msg, type, title, traceId, errorSource })
}
setTimeout(() => { // 异步执行,可以把前端报错的trace_id同步上
const info = window.msg_list.find(item => item.msg === msg && item.traceId === traceId)
Expand Down Expand Up @@ -343,4 +343,10 @@
height: calc(100vh - 52px);
}
}
.interface-exception-notify-message {
.message-detail .message-copy {
top: 0 !important;
right: 0 !important;
}
}
</style>
1 change: 1 addition & 0 deletions frontend/desktop/src/assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
var BK_DOMAIN = '{{BK_DOMAIN}}';
var BK_PAAS_ESB_HOST = '{{BK_PAAS_ESB_HOST}}'
var TASK_LIST_STATUS_FILTER_DAYS = {{TASK_LIST_STATUS_FILTER_DAYS}}
var MESSAGE_HELPER_URL = '{{MESSAGE_HELPER_URL}}'
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
return (arr = document.cookie.match(reg)) ? unescape(arr[2]) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
@search="onStaticIpSearch">
</ip-search-input>
</template>
<span v-if="isUnfold" @click="isUnfold = false" class="return-text">{{ i18n.return }}</span>
<span v-if="isUnfold" @click="isUnfold = false" class="return-text">{{ $t('返回') }}</span>
</div>
<div class="selected-ip-table-wrap">
<IpSelectorTable
Expand Down Expand Up @@ -95,8 +95,6 @@
</div>
</template>
<script>
import '@/utils/i18n.js' // ip选择器兼容标准运维国际化
import StaticIpAddingPanel from './StaticIpAddingPanel.vue'
import IpSearchInput from './IpSearchInput.vue'
import IpSelectorTable from './IpSelectorTable.vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
<template>
<div class="static-ip-adding-panel">
<ip-search-input
v-if="type === 'select'"
v-if="selectIpMode"
:class="['ip-search-wrap', { 'static-ip-unfold': allowUnfoldInput }]"
@search="onIpSearch">
</ip-search-input>
<div class="ip-list-wrap">
<template v-if="type === 'select' || isManualParse">
<template v-if="selectIpMode">
<IpSelectorTable
:selection="true"
:editable="true"
:operate="false"
:is-search-mode="isSearchMode"
:default-selected="selectedIp"
:static-ip-list="isManualParse ? searchResult : staticIpList"
:static-ip-list="isManualParse ? parseIpList : staticIpList"
:search-result="searchResult"
:list-in-page="isManualParse ? searchResult : listInPage"
:list-in-page="listInPage"
:static-ip-table-config="staticIpTableConfig"
@onIpSort="onIpSort"
@onHostNameSort="onHostNameSort"
Expand Down Expand Up @@ -63,11 +63,11 @@
</div>
<div class="adding-footer">
<div class="ip-list-btns">
<bk-button theme="primary" size="small" @click.stop="onAddIpConfirm">{{type === 'select' || isManualParse ? $t('添加') : $t('解析')}}</bk-button>
<bk-button theme="primary" size="small" @click.stop="onAddIpConfirm">{{selectIpMode ? $t('添加') : $t('解析')}}</bk-button>
<bk-button theme="default" size="small" @click.stop="onAddIpCancel">{{$t('取消')}}</bk-button>
</div>
<div class="message-wrap">
<span v-if="type === 'select'">{{$t('已选择')}} {{selectedIp.length}} {{$t('个')}}</span>
<span v-if="selectIpMode">{{$t('已选择')}} {{selectedIp.length}} {{$t('个')}}</span>
<span v-if="type === 'manual' && errorIpList.length > 0">
<span style="color: red;">{{ errorIpList.length }}</span>{{ errorStr }}
<span class="view-error-ip-btn" v-bk-tooltips="tooltipConfig">{{ $t('查看详情') }}</span>
Expand Down Expand Up @@ -124,7 +124,13 @@
placement: 'top'
},
isSearchInputFocus: false,
isManualParse: false
isManualParse: false,
parseIpList: []
}
},
computed: {
selectIpMode () {
return this.type === 'select' || this.isManualParse
}
},
watch: {
Expand All @@ -143,7 +149,7 @@
},
methods: {
setDisplayList () {
let list = this.isSearchMode ? this.searchResult : this.staticIpList
let list = this.isSearchMode ? this.searchResult : this.isManualParse ? this.parseIpList : this.staticIpList
if (this.ipSortActive) {
list = this.getSortIpList(list, this.ipSortActive)
}
Expand All @@ -161,12 +167,13 @@
this.currentPage = 1
},
onIpSearch (keyword) {
const staticIpList = this.isManualParse ? this.parseIpList : this.staticIpList
if (keyword) {
const keyArr = keyword.split(',').map(item => item.trim()).filter(item => {
return item.trim() !== ''
})
const ipv6Regexp = tools.getIpv6Regexp()
const list = this.staticIpList.filter(item => {
const list = staticIpList.filter(item => {
const { bk_host_innerip: ipv4, bk_host_innerip_v6: ipv6 } = item
return keyArr.some(str => {
let text = str
Expand All @@ -181,7 +188,7 @@
this.setPanigation(list)
this.isSearchMode = true
} else {
this.setPanigation(this.staticIpList)
this.setPanigation(staticIpList)
this.isSearchMode = false
}
},
Expand Down Expand Up @@ -228,7 +235,7 @@
this.hostNameSortActive = way
},
onPageChange (page) {
const list = this.isSearchMode ? this.searchResult : this.list
const list = this.isSearchMode ? this.searchResult : this.isManualParse ? this.parseIpList : this.list
this.currentPage = page
this.listInPage = list.slice((page - 1) * this.listCountPerPage, page * this.listCountPerPage)
},
Expand All @@ -250,7 +257,7 @@
}
if (str) {
if (!ipPattern.test(str) && !ipv6Regexp.test(str)) { // 字符串不是合法 ip 地址
ipInvalidList.push(str)
ipInvalidList.push(item)
} else {
let text = str
if (ipv6Regexp.test(str)) { // 判断是否为ipv6地址
Expand All @@ -261,7 +268,7 @@
return cloudMatch && [i.bk_host_innerip, i.bk_host_innerip_v6].includes(text)
})
if (!ipInList.length) { // ip 地址/ipv6地址不在可选列表里
ipNotExistList.push(str)
ipNotExistList.push(item)
} else {
ipInList.forEach(item => {
const ipInSelected = this.selectedIp.find(i => {
Expand All @@ -288,7 +295,7 @@
}
this.errorIpList = []
this.selectedIp = selectedIp
this.searchResult = selectedIp
this.parseIpList = selectedIp
this.setPanigation(selectedIp)
this.isManualParse = true
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
})
})
this.decorationsMap = {}
this.globalVarLength = 0
}
},
onLanguageChange () {
Expand Down
Loading

0 comments on commit a3f2385

Please sign in to comment.