-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module): support view usage for username quota
- Loading branch information
1 parent
3e46c25
commit 4215394
Showing
5 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/views/Modules/components/UsernameQuota/UsernameQuota.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<template> | ||
<div class="username-quota" :loading="isTableLoading"> | ||
<el-table :data="tableData"> | ||
<el-table-column prop="username" :label="$t('Clients.username')" /> | ||
<el-table-column prop="used" :label="$t('Modules.numberOfSessions')" /> | ||
</el-table> | ||
<div class="emq-table-footer"> | ||
<el-pagination | ||
hide-on-single-page | ||
background | ||
layout="total, sizes, prev, pager, next" | ||
:page-sizes="[20, 50, 100, 500]" | ||
:page-size.sync="params._limit" | ||
:current-page.sync="params._page" | ||
:total="params._count" | ||
@size-change="handleSizeChange" | ||
@current-change="getData" | ||
> | ||
</el-pagination> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { queryUsernameQuotaUsage } from '@/api/modules' | ||
export default { | ||
name: 'SlowQuery', | ||
data() { | ||
return { | ||
tableData: [], | ||
params: { | ||
_page: 1, | ||
_limit: 20, | ||
_count: 0, | ||
}, | ||
isTableLoading: false, | ||
} | ||
}, | ||
created() { | ||
this.getData() | ||
}, | ||
methods: { | ||
async getData() { | ||
try { | ||
this.isTableLoading = true | ||
const { items, meta } = await queryUsernameQuotaUsage(this.params) | ||
this.tableData = items | ||
this.params._count = meta.count | ||
} catch (error) { | ||
// | ||
} finally { | ||
this.isTableLoading = false | ||
} | ||
}, | ||
handleSizeChange() { | ||
this.params._page = 1 | ||
this.getData() | ||
}, | ||
}, | ||
} | ||
</script> | ||
<style lang="scss"> | ||
.username-quota { | ||
padding: 28px 16px 16px; | ||
} | ||
</style> |