mirror of
https://github.com/unraid/api.git
synced 2026-01-03 06:59:50 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new `DropdownMenu` component in user profiles with dynamic content rendering. - Added a new `Popover` component with interactive Storybook demos, improving component discoverability. - Added a new `DropdownMenuArrow` component to enhance dropdown visuals. - Implemented new CSS custom properties for charts, enhancing styling capabilities in light and dark themes. - Enhanced dropdown functionality by encapsulating dropdown logic in a new `UpcDropdownMenu` component. - Added a new `Select` component for improved user interaction within the `Sheet` component. - Introduced a new `SheetWithSelect` story to showcase selection functionality within the `Sheet` component. - Updated the `Sidebar` component to improve modal behavior and content positioning. - Enhanced `UserProfile` components with a new feedback function for better status indication. - **Style** - Refined layouts by replacing fixed widths with flexible, responsive designs. - Updated global styling with a refreshed chart color palette and expanded dark mode support. - **Refactor** - Migrated components to use a unified UI library, streamlining interactions and boosting consistency. - Improved type safety in `BrandLoading` component by utilizing a new type for variants and sizes. - Updated component imports and organization to enhance maintainability. - **Bug Fixes** - Removed unused promotional code and components, simplifying the codebase and improving performance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: Zack Spear <hi@zackspear.com> Co-authored-by: Eli Bosley <ekbosley@gmail.com>
76 lines
2.2 KiB
Vue
76 lines
2.2 KiB
Vue
<script setup lang="ts">
|
|
import { storeToRefs } from 'pinia';
|
|
|
|
import { CheckCircleIcon, ExclamationTriangleIcon, UserCircleIcon } from '@heroicons/vue/24/solid';
|
|
import { BrandLoading } from '@unraid/ui';
|
|
|
|
import type { ComposerTranslation } from 'vue-i18n';
|
|
|
|
import { useServerStore } from '~/store/server';
|
|
import { useUnraidApiStore } from '~/store/unraidApi';
|
|
|
|
const props = defineProps<{ t: ComposerTranslation }>();
|
|
|
|
const { username } = storeToRefs(useServerStore());
|
|
|
|
const unraidApiStore = useUnraidApiStore();
|
|
const { unraidApiStatus, unraidApiRestartAction } = storeToRefs(unraidApiStore);
|
|
const brandLoading = () => h(BrandLoading, { size: 'custom' });
|
|
|
|
interface StatusOutput {
|
|
icon: typeof BrandLoading | typeof ExclamationTriangleIcon | typeof CheckCircleIcon;
|
|
iconClasses?: string;
|
|
text: string;
|
|
textClasses?: string;
|
|
}
|
|
const status = computed((): StatusOutput | undefined => {
|
|
if (unraidApiStatus.value === 'connecting') {
|
|
return {
|
|
icon: brandLoading,
|
|
iconClasses: 'w-4',
|
|
text: props.t('Loading…'),
|
|
textClasses: 'italic',
|
|
};
|
|
}
|
|
if (unraidApiStatus.value === 'restarting') {
|
|
return {
|
|
icon: brandLoading,
|
|
iconClasses: 'w-4',
|
|
text: props.t('Restarting unraid-api…'),
|
|
textClasses: 'italic',
|
|
};
|
|
}
|
|
if (unraidApiStatus.value === 'offline') {
|
|
return {
|
|
icon: ExclamationTriangleIcon,
|
|
iconClasses: 'text-red-500 w-16px h-16px',
|
|
text: props.t('unraid-api is offline'),
|
|
};
|
|
}
|
|
if (unraidApiStatus.value === 'online') {
|
|
return {
|
|
icon: CheckCircleIcon,
|
|
iconClasses: 'text-green-600 w-16px h-16px',
|
|
text: props.t('Connected'),
|
|
};
|
|
}
|
|
return undefined;
|
|
});
|
|
|
|
const statusItemClasses = "text-14px flex flex-row justify-start items-center gap-8px mt-8px px-8px";
|
|
</script>
|
|
|
|
<template>
|
|
<li v-if="username" :class="statusItemClasses">
|
|
<UserCircleIcon class="w-16px h-16px" aria-hidden="true" />
|
|
{{ username }}
|
|
</li>
|
|
<li v-if="status" :class="statusItemClasses">
|
|
<component :is="status.icon" :class="status.iconClasses" aria-hidden="true" />
|
|
{{ status.text }}
|
|
</li>
|
|
<li v-if="unraidApiRestartAction" class="w-full">
|
|
<UpcDropdownItem :item="unraidApiRestartAction" :t="t" />
|
|
</li>
|
|
</template>
|