Skip to content

Commit

Permalink
Add num active count on dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
NHAS committed Nov 29, 2024
1 parent cc3a75b commit afa44ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions adminui/frontend/src/pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ const { next: nextPage, prev: prevPage, totalPages, currentItems: currentLogLine
<h5 class="card-title">View Active Sessions</h5>
<div>
{{
allDevices.filter(e => {
e.active
}).length ?? 0 + ' active sessions'
devicesStore.numActive() + ' active sessions'
}}
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion adminui/frontend/src/stores/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const useDevicesStore = defineStore({
getters: {
byAddress: state => (address: string) => state.devices.find(x => x.internal_ip == address),
byOwner: state => (owner: string) => state.devices.find(x => x.owner == owner),
numDevices: state => () => state.devices?.length ?? 0
numDevices: state => () => state.devices?.length ?? 0,
numActive: state => () => state.devices?.filter(x => x.active).length ?? 0
}
})

0 comments on commit afa44ae

Please sign in to comment.