Merge pull request #1753 from jumpserver/dev

v2.22.0-rc2
This commit is contained in:
Jiangjie.Bai
2022-05-17 15:22:01 +08:00
committed by GitHub
31 changed files with 59 additions and 41 deletions

View File

@@ -24,9 +24,9 @@ if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
)
app.listen(port, function () {
console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
// debug(chalk.green(`> Preview at http://localhost:${port}${publicPath}`))
if (report) {
console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
// debug(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`))
}
})

View File

@@ -56,7 +56,7 @@ const responseFake = (url, type, respond) => {
url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
type: type || 'get',
response(req, res) {
console.log('request invoke:' + req.path)
// debug('request invoke:' + req.path)
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
}
}

View File

@@ -59,9 +59,9 @@ module.exports = app => {
mockRoutesLength = mockRoutes.mockRoutesLength
mockStartIndex = mockRoutes.mockStartIndex
console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`))
// debug(chalk.magentaBright(`\n > Mock Server hot reload success! changed ${path}`))
} catch (error) {
console.log(chalk.redBright(error))
// debug(chalk.redBright(error))
}
}
})

View File

@@ -31,6 +31,7 @@
<script>
import Dialog from '@/components/Dialog'
import { UpdateToken, UploadKey } from '@/components/FormFields'
import { encryptPassword } from '@/utils/crypto'
export default {
name: 'UpdateSecretInfo',
components: {
@@ -61,10 +62,10 @@ export default {
handleConfirm() {
const data = {}
if (this.authInfo.password !== '') {
data.password = this.authInfo.password
data.password = encryptPassword(this.authInfo.password)
}
if (this.authInfo.private_key !== '') {
data.private_key = this.authInfo.private_key
data.private_key = encryptPassword(this.authInfo.private_key)
if (this.authInfo.passphrase) data.passphrase = this.authInfo.passphrase
}
this.$axios.patch(

View File

@@ -146,9 +146,7 @@ export default {
vm.showUpdateSecretDialog = false
setTimeout(() => {
vm.showUpdateSecretDialog = true
console.log('Show update1: ', vm.showUpdateSecretDialog)
})
console.log('Show update2: ', vm.showUpdateSecretDialog)
}
}
]

View File

@@ -238,7 +238,7 @@ export default {
updateContabValue(name, value, from) {
this.contabValueObj[name] = value
if (from && from !== name) {
console.log(`来自组件 ${from} 改变了 ${name} ${value}`)
// debug(`来自组件 ${from} 改变了 ${name} ${value}`)
this.changeRadio(name, value)
}
},

View File

@@ -53,7 +53,7 @@ export default {
}
} catch (error) {
this.isShow = false
console.log(error, 'error')
// debug(error, 'error')
}
}
}

View File

@@ -146,7 +146,7 @@ export default {
* - el-form 的 resetFields 不会触发 input & change 事件,无法监听
* - bug1: https://github.com/FEMessage/el-data-table/issues/176#issuecomment-587280825
* - bug2:
* 0. 建议先在监听器 watch.value 里 console.log(v.name, oldV.name)
* 0. 建议先在监听器 watch.value 里 // debug(v.name, oldV.name)
* 1. 打开 basic 示例
* 2. 在 label 为 name 的输入框里输入 1此时 log'1' ''
* 3. 点击 reset 按钮,此时 log 两条数据: '1' '1', '' ''

View File

@@ -97,7 +97,7 @@ export default {
},
handleClick(button) {
const callback = button.callback || function(values, form) {
// console.log('Click ', button.title, ': ', values)
// debug('Click ', button.title, ': ', values)
}
const form = this.$refs['form']
const values = form.getFormValue()

View File

@@ -72,7 +72,7 @@ export default {
},
methods: {
defaultCallback: function(action) {
// console.log(action)
// debug(action)
}
}
}

View File

@@ -205,8 +205,9 @@ export default {
}
return this.url.indexOf('?') === -1 ? `${this.url}?${query}` : `${this.url}&${query}`
},
// eslint-disable-next-line handle-callback-err
catchError(error) {
console.log(error)
// debug(error)
},
onSuccess(msg) {
this.errorMsg = ''

View File

@@ -1,5 +1,5 @@
export function cleanActions(actions, canDefaults, { selectedRows, reloadTable }) {
// console.log('Start clean actions: ', selectedRows.length, reloadTable)
// debug('Start clean actions: ', selectedRows.length, reloadTable)
const cleanedActions = []
const cloneActions = _.cloneDeep(actions)
cloneActions.forEach((action) => {

View File

@@ -17,7 +17,7 @@ export default {
}
// const locale = this.$i18n.locale
// const value = dt.toLocaleString(locale, { hourCycle: 'h23' })
// console.log(this.$i18n.locale)
// debug(this.$i18n.locale)
return {
value: value
}

View File

@@ -77,7 +77,7 @@ export default {
}
},
mounted() {
// console.log(this.treeSetting)
// debug(this.treeSetting)
},
methods: {
handleUrlChange(url) {

View File

@@ -18,7 +18,7 @@ router.beforeEach(async(to, from, next) => {
next()
} catch (e) {
const msg = 'Start service error: ' + e
console.log(e)
// debug(e)
}
})

View File

@@ -1379,6 +1379,7 @@
"HuaweiPrivatecloud": "Huawei Private Cloud",
"OpenStack": "OpenStack",
"GCP": "Google Cloud Platform",
"FC": "Fusion Compute",
"AWS_China": "AWS(China)",
"AWS_Int": "AWS(International)",
"HuaweiCloud": "Huawei Cloud",

View File

@@ -1422,6 +1422,7 @@
"HuaweiPrivatecloud": "ファーウェイプライベートクラウド",
"OpenStack": "OpenStack",
"GCP": "Googleクラウド",
"FC": "Fusion Compute",
"AWS_China": "AWS(中国)",
"AWS_Int": "AWS (国際)",
"HuaweiCloud": "ファーウェイ雲",

View File

@@ -1423,6 +1423,7 @@
"HuaweiPrivatecloud": "华为私有云",
"OpenStack": "OpenStack",
"GCP": "谷歌云",
"FC": "Fusion Compute",
"AWS_China": "AWS(中国)",
"AWS_Int": "AWS(国际)",
"HuaweiCloud": "华为云",

View File

@@ -272,6 +272,10 @@ export default {
return ['put', 'patch'].indexOf(this.method.toLowerCase()) > -1
},
encryptFields(values) {
// 批量提交clean 后可能是个数组
if (values instanceof Array) {
return values.map((item) => this.encryptFields(item))
}
values = { ...values }
for (const field of this.encryptedFields) {
let value = values[field]

View File

@@ -98,11 +98,11 @@ export default {
const vm = this
return {
submitMethod: () => 'patch',
cleanFormValue: function(value) {
cleanFormValue: (value) => {
const filterValue = {}
Object.keys(value).filter((key) => vm.checkedFields?.includes(key)).forEach((key) => {
filterValue[key] = value[key]
})
Object.keys(value)
.filter((key) => vm.checkedFields?.includes(key))
.forEach((key) => { filterValue[key] = value[key] })
const formValue = []
let object = {}
for (const row of vm.selectedRows) {

View File

@@ -126,7 +126,7 @@ function cleanRoute(tmp, parent) {
} else {
tmp.meta.fullPath = parentFullPath ? parentFullPath + '/' + tmp.path : parentFullPath
}
// console.log('Full path: ', tmp.meta.fullPath)
// debug('Full path: ', tmp.meta.fullPath)
}
// 设置默认active menu
if (tmp.meta.type === 'crud' && !tmp.meta.activeMenu) {

View File

@@ -82,7 +82,7 @@ const actions = {
commit('SET_PROFILE', response)
resolve(response)
}).catch(error => {
// console.log(error)
// debug(error)
reject(error)
})
})

View File

@@ -36,7 +36,7 @@ function beforeRequestAddTimezone(config) {
try {
config.headers['X-TZ'] = Intl.DateTimeFormat().resolvedOptions().timeZone
} catch (e) {
console.log('Current browser not support Intl tools')
// debug('Current browser not support Intl tools')
}
}
@@ -51,7 +51,7 @@ service.interceptors.request.use(
},
error => {
// do something with request error
console.log(error) // for debug
// debug(error) // for debug
return Promise.reject(error)
}
)

View File

@@ -4,7 +4,7 @@ import router, { resetRouter } from '@/router'
import Vue from 'vue'
import { Message } from 'element-ui'
import 'nprogress/nprogress.css' // progress bar style
import { getTokenFromCookie, setTokenToCookie } from '@/utils/auth'
import { getTokenFromCookie } from '@/utils/auth'
import orgUtil from '@/utils/org'
import orgs from '@/api/orgs'
import { getPropView, isViewHasOrgs } from '@/utils/jms'
@@ -44,12 +44,13 @@ async function checkLogin({ to, from, next }) {
}
function afterGetSetting(setting) {
if (setting['SESSION_EXPIRE_AT_BROWSER_CLOSE']) {
setInterval(() => {
const csrfToken = getTokenFromCookie()
if (csrfToken) { setTokenToCookie(csrfToken, '30s') }
}, 10 * 1000)
}
// if (setting['SESSION_EXPIRE_AT_BROWSER_CLOSE']) {
// setInterval(() => {
// const csrfToken = getTokenFromCookie()
// Vue.$log.debug('Refresh csrf token expiration: ', csrfToken)
// if (csrfToken) { setTokenToCookie(csrfToken, '30s') }
// }, 10 * 1000)
// }
}
async function getPublicSetting({ to, from, next }, isOpen) {

View File

@@ -172,7 +172,7 @@ export default {
})
},
hideMenu() {
console.log('Tree: ', this.tree)
// debug('Tree: ', this.tree)
this.tree.hideRMenu()
},
getSelectedNodes() {

View File

@@ -4,7 +4,7 @@
<script type="text/jsx">
import GenericListTable from '@/layout/components/GenericListTable'
import { ACCOUNT_PROVIDER_ATTRS_MAP, aliyun, aws_china, aws_international, huaweicloud, qcloud, azure, azure_international, vmware, nutanix, qingcloud_private, huaweicloud_private, openstack, gcp, baiducloud, jdcloud } from '../const'
import { ACCOUNT_PROVIDER_ATTRS_MAP, aliyun, aws_china, aws_international, huaweicloud, qcloud, azure, azure_international, vmware, nutanix, qingcloud_private, huaweicloud_private, openstack, gcp, baiducloud, jdcloud, fc } from '../const'
export default {
name: 'AccountList',
@@ -134,6 +134,10 @@ export default {
{
name: nutanix,
title: ACCOUNT_PROVIDER_ATTRS_MAP[nutanix].title
},
{
name: fc,
title: ACCOUNT_PROVIDER_ATTRS_MAP[fc].title
}
]
}

View File

@@ -13,6 +13,7 @@ export const qingcloud_private = 'qingcloud_private'
export const huaweicloud_private = 'huaweicloud_private'
export const openstack = 'openstack'
export const gcp = 'gcp'
export const fc = 'fc'
export const baiducloud = 'baiducloud'
export const jdcloud = 'jdcloud'
@@ -91,5 +92,10 @@ export const ACCOUNT_PROVIDER_ATTRS_MAP = {
name: gcp,
title: i18n.t('xpack.Cloud.GCP'),
attrs: ['service_account_key']
},
[fc]: {
name: fc,
title: i18n.t('xpack.Cloud.FC'),
attrs: ['api_endpoint', 'username', 'password']
}
}

View File

@@ -116,7 +116,7 @@ export default {
this.loading = false
})
} else {
console.log('error submit!!')
// debug('error submit!!')
return false
}
})

View File

@@ -101,8 +101,8 @@ export default {
).then(newSub => {
const msgType = this.idMessageTypeMapper[newSub.message_type]
msgType.receivers = newSub.receivers
}).catch(err => {
console.log(err)
}).catch(() => {
// debug(err)
})
},
getNameDisplay(header) {

View File

@@ -86,7 +86,7 @@ export default {
'tickets.change_ticketflow': ['users.view_user', 'tickets.view_ticket'],
'tickets.view_ticket': [
'assets.match_asset', 'assets.match_node', 'assets.match_systemuser',
'applications.match_application'
'applications.match_application', 'rbac.view_workbench'
],
'tickets.view_ticketflow': ['tickets.view_ticket'],
'users.invite_user': [

View File

@@ -79,7 +79,7 @@ describe('Breadcrumb.vue', () => {
// router.push('/menu/menu1/menu1-2/menu1-2-2')
// const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')
// const second = breadcrumbArray.at(1)
// console.log(breadcrumbArray)
// // debug(breadcrumbArray)
// const href = second.find('a').attributes().href
// expect(href).toBe('#/menu/menu1')
// })