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

feat: release 1.9.0 #31 #51

Merged
merged 20 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 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
62db74b
fix: 处理 fast_create_task 通知人覆盖问题 #39
normal-wls Oct 21, 2024
8dc3709
feat: 接口 get_task_list 支持状态过滤 #41
normal-wls Oct 21, 2024
07ec269
feat: create_space api 添加 APP 白名单 #44
normal-wls Oct 24, 2024
a0c6285
feat: http 插件支持 json 转义 #40
guohelu Oct 28, 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
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.8.1"
app:
region: default
bk_app_code: &APP_CODE bk_flow_engine
Expand Down
1 change: 1 addition & 0 deletions bkflow/apigw/serializers/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class CreateTaskWithoutTemplateSerializer(serializers.Serializer):
description = serializers.CharField(help_text=_("任务描述"), required=False)
constants = serializers.JSONField(help_text=_("任务启动参数"), required=False, default={})
pipeline_tree = serializers.JSONField(help_text=_("任务树"), required=True)
notify_config = serializers.JSONField(help_text=_("通知配置"), required=False, default={})


class PipelineTreeSerializer(serializers.Serializer):
Expand Down
3 changes: 2 additions & 1 deletion bkflow/apigw/views/create_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from apigw_manager.apigw.decorators import apigw_require
from blueapps.account.decorators import login_exempt
from django.conf import settings
from django.db import transaction
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
Expand All @@ -46,7 +47,7 @@ def create_space(request):
}
"""
data = json.loads(request.body)
if hasattr(request, "app"):
if hasattr(request, "app") and request.app.bk_app_code not in settings.APP_WHITE_LIST:
data["app_code"] = request.app.bk_app_code

ser = CreateSpaceSerializer(data=data)
Expand Down
3 changes: 2 additions & 1 deletion bkflow/apigw/views/create_task_without_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def create_task_without_template(request, space_id):
"notify_type": {"fail": [], "success": []},
"notify_receivers": {"more_receiver": "", "receiver_group": []},
}
create_task_data.setdefault("extra_info", {}).update({"notify_config": DEFAULT_NOTIFY_CONFIG})
notify_config = create_task_data.pop("notify_config", {}) or DEFAULT_NOTIFY_CONFIG
create_task_data.setdefault("extra_info", {}).update({"notify_config": notify_config})

client = TaskComponentClient(space_id=space_id)
result = client.create_task(create_task_data)
Expand Down
2 changes: 2 additions & 0 deletions bkflow/apigw/views/get_task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def get_task_list(request, space_id):
"create_at_start": "create_time__gte",
"create_at_end": "create_time__lte",
"name": "name__icontains",
"is_started": "is_started",
"is_finished": "is_finished",
}
for k, v in filter_map.items():
if k in data:
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
3 changes: 3 additions & 0 deletions bkflow/pipeline_plugins/components/collections/http/v1_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from __future__ import absolute_import

import json
import traceback
from copy import deepcopy

Expand Down Expand Up @@ -133,6 +134,8 @@ def plugin_schedule(self, data, parent_data, callback_data=None):
other = {"headers": {}, "timeout": timeout}

if method.upper() not in ["GET", "HEAD"]:
if not isinstance(body, str):
body = json.dumps(body)
other["data"] = body.encode("utf-8")
other["headers"] = {"Content-type": "application/json"}

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
2 changes: 2 additions & 0 deletions bkflow/task/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class Meta:
"start_time": ["gte", "lte"],
"finish_time": ["gte", "lte"],
"create_method": ["exact"],
"is_started": ["exact"],
"is_finished": ["exact"],
}


Expand Down
2 changes: 2 additions & 0 deletions config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
APP_INTERNAL_FROM_SUPERUSER_HEADER_KEY = "Bkflow-Internal-From-SuperUser"
APP_INTERNAL_TOKEN_REQUEST_META_KEY = "HTTP_BKFLOW_INTERNAL_TOKEN"

APP_WHITE_LIST = env.APP_WHITE_LIST_STR.split(",") if env.APP_WHITE_LIST_STR else []

# PAAS SERVICE DETECTION
BKPAAS_SERVICE_ADDRESSES_BKSAAS = os.getenv("BKPAAS_SERVICE_ADDRESSES_BKSAAS")
BKSAAS_DEFAULT_MODULE_NAME = "default"
Expand Down
3 changes: 3 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,6 @@

# 文档中心链接
BK_DOC_CENTER_HOST = os.getenv("BK_DOC_CENTER_HOST", os.getenv("BK_DOCS_URL_PREFIX", "")).rstrip("/")

# APP 白名单
APP_WHITE_LIST_STR = os.getenv("BKAPP_APP_WHITE_LIST", "") # 逗号分隔的字符串
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
3 changes: 2 additions & 1 deletion frontend/src/components/layout/NavigationHeadLeft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
},
methods: {
onHandleNavClick(nav) {
if (this.navActive === nav.id) return;
const { meta } = this.$route;
if (this.navActive === nav.id && meta.admin) return;

if (nav.id === 'space-manager') {
this.$router.push({ name: 'spaceAdmin' });
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/config/i18n/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,11 @@ const cn = {
'描述:': '描述:',
'关联流程:': '关联流程:',
请选择: '请选择',
'ID/名称/创建人/更新人/所属模板 Id/所属作用域类型/所属作用域值': 'ID/名称/创建人/更新人/所属模板 Id/所属作用域类型/所属作用域值',
'ID/名称/创建人/更新人/所属模板 ID/所属作用域类型/所属作用域值': 'ID/名称/创建人/更新人/所属模板 ID/所属作用域类型/所属作用域值',
操作: '操作',
所属作用域类型: '所属作用域类型',
所属作用域值: '所属作用域值',
'所属模板 Id': '所属模板 Id',
'所属模板 ID': '所属模板 ID',
创建人: '创建人',
更新人: '更新人',
恢复默认值: '恢复默认值',
Expand All @@ -399,7 +399,7 @@ const cn = {
'数据格式不正确,应为JSON格式': '数据格式不正确,应为JSON格式',
'确认" {0} "恢复默认值?': '确认" {0} "恢复默认值?',
'删除成功!': '删除成功!',
'ID/任务名称/创建人/执行人/所属模板 Id/所属作用域类型/所属作用域值': 'ID/任务名称/创建人/执行人/所属模板 Id/所属作用域类型/所属作用域值',
'ID/任务名称/创建人/执行人/所属模板 ID/所属作用域类型/所属作用域值': 'ID/任务名称/创建人/执行人/所属模板 ID/所属作用域类型/所属作用域值',
引擎操作: '引擎操作',
任务名称: '任务名称',
执行人: '执行人',
Expand All @@ -409,14 +409,14 @@ const cn = {
未知: '未知',
'任务删除成功!': '任务删除成功!',
新建任务: '新建任务',
模板Id: '模板Id',
模板ID: '模板ID',
请求参数: '请求参数',
'请求参数格式不正确,应为JSON格式': '请求参数格式不正确,应为JSON格式',
任务创建成功: '任务创建成功',
新建流程: '新建流程',
流程名称: '流程名称',
流程创建成功: '流程创建成功',
'ID/模板名称/创建人/更新人/启用/所属作用域类型/所属作用域值': 'ID/模板名称/创建人/更新人/启用/所属作用域类型/所属作用域值',
'ID/流程名称/创建人/更新人/启用/所属作用域类型/所属作用域值': 'ID/流程名称/创建人/更新人/启用/所属作用域类型/所属作用域值',
创建流程: '创建流程',
'当前已选择 x 条数据': '当前已选择 {num} 条数据',
',': ',',
Expand Down
Loading
Loading