Dashboard Data Refresh After creating a time entry, fixes ST-299

This commit is contained in:
Gregor Vostrak
2024-09-06 15:07:13 +02:00
committed by Constantin Graf
parent c09119af33
commit b518187ecb
3 changed files with 56 additions and 32 deletions

View File

@@ -51,47 +51,49 @@ const props = defineProps<{
}>(); }>();
const accentColor = useCssVar('--color-accent-quaternary'); const accentColor = useCssVar('--color-accent-quaternary');
const seriesData = props.weeklyHistory.map((el) => { const seriesData = computed(() => {
return { return props.weeklyHistory.map((el) => {
value: el.duration, return {
...{ value: el.duration,
itemStyle: { ...{
borderColor: new LinearGradient(0, 0, 0, 1, [ itemStyle: {
{ borderColor: new LinearGradient(0, 0, 0, 1, [
offset: 0,
color: 'rgba(' + accentColor.value + ',0.7)',
},
{
offset: 1,
color: 'rgba(' + accentColor.value + ',0.5)',
},
]),
emphasis: {
color: new LinearGradient(0, 0, 0, 1, [
{ {
offset: 0, offset: 0,
color: 'rgba(' + accentColor.value + ',0.9)', color: 'rgba(' + accentColor.value + ',0.7)',
}, },
{ {
offset: 1, offset: 1,
color: 'rgba(' + accentColor.value + ',0.5)',
},
]),
emphasis: {
color: new LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(' + accentColor.value + ',0.9)',
},
{
offset: 1,
color: 'rgba(' + accentColor.value + ',0.7)',
},
]),
},
borderRadius: [12, 12, 0, 0],
color: new LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(' + accentColor.value + ',0.7)', color: 'rgba(' + accentColor.value + ',0.7)',
}, },
{
offset: 1,
color: 'rgba(' + accentColor.value + ',0.5)',
},
]), ]),
}, },
borderRadius: [12, 12, 0, 0],
color: new LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgba(' + accentColor.value + ',0.7)',
},
{
offset: 1,
color: 'rgba(' + accentColor.value + ',0.5)',
},
]),
}, },
}, };
}; });
}); });
const weekdays = computed(() => { const weekdays = computed(() => {

View File

@@ -45,12 +45,17 @@ const { tasks } = storeToRefs(taskStore);
const clientStore = useClientsStore(); const clientStore = useClientsStore();
const { clients } = storeToRefs(clientStore); const { clients } = storeToRefs(clientStore);
const emit = defineEmits<{
change: [];
}>();
watch(isActive, () => { watch(isActive, () => {
if (isActive.value) { if (isActive.value) {
startLiveTimer(); startLiveTimer();
} else { } else {
stopLiveTimer(); stopLiveTimer();
} }
emit('change');
}); });
onMounted(async () => { onMounted(async () => {

View File

@@ -8,6 +8,7 @@ import ThisWeekOverview from '@/Components/Dashboard/ThisWeekOverview.vue';
import ActivityGraphCard from '@/Components/Dashboard/ActivityGraphCard.vue'; import ActivityGraphCard from '@/Components/Dashboard/ActivityGraphCard.vue';
import MainContainer from '@/packages/ui/src/MainContainer.vue'; import MainContainer from '@/packages/ui/src/MainContainer.vue';
import { canViewMembers } from '@/utils/permissions'; import { canViewMembers } from '@/utils/permissions';
import { router } from '@inertiajs/vue3';
const props = defineProps<{ const props = defineProps<{
latestTasks: { latestTasks: {
@@ -46,13 +47,29 @@ const props = defineProps<{
duration: number; duration: number;
}[]; }[];
}>(); }>();
function refreshDashboardData() {
router.reload({
only: [
'latestTasks',
'latestTeamActivity',
'lastSevenDays',
'dailyTrackedHours',
'weeklyProjectOverview',
'totalWeeklyTime',
'totalWeeklyBillableTime',
'totalWeeklyBillableAmount',
'weeklyHistory',
],
});
}
</script> </script>
<template> <template>
<AppLayout title="Dashboard" data-testid="dashboard_view"> <AppLayout title="Dashboard" data-testid="dashboard_view">
<MainContainer <MainContainer
class="pt-5 sm:pt-8 pb-4 sm:pb-6 border-b border-default-background-separator"> class="pt-5 sm:pt-8 pb-4 sm:pb-6 border-b border-default-background-separator">
<TimeTracker></TimeTracker> <TimeTracker @change="refreshDashboardData"></TimeTracker>
</MainContainer> </MainContainer>
<MainContainer <MainContainer
class="grid gap-5 sm:gap-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 pt-3 sm:pt-5 pb-4 sm:pb-6 border-b border-default-background-separator items-stretch"> class="grid gap-5 sm:gap-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 pt-3 sm:pt-5 pb-4 sm:pb-6 border-b border-default-background-separator items-stretch">