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

View File

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

View File

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

View File

@ -77,7 +77,7 @@ export default {
},
methods: {
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 => {
this.$message.success(this.$tc('DeleteSuccessMsg'))
this.$refs.GenericListTable.$refs.ListTable.reloadTable()

View File

@ -19,10 +19,10 @@
</el-row>
<el-divider />
<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-col>
<el-col :span="19">
<el-col :span="18">
<InfoPanel :content="iTask.regions.length" :title="$tc('TotalSyncRegion')" />
<InfoPanel :content="iTask.instance_count || 0" :title="$tc('TotalSyncAsset')" />
<InfoPanel :content="iTask.strategy.length" :title="$tc('TotalSyncStrategy')" />
@ -31,6 +31,7 @@
</el-col>
</el-row>
<Dialog
v-if="updateVisible"
:destroy-on-close="true"
:show-buttons="false"
:title="$tc('CloudAccountUpdate')"
@ -41,6 +42,7 @@
:object="object"
:provider="object.provider.value"
:visible.sync="updateVisible"
origin="update"
@submitSuccess="onSubmitSuccess"
/>
</Dialog>
@ -112,6 +114,22 @@ export default {
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: {
toSafeLocalDateStr,
handleDelete() {

View File

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

View File

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

View File

@ -28,8 +28,16 @@ export default {
formatterArgs: {
async: true,
permissions: 'assets.view_asset',
routeQuery: {
tab: 'AssetList'
getRoute({ row }) {
return {
name: 'ZoneDetail',
params: {
id: row.id
},
query: {
tab: 'AssetList'
}
}
}
}
},
@ -38,8 +46,16 @@ export default {
formatter: AmountFormatter,
formatterArgs: {
permissions: 'assets.view_gateway',
routeQuery: {
tab: 'GatewayList'
getRoute({ row }) {
return {
name: 'ZoneDetail',
params: {
id: row.id
},
query: {
tab: 'GatewayList'
}
}
}
}
}