merge: with remote

This commit is contained in:
ibuler 2024-06-12 19:06:34 +08:00
commit b97ef23bf8
8 changed files with 72 additions and 22 deletions

View File

@ -71,7 +71,6 @@ export default {
cellValue: this.cellValue cellValue: this.cellValue
}) })
} }
}, },
methods: { methods: {
getDetailRoute() { getDetailRoute() {
@ -99,6 +98,9 @@ export default {
const routeQuery = this.formatterArgs.routeQuery const routeQuery = this.formatterArgs.routeQuery
if (routeQuery && typeof routeQuery === 'object') { if (routeQuery && typeof routeQuery === 'object') {
detailRoute.query = this.formatterArgs.routeQuery detailRoute.query = this.formatterArgs.routeQuery
if (detailRoute.query.tab) {
detailRoute.query = detailRoute.query.tab
}
} }
return detailRoute return detailRoute
}, },

View File

@ -12,7 +12,7 @@ Vue.use(VueI18n)
const cookieLang = VueCookie.get('django_language') const cookieLang = VueCookie.get('django_language')
const storeLang = VueCookie.get('lang') const storeLang = VueCookie.get('lang')
const browserLang = navigator.systemLanguage || navigator.language const browserLang = navigator.systemLanguage || navigator.language
let lang = cookieLang || storeLang || browserLang || 'zh' let lang = cookieLang || storeLang || browserLang || 'en'
if (lang === 'zh-hant') { if (lang === 'zh-hant') {
lang = 'zh_hant' lang = 'zh_hant'
} else { } else {

View File

@ -22,7 +22,7 @@ export default {
component: () => import('@/views/accounts/AccountGather/AccountGatherList.vue') component: () => import('@/views/accounts/AccountGather/AccountGatherList.vue')
}, },
{ {
title: this.$t('AccountGatherList'), title: this.$t('AccountGatherTaskList'),
name: 'AccountGatherTaskList', name: 'AccountGatherTaskList',
hidden: !this.$hasPerm('accounts.view_gatheraccountsautomation'), hidden: !this.$hasPerm('accounts.view_gatheraccountsautomation'),
component: () => import('@/views/accounts/AccountGather/AccountGatherTaskList.vue') component: () => import('@/views/accounts/AccountGather/AccountGatherTaskList.vue')

View File

@ -77,7 +77,7 @@ export default {
}, },
methods: { methods: {
DeleteReleasedAssets() { DeleteReleasedAssets() {
this.$axios.delete(`/api/v1/xpack/cloud/sync-instance-tasks/${this.object.id}/released-assets/`).then( this.$axios.delete(`/api/v1/xpack/cloud/sync-instance-tasks/${this.object.task?.id}/released-assets/`).then(
res => { res => {
this.$message.success(this.$tc('DeleteSuccessMsg')) this.$message.success(this.$tc('DeleteSuccessMsg'))
this.$refs.GenericListTable.$refs.ListTable.reloadTable() this.$refs.GenericListTable.$refs.ListTable.reloadTable()

View File

@ -19,10 +19,10 @@
</el-row> </el-row>
<el-divider /> <el-divider />
<el-row :gutter="20" style="height: 80%;"> <el-row :gutter="20" style="height: 80%;">
<el-col :span="5" class="image"> <el-col :span="6" class="image">
<el-image :src="cloudImage" fit="contain" /> <el-image :src="cloudImage" fit="contain" />
</el-col> </el-col>
<el-col :span="19"> <el-col :span="18">
<InfoPanel :content="iTask.regions.length" :title="$tc('TotalSyncRegion')" /> <InfoPanel :content="iTask.regions.length" :title="$tc('TotalSyncRegion')" />
<InfoPanel :content="iTask.instance_count || 0" :title="$tc('TotalSyncAsset')" /> <InfoPanel :content="iTask.instance_count || 0" :title="$tc('TotalSyncAsset')" />
<InfoPanel :content="iTask.strategy.length" :title="$tc('TotalSyncStrategy')" /> <InfoPanel :content="iTask.strategy.length" :title="$tc('TotalSyncStrategy')" />
@ -31,6 +31,7 @@
</el-col> </el-col>
</el-row> </el-row>
<Dialog <Dialog
v-if="updateVisible"
:destroy-on-close="true" :destroy-on-close="true"
:show-buttons="false" :show-buttons="false"
:title="$tc('CloudAccountUpdate')" :title="$tc('CloudAccountUpdate')"
@ -41,6 +42,7 @@
:object="object" :object="object"
:provider="object.provider.value" :provider="object.provider.value"
:visible.sync="updateVisible" :visible.sync="updateVisible"
origin="update"
@submitSuccess="onSubmitSuccess" @submitSuccess="onSubmitSuccess"
/> />
</Dialog> </Dialog>
@ -112,6 +114,22 @@ export default {
return ACCOUNT_PROVIDER_ATTRS_MAP[`${this.object.provider.value}`].image return ACCOUNT_PROVIDER_ATTRS_MAP[`${this.object.provider.value}`].image
} }
}, },
watch: {
onlineSyncVisible: {
handler(newValue) {
if (newValue === false) {
this.$emit('refresh')
}
}
},
updateVisible: {
handler(newValue) {
if (newValue === false) {
this.$emit('refresh')
}
}
}
},
methods: { methods: {
toSafeLocalDateStr, toSafeLocalDateStr,
handleDelete() { handleDelete() {

View File

@ -29,6 +29,10 @@ export default {
object: { object: {
type: Object, type: Object,
default: () => {} default: () => {}
},
origin: {
type: String,
default: ''
} }
}, },
data() { data() {
@ -106,12 +110,12 @@ export default {
el: { el: {
provider: this.provider, provider: this.provider,
regions: this.object.task?.regions || [], regions: this.object.task?.regions || [],
getAuthInfo: async() => { getAuthInfo: () => {
if (this.object?.id) { if (this.object?.id) {
return this.object.id return this.object.id
} }
const form = this.$refs.form.$refs.form.dataForm const form = this.$refs.form.$refs.form.dataForm
await form.submitForm('form', true) form.$refs.form.validate()
return form.getFormValue()['attrs'] return form.getFormValue()['attrs']
} }
} }
@ -161,8 +165,6 @@ export default {
} }
} }
}, },
mounted() {
},
methods: { methods: {
submitForm(form, btn, submitType) { submitForm(form, btn, submitType) {
form.validate((valid) => { form.validate((valid) => {
@ -171,6 +173,13 @@ export default {
} }
}) })
this.$refs.form.$refs.form.dataForm.submitForm('form', false) this.$refs.form.$refs.form.dataForm.submitForm('form', false)
if (this.origin === 'update') {
setTimeout(() => {
this.$emit('refresh')
this.$emit('update:visible', false)
}, 500)
}
this.submitType = submitType this.submitType = submitType
}, },
handleSubmitSuccess(res) { handleSubmitSuccess(res) {

View File

@ -8,6 +8,7 @@
{{ content }} {{ content }}
</el-link> </el-link>
<Dialog <Dialog
:destroy-on-close="true"
:title="$tc('Region')" :title="$tc('Region')"
:visible.sync="regionVisible" :visible.sync="regionVisible"
:show-cancel="false" :show-cancel="false"
@ -78,11 +79,18 @@ export default {
} }
}, },
watch: { watch: {
checkedRegion() { regions: {
this.updateCheckedStatus() immediate: true,
handler(newVal) {
this.checkedRegion = newVal
this.refreshContent()
}
} }
}, },
mounted() { mounted() {
if (this.regions) {
this.checkedRegion = this.regions
}
this.refreshContent() this.refreshContent()
}, },
methods: { methods: {
@ -95,7 +103,6 @@ export default {
let method = 'get' let method = 'get'
let data = {} let data = {}
let url = `/api/v1/xpack/cloud/regions/?account_id=${authInfo}` let url = `/api/v1/xpack/cloud/regions/?account_id=${authInfo}`
if (typeof authInfo === 'object') { if (typeof authInfo === 'object') {
const attrs = JSON.parse(JSON.stringify(authInfo)) const attrs = JSON.parse(JSON.stringify(authInfo))
@ -103,15 +110,13 @@ export default {
url = `/api/v1/xpack/cloud/regions/?provider=${this.provider}` url = `/api/v1/xpack/cloud/regions/?provider=${this.provider}`
data = { 'attrs': encryptAttrsField(attrs) } data = { 'attrs': encryptAttrsField(attrs) }
} }
this.content = this.$t('Loading') this.content = this.$t('Loading')
this.$axios[method](url, data).then(resp => { this.$axios[method](url, data).then(resp => {
this.allRegions = resp?.regions this.allRegions = resp?.regions
console.log(Object.getOwnPropertyNames(data.attrs).length)
if (this.allRegions.length && Object.getOwnPropertyNames(data.attrs).length > 0) {
this.regionVisible = true this.regionVisible = true
this.updateCheckedStatus() this.updateCheckedStatus()
}
}).catch(error => { }).catch(error => {
this.$message.error(this.$tc('CloudRegionTip' + ' ' + error)) this.$message.error(this.$tc('CloudRegionTip' + ' ' + error))
}).finally(() => { }).finally(() => {

View File

@ -28,22 +28,38 @@ export default {
formatterArgs: { formatterArgs: {
async: true, async: true,
permissions: 'assets.view_asset', permissions: 'assets.view_asset',
routeQuery: { getRoute({ row }) {
return {
name: 'ZoneDetail',
params: {
id: row.id
},
query: {
tab: 'AssetList' tab: 'AssetList'
} }
} }
}
}
}, },
gateways: { gateways: {
label: this.$t('Gateways'), label: this.$t('Gateways'),
formatter: AmountFormatter, formatter: AmountFormatter,
formatterArgs: { formatterArgs: {
permissions: 'assets.view_gateway', permissions: 'assets.view_gateway',
routeQuery: { getRoute({ row }) {
return {
name: 'ZoneDetail',
params: {
id: row.id
},
query: {
tab: 'GatewayList' tab: 'GatewayList'
} }
} }
} }
} }
}
}
}, },
headerActions: { headerActions: {
hasLabelSearch: true, hasLabelSearch: true,