Skip to content

Commit

Permalink
Merge pull request #7678 from TencentBlueKing/feature_template_market…
Browse files Browse the repository at this point in the history
…_master

支持流程市场分享功能
  • Loading branch information
normal-wls authored Jan 13, 2025
2 parents dd2f303 + 4a34570 commit d47f09e
Show file tree
Hide file tree
Showing 61 changed files with 2,499 additions and 176 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.32.1-p3
version: 3.32.1-p4
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.32.1-p3"
app_version: "3.32.1-p4"
app:
region: default
bk_app_code: bk_sops
Expand Down
18 changes: 17 additions & 1 deletion config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"gcloud.contrib.develop",
"gcloud.contrib.collection",
"gcloud.contrib.operate_record",
"gcloud.contrib.template_market",
"gcloud.apigw",
"gcloud.common_template",
"gcloud.label",
Expand Down Expand Up @@ -214,7 +215,7 @@
# mako模板中:<script src="/a.js?v=${ STATIC_VERSION }"></script>
# 如果静态资源修改了以后,上线前改这个版本号即可

STATIC_VERSION = "3.32.1-p3"
STATIC_VERSION = "3.32.1-p4"
DEPLOY_DATETIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S")

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
Expand Down Expand Up @@ -868,6 +869,11 @@ def check_engine_admin_permission(request, *args, **kwargs):
# 周期任务消息通知类型
PERIODIC_TASK_REMINDER_NOTIFY_TYPE = env.PERIODIC_TASK_REMINDER_NOTIFY_TYPE

# 周期任务最短时间间隔
PERIODIC_TASK_SHORTEST_TIME = env.PERIODIC_TASK_SHORTEST_TIME
# 周期任务迭代次数
PERIODIC_TASK_ITERATION = env.PERIODIC_TASK_ITERATION

