mirror of
https://github.com/jumpserver/lina.git
synced 2025-11-08 19:02:40 +00:00
Compare commits
56 Commits
pr@dev@fea
...
v3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35ac740a60 | ||
|
|
f031760d81 | ||
|
|
b902ba26be | ||
|
|
7b61a4314c | ||
|
|
6039e240ac | ||
|
|
adb10b014f | ||
|
|
5de84a2681 | ||
|
|
d43b43ade7 | ||
|
|
955dabb02f | ||
|
|
f7901fcdf8 | ||
|
|
6650ec8da0 | ||
|
|
cb75a1620a | ||
|
|
8f9d1f4ddf | ||
|
|
44da5da8b6 | ||
|
|
b8326ef880 | ||
|
|
45448513cb | ||
|
|
3117046342 | ||
|
|
b68aecb5cc | ||
|
|
1c9b155d97 | ||
|
|
75b1be9864 | ||
|
|
615c3c1cf4 | ||
|
|
4d82231af4 | ||
|
|
c6cf6571b6 | ||
|
|
8ea990d070 | ||
|
|
f4a32170d5 | ||
|
|
073508675e | ||
|
|
1d6ca0a93a | ||
|
|
36aea652d6 | ||
|
|
1a42ce90ab | ||
|
|
31a401b55d | ||
|
|
582a84178d | ||
|
|
9b9f7c936c | ||
|
|
2a6100957f | ||
|
|
16606d6a27 | ||
|
|
0a612f50e6 | ||
|
|
fe36fa9390 | ||
|
|
ba109900ec | ||
|
|
ec7768267f | ||
|
|
cc58b374ab | ||
|
|
04ffbb8fd6 | ||
|
|
49880f6739 | ||
|
|
e6f98d58c4 | ||
|
|
fd1f16d43c | ||
|
|
968b2415b1 | ||
|
|
776090d6ba | ||
|
|
3a37952288 | ||
|
|
62b8fc0e3b | ||
|
|
b2028869cb | ||
|
|
5277a725f8 | ||
|
|
f137788c1a | ||
|
|
f7d17c8de7 | ||
|
|
feea70b0be | ||
|
|
04696ef3d6 | ||
|
|
1731f4f788 | ||
|
|
6f25d93909 | ||
|
|
46461ec324 |
@@ -204,7 +204,10 @@ export default {
|
||||
helpText: this.$t('accounts.AccountPush.WindowsPushHelpText'),
|
||||
hidden: () => {
|
||||
const automation = this.iPlatform.automation || {}
|
||||
return !automation.push_account_enabled || !automation.ansible_enabled || !this.$hasPerm('accounts.push_account') || this.addTemplate
|
||||
return !automation.push_account_enabled ||
|
||||
!automation.ansible_enabled ||
|
||||
!this.$hasPerm('accounts.push_account') ||
|
||||
this.addTemplate
|
||||
}
|
||||
},
|
||||
params: {
|
||||
@@ -280,16 +283,6 @@ export default {
|
||||
return secretTypes.indexOf(item.value) > -1
|
||||
})
|
||||
},
|
||||
controlShowField() {
|
||||
const privileged = ['privileged']
|
||||
let suFrom = ['su_from']
|
||||
const filterSuFrom = ['database', 'device', 'cloud', 'web', 'windows']
|
||||
const asset = this?.asset || {}
|
||||
if (filterSuFrom.includes(asset?.category?.value) || filterSuFrom.includes(asset?.type?.value)) {
|
||||
suFrom = []
|
||||
}
|
||||
return [...privileged, ...suFrom]
|
||||
},
|
||||
confirm(form) {
|
||||
const secretType = form.secret_type || ''
|
||||
if (secretType !== 'password') {
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
<DataZTree ref="dataztree" :setting="treeSetting" class="data-z-tree" v-on="$listeners">
|
||||
<slot v-if="treeSetting.hasRightMenu" slot="rMenu">
|
||||
<li v-if="treeSetting.showCreate" id="m_create" class="rmenu" tabindex="-1" @click="createTreeNode">
|
||||
<i class="fa fa-plus-square-o" /> {{ this.$t('tree.CreateNode') }}
|
||||
<i class="fa fa-plus-square-o" /> {{ this.$t('tree.CreateNode') }}
|
||||
</li>
|
||||
<li v-if="treeSetting.showUpdate" id="m_edit" class="rmenu" tabindex="-1" @click="editTreeNode">
|
||||
<i class="fa fa-pencil-square-o" /> {{ this.$t('tree.RenameNode') }}
|
||||
<i class="fa fa-pencil-square-o" /> {{ this.$t('tree.RenameNode') }}
|
||||
</li>
|
||||
<li v-if="treeSetting.showDelete" id="m_del" class="rmenu" tabindex="-1" @click="removeTreeNode">
|
||||
<i class="fa fa-minus-square" /> {{ this.$t('tree.DeleteNode') }}
|
||||
<i class="fa fa-minus-square" /> {{ this.$t('tree.DeleteNode') }}
|
||||
</li>
|
||||
<slot name="rMenu" />
|
||||
</slot>
|
||||
@@ -42,7 +42,9 @@ export default {
|
||||
customTreeHeaderName: this.$t('assets.AssetTree'),
|
||||
async: {
|
||||
enable: true,
|
||||
url: (process.env.VUE_APP_ENV === 'production') ? (`${this.setting.treeUrl}`) : (`${process.env.VUE_APP_BASE_API}${this.setting.treeUrl}`),
|
||||
url: (process.env.VUE_APP_ENV === 'production')
|
||||
? (`${this.setting.treeUrl}`)
|
||||
: (`${process.env.VUE_APP_BASE_API}${this.setting.treeUrl}`),
|
||||
autoParam: ['id=key', 'name=n', 'level=lv'],
|
||||
type: 'get',
|
||||
headers: {
|
||||
@@ -206,7 +208,9 @@ export default {
|
||||
this.showRMenu('root', event.clientX, event.clientY)
|
||||
} else if (treeNode && !treeNode.noR) {
|
||||
this.zTree.selectNode(treeNode)
|
||||
this.currentNodeId = treeNode.meta.data.id
|
||||
if (treeNode.meta?.data?.id) {
|
||||
this.currentNodeId = treeNode.meta.data.id
|
||||
}
|
||||
this.showRMenu('node', event.clientX, event.clientY)
|
||||
}
|
||||
},
|
||||
@@ -284,32 +288,32 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.rmenu {
|
||||
font-size: 12px;
|
||||
padding: 0 16px;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #606266;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rmenu {
|
||||
font-size: 12px;
|
||||
padding: 0 16px;
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #606266;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rmenu > a:hover, .dropdown-menu > a:focus {
|
||||
color: #262626;
|
||||
text-decoration: none;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.rmenu > a:hover, .dropdown-menu > a:focus {
|
||||
color: #262626;
|
||||
text-decoration: none;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.rmenu:hover {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
.rmenu:hover {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.data-z-tree >>> .fa {
|
||||
width: 10px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
.data-z-tree >>> .fa {
|
||||
width: 10px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -88,10 +88,12 @@ export default {
|
||||
default: () => ([])
|
||||
},
|
||||
readonly: {
|
||||
// 这个是在详情中,不可编辑,包括所有
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
settingReadonly: {
|
||||
// 这个是在资产添加时设置协议使用,不能修改 setting
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
@@ -144,6 +146,11 @@ export default {
|
||||
},
|
||||
items: {
|
||||
handler(value) {
|
||||
if (this.settingReadonly) {
|
||||
value = value.map(i => {
|
||||
return { name: i.name, port: i.port }
|
||||
})
|
||||
}
|
||||
this.$emit('input', value)
|
||||
},
|
||||
immediate: true,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button
|
||||
v-show="!isShow"
|
||||
type="text"
|
||||
class="button-text"
|
||||
v-show="!iShowSelect"
|
||||
:disabled="disabled"
|
||||
@click="isShow=true"
|
||||
class="button-text"
|
||||
type="text"
|
||||
@click="iShowSelect=true"
|
||||
>
|
||||
{{ iLabel }}
|
||||
<svg-icon class-name="icon" icon-class="switch" />
|
||||
</el-button>
|
||||
<Select2
|
||||
v-show="isShow"
|
||||
v-show="iShowSelect"
|
||||
ref="select2"
|
||||
v-model="iValue"
|
||||
:disabled="disabled"
|
||||
@@ -41,7 +41,7 @@ export default {
|
||||
},
|
||||
showSelect: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: false
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
@@ -50,8 +50,8 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: this.showSelect,
|
||||
iLabel: this.label
|
||||
iShowSelect: this.showSelect,
|
||||
iLabel: this.label || '-'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -67,14 +67,14 @@ export default {
|
||||
created() {
|
||||
const { path } = this.$route
|
||||
if (hasUUID(path) && this.value) {
|
||||
this.isShow = false
|
||||
this.iShowSelect = false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelectChange(val) {
|
||||
const options = this.$refs.select2.options.filter(item => item.value === val)
|
||||
const label = options.length > 0 ? options[0].label : ''
|
||||
this.isShow = false
|
||||
this.iShowSelect = false
|
||||
this.iLabel = val ? label : '-'
|
||||
}
|
||||
}
|
||||
@@ -84,8 +84,7 @@ export default {
|
||||
<style scoped>
|
||||
.button-text {
|
||||
color: #676a6c;
|
||||
padding-left: 0!important;
|
||||
padding-right: 0!important;
|
||||
padding: 5px!important;
|
||||
}
|
||||
.icon {
|
||||
color: #676a6c!important;
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
"AssetTree": "资产树",
|
||||
"CustomTree": "自定义树",
|
||||
"BuiltinTree": "类型树",
|
||||
"UserSwitchFrom": "用户切换自",
|
||||
"UserSwitchFrom": "切换自",
|
||||
"sshkeyAccount": "密钥账号",
|
||||
"passwordAccount": "密码账号",
|
||||
"Category": "类别",
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
:visible.sync="showViewSecretDialog"
|
||||
/>
|
||||
<AutomationParamsForm
|
||||
:visible.sync="autoPushVisible"
|
||||
:has-button="false"
|
||||
:method="pushAccountMethod"
|
||||
:visible.sync="autoPushVisible"
|
||||
@canSetting="onCanSetting"
|
||||
@submit="onSubmit"
|
||||
/>
|
||||
@@ -45,8 +45,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
const vm = this
|
||||
const filterSuFrom = ['database', 'device', 'cloud', 'web', 'windows']
|
||||
|
||||
return {
|
||||
needSetAutoPushParams: false,
|
||||
autoPushVisible: false,
|
||||
@@ -64,7 +62,7 @@ export default {
|
||||
change: (val) => {
|
||||
this.$axios.patch(
|
||||
`/api/v1/accounts/accounts/${this.object.id}/`,
|
||||
{ is_active: val }
|
||||
{ is_active: val, name: this.object.name }
|
||||
).then(res => {
|
||||
this.$message.success(this.$tc('common.updateSuccessMsg'))
|
||||
})
|
||||
@@ -184,14 +182,15 @@ export default {
|
||||
multiple: false,
|
||||
clearable: true,
|
||||
model: vm.object.su_from?.id || '',
|
||||
label: vm.object.su_from?.name ? vm.object.su_from?.name + `(${vm.object.su_from?.username})` : '',
|
||||
label: vm.object.su_from?.name ? vm.object.su_from?.name + `(${vm.object.su_from?.username})` : '-',
|
||||
ajax: {
|
||||
url: `/api/v1/accounts/accounts/su-from-accounts/?account=${vm.object.id}&fields_size=mini`,
|
||||
transformOption: (item) => {
|
||||
return { label: item.name + '(' + item.username + ')', value: item.id }
|
||||
}
|
||||
},
|
||||
disabled: !vm.$hasPerm('accounts.verify_account') || filterSuFrom.includes(vm.object?.asset?.category?.value) || filterSuFrom.includes(vm.object?.asset?.type?.value)
|
||||
disabled: !vm.$hasPerm('accounts.change_account') ||
|
||||
!vm.object.asset.auto_config?.su_enabled
|
||||
},
|
||||
callbacks: Object.freeze({
|
||||
change: (value) => {
|
||||
|
||||
@@ -152,6 +152,8 @@ export default {
|
||||
if (i.name === 'http') {
|
||||
i.display_name = 'http(s)'
|
||||
}
|
||||
// 这个不删除会导致时,把 platform id 提交成 asset 的
|
||||
delete i['id']
|
||||
return i
|
||||
})
|
||||
const protocolChoices = this.defaultConfig.fieldsMeta.protocols.el.choices
|
||||
|
||||
@@ -123,17 +123,8 @@ export default {
|
||||
}
|
||||
attrs[item] = encryptPassword(value)
|
||||
}
|
||||
const toListFields = ['ip_group']
|
||||
for (const item of toListFields) {
|
||||
let value = attrs[item]
|
||||
if (!value) {
|
||||
continue
|
||||
}
|
||||
value = value?.split(',') || []
|
||||
value = value.filter((value, index) => {
|
||||
if (value) return true
|
||||
})
|
||||
attrs[item] = value
|
||||
if (Array.isArray(attrs.ip_group)) {
|
||||
values.attrs.ip_group = attrs.ip_group.filter(Boolean)
|
||||
}
|
||||
return values
|
||||
},
|
||||
@@ -141,9 +132,6 @@ export default {
|
||||
if (!formValue.attrs) {
|
||||
return formValue
|
||||
}
|
||||
if (Array.isArray(formValue.attrs.ip_group)) {
|
||||
formValue.attrs.ip_group = formValue.attrs.ip_group.toString()
|
||||
}
|
||||
return formValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
is_periodic: true,
|
||||
interval: 24,
|
||||
hostname_strategy: 'instance_name_partial_ip',
|
||||
ip_network_segment_group: '*'
|
||||
ip_network_segment_group: ['*']
|
||||
},
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['name']],
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
const [name, port] = i.split('/')
|
||||
return { name, port }
|
||||
})
|
||||
formValue.ip_network_segment_group = formValue.ip_network_segment_group.toString()
|
||||
|
||||
return formValue
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
|
||||
@@ -24,23 +24,6 @@ export default {
|
||||
const vm = this
|
||||
return {
|
||||
loading: true,
|
||||
nameComponentMap: {
|
||||
host: {
|
||||
icon: 'fa-inbox'
|
||||
},
|
||||
device: {
|
||||
icon: 'fa-microchip'
|
||||
},
|
||||
database: {
|
||||
icon: 'fa-database'
|
||||
},
|
||||
cloud: {
|
||||
icon: 'fa-cloud'
|
||||
},
|
||||
web: {
|
||||
icon: 'fa-globe'
|
||||
}
|
||||
},
|
||||
tab: {
|
||||
submenu: [],
|
||||
activeMenu: 'host'
|
||||
@@ -106,9 +89,7 @@ export default {
|
||||
hasBulkDelete: false,
|
||||
hasRightActions: true,
|
||||
createRoute: 'PlatformCreate',
|
||||
canCreate: () => {
|
||||
return this.$hasPerm('assets.add_platform')
|
||||
},
|
||||
canCreate: () => this.$hasPerm('assets.add_platform'),
|
||||
handleImportClick: ({ selectedRows }) => {
|
||||
this.$eventBus.$emit('showImportDialog', {
|
||||
selectedRows,
|
||||
@@ -135,7 +116,7 @@ export default {
|
||||
},
|
||||
async mounted() {
|
||||
try {
|
||||
await this.setCategories()
|
||||
await this.setCategoriesTab()
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
@@ -150,15 +131,23 @@ export default {
|
||||
return item.category === this.tab.activeMenu
|
||||
})
|
||||
},
|
||||
async setCategories() {
|
||||
async setCategoriesTab() {
|
||||
const categoryIcon = {
|
||||
host: 'fa-inbox',
|
||||
device: 'fa-microchip',
|
||||
database: 'fa-database',
|
||||
cloud: 'fa-cloud',
|
||||
web: 'fa-globe',
|
||||
custom: 'fa-th'
|
||||
}
|
||||
const state = await this.$store.dispatch('assets/getAssetCategories')
|
||||
for (const item of state.assetCategories) {
|
||||
const name = item.value
|
||||
this.nameComponentMap[name]['name'] = name
|
||||
this.nameComponentMap[name]['title'] = item.label
|
||||
this.tab.submenu.push({
|
||||
name: item.value,
|
||||
title: item.label,
|
||||
icon: categoryIcon[item.value]
|
||||
})
|
||||
}
|
||||
|
||||
this.tab.submenu = _.toArray(this.nameComponentMap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,19 +70,14 @@ export default {
|
||||
],
|
||||
successUrl: { name: 'Settings', params: { activeMenu: 'EmailContent' }},
|
||||
fieldsMeta: {},
|
||||
afterGetFormValue(validValues) {
|
||||
validValues.SECURITY_LOGIN_IP_BLACK_LIST = validValues.SECURITY_LOGIN_IP_BLACK_LIST.toString()
|
||||
validValues.SECURITY_LOGIN_IP_WHITE_LIST = validValues.SECURITY_LOGIN_IP_WHITE_LIST.toString()
|
||||
return validValues
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
const ipBlackList = value.SECURITY_LOGIN_IP_BLACK_LIST
|
||||
const ipWhiltList = value.SECURITY_LOGIN_IP_WHITE_LIST
|
||||
if (!Array.isArray(ipBlackList)) {
|
||||
value.SECURITY_LOGIN_IP_BLACK_LIST = ipBlackList ? ipBlackList.split(',') : []
|
||||
if (Array.isArray(ipBlackList)) {
|
||||
value.SECURITY_LOGIN_IP_BLACK_LIST = ipBlackList.filter(Boolean)
|
||||
}
|
||||
if (!Array.isArray(ipWhiltList)) {
|
||||
value.SECURITY_LOGIN_IP_WHITE_LIST = ipWhiltList ? ipWhiltList.split(',') : []
|
||||
if (Array.isArray(ipWhiltList)) {
|
||||
value.SECURITY_LOGIN_IP_WHITE_LIST = ipWhiltList.filter(Boolean)
|
||||
}
|
||||
return value
|
||||
},
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
v-bind="$data"
|
||||
:create-success-next-route="successUrl"
|
||||
:update-success-next-route="successUrl"
|
||||
:after-get-form-value="afterGetFormValue"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -18,7 +17,7 @@ export default {
|
||||
return {
|
||||
url: '/api/v1/terminal/endpoint-rules/',
|
||||
initial: {
|
||||
ip_group: '*'
|
||||
ip_group: ['*']
|
||||
},
|
||||
successUrl: { name: 'TerminalSetting', params: { activeMenu: 'EndpointRuleList' }},
|
||||
fields: [
|
||||
@@ -41,14 +40,10 @@ export default {
|
||||
},
|
||||
hasDetailInMsg: false,
|
||||
cleanFormValue(value) {
|
||||
if (!Array.isArray(value.ip_group)) {
|
||||
value.ip_group = value.ip_group ? value.ip_group.split(',') : []
|
||||
if (Array.isArray(value.ip_group)) {
|
||||
value.ip_group = value.ip_group.filter(Boolean)
|
||||
}
|
||||
return value
|
||||
},
|
||||
afterGetFormValue(formValue) {
|
||||
formValue.ip_group = formValue.ip_group?.toString()
|
||||
return formValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ export default {
|
||||
if (!validValues?.meta?.HOSTS) {
|
||||
return validValues
|
||||
}
|
||||
validValues.meta.HOSTS = validValues.meta.HOSTS.toString()
|
||||
return validValues
|
||||
},
|
||||
cleanFormValue(value) {
|
||||
|
||||
Reference in New Issue
Block a user