Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into release_hb_merge_…
Browse files Browse the repository at this point in the history
…master

# Conflicts:
#	config/default.py
#	env.py
#	frontend/desktop/src/config/i18n/cn.js
#	frontend/desktop/src/config/i18n/en.js
#	frontend/desktop/src/pages/task/TaskExecute/ExecuteInfo.vue
#	frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue
  • Loading branch information
normal-wls committed Dec 12, 2023
2 parents 6827f6a + 2d10bcb commit 8e0ce67
Show file tree
Hide file tree
Showing 33 changed files with 783 additions and 269 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.31.10
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.31.10"
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 @@ -211,7 +211,7 @@
# mako模板中:<script src="/a.js?v=${ STATIC_VERSION }"></script>
# 如果静态资源修改了以后,上线前改这个版本号即可

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

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
Expand Down Expand Up @@ -506,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 @@ -835,6 +837,10 @@ 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

Expand Down
7 changes: 7 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@
# 默认六个月
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]

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
})
})
this.decorationsMap = {}
this.globalVarLength = 0
}
},
onLanguageChange () {
Expand Down
85 changes: 71 additions & 14 deletions frontend/desktop/src/components/common/RenderForm/tags/TagInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@
this.$nextTick(() => {
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.innerHTML = this.value
this.handleInputBlur()
divInputDom.innerText = this.value
this.updateInputHtml()
}
})
}
Expand All @@ -180,17 +180,17 @@
// 如果表单项开启了变量免渲染,不以tag展示
if (!val) {
const divInputDom = this.$el.querySelector('.div-input')
divInputDom.innerHTML = this.value
divInputDom.innerText = this.value
} else {
this.handleInputBlur()
this.updateInputHtml()
}
},
formMode (val) {
if (val) {
this.$nextTick(() => {
const divInputDom = this.$el.querySelector('.div-input')
divInputDom.innerHTML = this.value
this.handleInputBlur()
divInputDom.innerText = this.value
this.updateInputHtml()
})
} else {
this.validate()
Expand All @@ -203,14 +203,19 @@
mounted () {
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.innerHTML = this.value
divInputDom.innerText = this.value
if (this.render && this.value) {
this.handleInputBlur()
this.updateInputHtml()
}
divInputDom.addEventListener('paste', this.handlePaste)
}
},
beforeDestroy () {
window.removeEventListener('click', this.handleListShow, false)
const divInputDom = this.$el.querySelector('.div-input')
if (divInputDom) {
divInputDom.removeEventListener('paste', this.handlePaste)
}
},
methods: {
handleListShow (e) {
Expand Down Expand Up @@ -310,6 +315,7 @@
// 文本框输入
handleInputChange (e, selection) {
if (!selection) {
// 实时更新
this.updateInputValue()
}
let matchResult = []
Expand All @@ -318,10 +324,22 @@
this.isListOpen = false
return
}
// 获取文本
this.lastEditRange = window.getSelection().getRangeAt(0)
const offsetText = focusNode.data.substring(0, anchorOffset)
let matchText = offsetText
// 如果不包含$则不进行后续计算
if (matchText.indexOf('$') === -1) {
this.isListOpen = false
return
}
// 过滤掉完整的变量格式文本
const varRegexp = /\s?\${[a-zA-Z_][\w|.]*}\s?/g
let matchText = offsetText.split(varRegexp).pop()
if (varRegexp.test(matchText)) {
matchText = offsetText.split(varRegexp).pop()
}
// 拿到字段最后以$开头的部分
matchText = matchText.replace(/(.*)(\$[^\}]*)/, ($0, $1, $2) => $2)
// 判断是否为变量格式
Expand Down Expand Up @@ -389,16 +407,23 @@
? item.value
: item.textContent.trim() === ''
? ' '
: item.textContent.replace(/&nbsp;/g, ' ')
: item.textContent
}).join('')
}
inputValue = inputValue.replace(/\u00A0/g, ' ')
this.input.value = inputValue
this.updateForm(inputValue)
},
// 文本框失焦
handleInputBlur (e) {
this.$emit('blur')
this.input.focus = false
// 更新文本框结构,生成tag标签
this.updateInputHtml()
// 向上更新表单
this.updateForm(this.input.value)
},
// 更新文本框结构,生成tag标签
updateInputHtml () {
// 如果表单项开启了变量免渲染,不以tag展示
if (!this.render) return
// 支持所有变量(系统变量,内置变量,自定义变量)
Expand All @@ -411,6 +436,13 @@
return item.type === 'button' ? item.value : item.textContent
}).join('')
}
// 将html标签拆成文本形式
domValue = domValue.replace(/(<|>)/g, ($0, $1) => `<span>${$1}</span>`)
// 用户手动输入的实体字符渲染时需要切开展示
domValue = domValue.replace(/&(nbsp|ensp|emsp|thinsp|zwnj|zwj|quot|apos|lt|gt|amp|cent|pound|yen|euro|sect|copy|reg|trade|times|divide);/g, ($0, $1) => {
return `<span>&</span><span>${$1}</span><span>;</span>`
})
const innerHtml = domValue.replace(varRegexp, (match, $0) => {
let isExistVar = false
if ($0) {
Expand All @@ -424,12 +456,15 @@
}
if (isExistVar) {
const randomId = Math.random().toString().slice(-6)
return `<input type="button" class="var-tag" id="${randomId}" value=${match} />` // 两边留空格保持间距
// 将装转的尖括号恢复原样
let value = match.replace(/<span>(<|>)<\/span>/g, ($0, $1) => $1)
// 将双引号转为实体字符
value = value.replace(/"/g, '&quot;')
return `<input type="button" class="var-tag" id="${randomId}" value="${value}" />`
}
return match
})
divInputDom.innerHTML = innerHtml
this.updateInputValue()
},
// 文本框按键事件
handleInputKeyDown (e) {
Expand Down Expand Up @@ -476,6 +511,28 @@
handleBlur () {
this.emit_event(this.tagCode, 'blur', this.value)
this.$emit('blur', this.value)
},
handlePaste (e) {
event.preventDefault()
let text = ''
const clp = (e.originalEvent || e).clipboardData
if (clp === undefined || clp === null) {
text = window.clipboardData.getData('text') || ''
text = text.replace(/(\n|\r|\r\n)/g, ' ')
if (text !== '') {
if (window.getSelection) {
const newNode = document.createElement('span')
newNode.innerHTML = text
window.getSelection().getRangeAt(0).insertNode(newNode)
} else {
document.selection.createRange().pasteHTML(text)
}
}
} else {
text = clp.getData('text/plain') || ''
text = text.replace(/(\n|\r|\r\n)/g, ' ')
text && document.execCommand('insertText', false, text)
}
}
}
}
Expand Down Expand Up @@ -558,7 +615,7 @@
line-height: 18px;
padding: 7px 0;
color: #63656e;
white-space: nowrap;
white-space: pre;
overflow: hidden;
/deep/.var-tag {
margin-right: 1px;
Expand Down
Loading

0 comments on commit 8e0ce67

Please sign in to comment.