mirror of
https://github.com/unraid/api.git
synced 2026-01-07 09:10:05 -06:00
refactor(web): key actions component filter props
This commit is contained in:
@@ -3,16 +3,28 @@ import { storeToRefs } from 'pinia';
|
||||
|
||||
import { useServerStore } from '~/store/server';
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
filterBy?: string[] | undefined;
|
||||
filterOut?: string[] | undefined;
|
||||
t: any;
|
||||
}>();
|
||||
|
||||
const { keyActions } = storeToRefs(useServerStore());
|
||||
|
||||
const filteredKeyActions = computed(() => {
|
||||
if (!keyActions.value || (!props.filterOut && !props.filterBy)) return keyActions.value;
|
||||
|
||||
return keyActions.value.filter((action: { name: string; }) => {
|
||||
return props.filterOut
|
||||
? !props.filterOut?.includes(action.name)
|
||||
: props.filterBy?.includes(action.name);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ul v-if="keyActions" class="flex flex-col gap-y-8px">
|
||||
<li v-for="action in keyActions" :key="action.name">
|
||||
<ul v-if="filteredKeyActions" class="flex flex-col gap-y-8px">
|
||||
<li v-for="action in filteredKeyActions" :key="action.name">
|
||||
<BrandButton
|
||||
class="w-full sm:max-w-300px"
|
||||
:disabled="action?.disabled"
|
||||
|
||||
Reference in New Issue
Block a user