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