Skip to content

Commit

Permalink
Merge master to dependencies update branch
Browse files Browse the repository at this point in the history
  • Loading branch information
normal-wls committed May 28, 2024
1 parent 458e7fc commit 20b03cc
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 148 deletions.
8 changes: 6 additions & 2 deletions api/collections/nodeman.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,9 @@ def get_rsa_public_key(self, executor):
def install_channel(self):
return self._request(method="get", url=_get_nodeman_api_v2("install_channel"), data={})

def get_ipchooser_host_details(self, params: dict):
return self._request(method="post", url=_get_nodeman_api("core/api/ipchooser_host/details"), data=params)
def get_ipchooser_host_details(self, all_scope: bool, host_list: list):
return self._request(
method="post",
url=_get_nodeman_api("core/api/ipchooser_host/details"),
data={"all_scope": all_scope, "host_list": host_list},
)
18 changes: 9 additions & 9 deletions frontend/desktop/src/pages/task/TaskExecute/ExecuteInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -874,11 +874,11 @@
}
this.pluginOutputs = outputs
this.outputRenderConfig = [...storeOutputs, ...outputs]
// 设置host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${this.thirdPartyNodeCode}/`
$.context.bk_plugin_api_host[this.thirdPartyNodeCode] = hostUrl
if (forms.renderform) {
// 设置host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${this.thirdPartyNodeCode}/`
$.context.bk_plugin_api_host[this.thirdPartyNodeCode] = hostUrl
// 输入参数
const renderFrom = forms.renderform
/* eslint-disable-next-line */
Expand Down Expand Up @@ -982,11 +982,11 @@
if (!resp.result) return
// 获取参数
const { forms, inputs } = resp.data
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
if (forms.renderform) {
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
// 输入参数
$.atoms[plugin] = {}
const renderFrom = forms.renderform
Expand Down Expand Up @@ -1169,7 +1169,7 @@
jsFlowInstance && jsFlowInstance.setCanvasPosition(offsetX, offsetY, true)
}
},
toggleNodeActive (id, isActive) {
const node = document.getElementById(id)
if (!id || !node) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
getFormsHookState () {
const hooked = {}
const keys = Object.keys(this.constants)
this.inputs.forEach(form => {
Array.isArray(this.inputs) && this.inputs.forEach(form => {
// 已勾选到全局变量中, 判断勾选的输入参数生成的变量及自定义全局变量source_info是否包含该节点对应表单tag_code
// 可能存在表单勾选时已存在相同key的变量,选择复用自定义变量
const isHooked = keys.some(item => {
Expand Down Expand Up @@ -437,46 +437,7 @@
}
// 第三方插件
if (isThird) {
const resp = await this.loadPluginServiceDetail({
plugin_code: plugin,
plugin_version: version,
with_app_detail: true
})
if (!resp.result) return
// 获取参数
const { outputs: respsOutputs, forms, inputs } = resp.data
if (forms.renderform) {
if (!this.isLegacySubProcess) {
// 获取第三方插件公共输出参数
if (!this.pluginOutput['remote_plugin']) {
await this.loadAtomConfig({ atom: 'remote_plugin', version: '1.0.0' })
}
// 输出参数
const storeOutputs = this.pluginOutput['remote_plugin']['1.0.0']
const outputs = []
for (const [key, val] of Object.entries(respsOutputs.properties)) {
outputs.push({
name: val.title,
key,
type: val.type,
schema: { description: val.description || '--' }
})
}
this.outputs = [...storeOutputs, ...outputs]
}
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
// 输入参数
$.atoms[plugin] = {}
const renderFrom = forms.renderform
/* eslint-disable-next-line */
eval(renderFrom)
} else {
$.atoms[plugin] = inputs
this.outputs = [] // jsonschema form输出参数
}
await this.getThirdConfig(plugin, version)
} else {
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id, scope: 'task' })
this.outputs = this.pluginOutput[plugin][version]
Expand All @@ -487,6 +448,51 @@
console.log(e)
}
},
// 第三方插件输入输出配置
async getThirdConfig (plugin, version) {
try {
const resp = await this.loadPluginServiceDetail({
plugin_code: plugin,
plugin_version: version,
with_app_detail: true
})
if (!resp.result) return
// 获取参数
const { outputs: respOutputs, forms, inputs } = resp.data
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
if (forms.renderform) {
// 输入参数
$.atoms[plugin] = {}
const renderFrom = forms.renderform
/* eslint-disable-next-line */
eval(renderFrom)
} else {
$.atoms[plugin] = inputs
}
// 输出参数
const outputs = []
// 获取第三方插件公共输出参数
if (!this.pluginOutput['remote_plugin']) {
await this.loadAtomConfig({ atom: 'remote_plugin', version: '1.0.0' })
}
const storeOutputs = this.pluginOutput['remote_plugin']['1.0.0']
for (const [key, val] of Object.entries(respOutputs.properties)) {
outputs.push({
name: val.title || key,
key,
type: val.type,
schema: { description: val.description }
})
}
this.outputs = [...storeOutputs, ...outputs]
} catch (error) {
console.warn(error)
}
},
/**
* 获取子流程任务节点输入参数值
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
data () {
return {
formData: tools.deepClone(this.value),
context: {
site_url: $.context.site_url,
project_id: $.context.project?.id
}
context: { ...$.context }
}
},
watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
data () {
return {
inputFormData: tools.deepClone(this.value),
context: {
site_url: $.context.site_url,
project_id: $.context.project?.id
}
context: { ...$.context }
}
},
watch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,53 +625,7 @@
}
// 第三方插件
if (isThird) {
const resp = await this.loadPluginServiceDetail({
plugin_code: plugin,
plugin_version: version,
with_app_detail: true
})
if (!resp.result) return
// 获取参数
const { outputs: respsOutputs, forms, inputs } = resp.data
// 获取不同版本的描述
let desc = resp.data.desc || ''
if (desc && desc.includes('\n')) {
const descList = desc.split('\n')
desc = descList.join('<br>')
}
this.updateBasicInfo({ desc })
if (forms.renderform) {
if (!this.isSubflow) {
// 获取第三方插件公共输出参数
if (!this.pluginOutput['remote_plugin']) {
await this.loadAtomConfig({ atom: 'remote_plugin', version: '1.0.0' })
}
// 输出参数
const storeOutputs = this.pluginOutput['remote_plugin']['1.0.0']
const outputs = []
for (const [key, val] of Object.entries(respsOutputs.properties)) {
outputs.push({
name: val.title,
key,
type: val.type,
schema: { description: val.description || '--' }
})
}
this.outputs = [...storeOutputs, ...outputs]
}
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
// 输入参数
$.atoms[plugin] = {}
const renderFrom = forms.renderform
/* eslint-disable-next-line */
eval(renderFrom)
} else {
$.atoms[plugin] = inputs
this.outputs = [] // jsonschema form输出参数
}
await this.getThirdConfig(plugin, version)
} else {
await this.loadAtomConfig({ atom: plugin, version, classify, name, project_id })
}
Expand All @@ -681,6 +635,58 @@
console.log(e)
}
},
// 第三方插件输入输出配置
async getThirdConfig (plugin, version) {
try {
const resp = await this.loadPluginServiceDetail({
plugin_code: plugin,
plugin_version: version,
with_app_detail: true
})
if (!resp.result) return
// 获取参数
const { outputs: respOutputs, forms, inputs } = resp.data
// 获取不同版本的描述
let desc = resp.data.desc || ''
if (desc && desc.includes('\n')) {
const descList = desc.split('\n')
desc = descList.join('<br>')
}
this.updateBasicInfo({ desc })
// 获取host
const { origin } = window.location
const hostUrl = `${origin + window.SITE_URL}plugin_service/data_api/${plugin}/`
$.context.bk_plugin_api_host[plugin] = hostUrl
if (forms.renderform) {
// 输入参数
$.atoms[plugin] = {}
const renderFrom = forms.renderform
/* eslint-disable-next-line */
eval(renderFrom)
} else {
$.atoms[plugin] = inputs
}
// 输出参数
const outputs = []
// 获取第三方插件公共输出参数
if (!this.pluginOutput['remote_plugin']) {
await this.loadAtomConfig({ atom: 'remote_plugin', version: '1.0.0' })
}
const storeOutputs = this.pluginOutput['remote_plugin']['1.0.0']
for (const [key, val] of Object.entries(respOutputs.properties)) {
outputs.push({
name: val.title || key,
key,
type: val.type,
schema: { description: val.description }
})
}
this.outputs = [...storeOutputs, ...outputs]
} catch (error) {
console.warn(error)
}
},
/**
* 加载子流程任务节点输入、输出、版本配置项
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@
margin-right: 10px;
padding: 0 25px;
}
}
.textarea-wrap {
height: 88px;
Expand Down
20 changes: 20 additions & 0 deletions gcloud/utils/data_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""


def _default_func(data, *args, **kwargs):
return data


def chunk_data(data, chunk_size, func=None, *args, **kwargs):
return [(func or _default_func)(data[i : i + chunk_size], *args, **kwargs) for i in range(0, len(data), chunk_size)]
Loading

0 comments on commit 20b03cc

Please sign in to comment.