Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 1.9.0 merge dev #65

Merged
merged 29 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
622e155
feat: 版本日志支持英文 #16
normal-wls Sep 10, 2024
fd0ddea
Merge pull request #17 from normal-wls/feat_support_en_version_log_ma…
MarinPeng Sep 10, 2024
0cea4a3
fix: 中心导航国际化规范调整 --bug=130458497
ywywZhou Sep 11, 2024
e6d4ea9
perf: 下拉框变量移除远程数据源选项 #20 (#21)
normal-wls Sep 13, 2024
4316885
fix: 1.8.0产品验收问题 --story=131115507
ywywZhou Oct 9, 2024
63c53bd
fix: 空间配置-名称国际化 --story=131115479
ywywZhou Oct 9, 2024
216637b
fix: 1.8.0验收问题修复 --story=131115465
normal-wls Oct 9, 2024
9bdf23f
Merge pull request #29 from ywywZhou/1.8.0_bugfix
luofann Oct 9, 2024
72b2370
feat: release 1.8.1 #31
normal-wls Oct 9, 2024
7ffd21a
fix: 日期时间范围变量值类型错误问题修复 #33
ywywZhou Oct 9, 2024
cab86f6
Merge pull request #34 from ywywZhou/master_bugfix
luofann Oct 9, 2024
10f7465
feat: 文档中心跳转支持中英文 --story=132104161
normal-wls Oct 14, 2024
050f044
chore: 出现全局公告时会额外出一个滚动条问题优化 --story=131115507
ywywZhou Oct 14, 2024
148617a
Merge pull request #37 from ywywZhou/master_bugfix
luofann Oct 14, 2024
e4c9808
feat: 调试任务相关交互优化方案 --story=119022030
ywywZhou Oct 14, 2024
edb7f41
Merge pull request #38 from ywywZhou/mock_interaction_optimization_xug
luofann Oct 18, 2024
b081385
Merge remote-tracking branch 'upstream/develop' into release_1.9.0
normal-wls Oct 28, 2024
a45985a
Merge remote-tracking branch 'upstream/master' into release_1.9.0
normal-wls Oct 28, 2024
61b2d29
Merge pull request #51 from normal-wls/release_1.9.0
normal-wls Oct 29, 2024
d2162cf
feat: release V1.9.0 #31
normal-wls Oct 29, 2024
2e9c0aa
fix: 调试任务交互验收问题修复 --story=120517052
ywywZhou Nov 6, 2024
ba89944
fix: 决策表导入导出验收问题修复 --story=120516746
ywywZhou Nov 7, 2024
38a2a31
Merge pull request #57 from ywywZhou/decision_export_import_bugfix
luofann Nov 7, 2024
f098b7e
Merge pull request #56 from ywywZhou/mock_interaction_bugfix
luofann Nov 7, 2024
dfda89b
fix: 已存在的决策表导出后无法导入收问题修复 #59
ywywZhou Nov 8, 2024
cbf144b
fix: Excel表中没有输出字段 导入展示异常问题修复 #58
ywywZhou Nov 8, 2024
28ce9ed
fix: 流程通知人保存后未生效问题修复 --story=120397003
ywywZhou Nov 4, 2024
1575dd2
fix: 没有配置规则即可创建成功决策表问题修复 --story=130966859
ywywZhou Nov 11, 2024
8dedb31
fix: 决策表导出文件名符合蓝鲸规范 --story=130968939
ywywZhou Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "1.8.0"
app_version: "1.9.0"
app:
region: default
bk_app_code: &APP_CODE bk_flow_engine
Expand Down
4 changes: 3 additions & 1 deletion bkflow/interface/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def bkflow_settings(request):
frontend_entry_url = "{}bkflow".format(settings.STATIC_URL) if settings.RUN_VER == "open" else "/static/bkflow"
enable_notice_center = int(EnvironmentVariables.objects.get_var("ENABLE_NOTICE_CENTER", 0))
language = request.COOKIES.get("blueking_language", "zh-cn")
doc_lang_mappings = {"zh-cn": "ZH", "en": "EN"}
run_ver_key = "BKAPP_RUN_VER_NAME" if language == "zh-cn" else "BKAPP_RUN_VER_NAME_{}".format(language.upper())

