Undo reverse logic when filtering by component type
This commit is contained in:
parent
78c3eb5c3d
commit
c89eb19944
|
@ -16,21 +16,23 @@
|
|||
|
||||
let modal
|
||||
let searchTerm = ""
|
||||
|
||||
let filter = "all"
|
||||
let filterOptions = [
|
||||
{ label: "All Plugins", value: "all" },
|
||||
{ label: "Components", value: "datasource" },
|
||||
{ label: "Datasources", value: "component" },
|
||||
{ label: "Components", value: "component" },
|
||||
{ label: "Datasources", value: "datasource" },
|
||||
]
|
||||
let filter = "all"
|
||||
$: filteredPlugins =
|
||||
filter === "all" && searchTerm.length === 0
|
||||
? $plugins
|
||||
: $plugins
|
||||
.filter(plugin => plugin.schema.type !== filter)
|
||||
.filter(plugin =>
|
||||
plugin?.name?.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
)
|
||||
|
||||
$: filteredPlugins = $plugins
|
||||
.filter(plugin => {
|
||||
return filter === "all" || plugin.schema.type === filter
|
||||
})
|
||||
.filter(plugin => {
|
||||
return (
|
||||
!searchTerm ||
|
||||
plugin?.name?.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
)
|
||||
})
|
||||
|
||||
onMount(async () => {
|
||||
await plugins.load()
|
||||
|
|
Loading…
Reference in New Issue