Skip to content

Commit

Permalink
Merge pull request #4410 from jumpserver/dev
Browse files Browse the repository at this point in the history
v4.3.0
  • Loading branch information
BaiJiangJie authored Oct 17, 2024
2 parents 19b1dc0 + 9b6f54c commit 56aa3ca
Show file tree
Hide file tree
Showing 41 changed files with 306 additions and 102 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"normalize.css": "7.0.0",
"npm": "^7.8.0",
"nprogress": "0.2.0",
"path-to-regexp": "2.4.0",
"path-to-regexp": "3.3.0",
"v-sanitize": "^0.0.13",
"vue": "2.6.10",
"vue-codemirror": "4.0.6",
Expand Down Expand Up @@ -117,7 +117,7 @@
"sass-loader": "^7.1.0",
"script-ext-html-webpack-plugin": "2.1.3",
"script-loader": "0.7.2",
"serve-static": "^1.13.2",
"serve-static": "^1.16.0",
"strip-ansi": "^7.1.0",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.2",
Expand Down
10 changes: 10 additions & 0 deletions src/api/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function testEmailSetting(data) {
data: data
})
}

export function importLicense(formData) {
return request({
url: '/api/v1/xpack/license/import',
Expand All @@ -25,6 +26,7 @@ export function importLicense(formData) {
data: formData
})
}

export function testLdapSetting(data, refresh = true) {
let url = '/api/v1/settings/ldap/testing/config/'
if (refresh) {
Expand Down Expand Up @@ -96,9 +98,17 @@ export function getPublicSettings(isOpen) {
method: 'get'
})
}

export function getLogo() {
return request({
url: '/api/v1/xpack/interface/setting/',
method: 'get'
})
}

export function getPreference() {
return request({
url: '/api/v1/users/preference/?category=luna',
method: 'get'
})
}
8 changes: 6 additions & 2 deletions src/components/Apps/AssetTreeTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export default {
type: String,
default: '/api/v1/assets/assets/'
},
typeUrl: {
type: String,
default: '/api/v1/assets/nodes/category/tree/'
},
nodeUrl: {
type: String,
default: '/api/v1/assets/nodes/'
Expand Down Expand Up @@ -105,9 +109,9 @@ export default {
showAssets: false,
showSearch: false,
customTreeHeaderName: this.$t('TypeTree'),
url: '/api/v1/assets/nodes/category/tree/',
url: this.typeUrl,
nodeUrl: this.treeSetting?.nodeUrl || this.nodeUrl,
treeUrl: `/api/v1/assets/nodes/category/tree/?assets=${showAssets ? '1' : '0'}&count_resource=${this.treeSetting.countResource || 'asset'}`,
treeUrl: `${this.typeUrl}?assets=${showAssets ? '1' : '0'}&count_resource=${this.treeSetting.countResource || 'asset'}`,
callback: {
onSelected: (event, treeNode) => this.getAssetsUrl(treeNode)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Cards/DetailCard/ItemValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
formatterData = data
}
return (
<span>{formatterData}</span>
<span style={{ whiteSpace: 'pre-wrap', lineHeight: '1.2' }}>{formatterData}</span>
)
}
if (this.value instanceof Array) {
Expand Down
1 change: 1 addition & 0 deletions src/components/Dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default {
&__body {
padding: 20px 30px;
font-size: 13px;
&:has(.el-table) {
background: #f3f3f4;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/AutoDataForm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
v-bind="$attrs"
v-on="$listeners"
>
<span
<div
v-for="(group, i) in groups"
:key="'group-'+group.name"
:slot="'id:'+group.name"
Expand All @@ -18,7 +18,7 @@
:index="i"
:line="i !== 0 && !groupHidden(groups[i - 1], i - 1)"
/>
</span>
</div>
</DataForm>
</template>

Expand Down
4 changes: 0 additions & 4 deletions src/components/Form/AutoDataForm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import BasicTree from '@/components/Form/FormFields/BasicTree.vue'
import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
import { assignIfNot, toSentenceCase } from '@/utils/common'
import TagInput from '@/components/Form/FormFields/TagInput.vue'
import TransferSelect from '@/components/Form/FormFields/TransferSelect.vue'
import i18n from '@/i18n/i18n'

export class FormFieldGenerator {
Expand Down Expand Up @@ -135,9 +134,6 @@ export class FormFieldGenerator {
case 'comment':
field.el.type = 'textarea'
break
case 'users':
field.component = TransferSelect
field.el.label = field.label
}
return field
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
placement="right"
popper-class="help-tips"
>
<div slot="content" v-sanitize="data.helpTip" /> <!-- Noncompliant -->
<div slot="content" v-sanitize="data.helpTip" class="help-tip-content" /> <!-- Noncompliant -->
<i class="fa fa-question-circle-o help-tip-icon" />
</el-tooltip>
</template>
Expand Down Expand Up @@ -322,4 +322,9 @@ export default {
cursor: pointer;
}
}
.help-tip-content {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
5 changes: 1 addition & 4 deletions src/components/Form/FormFields/InputWithUnit.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-input v-model="iValue" v-bind="$attrs" v-on="$listeners">
<el-input v-bind="$attrs" v-on="$listeners">
<template slot="append">{{ iUnit }}</template>
</el-input>
</template>
Expand Down Expand Up @@ -30,9 +30,6 @@ export default {
computed: {
iUnit() {
return this.displayMapper[this.unit] || this.unit
},
iValue() {
return this.$attrs.value ? this.$attrs.value : this.defaultValue
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Form/FormFields/PasswordRule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default {
type: 'input-number',
el: {
min: 8,
max: 30
max: 36,
size: 'mini'
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/FormFields/UserPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
patterns.push([/\d/, i18n.t('NUMBER_REQUIRED')])
}
if (passwordRule['SECURITY_PASSWORD_SPECIAL_CHAR']) {
const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?_+-]")
patterns.push([pattern, i18n.t('SPECIAL_CHAR_REQUIRED')])
}
for (const [pattern, msg] of patterns) {
Expand Down
10 changes: 10 additions & 0 deletions src/components/Table/TableFormatters/LabelsFormatter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ export default {
}
},
computed: {},
watch: {
cellValue: {
handler(newValue) {
if (newValue) {
this.initial = this.formatterArgs.getLabels(this.cellValue)
this.iLabels = [...this.initial]
}
}
}
},
mounted() {
this.initial = this.formatterArgs.getLabels(this.cellValue)
this.iLabels = [...this.initial]
Expand Down
2 changes: 1 addition & 1 deletion src/layout/components/NavHeader/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default {
// 未找到与之对应的
& ::v-deep .el-submenu__title {
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0 8px;
line-height: $headerHeight;
height: $headerHeight;
Expand Down
8 changes: 7 additions & 1 deletion src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ body {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: auto;
color: var(--color-text-primary);
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 1.428;
}
Expand Down Expand Up @@ -593,3 +593,9 @@ li.rmenu i.fa {
height: 6px; /* 设置水平滚动条的高度 */
}
}

.black-theme-popover {
width: 300px;
max-height: 700px;
overflow-y: scroll;
}
8 changes: 8 additions & 0 deletions src/styles/menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ $single-menu-height: 38px;
}
}

.el-menu--vertical {
background-color: #fff;
}

.el-menu {
border-right: none !important;
background-color: inherit !important;
Expand Down Expand Up @@ -139,6 +143,10 @@ $single-menu-height: 38px;
.nest-menu .level2-menu {
line-height: $single-menu-height;
}

.el-tooltip {
width: 55px !important;
}
}
}
}
24 changes: 24 additions & 0 deletions src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ export function getErrorResponseMsg(error) {
}).filter(i => i).join('; ')
} else if (typeof data === 'string') {
return data
} else {
msg = error.toString()
}
return msg
}
Expand Down Expand Up @@ -310,4 +312,26 @@ export function toSentenceCase(string) {
}).join(' ')
return s[0].toUpperCase() + s.slice(1)
}

export { BASE_URL }

export function openNewWindow(url) {
let count
let top = 50
count = parseInt(window.sessionStorage.getItem('newWindowCount'), 10)
if (isNaN(count)) {
count = 0
}
let left = 100 + count * 100
top = 50 + count * 50
if (left + screen.width / 3 > screen.width) {
// 支持两排足以
top = screen.height / 3
count = 1
left = 100
}
let params = 'toolbar=yes,scrollbars=yes,resizable=yes'
params = params + `,top=${top},left=${left},width=${screen.width / 3},height=${screen.height / 3}`
window.sessionStorage.setItem('newWindowCount', `${count + 1}`)
window.open(url, '_blank', params)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
initial: {
is_periodic: false,
password_rules: {
length: 16
length: 36
},
interval: 24,
accounts: [],
Expand Down
2 changes: 1 addition & 1 deletion src/views/accounts/AccountPush/AccountPushCreateUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
initial: {
is_periodic: false,
password_rules: {
length: 30
length: 36
},
interval: 24,
secret_type: 'password',
Expand Down
2 changes: 1 addition & 1 deletion src/views/accounts/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import InputWithUnit from '@/components/Form/FormFields/InputWithUnit.vue'
import store from '@/store'

const validatorInterval = (rule, value, callback) => {
if (parseInt(value) < 1) {
if (isNaN(parseInt(value, 10)) || parseInt(value) < 1) {
return callback(new Error(i18n.t('EnsureThisValueIsGreaterThanOrEqualTo1')))
}
callback()
Expand Down
13 changes: 0 additions & 13 deletions src/views/acl/CommandAcl/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<TabPage
:active-menu.sync="config.activeMenu"
:submenu="config.submenu"
@tab-click="handleTabClick"
/>
</template>

Expand Down Expand Up @@ -35,18 +34,6 @@ export default {
]
}
}
},
methods: {
handleTabClick(tab) {
const query = _.cloneDeep(this.$route.query)
const newQuery = {
...query,
tab: tab.name
}
this.$nextTick(() => {
this.$router.replace({ query: newQuery })
})
}
}
}
</script>
3 changes: 2 additions & 1 deletion src/views/assets/Asset/AssetList/AllList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default {
},
tableConfig: {
url: tableUrl,
category: 'all'
category: 'all',
extraQuery: { 'order': '-date_updated' }
},
headerActions: {
handleImportClick: ({ selectedRows }) => {
Expand Down
8 changes: 1 addition & 7 deletions src/views/assets/Cloud/Account/components/TimingPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ export default {
btn.loading = true
}
})
if (form.value.interval && typeof form.value.interval === 'number') {
form.value.interval = parseInt(form.value.interval, 10)
} else {
form.value.interval = 24
}
form.value.interval = parseInt(form.value.interval, 10)
this.$refs.form.$refs.form.dataForm.submitForm('form', false)
},
handleSubmitSuccess(res) {
Expand Down
Loading

0 comments on commit 56aa3ca

Please sign in to comment.