Skip to content

Commit

Permalink
Merge pull request jumpserver#3693 from jumpserver/dev
Browse files Browse the repository at this point in the history
v3.10.2
  • Loading branch information
BaiJiangJie authored Jan 17, 2024
2 parents efb0e9d + d7099c1 commit fdbd7d2
Show file tree
Hide file tree
Showing 38 changed files with 234 additions and 118 deletions.
5 changes: 5 additions & 0 deletions src/components/Apps/AssetSelect/dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:table-config="tableConfig"
:tree-url="`${baseNodeUrl}children/tree/`"
:url="baseUrl"
:tree-setting="treeSetting"
class="tree-table"
v-bind="$attrs"
/>
Expand Down Expand Up @@ -52,6 +53,10 @@ export default {
disabled: {
type: [Boolean, Function],
default: false
},
treeSetting: {
type: Object,
default: () => ({})
}
},
data() {
Expand Down
5 changes: 5 additions & 0 deletions src/components/Apps/AssetSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
ref="dialog"
:base-node-url="baseNodeUrl"
:base-url="baseUrl"
:tree-setting="treeSetting"
:tree-url-query="treeUrlQuery"
:value="value"
:visible.sync="dialogVisible"
Expand Down Expand Up @@ -48,6 +49,10 @@ export default {
value: {
type: Array,
default: () => []
},
treeSetting: {
type: Object,
default: () => ({})
}
},
data() {
Expand Down
9 changes: 8 additions & 1 deletion src/components/Apps/AssetTreeTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default {
const showAssets = this.treeSetting?.showAssets || this.showAssets
const treeUrlQuery = this.setTreeUrlQuery()
const assetTreeUrl = `${this.treeUrl}?assets=${showAssets ? '1' : '0'}&${treeUrlQuery}`
const vm = this
return {
treeTabConfig: {
Expand All @@ -81,7 +82,13 @@ export default {
nodeUrl: this.nodeUrl,
treeUrl: assetTreeUrl,
callback: {
onSelected: (event, treeNode) => this.getAssetsUrl(treeNode)
onSelected: (event, treeNode) => this.getAssetsUrl(treeNode),
beforeRefresh: () => {
const query = { ...this.$route.query, node_id: '', asset_id: '' }
setTimeout(() => {
vm.$router.replace({ query: query })
}, 100)
}
},
...this.treeSetting
}
Expand Down
9 changes: 6 additions & 3 deletions src/components/Form/AutoDataForm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import Switcher from '@/components/Form/FormFields/Switcher.vue'
import rules from '@/components/Form/DataForm/rules'
import BasicTree from '@/components/Form/FormFields/BasicTree.vue'
import JsonEditor from '@/components/Form/FormFields/JsonEditor.vue'
import TransferSelect from '@/components/Form/FormFields/TransferSelect.vue'
import { assignIfNot } from '@/utils/common'
import TagInput from '@/components/Form/FormFields/TagInput.vue'
import TransferSelect from '@/components/Form/FormFields/TransferSelect.vue'

export class FormFieldGenerator {
constructor(emit) {
Expand Down Expand Up @@ -45,7 +45,7 @@ export class FormFieldGenerator {
break
case 'field':
type = ''
field.component = TransferSelect
field.component = ObjectSelect2
if (fieldRemoteMeta.required) {
field.el.clearable = false
}
Expand Down Expand Up @@ -76,7 +76,7 @@ export class FormFieldGenerator {
field.component = ObjectSelect2
break
case 'm2m_related_field':
field.component = TransferSelect
field.component = ObjectSelect2
field.el.label = field.label
break
case 'nested object':
Expand Down Expand Up @@ -134,6 +134,9 @@ export class FormFieldGenerator {
case 'comment':
field.el.type = 'textarea'
break
case 'users':
field.component = TransferSelect
field.el.label = field.label
}
return field
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/Form/FormFields/WeekCronSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ export default {
},
formatWeektime(col) {
const timeStamp = 1542384000000 // '2018-11-17 00:00:00'
const beginStamp = timeStamp + col * 1800000 // col * 30 * 60 * 1000
const timezone = 8
const offsetGMT = new Date().getTimezoneOffset() // 本地时间和格林威治的时间差,单位为分钟
const nowDate = new Date(timeStamp).getTime()
const targetStamp = new Date(nowDate + offsetGMT * 60 * 1000 + timezone * 60 * 60 * 1000).getTime()
const beginStamp = targetStamp + col * 1800000 // col * 30 * 60 * 1000
const endStamp = beginStamp + 1800000
const begin = this.formatDate(new Date(beginStamp), 'hh:mm')
Expand Down
5 changes: 4 additions & 1 deletion src/components/Table/AutoDataSearch/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<el-button v-if="shouldFold" circle class="search-btn" size="mini" @click="handleManualSearch">
<svg-icon icon-class="search" />
</el-button>
<TagSearch v-else :options="iOption" v-bind="$attrs" @tagSearch="handleTagSearch" v-on="$listeners" />
<TagSearch v-else :options="iOption" v-bind="$attrs" v-on="$listeners" @tag-search="handleTagSearch" />
</span>
</template>

Expand Down Expand Up @@ -68,6 +68,9 @@ export default {
},
methods: {
handleTagSearch(tags) {
if (_.isEqual(tags, this.tags)) {
return
}
this.tags = tags
if (tags.length === 0) {
this.manualSearch = false
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/ListTable/TableAction/LeftSide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
title: this.$t('common.BatchUpdate'),
name: 'actionUpdateSelected',
has: this.hasBulkUpdate,
icon: 'fa fa-refresh',
fa: 'batch-update',
can: function({ selectedRows }) {
let canBulkUpdate = vm.canBulkUpdate
if (typeof canBulkUpdate === 'function') {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Table/ListTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,14 @@ export default {
this.dataTable.getList()
},
search(attrs) {
this.$log.debug('ListTable: search table', attrs)
this.$emit('TagSearch', attrs)
return this.dataTable?.search(attrs, true)
this.$refs.dataTable?.$refs.dataTable?.search(attrs, true)
},
filter(attrs) {
this.$emit('TagFilter', attrs)
this.$refs.dataTable.$refs.dataTable.search(attrs, true)
this.$log.debug('ListTable: found filter change', attrs)
this.search(attrs)
},
hasActionPerm(action) {
const permRequired = this.permissions[action]
Expand Down
27 changes: 14 additions & 13 deletions src/components/Table/TagSearch/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<el-tag
v-for="(v, k) in filterTags"
:key="k"
:disable-transitions="true"
:name="k"
class="filter-tag"
closable
size="small"
class="filter-tag"
type="info"
:disable-transitions="true"
@close="handleTagClose(k)"
@click="handleTagClick(v,k)"
@close="handleTagClose(k)"
>
<strong v-if="v.label">{{ v.label + ':' }}</strong>
<span v-if="v.valueLabel">{{ v.valueLabel }}</span>
Expand All @@ -27,14 +27,14 @@
<el-input
ref="SearchInput"
v-model="filterValue"
:placeholder="placeholder"
class="search-input"
:class="options.length < 1 ? 'search-input2': ''"
:placeholder="placeholder"
:validate-event="false"
class="search-input"
suffix-icon="el-icon-search"
@blur="focus = false"
@focus="focus = true"
@change="handleConfirm"
@focus="focus = true"
@keyup.enter.native="handleConfirm"
@keyup.delete.native="handleDelete"
/>
Expand Down Expand Up @@ -122,6 +122,12 @@ export default {
},
deep: true
},
filterTags: {
handler() {
this.$emit('tag-search', this.filterMaps)
},
deep: true
},
filterValue(newValue, oldValue) {
if (newValue === '' && oldValue !== '') {
this.emptyCount = 1
Expand Down Expand Up @@ -210,11 +216,6 @@ export default {
...asFilterTags,
...routeFilter
}
if (Object.keys(this.filterTags).length > 0) {
setTimeout(() => {
return this.$emit('tagSearch', this.filterMaps)
}, 400)
}
},
getValueLabel(key, value) {
for (const field of this.options) {
Expand Down Expand Up @@ -252,7 +253,7 @@ export default {
if (this.getUrlQuery) {
this.checkUrlFields(evt)
}
this.$emit('tagSearch', this.filterMaps)
// this.$emit('tagSearch', this.filterMaps)
return true
},
handleDelete() {
Expand Down Expand Up @@ -284,7 +285,7 @@ export default {
valueLabel: this.valueLabel
}
this.$set(this.filterTags, this.filterKey, tag)
this.$emit('tagSearch', this.filterMaps)
// this.$emit('tagSearch', this.filterMaps)
// 修改查询参数时改变url中保存的参数
if (this.getUrlQuery) {
Expand Down
3 changes: 3 additions & 0 deletions src/components/Tree/DataZTree/components/ZTree/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ export default {
},
async refresh() {
this.treeSearchValue = ''
if (this.treeSetting?.callback?.beforeRefresh) {
this.treeSetting.callback.beforeRefresh()
}
if (this.treeSetting?.callback?.refresh) {
await this.treeSetting.callback.refresh()
}
Expand Down
24 changes: 13 additions & 11 deletions src/i18n/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -969,29 +969,30 @@
"LoginCount": "Login count",
"LoginOverview": "Sessions overview",
"LoginTo": "Login to",
"LoginUsers": "Active accounts",
"ActiveUsers": "Active users",
"Monthly": "Monthly",
"CurrentConnections": "Current connections",
"TodayFailedConnections": "Connections failed today",
"CurrentConnectionUsers": "Current connection users",
"TodayFailedConnections": "Number of failed sessions today",
"OnlineSessions": "Online sessions",
"OnlineUserDevices": "Online user devices",
"RealTimeData": "Real-time data",
"UserAssetActivity": "Account/Asset activity",
"UserData": "Account data",
"UserAssetActivity": "User/asset activity status",
"UserData": "User data",
"LoginUserToday": "Login account today",
"AssetData": "Asset data",
"LoginAssetToday": "Active assets today",
"LoginAssetToday": "Active asset today",
"WeekAdd": "New this week",
"ProportionOfAssetTypes": "Proportion of asset types",
"Proportion": "Proportion",
"LoginUserRanking": "Login account ranking",
"ActiveAssetRanking": "Login asset ranking",
"LoginUserRanking": "Session user ranking",
"ActiveAssetRanking": "Session asset Ranking",
"AssetName": "Asset name",
"NumberOfVisits": "Number of visits",
"ranking": "Ranking",
"Today": "Today",
"Last7Days": "Last 7 days",
"Last30Days": "Last30 days",
"Last7Days": "Last 7d",
"Last30Days": "Last 30d",
"OnlineUsers": "Online accounts",
"ConnectUsers": "Connect accounts",
"Num": "Num",
Expand All @@ -1009,13 +1010,14 @@
"BatchCommandNotExecuted": "Batch command not executed",
"ExecuteFailedCommand": "Execute failed command",
"SessionTrend": "Session trend",
"SessionConnectTrend": "Session connection trends",
"UserLoginTrend": "Account login trend",
"TimesWeekUnit": "times/week",
"TopAssetsOfWeek": "Top assets of week",
"TopUsersOfWeek": "Top user of week",
"User": "User",
"UserRatio": "User Ratio",
"UsersTotal": "Accounts total",
"UsersTotal": "User total",
"Weekly": "Weekly",
"TotalJobFailed": "Total job failed",
"TotalJobRunning": "Total job running",
Expand Down Expand Up @@ -2002,7 +2004,7 @@
"Account": "Account",
"Existing": "Existing",
"UserInformation": "User information",
"Authentication": "Account",
"Authentication": "Authentication",
"Comment": "Comment",
"ConfirmPassword": "Confirm password",
"DateExpired": "Date expired",
Expand Down
18 changes: 10 additions & 8 deletions src/i18n/langs/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -971,22 +971,23 @@
"LoginCount": "ログイン回数",
"LoginOverview": "セッション統計",
"LoginTo": "ログインしました",
"LoginUsers": "アクティブなアカウント",
"ActiveUsers": "アクティブユーザー",
"Monthly": "月ごと",
"CurrentConnections": "現在の接続数",
"TodayFailedConnections": "今日の接続に失敗しました",
"CurrentConnectionUsers": "現在のセッションユーザーの数",
"TodayFailedConnections": "今日の失敗したセッションの数",
"OnlineSessions": "オンラインセッション",
"RealTimeData": "リアルタイムデータ",
"UserAssetActivity": "アカウント/資産のアクティブ化",
"UserData": "アカウントデータ",
"LoginUserToday": "今日のログインアカウント数",
"UserAssetActivity": "ユーザー/アセットのアクティビティステータス",
"UserData": "ユーザーデータ",
"LoginUserToday": "今日のログインユーザー数",
"AssetData": "資産データ",
"LoginAssetToday": "今日のアクティブ資産数",
"WeekAdd": "今週の追加",
"ProportionOfAssetTypes": "資産タイプの割合",
"Proportion": "占有率",
"LoginUserRanking": "ログインアカウントランキング",
"ActiveAssetRanking": "ログイン資産ランキング",
"LoginUserRanking": "セッションユーザーランキング",
"ActiveAssetRanking": "セッションアセットランキング",
"AssetName": "資産名",
"NumberOfVisits": "アクセス回数",
"ranking": "ランキング",
Expand All @@ -1010,13 +1011,14 @@
"BatchCommandNotExecuted": "未実行コマンド",
"ExecuteFailedCommand": "失敗コマンドの実行",
"SessionTrend": "セッショントレンド",
"SessionConnectTrend": "セッション接続の傾向",
"UserLoginTrend": "アカウントログイントレンド",
"TimesWeekUnit": "回/週",
"TopAssetsOfWeek": "週間資産TOP10",
"TopUsersOfWeek": "週ユーザーTOP10",
"User": "ユーザー",
"UserRatio": "ユーザー比率統計",
"UsersTotal": "アカウント総数",
"UsersTotal": "総ユーザー数",
"Weekly": "週ごと"
},
"ops": {
Expand Down
Loading

0 comments on commit fdbd7d2

Please sign in to comment.