diff --git a/dashboard/src/components/list/ListControl.svelte b/dashboard/src/components/list/ListControl.svelte index b88614c0..11cc0db1 100644 --- a/dashboard/src/components/list/ListControl.svelte +++ b/dashboard/src/components/list/ListControl.svelte @@ -349,6 +349,16 @@ function resetPage() { {#if pageOptions.type === 'member'} + + + Proxy tags + resetPage()}> + + + + + + Avatar diff --git a/dashboard/src/components/list/functions.ts b/dashboard/src/components/list/functions.ts index 30eb235d..0396a0ba 100644 --- a/dashboard/src/components/list/functions.ts +++ b/dashboard/src/components/list/functions.ts @@ -50,29 +50,38 @@ function search(list: T[], options: ListOptions): T[] { function filter(list: T[], options: ListOptions): T[] { let newList = [...list]; + Object.keys(options.filter).forEach(x => { if (options.filter[x] === 'include') { - newList = [...list].filter(item => item[x] && true); + newList = [...newList].filter(item => item[x] && true); } }); - let newList2 = [...newList] - Object.keys(options.filter).forEach(x => { if (options.filter[x] === 'exclude') { - newList2 = [...newList].filter(item => !item[x] && true) + newList = [...newList].filter(item => !item[x] && true) } }); - let anotherList = [...newList2]; + Object.keys(options.filterArray).forEach(x => { + if (options.filterArray[x] === 'include') { + newList = [...newList].filter(i => i[x] && i[x].length > 0 ? true : false) + } + }) + + Object.keys(options.filterArray).forEach(x => { + if (options.filterArray[x] === 'exclude') { + newList = [...newList].filter(i => !i[x] || i[x].length === 0 ? true : false) + } + }) if (options.show === 'private') { - anotherList = [...newList2].filter(item => item.privacy && item.privacy.visibility === 'private'); + newList = [...newList].filter(item => item.privacy && item.privacy.visibility === 'private'); } else if (options.show === 'public') { - anotherList = [...newList2].filter(item => item.privacy && item.privacy.visibility === 'public'); + newList = [...newList].filter(item => item.privacy && item.privacy.visibility === 'public'); } - return anotherList; + return newList; } function sort(list: T[], options: ListOptions): T[] { diff --git a/dashboard/src/components/list/types.ts b/dashboard/src/components/list/types.ts index 5abfa84e..40a319da 100644 --- a/dashboard/src/components/list/types.ts +++ b/dashboard/src/components/list/types.ts @@ -48,6 +48,11 @@ export interface ListOptions { banner: "all"|"include"|"exclude", } + // filter members based on whether an array field has any items or not + // used for proxy tags right now + filterArray: { + proxy_tags: "all"|"include"|"exclude", + } // what it says on the tin sort: 'name'|'description'|'birthday'|'pronouns'|'display_name'|'id'|'none'|'created' | 'color', order: "ascending"|"descending", @@ -114,7 +119,9 @@ export const defaultListOptions: ListOptions = { icon: 'all', color: 'all', banner: 'all' - + }, + filterArray: { + proxy_tags: 'all', }, sort: 'name', order: 'ascending',