Skip to content

Commit

Permalink
feat: hb merge master #ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
normal-wls committed Jun 20, 2024
2 parents 25d901a + d4b5495 commit c20ac7e
Show file tree
Hide file tree
Showing 26 changed files with 274 additions and 83 deletions.
9 changes: 8 additions & 1 deletion config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,10 @@ def monitor_report_config():
# 节点历史最大执行记录数
MAX_RECORDED_NODE_EXECUTION_TIMES = env.MAX_RECORDED_NODE_EXECUTION_TIMES

# 节点最大执行时间限制(需要插件实现中进行主动失败)
WITHOUT_NODE_MAX_EXECUTION_DAYS_TAG = env.WITHOUT_NODE_MAX_EXECUTION_DAYS_TAG
NODE_MAX_EXECUTION_DAYS = env.NODE_MAX_EXECUTION_DAYS


# engine admin permission settings
def check_engine_admin_permission(request, *args, **kwargs):
Expand Down Expand Up @@ -843,7 +847,10 @@ def check_engine_admin_permission(request, *args, **kwargs):
)

# 任务列表过滤失败任务最大天数
TASK_LIST_STATUS_FILTER_DAYS = env.BKPAAS_TASK_LIST_STATUS_FILTER_DAYS
TASK_LIST_STATUS_FILTER_DAYS = env.BKAPP_TASK_LIST_STATUS_FILTER_DAYS

# 我的动态过滤任务最大天数
MY_DYNAMIC_LIST_FILTER_DAYS = env.BKAPP_MY_DYNAMIC_LIST_FILTER_DAYS

# 第三方插件特殊轮询时间配置
REMOTE_PLUGIN_FIX_INTERVAL_CODES = env.REMOTE_PLUGIN_FIX_INTERVAL_CODES
Expand Down
15 changes: 13 additions & 2 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,16 @@
# 节点历史最大执行记录数
MAX_RECORDED_NODE_EXECUTION_TIMES = int(os.getenv("BKAPP_MAX_RECORDED_NODE_EXECUTION_TIMES", 5))

# 节点最大执行时间限制(需要插件实现中进行主动失败)
WITHOUT_NODE_MAX_EXECUTION_DAYS_TAG = -1
NODE_MAX_EXECUTION_DAYS = int(os.getenv("BKAPP_NODE_MAX_EXECUTION_DAYS", WITHOUT_NODE_MAX_EXECUTION_DAYS_TAG))

# 获取 PaaS 注入的蓝鲸域名
BKPAAS_BK_DOMAIN = os.getenv("BKPAAS_BK_DOMAIN", "") or os.getenv("BK_DOMAIN", "")

# PaaS 注入的蓝鲸共享资源域名
BKPAAS_SHARED_RES_URL = os.getenv("BKPAAS_SHARED_RES_URL", "")

# 任务状态展示版本, v2 为支持了等待处理展示的版本,修改为 v1 会退化为不计算独立子任务的状态
TASK_STATUS_DISPLAY_VERSION = os.getenv("BKAPP_TASK_STATUS_DISPLAY_VERSION", "v2")

Expand All @@ -124,8 +131,12 @@
or "CLASSIC"
)

# 默认六个月
BKPAAS_TASK_LIST_STATUS_FILTER_DAYS = int(os.getenv("BKPAAS_TASK_LIST_STATUS_FILTER_DAYS", 180))
# 任务列表展示时间,默认六个月
BKAPP_TASK_LIST_STATUS_FILTER_DAYS = int(os.getenv("BKAPP_TASK_LIST_STATUS_FILTER_DAYS", 180))

# 我的动态展示时间,默认六个月
BKAPP_MY_DYNAMIC_LIST_FILTER_DAYS = int(os.getenv("BKAPP_MY_DYNAMIC_LIST_FILTER_DAYS", 30))


