mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-31 14:38:02 +00:00
fix: Add loading state to AccountInfoFormatter for async data fetching
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
trigger="click"
|
trigger="click"
|
||||||
@show="getAsyncItems"
|
@show="getAsyncItems"
|
||||||
>
|
>
|
||||||
<div class="detail-content">
|
<div v-if="!loading" class="detail-content">
|
||||||
<div v-if="accountData.length === 0" class="empty-item">
|
<div v-if="accountData.length === 0" class="empty-item">
|
||||||
<span>{{ $t('No accounts') }}</span>
|
<span>{{ $t('No accounts') }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -29,7 +29,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs),
|
formatterArgs: Object.assign(this.formatterArgsDefault, this.col.formatterArgs),
|
||||||
value: this.cellValue,
|
value: this.cellValue,
|
||||||
accountData: []
|
accountData: [],
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -39,10 +40,13 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getAsyncItems() {
|
async getAsyncItems() {
|
||||||
|
this.loading = true
|
||||||
const userId = this.$route.params.id || 'self'
|
const userId = this.$route.params.id || 'self'
|
||||||
const url = `/api/v1/perms/users/${userId}/assets/${this.row.id}`
|
const url = `/api/v1/perms/users/${userId}/assets/${this.row.id}`
|
||||||
this.$axios.get(url).then(res => {
|
this.$axios.get(url).then(res => {
|
||||||
this.accountData = res?.permed_accounts || []
|
this.accountData = res?.permed_accounts || []
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user