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