ctx = {
Expand All @@ -36,7 +37,8 @@ def bkflow_settings(request):
"MEMBER_SELECTOR_DATA_HOST": settings.MEMBER_SELECTOR_DATA_HOST,
"APP_CODE": settings.APP_CODE,
"USERNAME": request.user.username,
"BK_DOC_URL": f"{env.BK_DOC_CENTER_HOST}/markdown/ZH/BKFlow/1.8/UserGuide/Introduce/introduce.md",
"BK_DOC_URL": f"{env.BK_DOC_CENTER_HOST}/markdown/{doc_lang_mappings.get(language, 'ZH')}/BKFlow/1.8"
f"/UserGuide/Introduce/introduce.md",
# 是否开启通知中心
"ENABLE_NOTICE_CENTER": enable_notice_center,
"BK_PAAS_SHARED_RES_URL": env.BKPAAS_SHARED_RES_URL,
Expand Down
81 changes: 40 additions & 41 deletions bkflow/pipeline_plugins/query/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,55 +21,54 @@

import logging

import requests
from django.conf import settings
from django.http import JsonResponse
from django.utils.translation import ugettext_lazy as _

logger = logging.getLogger("root")


def variable_select_source_data_proxy(request):
"""
@summary: 获取下拉框源数据的通用接口
@summary: 获取下拉框源数据的通用接口,暂时关闭该接口
@param request:
@return:
"""
url = request.GET.get("url")
try:
response = requests.get(url=url, verify=False, timeout=10)
except Exception as e:
logger.exception("variable select get data from url[url={url}] raise error: {error}".format(url=url, error=e))
text = _("请求数据异常: {error}").format(error=e)
data = [{"text": text, "value": ""}]
return JsonResponse(data, safe=False)
return JsonResponse([{"text": "text1", "value": "value1"}])

try:
data = response.json()
except Exception:
try:
content = response.content.decode(response.encoding)
logger.exception(
"variable select get data from url[url={url}] is not a valid JSON: {data}".format(
url=url, data=content[:500]
)
)
except Exception:
logger.exception("variable select get data from url[url={url}] data is not a valid JSON".format(url=url))
text = _("返回数据格式错误,不是合法 JSON 格式")
data = [{"text": text, "value": ""}]
return JsonResponse(data, safe=False)

# 支持开发者对远程数据源数据配置处理函数,进行再处理
post_process_function = getattr(settings, "REMOTE_SOURCE_DATA_TRANSFORM_FUNCTION", None)
if post_process_function and callable(post_process_function):
try:
data = post_process_function(data)
except Exception as e:
logger.exception(
"variable select transforming data from remote resource url[url={url}] "
"raise error: {error}".format(url=url, error=e)
)
text = _("远程数据源数据转换失败: {error}").format(error=e)
data = [{"text": text, "value": ""}]
return JsonResponse(data, safe=False)
# url = request.GET.get("url")
# try:
# response = requests.get(url=url, verify=False, timeout=10)
# except Exception as e:
# logger.exception("variable select get data from url[url={url}] raise error: {error}".format(url=url, error=e))
# text = _("请求数据异常: {error}").format(error=e)
# data = [{"text": text, "value": ""}]
# return JsonResponse(data, safe=False)
#
# try:
# data = response.json()
# except Exception:
# try:
# content = response.content.decode(response.encoding)
# logger.exception(
# "variable select get data from url[url={url}] is not a valid JSON: {data}".format(
# url=url, data=content[:500]
# )
# )
# except Exception:
# logger.exception("variable select get data from url[url={url}] data is not a valid JSON".format(url=url))
# text = _("返回数据格式错误,不是合法 JSON 格式")
# data = [{"text": text, "value": ""}]
# return JsonResponse(data, safe=False)
#
# # 支持开发者对远程数据源数据配置处理函数,进行再处理
# post_process_function = getattr(settings, "REMOTE_SOURCE_DATA_TRANSFORM_FUNCTION", None)
# if post_process_function and callable(post_process_function):
# try:
# data = post_process_function(data)
# except Exception as e:
# logger.exception(
# "variable select transforming data from remote resource url[url={url}] "
# "raise error: {error}".format(url=url, error=e)
# )
# text = _("远程数据源数据转换失败: {error}").format(error=e)
# data = [{"text": text, "value": ""}]
# return JsonResponse(data, safe=False)
34 changes: 18 additions & 16 deletions bkflow/pipeline_plugins/static/variables/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
hookable: true,
items: [{name: gettext("自定义"), value: "0"}, {name: gettext("远程数据源"), value: "1"}],
value: "0",
hidden: true,
validation: [
{
type: "required"
Expand All @@ -29,7 +30,7 @@
attrs: {
name: gettext("选项"),
hookable: true,
placeholder: gettext('请输入数据源信息,自定义数据源格式为 [{"text": "", "value": ""}...],若是远程数据源则填写返回该格式数据的 URL'),
placeholder: gettext('请输入数据源信息,自定义数据源格式为 [{"text": "", "value": ""}...]'),
validation: [
{
type: "required"
Expand Down Expand Up @@ -73,10 +74,11 @@
let remote_url = "";
let items = [];
let placeholder = '';
if (metaConfig.datasource === "1") {
remote_url = $.context.get('site_url') + 'api/plugin_query/variable_select_source_data_proxy/?url=' + metaConfig.items_text;
remote = true;
} else {
// if (metaConfig.datasource === "1") {
// remote_url = $.context.get('site_url') + 'api/plugin_query/variable_select_source_data_proxy/?url=' + metaConfig.items_text;
// remote = true;
// }
if (metaConfig.datasource === "0") {
try {
items = JSON.parse(metaConfig.items_text);
} catch (err) {
Expand All @@ -92,16 +94,16 @@
let multiple = false;
let default_val = metaConfig.default || '';

if (metaConfig.type === "1") {
multiple = true;
default_val = [];
if (metaConfig.default) {
let vals = metaConfig.default.split(',');
for (let i in vals) {
default_val.push(vals[i].trim());
}
}
}
// if (metaConfig.type === "1") {
// multiple = true;
// default_val = [];
// if (metaConfig.default) {
// let vals = metaConfig.default.split(',');
// for (let i in vals) {
// default_val.push(vals[i].trim());
// }
// }
// }
return {
tag_code: this.tag_code,
type: "select",
Expand All @@ -115,7 +117,7 @@
remote_url: remote_url,
placeholder: placeholder,
remote_data_init: function (data) {
return data
return data;
},
validation: [
{
Expand Down
18 changes: 18 additions & 0 deletions bkflow/space/migrations/0007_alter_space_app_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.15 on 2024-10-09 03:06

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('space', '0006_auto_20240823_1544'),
]

operations = [
migrations.AlterField(
model_name='space',
name='app_code',
field=models.CharField(max_length=32, verbose_name='应用ID'),
),
]
2 changes: 1 addition & 1 deletion bkflow/space/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Space(CommonModel):
id = models.AutoField(_("空间ID"), primary_key=True)
# 空间名不允许重复
name = models.CharField(_("空间名称"), max_length=32, null=False, blank=False, unique=True)
app_code = models.CharField(_("APP Code"), max_length=32, null=False, blank=False)
app_code = models.CharField(_("应用ID"), max_length=32, null=False, blank=False)
desc = models.CharField(_("空间描述"), max_length=128, null=True, blank=True)
platform_url = models.CharField(_("平台提供服务的地址"), max_length=256, null=False, blank=False)
create_type = models.CharField(
Expand Down
1 change: 1 addition & 0 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ body {
}
.with-system-notice {
height: calc(100vh - 40px) !important;
.navigation-nav,
.container-content {
max-height: calc(100vh - 92px)!important;
}
Expand Down
49 changes: 32 additions & 17 deletions frontend/src/components/DecisionTable/ImportExport/ExportBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import { getCellText } from './dataTransfer.js';
export default {
props: {
name: {
type: String,
default: '',
},
data: {
type: Object,
default: () => ({}),
Expand All @@ -42,34 +38,52 @@
horizontal: 'center', // 水平居中
vertical: 'center', // 垂直居中
},
border: {
top: { style: 'thin', color: { rgb: '000000' } },
bottom: { style: 'thin', color: { rgb: '000000' } },
left: { style: 'thin', color: { rgb: '000000' } },
right: { style: 'thin', color: { rgb: '000000' } },
},
border: ['top', 'bottom', 'left', 'right'].reduce((acc, side) => {
acc[side] = { style: 'thin', color: { rgb: '000000' } };
return acc;
}, {}),
};

// 定义表头和注释
const headers = [
{
label: 'Input',
children: inputs.map(item => ({ label: `${item.name}(${item.id})`, description: JSON.stringify(item) })),
children: inputs.map((item) => {
const { id, name, ...rest } = item;
return { label: `${name}(${id})`, description: JSON.stringify(rest) };
}),
},
{
label: 'Output',
children: outputs.map(item => ({ label: `${item.name}(${item.id})`, description: JSON.stringify(item) })),
children: outputs.map((item) => {
const { id, name, ...rest } = item;
return { label: `${name}(${id})`, description: JSON.stringify(rest) };
}),
},
];
const data = records.reduce((acc, cur) => {
// 暂时过滤【条件组合】类型!!!
if (cur.inputs.type !== 'common') return acc;
const arr = [];
cur.inputs.conditions.forEach((item) => {
arr.push({ v: getCellText(item), t: 's', s: cellStyles });
cur.inputs.conditions.forEach((item, index) => {
const inputInfo = inputs[index];
const v = getCellText(item);
if (inputInfo.type === 'select') {
// 下拉框类型导出为text
const option = inputInfo.options.items.find(o => o.id === v);
arr.push({ v: option.name, t: 's', s: cellStyles });
} else {
arr.push({ v, t: 's', s: cellStyles });
}
});
outputs.forEach((item) => {
arr.push({ v: cur.outputs[item.id], t: 's', s: cellStyles });
if (item.type === 'select') {
// 下拉框类型导出为text
const option = item.options.items.find(o => o.id === cur.outputs[item.id]);
arr.push({ v: option.name, t: 's', s: cellStyles });
} else {
arr.push({ v: cur.outputs[item.id], t: 's', s: cellStyles });
}
});
acc.push(arr);
return acc;
Expand Down Expand Up @@ -108,8 +122,9 @@
fill: { fgColor: { rgb: '9FE3FF' } },
},
});
const c = headerIndex === 0 ? childIndex : (headers[headerIndex - 1].children.length + childIndex);
comments.push({
cell: XLSX.utils.encode_cell({ c: headerIndex * header.children.length + childIndex, r: 1 }),
cell: XLSX.utils.encode_cell({ c, r: 1 }),
comment: child.description,
});
});
Expand Down Expand Up @@ -154,7 +169,7 @@
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');

// 导出工作簿
XLSX.writeFile(wb, `${this.name || 'Decision'}_${moment().format('YYYYMMDDHHmmss')}.xlsx`);
XLSX.writeFile(wb, `${window.APP_CODE}_decision_${moment().format('YYYYMMDDHHmmss')}.xlsx`);
},
},
};
Expand Down
22 changes: 15 additions & 7 deletions frontend/src/components/DecisionTable/ImportExport/ImportBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script>
import * as XLSX from 'xlsx';
import tools from '@/utils/tools.js';
import { validateFiled, parseValue, validateValue, getValueRight } from './dataTransfer.js';
import { validateFiled, parseValue, getValueRight } from './dataTransfer.js';
export default {
props: {
data: {
Expand Down Expand Up @@ -114,7 +114,13 @@
},
getHeader(row, sheetValue) {
const header = [];
const titleRegex = /^([^\(]+)\(([^)]+)\)$/;
const result = row.every((cell) => {
if (!titleRegex.test(cell)) {
this.showMessage(`表格【${cell}】列标题数据结构不对`);
return false;
}

const comment = sheetValue.find(value => Object.prototype.toString.call(value) === '[object Object]' && value.v === cell);

if (!comment || !comment.c) {
Expand All @@ -127,7 +133,12 @@
this.showMessage(`表格【${cell}】列的配置注释不是json格式`);
return false;
}
header.push(JSON.parse(t));
const [, name, id] = cell.match(titleRegex);
header.push({
id,
name,
...JSON.parse(t),
});

return true;
});
Expand All @@ -142,11 +153,8 @@
const outputs = {};

const result = header.every((col, colIndex) => {
// 解析value和操作方式
const { value, type } = parseValue(row[colIndex]);

// 校验value
const message = validateValue(value, col);
// 解析并校验value和操作方式
const { value, type, message } = parseValue(row[colIndex], col);
if (message) {
this.showMessage(message);
return false;
Expand Down
Loading
Loading