Skip to content

Commit

Permalink
Merge pull request #4172 from FlowFuse/add-search-functionality-to-th…
Browse files Browse the repository at this point in the history
…e-applications-instances-page

Add search functionality to the applications instances page
  • Loading branch information
Steve-Mcl authored Jul 12, 2024
2 parents fc1a5dc + 259fdcb commit 539134f
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion frontend/src/pages/application/Overview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
v-if="instances?.length > 0"
data-el="cloud-instances"
:columns="cloudColumns"
:rows="cloudRows"
:rows="filteredRows"
:show-search="true"
search-placeholder="Search Instances"
:rows-selectable="true"
@update:search="updateSearch"
@row-selected="selectedCloudRow"
>
<template
Expand Down Expand Up @@ -131,6 +134,11 @@ export default {
}
},
emits: ['instance-delete', 'instance-suspend', 'instance-restart', 'instance-start'],
data () {
return {
searchTerm: ''
}
},
computed: {
...mapState('account', ['team', 'teamMembership']),
cloudColumns () {
Expand All @@ -153,6 +161,15 @@ export default {
return instance
})
},
filteredRows () {
return this.cloudRows
.filter(
row => [
row.name.toLowerCase().includes(this.searchTerm),
row.id.toLowerCase().includes(this.searchTerm)
].includes(true)
)
},
isVisitingAdmin () {
return this.teamMembership.role === Roles.Admin
}
Expand All @@ -165,6 +182,9 @@ export default {
id: cloudInstance.id
}
})
},
updateSearch (searchTerm) {
this.searchTerm = searchTerm
}
}
}
Expand Down

0 comments on commit 539134f

Please sign in to comment.