Skip to content

Commit

Permalink
fix: SRE商店功能开发 --story=121000017
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 27271
  • Loading branch information
ywywZhou committed Dec 19, 2024
1 parent 6ba3db8 commit 240ce99
Show file tree
Hide file tree
Showing 17 changed files with 843 additions and 17 deletions.
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
3 changes: 3 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,9 @@
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 ENABLE_NOTICE_CENTER = {{ENABLE_NOTICE_CENTER}}
function getCookie(name) {
Expand Down
26 changes: 25 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,31 @@ const cn = {
'产品官网': '产品官网',
'联系bk助手': '联系bk助手',
'蓝鲸桌面': '蓝鲸桌面',
'蓝鲸': '蓝鲸'
'蓝鲸': '蓝鲸',
'共享到商店': '共享到商店',
'共享到SRE商店': '共享到SRE商店',
'帮助文档': '帮助文档',
'SRE商店': 'SRE商店',
'templateSharedTips': '注意事项:共享的流程不包含敏感信息,支持在 {0} 预览',
'templateSharedSuccessTips': '共享成功,请前往 {0} 查看',
'更新': '更新',
'共享类型': '共享类型',
'场景名称': '场景名称',
'场景标识': '场景标识',
'场景分类': '场景分类',
'风险级别': '风险级别',
'使用说明': '使用说明',
'高': '高',
'低': '低',
'请输入场景名称': '请输入场景名称',
'请选择场景名称': '请选择场景名称',
'请输入场景标识': '请输入场景标识',
'请选择场景分类': '请选择场景分类',
'场景使用者通过标签可以快速找到同一类场景': '场景使用者通过标签可以快速找到同一类场景',
'申明该场景的运维操作风险级别,以便场景使用者决策场景的使用方式': '申明该场景的运维操作风险级别,以便场景使用者决策场景的使用方式',
'请输入标签,enter保存': '请输入标签,enter保存',
'将清空输入信息': '将清空输入信息',
'【n】标签已存在': '【{n}】标签已存在'
}

export default cn
26 changes: 25 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,31 @@ 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': 'Note: The shared process does not contain sensitive information and can be previewed at {0}',
'templateSharedSuccessTips': 'Shared successfully, please go to {0} to view',
'更新': 'Updated',
'共享类型': 'Sharing Type',
'场景名称': 'Scene Name',
'场景标识': 'Scene Identifier',
'场景分类': 'Scene Category',
'风险级别': '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'
}

export default en
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
13 changes: 11 additions & 2 deletions frontend/desktop/src/pages/task/TaskCreate/TaskParamFill.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@
'viewMode': state => state.view_mode,
'app_id': state => state.app_id,
'functionClaimMsg': state => state.functionClaimMsg,
'permissionMeta': state => state.permissionMeta
'permissionMeta': state => state.permissionMeta,
'bizId': state => state.project.bizId
}),
...mapState('project', {
'timeZone': state => state.timezone,
Expand Down Expand Up @@ -575,7 +576,15 @@
this.$router.push(url)
// 如果被嵌入了,则像父页面发送事件
if (this.hideHeader) {
window.parent.postMessage({ eventName: 'createTaskEvent' }, '*')
window.parent.postMessage({
eventName: 'createTaskEvent',
data: {
cc_id: this.bizId,
project_id: this.project_id,
task_id: taskData.id,
task_name: taskData.name
}
}, '*')
}
} catch (e) {
console.log(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@
if (!isFromCreate && this.$route.name === 'taskExecute' && window.history.length > 2) {
return this.$router.back()
}
// 如果被嵌入了,则像父页面发送事件
if (this.hideHeader) {
window.parent.postMessage({ eventName: 'goBackEvent' }, '*')
return
}
this.$router.push({
name: 'taskList',
params: { project_id: this.project_id }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<template>
<bk-select
:value="value"
searchable
multiple
display-tag
:placeholder="$t('请选择标签')"
ext-popover-cls="tpl-shared-tag-popover"
:loading="loading"
@change="onSelectChange">
<bk-option v-for="(tag, index) in tagList"
:key="index"
:id="tag.id"
:name="tag.name">
</bk-option>
<template slot="extension">
<bk-input
v-if="isTagInputShow"
ref="tagInput"
v-model="newTag"
:placeholder="$t('请输入标签,enter保存')"
@blur="resetTagInput"
@enter="addTag">
</bk-input>
<div v-else @click="showTagInput">
<i class="bk-icon icon-plus-circle mr2"></i>
{{ $t('新增') }}
</div>
</template>
</bk-select>
</template>
<script>
import { mapActions } from 'vuex'
export default {
model: {
prop: 'value',
event: 'change'
},
props: {
loading: {
type: Boolean,
default: false
},
value: {
type: Array,
default: () => ([])
},
tagList: {
type: Array,
default: () => ([])
}
},
data () {
return {
isTagInputShow: false,
newTag: ''
}
},
methods: {
...mapActions('templateMarket/', [
'createLabel'
]),
onSelectChange (val) {
this.$emit('change', val)
},
showTagInput () {
this.isTagInputShow = true
this.$nextTick(() => {
this.$refs.tagInput.focus()
})
},
resetTagInput () {
this.isTagInputShow = false
this.newTag = ''
},
async addTag () {
if (this.newTag) {
// 判断是否存在重复
const isExist = this.tagList.find(item => item.name === this.newTag)
if (isExist) {
this.$bkMessage({
message: this.$t('【n】标签已存在', { n: this.newTag }),
theme: 'error'
})
return
}
try {
const resp = await this.createLabel({
name: this.newTag,
code: this.newTag
})
// 添加新标签到父组件的标签列表
this.$emit('update:tagList', [...this.tagList, resp.data])
// 添加新标签到选中的标签列表
this.$emit('change', [...this.value, resp.data.id])
} catch (error) {
console.warn(error)
}
}
this.isTagInputShow = false
}
}
}
</script>
<style lang="scss">
.tpl-shared-tag-popover {
.bk-select-extension {
padding: 2px 10px;
text-align: center;
line-height: 30px;
cursor: pointer;
.bk-form-input {
height: 30px;
}
}
}
</style>
Loading

0 comments on commit 240ce99

Please sign in to comment.