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

修改代码注释问题 #6816

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 config/stag.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
if RUN_VER == "open":
from blueapps.patch.settings_open_saas import * # noqa
else:
from blueapps.patch.settings_paas_services import * # noqaJobExecuteTaskComponent
from blueapps.patch.settings_paas_services import * # noqa

import env

Expand Down
41 changes: 41 additions & 0 deletions frontend/desktop/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,44 @@ axios.interceptors.response.use(
return Promise.reject(response)
}
)

axios.jsonp = (url, data) => {
if (!url) {
throw new Error('url is necessary')
}
const callback = 'CALLBACK' + Math.random().toString().substr(9, 18)
const JSONP = document.createElement('script')
JSONP.setAttribute('type', 'text/javascript')

const headEle = document.getElementsByTagName('head')[0]

let ret = ''
if (data) {
if (typeof data === 'string') {
ret = '&' + data
} else if (typeof data === 'object') {
for (const key in data) {
ret += '&' + key + '=' + encodeURIComponent(data[key])
}
}
ret += '&_time=' + Date.now()
}
JSONP.src = `${url}?callback=${callback}${ret}`

function remove () {
headEle.removeChild(JSONP)
delete window[callback]
}
return new Promise((resolve, reject) => {
window[callback] = r => {
resolve(r)
remove()
}
JSONP.onerror = err => {
reject(err)
remove()
}

headEle.appendChild(JSONP)
})
}
1 change: 1 addition & 0 deletions frontend/desktop/src/assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
var MEMBER_SELECTOR_DATA_HOST = '{{MEMBER_SELECTOR_DATA_HOST}}';
var MAX_NODE_EXECUTE_TIMEOUT = {{MAX_NODE_EXECUTE_TIMEOUT}};
var BK_DOMAIN = '{{BK_DOMAIN}}'
var BK_PAAS_ESB_HOST = {{BK_PAAS_ESB_HOST}}
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
return (arr = document.cookie.match(reg)) ? unescape(arr[2]) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
},
computed: {
failedAgentLength () {
return this.staticIps.filter(item => !item.agent).length
return this.staticIps.filter(item => item.agent !== 1).length
},
isShowQuantity () {
return this.staticIps.length
Expand Down Expand Up @@ -224,14 +224,14 @@
this.handleIpCopy(ipStr)
},
copyAgentIp () {
const ipStr = this.staticIps.filter(item => !item.agent).map(d => d.bk_host_innerip).join(',')
const ipStr = this.staticIps.filter(item => item.agent !== 1).map(d => d.bk_host_innerip).join(',')
this.handleIpCopy(ipStr)
},
clearIp () {
this.$emit('change', [])
},
clearFailedAgentIp () {
const staticIps = this.staticIps.filter(item => !!item.agent)
const staticIps = this.staticIps.filter(item => item.agent === 1)
this.$emit('change', staticIps)
},
onDropdownShow () {
Expand Down
16 changes: 14 additions & 2 deletions frontend/desktop/src/components/layout/NavigatorHeadRight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import ProjectSelector from './ProjectSelector.vue'
import VersionLog from './VersionLog.vue'
import Cookies from 'js-cookie'
import axios from 'axios'

export default {
name: 'NavigatorHeadRight',
Expand Down Expand Up @@ -163,7 +164,7 @@
...mapMutations('project', [
'setProjectId'
]),
toggleLanguage (language) {
async toggleLanguage (language) {
this.curLanguage = language
const local = language === 'chinese' ? 'zh-cn' : 'en'
const domain = window.BK_DOMAIN || window.location.hostname.replace(/^[^.]+(.*)$/, '$1')
Expand All @@ -172,7 +173,18 @@
domain,
path: '/'
})
window.location.reload()
if (window.BK_PAAS_ESB_HOST) {
const url = `${window.BK_PAAS_ESB_HOST}/api/c/compapi/v2/usermanage/fe_update_user_language/`
try {
await axios.jsonp(url, { language })
} catch (error) {
console.warn(error)
} finally {
window.location.reload()
}
} else {
window.location.reload()
}
},
goToHelpDoc () {
window.open(this.bkDocUrl, '_blank')
Expand Down