# 第三方插件特殊轮询时间配置
REMOTE_PLUGIN_FIX_INTERVAL_CODES_STR = os.getenv("BKAPP_REMOTE_PLUGIN_FIX_INTERVAL_CODES", "")
Expand Down
3 changes: 2 additions & 1 deletion frontend/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"license": "ISC",
"dependencies": {
"@blueking/bkcharts": "^2.0.11-alpha.5",
"@blueking/bkui-form": "0.0.42",
"@blueking/bkui-form": "0.0.42-beta.5",
"@blueking/crypto-js-sdk": "0.0.5",
"@blueking/login-modal": "^1.0.1",
"@blueking/notice-component-vue2": "^2.0.1",
"@blueking/platform-config": "^1.0.2",
"@blueking/user-selector": "^1.0.5-beta.2",
"@vue/babel-preset-jsx": "^1.3.0",
"ajv": "^6.10.2",
Expand Down
16 changes: 9 additions & 7 deletions frontend/desktop/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
}
}
},
created () {
async created () {
window.msg_list = []
bus.$on('showLoginModal', args => {
const { has_plain, login_url, width, height, method } = args
Expand Down Expand Up @@ -193,7 +193,8 @@
})
})
}
this.getPageFooter()
await this.getPageFooter()
this.getGlobalConfig()
window.addEventListener('message', this.messageHandler, false)
},
mounted () {
Expand All @@ -203,7 +204,9 @@
...mapActions([
'getPermissionMeta',
'queryUserPermission',
'getFooterContent'
'getFooterContent',
'getFooterInfo',
'getGlobalConfig'
]),
...mapActions('appmaker/', [
'loadAppmakerDetail'
Expand All @@ -229,7 +232,7 @@
'setProjectConfig'
]),
...mapMutations([
'setPageFooter',
'setFooterInfo',
'setAdminPerm',
'setStatisticsPerm'
]),
Expand Down Expand Up @@ -309,12 +312,11 @@
async getPageFooter () {
try {
this.footerLoading = true
const resp = await this.getFooterContent()
const resp = await this.getFooterInfo()
if (resp.result) {
this.setPageFooter(resp.data)
this.setFooterInfo(resp.data)
}
} catch (e) {
this.setPageFooter(`<div class="copyright"><div>蓝鲸智云 版权所有</div></div>`)
console.log(e)
} finally {
this.footerLoading = false
Expand Down
13 changes: 8 additions & 5 deletions frontend/desktop/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ axios.interceptors.response.use(
bus.$emit('createSnapshot', true) // 创建模板快照
}

const successUrl = `${window.location.origin}${window.SITE_URL}static/bk_sops/login_success.html`
let [loginUrl] = data.login_url.split('?')
loginUrl = `${loginUrl}?c_url=${encodeURIComponent(successUrl)}`

showLoginModal({ loginUrl })
// 退出登录接口不打开登录弹框
if (response.config.url.indexOf('/logout') === -1) {
const successUrl = `${window.location.origin}${window.SITE_URL}static/bk_sops/login_success.html`
let [loginUrl] = data.login_url.split('?')
loginUrl = `${loginUrl}?c_url=${encodeURIComponent(successUrl)}`

showLoginModal({ loginUrl })
}
}
break
case 499:
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 @@ -52,6 +52,10 @@
var BK_DOMAIN = '{{BK_DOMAIN}}';
var BK_PAAS_ESB_HOST = '{{BK_PAAS_ESB_HOST}}'
var TASK_LIST_STATUS_FILTER_DAYS = {{TASK_LIST_STATUS_FILTER_DAYS}}
var LOGIN_URL = '{{LOGIN_URL}}'
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_NOTICE_CENTER = {{ENABLE_NOTICE_CENTER}}
var MESSAGE_HELPER_URL = '{{MESSAGE_HELPER_URL}}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@
},
// 文本框失焦
handleInputBlur (e) {
this.$emit('blur')
this.$emit('blur', this.input.value)
this.input.focus = false
// 更新文本框结构,生成tag标签
this.updateInputHtml()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
},
// 文本框失焦
handleInputBlur (e) {
this.$emit('blur')
this.$emit('blur', this.input.value)
this.input.focus = false
// 更新文本框结构,生成tag标签
this.updateInputHtml()
Expand Down
17 changes: 10 additions & 7 deletions frontend/desktop/src/components/layout/CopyrightFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
* specific language governing permissions and limitations under the License.
*/
<template>
<footer id="page-footer-wrapper" v-html="footer"></footer>
<footer id="page-footer-wrapper">
<p class="link-list" v-html="platformInfo.i18n.footerInfoHTML"></p>
<p class="copyright" v-if="footerInfo.year">
{{ `Copyright © ${footerInfo.year} Tencent BlueKing. All Rights Reserved. ${footerInfo.sops_version}` }}
</p>
</footer>
</template>
<script>
import { mapState } from 'vuex'
Expand All @@ -19,7 +24,8 @@
name: 'CopyrightFooter',
computed: {
...mapState({
footer: state => state.footer
footerInfo: state => state.footerInfo,
platformInfo: state => state.platformInfo
})
}
}
Expand All @@ -34,18 +40,15 @@
text-align: center;
}
.link-list {
text-align: center;
margin-bottom: 6px;
font-size: 12px;
}
.link-item {
display: inline-block;
margin-left: -4px;
padding: 0 4px;
line-height: 1;
color: #3480fe;
border-right: 1px solid #3480fe;
&:last-child {
border-right: none;
}
}
.desc {
margin-bottom: 8px;
Expand Down
5 changes: 3 additions & 2 deletions frontend/desktop/src/components/layout/Navigation.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<bk-navigation
navigation-type="left-right"
:side-title="$t('标准运维')"
:side-title="platformInfo.name"
:need-menu="true"
:class="$route.name === 'taskList' ? 'hide-header-border' : ''"
:default-open="sideNavOpen"
@toggle="toggleSideNav">
<div slot="side-icon" class="logo-area">
<img :src="logo" class="logo" />
<img :src="platformInfo.appLogo || logo" class="logo" />
</div>
<template slot="header">
<div class="header-title">{{ title }}</div>
Expand Down Expand Up @@ -98,6 +98,7 @@
},
computed: {
...mapState({
platformInfo: state => state.platformInfo,
hasAdminPerm: state => state.hasAdminPerm,
hasStatisticsPerm: state => state.hasStatisticsPerm,
app_id: state => state.app_id,
Expand Down
14 changes: 11 additions & 3 deletions frontend/desktop/src/components/layout/NavigatorHeadRight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
},
methods: {
...mapActions([
'logout',
'queryNewVersion',
'getVersionList',
'getVersionDetail'
Expand Down Expand Up @@ -230,9 +231,16 @@
reloadHome () {
this.reload()
},
handleLogout () {
const newUrl = window.location.origin + (window.SITE_URL || '/') + 'logout'
window.location.replace(newUrl)
async handleLogout () {
try {
await this.logout()
} catch (error) {
console.warn(error)
} finally {
let loginUrl = window.LOGIN_URL
loginUrl = /\/$/.test(loginUrl) ? loginUrl : `${loginUrl}/`
window.location.replace(`${loginUrl}?is_from_logout=1&c_url=${window.location.href}`)
}
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion frontend/desktop/src/config/i18n/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,14 @@ const cn = {
'返回首页': '返回首页',
'请至少选择一个节点': '请至少选择一个节点',
'代理人仅可设置为本人': '代理人仅可设置为本人',
'任务等待处理中,无需暂停': '任务等待处理中,无需暂停'
'任务等待处理中,无需暂停': '任务等待处理中,无需暂停',
'代理人仅可设置为本人': '代理人仅可设置为本人',

Check failure on line 1832 in frontend/desktop/src/config/i18n/cn.js

View workflow job for this annotation

GitHub Actions / eslint

Duplicate key '代理人仅可设置为本人'
'技术支持': '技术支持',
'社区论坛': '社区论坛',
'产品官网': '产品官网',
'联系bk助手': '联系bk助手',
'蓝鲸桌面': '蓝鲸桌面',
'蓝鲸': '蓝鲸'
}

export default cn
9 changes: 8 additions & 1 deletion frontend/desktop/src/config/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,14 @@ const en = {
'返回首页': 'Return to Home',
'请至少选择一个节点': 'Please select at least one node',
'代理人仅可设置为本人': 'The executor proxy can only set yourself',
'任务等待处理中,无需暂停': 'The task is waiting for processing, no need to pause'
'任务等待处理中,无需暂停': 'The task is waiting for processing, no need to pause',
'代理人仅可设置为本人': 'The agent can only be set as yourself.',

Check failure on line 1866 in frontend/desktop/src/config/i18n/en.js

View workflow job for this annotation

GitHub Actions / eslint

Duplicate key '代理人仅可设置为本人'
'技术支持': 'Technical Support',
'社区论坛': 'Community Forum',
'产品官网': 'Product Website',
'联系bk助手': 'Contact BK Assistant',
'蓝鲸桌面': 'BlueWhale Desktop',
'蓝鲸': 'BlueKing'
}

export default en
2 changes: 1 addition & 1 deletion frontend/desktop/src/pages/appmaker/AppTaskHome/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
:title="props.row.name"
:to="{
name: 'appmakerTaskExecute',
params: { app_id: props.row.create_info, project_id: props.row.project.id },
params: { app_id: app_id, project_id: props.row.project.id },
query: { instance_id: props.row.id, template_id: props.row.template_id }
}">
{{props.row.name}}
Expand Down
22 changes: 11 additions & 11 deletions frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@
import axios from 'axios'
import tools from '@/utils/tools.js'
import { TASK_STATE_DICT } from '@/constants/index.js'
import dom from '@/utils/dom.js'
import TemplateCanvas from '@/components/common/TemplateCanvas/index.vue'
import ModifyParams from './ModifyParams.vue'
import ExecuteInfo from './ExecuteInfo/index.vue'
Expand All @@ -224,6 +223,7 @@
import TemplateData from './TemplateData'
import injectVariableDialog from './InjectVariableDialog.vue'
import tplPerspective from '@/mixins/tplPerspective.js'
import { setShortcutIcon } from '@blueking/platform-config'
const CancelToken = axios.CancelToken
let source = CancelToken.source()
Expand Down Expand Up @@ -390,6 +390,7 @@
},
computed: {
...mapState({
platformInfo: state => state.platformInfo,
view_mode: state => state.view_mode,
appId: state => state.app_id,
hasAdminPerm: state => state.hasAdminPerm,
Expand Down Expand Up @@ -2008,32 +2009,31 @@
},
// 根据当前任务的状态修改页面对应浏览器tab的icon
modifyPageIcon () {
let nameSuffix = ''
let namePrefix = ''
switch (this.state) {
case 'CREATED':
nameSuffix = 'created'
namePrefix = 'created'
break
case 'FINISHED':
nameSuffix = 'finished'
namePrefix = 'finished'
break
case 'FAILED':
case 'REVOKED':
nameSuffix = 'failed'
namePrefix = 'failed'
break
case 'RUNNING':
case 'READY':
nameSuffix = 'running'
namePrefix = 'running'
if (this.tabIconState === 'SUSPENDED') {
nameSuffix = 'suspended'
namePrefix = 'suspended'
}
break
case 'SUSPENDED':
case 'NODE_SUSPENDED':
nameSuffix = 'suspended'
namePrefix = 'suspended'
}
const picName = nameSuffix ? `bk_sops_${nameSuffix}` : 'bk_sops'
const path = `${window.SITE_URL}static/core/images/${picName}.png`
dom.setPageTabIcon(path)
const picName = namePrefix ? `${namePrefix}Img` : 'bk_sops'
setShortcutIcon(this.platformInfo[picName])
},
// 下次画布组件更新后执行队列
onTemplateCanvasMounted () {
Expand Down
Loading

0 comments on commit c20ac7e

Please sign in to comment.