Skip to content

Commit

Permalink
Merge pull request #4367 from jumpserver/dev
Browse files Browse the repository at this point in the history
merge: from dev to master
  • Loading branch information
BaiJiangJie authored Sep 19, 2024
2 parents 77ef172 + 3cb9dec commit 19b1dc0
Show file tree
Hide file tree
Showing 66 changed files with 700 additions and 315 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/build-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Lock Pull Request
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"state":"pending", "description":"Action running, merge disabled", "context":"Lock PR"}' \
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -59,3 +64,9 @@ jobs:
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Unlock Pull Request
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"state":"success", "description":"Action running, merge disabled", "context":"Lock PR"}' \
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
tag: ${{ steps.get_version.outputs.TAG }}
- uses: actions/setup-node@v2
with:
node-version: '16.20'
node-version: '20.15'
- name: Install dependencies
run: yarn install
- name: Build web
Expand Down
Binary file modified src/assets/img/icons/cisco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/clickhouse.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/db2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/gateway.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img/icons/h3c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/mariadb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/mysql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/oracle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/other.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/private.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/unix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/vmware.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/icons/windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/components/Apps/AssetSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
type: String,
default: '/api/v1/assets/assets/'
},
defaultPageSize: {
type: Number,
default: 10
},
baseNodeUrl: {
type: String,
default: '/api/v1/assets/nodes/'
Expand Down Expand Up @@ -70,6 +74,7 @@ export default {
value: iValue,
multiple: true,
clearable: true,
defaultPageSize: this.defaultPageSize,
ajax: {
url: this.baseUrl,
transformOption: (item) => {
Expand Down
28 changes: 19 additions & 9 deletions src/components/Form/AutoDataForm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,32 @@ export class FormFieldGenerator {
return field
}

afterGenerateField(field) {
field.label = toSentenceCase(field.label)

if (field.placeholder) {
field.el.placeholder = field.placeholder
}

setChoicesTips(field, fieldMeta, fieldRemoteMeta) {
// 设置 checkbox 的 tips
if (field.tips && ['checkbox-group', 'radio-group'].indexOf(field.type) !== -1) {
if (['checkbox-group', 'radio-group'].indexOf(field.type) !== -1) {
field.options.map(option => {
if (!option.tip && field.tips[option.value]) {
if (!option.tip && field.tips) {
option.tip = field.tips[option.value]
}
if (!option.tip) {
const match = option.label.match(/^(.+?)\s*\((.*?)\)$/)
if (match) {
option.label = match[1]
option.tip = match[2]
}
}
})
}
}

afterGenerateField(field) {
field.label = toSentenceCase(field.label)

if (field.placeholder) {
field.el.placeholder = field.placeholder
}

this.setChoicesTips(field)
return field
}

Expand Down
6 changes: 5 additions & 1 deletion src/components/Form/FormFields/InputWithUnit.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-input v-bind="$attrs" v-on="$listeners">
<el-input v-model="iValue" v-bind="$attrs" v-on="$listeners">
<template slot="append">{{ iUnit }}</template>
</el-input>
</template>
Expand All @@ -15,6 +15,7 @@ export default {
},
data() {
return {
defaultValue: 24,
displayMapper: {
'second': this.$t('Second'), // 'sec' is the default value of 'unit
'min': this.$t('Minute'), // 'min' is the default value of 'unit
Expand All @@ -29,6 +30,9 @@ export default {
computed: {
iUnit() {
return this.displayMapper[this.unit] || this.unit
},
iValue() {
return this.$attrs.value ? this.$attrs.value : this.defaultValue
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/components/Form/FormFields/Select2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,19 @@ export default {
allowCreate: {
type: Boolean,
default: false
},
defaultPageSize: {
type: Number,
default: 10
}
},
data() {
const vm = this
const defaultPageSize = 10
const defaultParams = {
search: '',
page: 1,
hasMore: true,
pageSize: defaultPageSize
pageSize: vm.defaultPageSize
}
// 设置axios全局报错提示不显示
const validateStatus = (status) => {
Expand Down Expand Up @@ -194,7 +197,6 @@ export default {
}
},
iAjax() {
const defaultPageSize = 10
const defaultMakeParams = (params) => {
const page = params.page || 1
const offset = (page - 1) * params.pageSize
Expand Down Expand Up @@ -237,7 +239,7 @@ export default {
}
const defaultAjax = {
url: '',
pageSize: defaultPageSize,
pageSize: this.defaultPageSize,
makeParams: defaultMakeParams,
transformOption: defaultTransformOption,
processResults: defaultProcessResults,
Expand Down
36 changes: 3 additions & 33 deletions src/components/Table/ListTable/TableAction/ImportTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
import DataTable from '@/components/Table/DataTable/index.vue'
import { getUpdateObjURL } from '@/utils/common'
import { sleep } from '@/utils/time'
import { EditableInputFormatter, StatusFormatter } from '@/components/Table/TableFormatters'
import { EditableInputFormatter } from '@/components/Table/TableFormatters'
import { encryptPassword } from '@/utils/crypto'
import getStatusColumnMeta from '@/components/Table/ListTable/TableAction/const'
export default {
name: 'ImportTable',
Expand Down Expand Up @@ -223,38 +224,7 @@ export default {
},
methods: {
generateTableColumns(tableTitles, tableData) {
const vm = this
const columns = [{
prop: '@status',
label: vm.$t('Status'),
width: '80px',
align: 'center',
formatter: StatusFormatter,
formatterArgs: {
faChoices: {
ok: 'fa-check text-primary',
error: 'fa-times text-danger',
pending: 'fa-clock-o'
},
getChoicesKey(val) {
if (val === 'ok' || val === 'pending') {
return val
}
return 'error'
},
getTip(val) {
if (val === 'ok') {
return vm.$t('Success')
} else if (val === 'pending') {
return vm.$t('Pending')
} else if (val && val.name === 'error') {
return val.error
}
return ''
},
hasTips: true
}
}]
const columns = [{ ...getStatusColumnMeta.bind(this)().status }]
for (const item of tableTitles) {
const dataItemLens = tableData.map(d => {
if (!d) {
Expand Down
40 changes: 40 additions & 0 deletions src/components/Table/ListTable/TableAction/const.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { StatusFormatter } from '@/components/Table/TableFormatters'
import i18n from '@/i18n/i18n'

export const getStatusColumnMeta = (prop = '@status') => {
return {
status: {
prop: prop,
label: i18n.t('Status'),
width: '80px',
align: 'center',
formatter: StatusFormatter,
formatterArgs: {
faChoices: {
ok: 'fa-check text-primary',
error: 'fa-times text-danger',
pending: 'fa-clock-o'
},
getChoicesKey: (val) => {
if (val === 'ok' || val === 'pending') {
return val
}
return 'error'
},
getTip: (val) => {
if (val === 'ok') {
return i18n.t('Success')
} else if (val === 'pending') {
return i18n.t('Pending')
} else if ((val && val.name === 'error') || val.error !== undefined) {
return val.error
}
return ''
},
hasTips: true
}
}
}
}

export default getStatusColumnMeta
21 changes: 11 additions & 10 deletions src/components/Table/ListTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,23 @@ export default {
}
},
mounted() {
this.urlUpdated[this.tableUrl] = location.href
this.$set(this.urlUpdated, this.tableUrl, location.href)
},
deactivated() {
this.isDeactivated = true
},
activated() {
this.isDeactivated = false
const preURL = this.urlUpdated[this.tableUrl]
if (!preURL || preURL === location.href) {
return
}
this.urlUpdated[this.tableUrl] = location.href
this.$log.debug('Reload the table get latest data: pre ', preURL, ' current: ', location.href)
setTimeout(() => {
this.$nextTick(() => {
this.isDeactivated = false
const cleanUrl = this.tableUrl.split('?')[0]
const preURL = this.urlUpdated[cleanUrl]
if (!preURL || preURL === location.href) return
this.$set(this.urlUpdated, this.tableUrl, location.href)
this.$log.debug('Reload the table get latest data: pre ', preURL, ' current: ', location.href)
this.reloadTable()
}, 500)
})
},
methods: {
handleActionInitialDone() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tree/DataZTree/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
showRenameBtn: false,
drag: {
isCopy: false,
isMove: true
isMove: !this.$store.getters.currentOrgIsRoot
}
},
callback: {
Expand Down
20 changes: 18 additions & 2 deletions src/components/Widgets/Announcement/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,29 @@ export default {
]),
announcement() {
const ann = this.publicSettings.ANNOUNCEMENT
return { id: ann['ID'], subject: ann['SUBJECT'], content: ann['CONTENT'], link: ann['LINK'] }
return {
id: ann['ID'],
subject: ann['SUBJECT'],
content: ann['CONTENT'],
link: ann['LINK'],
date_start: ann['DATE_START'],
date_end: ann['DATE_END']
}
},
enabled() {
return this.publicSettings.ANNOUNCEMENT_ENABLED && (this.announcement.content || this.announcement.subject)
return this.publicSettings.ANNOUNCEMENT_ENABLED && (this.announcement.content || this.announcement.subject) && this.isDateValid
},
title() {
return this.$t('Announcement') + ': ' + this.announcement.subject
},
isDateValid() {
if (this.announcement.date_start === undefined || this.announcement.date_end === undefined) {
return true
}
const now = new Date()
const start = new Date(this.announcement.date_start)
const end = new Date(this.announcement.date_end)
return now >= start && now <= end
}
},
methods: {
Expand Down
6 changes: 4 additions & 2 deletions src/layout/components/AppMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ export default {
query[k] = v
}
let key
if (this.$route.name.toLowerCase().includes('list')) {
return _.trimEnd(this.$route.path, '/') + '?' + new URLSearchParams(query).toString()
key = _.trimEnd(this.$route.path, '/') + '?' + new URLSearchParams(query).toString()
} else {
return new Date().getTime()
key = new Date().getTime()
}
return key
},
chatAiEnabled() {
return this.publicSettings?.CHAT_AI_ENABLED
Expand Down
8 changes: 6 additions & 2 deletions src/layout/components/NavHeader/AccountDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ export default {
break
case 'logout':
this.logout()
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
break
}
},
logout() {
async logout() {
const currentOrg = this.$store.getters.currentOrg
if (currentOrg.autoEnter) {
await this.$store.dispatch('users/setCurrentOrg', this.$store.getters.preOrg)
}
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/layout/components/NavHeader/SiteMessages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<span class="msg-detail-time">{{ formatDate(currentMsg.date_created) }}</span>
</div>
<div class="msg-detail-txt">
<span v-sanitize="currentMsg.content.message" />
<MarkDown :value="currentMsg.content.message" />
</div>
</div>
</Dialog>
Expand All @@ -80,10 +80,14 @@
<script>
import { toSafeLocalDateStr } from '@/utils/time'
import Dialog from '@/components/Dialog'
import MarkDown from '@/components/Widgets/MarkDown'
export default {
name: 'SiteMessages',
components: { Dialog },
components: {
Dialog,
MarkDown
},
data() {
return {
show: false,
Expand Down
Loading

0 comments on commit 19b1dc0

Please sign in to comment.