Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.10.10-lts #3941

Merged
merged 14 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions src/components/Cards/DetailCard/auto.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,28 @@ export default {

if (Array.isArray(value)) {
if (typeof value[0] === 'object') {
value.forEach(item => {
const fieldName = `${name}.${item.name}`
if (excludes.includes(fieldName)) {
return
}
this.items.push({
key: item.label,
value: item.value
const firstValue = value[0]
if (firstValue.hasOwnProperty('name')) {
value.forEach(item => {
const fieldName = `${name}.${item.name}`
if (excludes.includes(fieldName)) {
return
}
this.items.push({
key: item.label,
value: item.value
})
})
})
} else {
value.forEach((item, index) => {
const v = Object.entries(item).map(([key, value]) => `${key}:${value}`).join(', ')
const data = { value: v }
if (index === 0) {
data['key'] = label
}
this.items.push(data)
})
}
} else if (typeof value[0] === 'string') {
value.forEach((item, index) => {
let data = {}
Expand Down
21 changes: 14 additions & 7 deletions src/components/Libs/Krry/cascader/models/container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,34 @@ export default {
},
props: {
boxTitle: {
type: Array
type: Array,
default: () => []
},
boxOperation: {
type: Array
type: Array,
default: () => []
},
// 地域数据
dataObj: {
type: Object
type: Object,
default: () => {}
},
// 已选数据
selectedData: {
type: Array
type: Array,
default: () => []
},
onChangeSelected: {
type: Function
type: Function,
default: () => () => {}
},
filterable: {
type: Boolean
type: Boolean,
default: () => false
},
filterPlaceholder: {
type: String
type: String,
default: () => ''
}
},
data() {
Expand Down
20 changes: 13 additions & 7 deletions src/components/Libs/Krry/cascader/models/models/box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="vip-footer">
<el-button
type="text"
:disabled="selectedDistrict.length > 0 ? false : true"
:disabled="selectedDistrict.length<=0"
size="small"
round
@click="checkedSelected"
Expand All @@ -62,23 +62,29 @@ export default {
components: {},
props: {
title: {
type: String
type: String,
default: () => ''
},
operation: {
type: String
type: String,
default: () => ''
},
operateId: {
type: Number
type: Number,
default: () => 0
},
// 区域数据
districtList: {
type: Array
type: Array,
default: () => []
},
filterable: {
type: Boolean
type: Boolean,
default: () => false
},
filterPlaceholder: {
type: String
type: String,
default: () => ''
}
},
data() {
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: false
isMove: true
}
},
callback: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Widgets/Term/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
callback: () => {
this.xterm.selectAll()
const text = this.xterm.getSelection()
const filename = `shortcut_cmd_${this.$route.query?.taskId}.log`
const filename = `${this.$route.query?.type}_${this.$route.query?.taskId}.log`
downloadText(text, filename)
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,8 @@
"passwordWillExpiredSuffixMsg": " days.Please change your password as soon as possible.",
"dateLastLogin": "Date last login",
"AddAllMembersWarningMsg": "Are you sure you want to add all members?",
"disallowSelfUpdateFields": "Not allowed to modify the current fields oneself"
"disallowSelfUpdateFields": "Not allowed to modify the current fields oneself",
"GlobalDisableMfaMsg": "Global enforcement has been enabled"
},
"notifications": {
"MessageType": "Message Type",
Expand Down Expand Up @@ -2271,6 +2272,8 @@
"HostnameStrategy": "Used to produce the asset hostname. For example, 1. Instance name (instanceDemo);2. Instance name and Partial IP (instanceDemo-250.1)",
"IsAlwaysUpdate": "Keep assets up to date",
"FullySynchronous": "Assets fully synchronized",
"ReleaseAssets": "Release assets",
"ReleaseAssetsHelpTips": "Whether to automatically delete assets synchronized through this task and released on the cloud at the end of the task",
"AccountCreate": "Create account",
"AccountList": "Account list",
"AccountUpdate": "Update account",
Expand Down
7 changes: 5 additions & 2 deletions src/i18n/langs/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,8 @@
"passwordWillExpiredPrefixMsg": "パスワードはまもなく",
"passwordWillExpiredSuffixMsg": "期限が切れた後、できるだけ早くパスワードを変更してください。",
"AddAllMembersWarningMsg": "すべてのメンバーを追加してもよろしいですか?",
"disallowSelfUpdateFields": "現在のフィールドを自分で変更することは許可されていません"
"disallowSelfUpdateFields": "現在のフィールドを自分で変更することは許可されていません",
"GlobalDisableMfaMsg": "グローバルでの強制が有効になっています"
},
"notifications": {
"MessageType": "メッセージタイプ",
Expand Down Expand Up @@ -2267,6 +2268,8 @@
"HostnameStrategy": "資産を生成するためにホスト名。例: 1. インスタンス名 (instanceDemo) 2.インスタンス名と一部IP (下位2桁) (instanceDemo-250.1)",
"IsAlwaysUpdate": "資産は常に最新です",
"FullySynchronous": "資産完全にシンクロします",
"ReleaseAssets": "資産の同期解放",
"ReleaseAssetsHelpTips": "タスクの終了時に、このタスクを介して同期され、クラウド上で解放された資産を自動的に削除するかどうか",
"AccountCreate": "アカウントの作成",
"AccountList": "アカウントリスト",
"AccountUpdate": "アカウントの更新",
Expand Down Expand Up @@ -2425,4 +2428,4 @@
"BindResource": "リソースを関連付ける",
"SelectResource": "リソースを選択"
}
}
}
5 changes: 4 additions & 1 deletion src/i18n/langs/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,8 @@
"passwordExpired": "密码过期了",
"passwordWillExpiredPrefixMsg": "密码即将在 ",
"passwordWillExpiredSuffixMsg": "天 后过期,请尽快修改您的密码。",
"disallowSelfUpdateFields": "不允许自己修改当前字段"
"disallowSelfUpdateFields": "不允许自己修改当前字段",
"GlobalDisableMfaMsg": "全局已强制开启"
},
"notifications": {
"MessageType": "消息类型",
Expand Down Expand Up @@ -2186,6 +2187,8 @@
"HostnameStrategy": "用于生成资产主机名。例如:1. 实例名称 (instanceDemo);2. 实例名称和部分IP(后两位) (instanceDemo-250.1)",
"IsAlwaysUpdate": "资产保持最新",
"FullySynchronous": "资产完全同步",
"ReleaseAssets": "同步释放资产",
"ReleaseAssetsHelpTips": "是否在任务结束时,自动删除通过此任务同步下来且已经在云上释放的资产",
"AccountCreate": "创建账户",
"AccountList": "云账号",
"AccountUpdate": "更新账户",
Expand Down
11 changes: 7 additions & 4 deletions src/store/modules/users.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { getProfile as apiGetProfile, logout } from '@/api/users'
import { getCurrentOrgLocal, getPreOrgLocal, getTokenFromCookie, saveCurrentOrgLocal, setPreOrgLocal } from '@/utils/auth'
import {
getCurrentOrgLocal, getPreOrgLocal, getTokenFromCookie, saveCurrentOrgLocal, setPreOrgLocal
} from '@/utils/auth'
import orgUtil from '@/utils/org'
import { resetRouter } from '@/router'
import Vue from 'vue'
Expand Down Expand Up @@ -70,7 +72,7 @@ const mutations = {
},
SET_CURRENT_ORG(state, org) {
// 系统组织和全局组织不设置成 Pre org
if (!state.currentOrg?.autoEnter) {
if (!state.currentOrg?.autoEnter && !state.currentOrg?.is_root) {
state.preOrg = state.currentOrg
setPreOrgLocal(state.username, state.currentOrg)
}
Expand Down Expand Up @@ -142,7 +144,7 @@ const actions = {
const systemOrg = {
id: orgUtil.SYSTEM_ORG_ID,
name: 'SystemSetting',
autoEnter: true
autoEnter: new Date().getTime()
}
commit('SET_CURRENT_ORG', systemOrg)
},
Expand All @@ -157,7 +159,8 @@ const actions = {
const globalOrg = {
id: orgUtil.GLOBAL_ORG_ID,
name: 'Global',
autoEnter: true
is_root: true,
autoEnter: new Date().getTime()
}
commit('SET_CURRENT_ORG', globalOrg)
},
Expand Down
7 changes: 6 additions & 1 deletion src/utils/org.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export const GLOBAL_ORG_ID = '00000000-0000-0000-0000-000000000000'

function getPropOrg() {
const orgs = store.getters.usingOrgs
const preOrg = store.getters.preOrg || {}
const preFound = orgs.find((item) => item.id === preOrg.id)
if (preFound) {
return preFound
}
const defaultOrg = orgs.find((item) => item.is_default)
if (defaultOrg) {
return defaultOrg
Expand Down Expand Up @@ -62,7 +67,7 @@ async function changeOrg(org, reload = true, vm = null) {
}
}
location.hash = '#' + path
setTimeout(() => location.reload(), 400)
setTimeout(() => location.reload(), 500)
}

function hasCurrentOrgPermission() {
Expand Down
18 changes: 15 additions & 3 deletions src/utils/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import orgs from '@/api/orgs'
import { getPropView, isViewHasOrgs } from '@/utils/jms'

const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
const autoEnterOrgs = ['00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000000']

function reject(msg) {
return new Promise((resolve, reject) => reject(msg))
Expand Down Expand Up @@ -42,6 +43,10 @@ async function getPublicSetting({ to, from, next }, isOpen) {

async function refreshCurrentOrg() {
return orgs.getCurrentOrg().then(org => {
// Root 就不刷新本地的了, 会影响 autoEnter
if (autoEnterOrgs.indexOf(org.id) !== -1) {
return
}
store.dispatch('users/setCurrentOrg', org)
})
}
Expand All @@ -60,9 +65,16 @@ async function changeCurrentOrgIfNeed({ to, from, next }) {
Vue.$log.error('Current org is null or not a object: ', currentOrg)
await orgUtil.change2PropOrg({ to, from, next })
}
if (currentOrg.name === 'SystemSetting') {
const preOrg = store.getters.preOrg
await orgUtil.changeOrg(preOrg)
const globalOrgPath = [
'/console/perms/login-acls/', '/console/users/roles/',
'/console/perms/connect-method-acls/', '/settings/'
]
if (autoEnterOrgs.indexOf(currentOrg.id) !== -1 && currentOrg.autoEnter) {
const delta = new Date().getTime() - currentOrg.autoEnter
const notNeedChange = globalOrgPath.find(path => to.path.indexOf(path) === 0)
if (!notNeedChange && delta > 3000) {
await orgUtil.change2PropOrg({ to, from, next })
}
return
}
if (!orgUtil.hasCurrentOrgPermission()) {
Expand Down
3 changes: 1 addition & 2 deletions src/views/assets/Asset/AssetDetail/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ export default {
url: `/api/v1/assets/assets/${this.object.id}/`,
object: this.object,
nested: 'spec_info',
showUndefine: true,
excludes: ['script']
showUndefine: true
},
customInfoConfig: {
title: this.$t('common.CustomInfo'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
[this.$t('xpack.Cloud.CloudSource'), ['account', 'regions']],
[this.$t('xpack.Cloud.SaveSetting'), [
'hostname_strategy', 'ip_network_segment_group',
'sync_ip_type', 'is_always_update', 'fully_synchronous'
'sync_ip_type', 'is_always_update', 'fully_synchronous', 'release_assets'
]],
[this.$t('xpack.Cloud.SyncStrategy'), ['strategy']],
[this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']],
Expand Down Expand Up @@ -68,6 +68,11 @@ export default {
label: this.$t('xpack.Cloud.FullySynchronous'),
helpTips: this.$t('xpack.Cloud.FullySynchronousHelpTips')
},
release_assets: {
type: 'switch',
label: this.$t('xpack.Cloud.ReleaseAssets'),
helpTips: this.$t('xpack.Cloud.ReleaseAssetsHelpTips')
},
regions: {
component: Select2,
el: {
Expand Down
24 changes: 3 additions & 21 deletions src/views/ops/File/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
import { TreeTable } from '@/components'
import Term from '@/components/Widgets/Term'
import Page from '@/layout/components/Page'
import { createJob, getJob, getTaskDetail, JobUploadFile } from '@/api/ops'
import { createJob, getTaskDetail, JobUploadFile } from '@/api/ops'
import { formatFileSize } from '@/utils/common'
import store from '@/store'

Expand Down Expand Up @@ -230,28 +230,9 @@ export default {
},
mounted() {
this.enableWS()
this.initData()
},
methods: {
formatFileSize,
async initData() {
this.recoverStatus()
},
recoverStatus() {
if (this.$route.query.taskId) {
this.currentTaskId = this.$route.query.taskId
getTaskDetail(this.currentTaskId).then(data => {
getJob(data.job_id).then(res => {
this.runAsInput.value = res.runas
this.runAsInput.callback(res.runas)
this.executionInfo.status = data['status']
this.executionInfo.timeCost = data['time_cost']
this.setCostTimeInterval()
this.writeExecutionOutput()
})
})
}
},
enableWS() {
const scheme = document.location.protocol === 'https:' ? 'wss' : 'ws'
const port = document.location.port ? ':' + document.location.port : ''
Expand Down Expand Up @@ -281,7 +262,7 @@ export default {
}
},
taskStatusStat(summary) {
const { ok, failures, dark, excludes, skipped } = summary
const { ok = [], failures = [], dark = [], excludes = [], skipped = [] } = summary

const failedKeys = Object.keys(failures)
const darkKeys = Object.keys(dark)
Expand Down Expand Up @@ -439,6 +420,7 @@ export default {
this.executionInfo.timeCost = 0
this.executionInfo.status = 'running'
this.currentTaskId = res.task_id
this.$router.replace({ query: { taskId: this.currentTaskId, type: 'file_upload' }})
this.setCostTimeInterval()
this.writeExecutionOutput()
}).catch(() => {
Expand Down
Loading