# bk_audit
ENABLE_BK_AUDIT = True if env.BK_AUDIT_DATA_TOKEN else False
BK_AUDIT_SETTINGS = {
Expand All @@ -883,3 +889,13 @@ def check_engine_admin_permission(request, *args, **kwargs):
if "BKAPP_SOPS_BROKER_URL" in os.environ:
BROKER_URL = os.getenv("BKAPP_SOPS_BROKER_URL")
print(f"BROKER_URL: {BROKER_URL}")


# 流程商店
ENABLE_TEMPLATE_MARKET = env.ENABLE_TEMPLATE_MARKET
# 流程商店 API 地址
TEMPLATE_MARKET_API_URL = env.TEMPLATE_MARKET_API_URL
# 模板市场路由
TEMPLATE_MARKET_HOST = env.TEMPLATE_MARKET_HOST
# 模板市场文档路由
TEMPLATE_MARKET_DOC_URL = env.TEMPLATE_MARKET_DOC_URL
10 changes: 5 additions & 5 deletions config/urls_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
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.
"""
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from django.conf.urls import include, url
from django.conf import settings

from django.conf.urls import include, url
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions

# 用户自定义 urlconf
urlpatterns_custom = [
Expand All @@ -41,6 +40,7 @@
url(r"^plugin_service/", include("plugin_service.urls")),
url(r"^mako_operations/", include("gcloud.mako_template_helper.urls")),
url(r"^engine_admin/", include("pipeline.contrib.engine_admin.urls")),
url(r"^template_market/", include("gcloud.contrib.template_market.urls")),
]

schema_view = get_schema_view(
Expand Down
14 changes: 14 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@
# 周期任务消息通知类型
PERIODIC_TASK_REMINDER_NOTIFY_TYPE = json.loads(os.getenv("PERIODIC_TASK_REMINDER_NOTIFY_TYPE", '["email"]'))

# 周期任务最短时间间隔,以分钟为单位,例如:30,0 表示无限制
PERIODIC_TASK_SHORTEST_TIME = int(os.getenv("PERIODIC_TASK_SHORTEST_TIME", 0))
# 周期任务迭代次数
PERIODIC_TASK_ITERATION = int(os.getenv("PERIODIC_TASK_ITERATION", 10))

# bk_audit
BK_AUDIT_ENDPOINT = os.getenv("BK_AUDIT_ENDPOINT", None)
BK_AUDIT_DATA_TOKEN = os.getenv("BK_AUDIT_DATA_TOKEN", None)

# 流程商店
ENABLE_TEMPLATE_MARKET = int(os.getenv("ENABLE_TEMPLATE_MARKET", 0))
# 流程商店 API 地址
TEMPLATE_MARKET_API_URL = os.getenv("TEMPLATE_MARKET_API_URL", "")
# 模板市场路由
TEMPLATE_MARKET_HOST = os.getenv("TEMPLATE_MARKET_HOST", "")
# 模板市场文档路由
TEMPLATE_MARKET_DOC_URL = os.getenv("TEMPLATE_MARKET_DOC_URL", "")
3 changes: 2 additions & 1 deletion frontend/desktop/builds/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const proxyPath = [
'iam/*',
'plugin_service/*',
'mako_operations/*',
'collection/*'
'collection/*',
'template_market/*'
]
const proxyRule = {}
proxyPath.forEach((item) => {
Expand Down
1 change: 1 addition & 0 deletions frontend/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@blueking/notice-component-vue2": "^2.0.1",
"@blueking/platform-config": "^1.0.2",
"@blueking/user-selector": "^1.0.5-beta.2",
"@toast-ui/editor": "^3.2.2",
"@vue/babel-preset-jsx": "^1.3.0",
"ajv": "^6.10.2",
"art-template": "^4.13.0",
Expand Down
7 changes: 5 additions & 2 deletions frontend/desktop/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/>
<navigation v-if="!hideHeader" :class="['sops-layout-navigation', { 'with-system-notice': hasAlertNotice }]">
<template slot="page-content">
<div :class="['main-container', { 'with-system-notice': hasAlertNotice }]">
<div :class="['main-container with-navigation', { 'with-system-notice': hasAlertNotice }]">
<router-view v-if="isRouterViewShow"></router-view>
</div>
<permissionApply
Expand Down Expand Up @@ -362,7 +362,10 @@
}
.main-container {
width: 100%;
height: calc(100vh - 52px);
height: 100vh;
&.with-navigation {
height: calc(100vh - 52px);
}
&.with-system-notice {
height: calc(100vh - 92px);
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/desktop/src/assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
var BK_PAAS_SHARED_RES_URL = '{{BK_PAAS_SHARED_RES_URL}}'
var APP_NAME = '{{APP_NAME}}'
var RUN_VER_NAME = '{{RUN_VER_NAME}}'
var ENABLE_TEMPLATE_MARKET = {{ENABLE_TEMPLATE_MARKET}}
var TEMPLATE_MARKET_HOST = '{{TEMPLATE_MARKET_HOST}}'
var TEMPLATE_MARKET_DOC_URL = '{{TEMPLATE_MARKET_DOC_URL}}'
var PERIODIC_TASK_SHORTEST_TIME = {{PERIODIC_TASK_SHORTEST_TIME}}
// 是否开启通知中心
var ENABLE_NOTICE_CENTER = {{ENABLE_NOTICE_CENTER}}
function getCookie(name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<!-- corn 规则 tips -->
<div id="periodic-cron-tips-html">
<img style="width:542px;height: 258px;" class="ui-img" :src="periodicCronImg">
<p v-if="shortestTime" class="shortest-time-tips">
{{ $t('当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置', { n: shortestTime }) }}
</p>
</div>
<div class="time-input">
<input
Expand Down Expand Up @@ -102,7 +105,8 @@
theme: 'light',
content: '#periodic-cron-tips-html',
placement: 'top-start'
}
},
shortestTime: window.PERIODIC_TASK_SHORTEST_TIME
}
},
watch: {
Expand Down Expand Up @@ -350,5 +354,9 @@
.tippy-tooltip {
padding: initial;
}
.shortest-time-tips {
padding: 10px 5px;
color: #ff9c01;
}
}
</style>
34 changes: 33 additions & 1 deletion frontend/desktop/src/config/i18n/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,39 @@ const cn = {
'产品官网': '产品官网',
'联系bk助手': '联系bk助手',
'蓝鲸桌面': '蓝鲸桌面',
'蓝鲸': '蓝鲸'
'蓝鲸': '蓝鲸',
'共享到商店': '共享到商店',
'共享到SRE商店': '共享到SRE商店',
'帮助文档': '帮助文档',
'SRE商店': 'SRE商店',
'templateSharedTips': '共享的流程支持在 {0} 预览并导入其他业务,请勿包含敏感信息',
'templateSharedSuccessTips': '共享成功,请前往 {0} 查看',
'更新': '更新',
'共享类型': '共享类型',
'场景名称': '场景名称',
'场景标识': '场景标识',
'场景分类': '场景分类',
'场景标签': '场景标签',
'风险级别': '风险级别',
'使用说明': '使用说明',
'高': '高',
'低': '低',
'请输入场景名称': '请输入场景名称',
'请选择场景名称': '请选择场景名称',
'请输入场景标识': '请输入场景标识',
'请选择场景分类': '请选择场景分类',
'场景使用者通过标签可以快速找到同一类场景': '场景使用者通过标签可以快速找到同一类场景',
'声明该场景的运维操作风险级别,以便场景使用者决策场景的使用方式': '声明该场景的运维操作风险级别,以便场景使用者决策场景的使用方式',
'请输入标签,enter保存': '请输入标签,enter保存',
'将清空输入信息': '将清空输入信息',
'【n】标签已存在': '【{n}】标签已存在',
'场景名称重复:': '场景名称重复:',
'场景名称长度最小3个字符': '场景名称长度最小3个字符',
'请输入群 ID,多个 ID 以分号隔开': '请输入群 ID,多个 ID 以分号隔开',
'当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置': '当前环境配置周期任务间隔不低于 {n} 分钟,如有特殊需求请联系管理员配置',
'仅支持上传.mp4,.mov文件': '仅支持上传.mp4,.mov文件',
'选择视频文件': '选择视频文件',
'上传视频': '上传视频'
}

export default cn
34 changes: 33 additions & 1 deletion frontend/desktop/src/config/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,39 @@ const en = {
'产品官网': 'Product Website',
'联系bk助手': 'Contact BK Assistant',
'蓝鲸桌面': 'BlueWhale Desktop',
'蓝鲸': 'BlueKing'
'蓝鲸': 'BlueKing',
'共享到商店': 'Shared to the store',
'共享到SRE商店': 'Shared to the SRE Store',
'帮助文档': 'Help Doc',
'SRE商店': 'SRE Store',
'templateSharedTips': 'The shared process can be previewed in {0} and imported into other businesses. Please do not include sensitive information',
'templateSharedSuccessTips': 'Shared successfully, please go to {0} to view',
'更新': 'Updated',
'共享类型': 'Sharing Type',
'场景名称': 'Scene Name',
'场景标识': 'Scene Identifier',
'场景分类': 'Scene Category',
'场景标签': 'Scene Labels',
'风险级别': 'Risk Level',
'使用说明': 'Instructions',
'高': 'High',
'低': 'Low',
'请输入场景名称': 'Please enter the scene name',
'请选择场景名称': 'Please select the scene name',
'请输入场景标识': 'Please enter the scene identifier',
'请选择场景分类': 'Please select the scene category',
'场景使用者通过标签可以快速找到同一类场景': 'Scene users can quickly find scenes of the same category through tags',
'声明该场景的运维操作风险级别,以便场景使用者决策场景的使用方式': 'Declare the operational risk level of the scene to aid users in deciding how to use the scene',
'请输入标签,enter保存': 'Please enter a tag and press Enter to save',
'将清空输入信息': 'This will clear the input information',
'【n】标签已存在': 'The tag [{n}] already exists',
'场景名称重复:': 'Duplicate scene name:',
'场景名称长度最小3个字符': 'The scene name must be at least 3 characters long',
'请输入群 ID,多个 ID 以分号隔开': 'Please enter group IDs, separated by semicolons if there are multiple IDs',
'当前环境配置周期任务间隔不低于 n 分钟,如有特殊需求请联系管理员配置': 'In the current environment, the interval for scheduled tasks is no less than {n} minutes. If you have special requirements, please contact the administrator for configuration',
'仅支持上传.mp4,.mov文件': 'Only .mp4 and .mov files are supported for upload',
'选择视频文件': 'Select video file',
'上传视频': 'Upload Video'
}

export default en
2 changes: 1 addition & 1 deletion frontend/desktop/src/constants/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const COMMON_ROUTE_LIST = [
name: i18n.t('流程'),
icon: 'icon-sitemap-shape',
hasProjectId: true,
subRoutes: ['processHome', 'processCommon', 'processCollect', 'templatePanel', 'projectCommonTemplatePanel'],
subRoutes: ['processHome', 'processCommon', 'processCollect', 'templatePanel', 'templatePreview', 'projectCommonTemplatePanel'],
url: '/template/home/'
},
{
Expand Down
1 change: 1 addition & 0 deletions frontend/desktop/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Input, InputNumber, Select, Radio, RadioGroup, RadioButton, Checkbox,
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import locales from 'element-ui/lib/locale'
import '@toast-ui/editor/dist/toastui-editor.css'
import { STRING_LENGTH } from '@/constants/index.js'
import cron from '@/assets/js/node-cron-valid/node-cron-vaild.js'
import tools from './utils/tools'
Expand Down
1 change: 1 addition & 0 deletions frontend/desktop/src/pages/appmaker/AppEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
:placeholder="$t('请选择')"
:clearable="true"
:is-loading="schemeLoading"
:key="schemeLoading"
@selected="onSelectScheme">
<bk-option
v-for="(option, index) in schemeList"
Expand Down
33 changes: 5 additions & 28 deletions frontend/desktop/src/pages/task/ClockedList/EditClockedTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<NodePreview
ref="nodePreview"
:preview-data-loading="previewDataLoading"
:canvas-data="formatCanvasData('perview', previewData)"
:canvas-data="canvasData"
:preview-bread="previewBread"
:preview-data="previewData"
:common="false"
Expand Down Expand Up @@ -220,6 +220,7 @@
import { NAME_REG, STRING_LENGTH } from '@/constants/index.js'
import NodePreview from '@/pages/task/NodePreview.vue'
import NoData from '@/components/common/base/NoData.vue'
import { formatCanvasData } from '@/utils/checkDataType'
export default {
components: {
TaskParamEdit,
Expand Down Expand Up @@ -414,6 +415,9 @@
},
schemeSelectPlaceholder () {
return this.formData.template_id && !this.schemeList.length ? i18n.t('此流程无执行方案,无需选择') : i18n.t('请选择')
},
canvasData () {
return formatCanvasData('preview', this.previewData)
}
},
created () {
Expand Down Expand Up @@ -701,33 +705,6 @@
})
return nodes
},
/**
* 格式化pipelineTree的数据,只输出一部分数据
* @params {Object} data 需要格式化的pipelineTree
* @return {Object} {lines(线段连接), locations(节点默认都被选中), branchConditions(分支条件)}
*/
formatCanvasData (mode, data) {
const { line, location, gateways, activities } = data
const branchConditions = {}
for (const gKey in gateways) {
const item = gateways[gKey]
if (item.conditions) {
branchConditions[item.id] = Object.assign({}, item.conditions)
}
if (item.default_condition) {
const nodeId = item.default_condition.flow_id
branchConditions[item.id][nodeId] = item.default_condition
}
}
return {
lines: line,
locations: location.map(item => {
const code = item.type === 'tasknode' ? activities[item.id].component.code : ''
return { ...item, mode, code, status: '' }
}),
branchConditions
}
},
/**
* 点击预览模式下的面包屑
* @params {String} id 点击的节点id(可能为父节点或其他子流程节点)
Expand Down
Loading

0 comments on commit d47f09e

Please sign in to comment.