Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Global Timeline #2265

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4ea1d3d
extended query filter to accept nested tables
michael-genson Mar 15, 2023
c5bbe63
decoupled timeline api from recipe slug
michael-genson Mar 15, 2023
74e4118
modified frontend to use simplified events api
michael-genson Mar 15, 2023
a346889
fixed nested loop index ghosting
michael-genson Mar 15, 2023
fb9fb00
updated existing tests
michael-genson Mar 15, 2023
7917ff9
gave mypy a snack
michael-genson Mar 15, 2023
9bab9ae
added tests for nested queries
michael-genson Mar 15, 2023
c022675
fixed "last made" render error
michael-genson Mar 15, 2023
dd15a4a
decoupled recipe timeline from dialog
michael-genson Mar 15, 2023
c264294
removed unused props
michael-genson Mar 16, 2023
2f6495a
tweaked recipe get_all to accept ids
michael-genson Mar 16, 2023
09a3307
created group global timeline
michael-genson Mar 17, 2023
3ba85f6
extracted timeline item into its own component
michael-genson Mar 17, 2023
4239753
fixed apploader centering
michael-genson Mar 17, 2023
cb715cc
added paginated scrolling to recipe timeline
michael-genson Mar 17, 2023
f6ba646
added sort direction config
michael-genson Mar 18, 2023
8b91773
added sort direction to user preferences
michael-genson Mar 18, 2023
ace2f50
updated API docs with new query filter feature
michael-genson Mar 18, 2023
4b3ba9c
better error tracing
michael-genson Mar 18, 2023
3f332e4
fix for recipe not found response
michael-genson Mar 18, 2023
b6e833f
simplified recipe crud route for slug/id
michael-genson Mar 18, 2023
e83bedb
made query filter UUID validation clearer
michael-genson Mar 19, 2023
a922879
moved timeline menu option below shopping lists
michael-genson Mar 24, 2023
7f7f7f2
Merge branch 'mealie-next' into feat/global-timeline
michael-genson Apr 5, 2023
745c661
Merge branch 'mealie-next' into feat/global-timeline
hay-kot Apr 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/docs/documentation/getting-started/api-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ This filter will find all recipes created on or after a particular date: <br>
This filter will find all units that have `useAbbreviation` disabled: <br>
`useAbbreviation = false`

##### Nested Property filters
When querying tables with relationships, you can filter properties on related tables. For instance, if you want to query all recipes owned by a particular user: <br>
`user.username = "SousChef20220320"`

This timeline event filter will return all timeline events for recipes that were created after a particular date: <br>
`recipe.createdAt >= "2023-02-25"`

##### Compound Filters
You can combine multiple filter statements using logical operators (`AND`, `OR`).

Expand Down
20 changes: 17 additions & 3 deletions frontend/components/Domain/Recipe/RecipeCardMobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@
:to="$listeners.selected ? undefined : `/recipe/${slug}`"
@click="$emit('selected')"
>
<v-img v-if="vertical">
<RecipeCardImage
:icon-size="100"
:height="75"
:slug="slug"
:recipe-id="recipeId"
small
:image-version="image"
/>
</v-img>
<v-list-item three-line>
<slot name="avatar">
<slot v-if="!vertical" name="avatar">
<v-list-item-avatar tile size="125" class="v-mobile-img rounded-sm my-0 ml-n4">
<RecipeCardImage
:icon-size="100"
Expand All @@ -17,15 +27,15 @@
:recipe-id="recipeId"
small
:image-version="image"
></RecipeCardImage>
/>
</v-list-item-avatar>
</slot>
<v-list-item-content>
<v-list-item-title class="mb-1">{{ name }} </v-list-item-title>
<v-list-item-subtitle>
<SafeMarkdown :source="description" />
</v-list-item-subtitle>
<div class="d-flex justify-center align-center">
<div class="d-flex flex-wrap justify-end align-center">
<slot name="actions">
<RecipeFavoriteBadge v-if="loggedIn" :slug="slug" show-always />
<v-rating
Expand Down Expand Up @@ -107,6 +117,10 @@ export default defineComponent({
type: String,
required: true,
},
vertical: {
type: Boolean,
default: false,
}
},
setup() {
const { $auth } = useContext();
Expand Down
245 changes: 0 additions & 245 deletions frontend/components/Domain/Recipe/RecipeDialogTimeline.vue

This file was deleted.

16 changes: 9 additions & 7 deletions frontend/components/Domain/Recipe/RecipeLastMade.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ import { defineComponent, reactive, ref, toRefs, useContext } from "@nuxtjs/comp
import { whenever } from "@vueuse/core";
import { VForm } from "~/types/vuetify";
import { useUserApi } from "~/composables/api";
import { RecipeTimelineEventIn } from "~/lib/api/types/recipe";
import { Recipe, RecipeTimelineEventIn } from "~/lib/api/types/recipe";

export default defineComponent({
props: {
value: {
type: String,
default: null,
},
recipeSlug: {
type: String,
required: true,
recipe: {
type: Object as () => Recipe,
default: null,
},
},
setup(props, context) {
Expand All @@ -99,6 +99,7 @@ export default defineComponent({
eventType: "comment",
eventMessage: "",
timestamp: undefined,
recipeId: props.recipe?.id || "",
});

whenever(
Expand All @@ -113,20 +114,21 @@ export default defineComponent({

const state = reactive({datePickerMenu: false});
async function createTimelineEvent() {
if (!newTimelineEvent.value.timestamp) {
if (!(newTimelineEvent.value.timestamp && props.recipe?.id && props.recipe?.slug)) {
return;
}

newTimelineEvent.value.recipeId = props.recipe.id
const actions: Promise<any>[] = [];

// the user only selects the date, so we set the time to end of day local time
// we choose the end of day so it always comes after "new recipe" events
newTimelineEvent.value.timestamp = new Date(newTimelineEvent.value.timestamp + "T23:59:59").toISOString();
actions.push(userApi.recipes.createTimelineEvent(props.recipeSlug, newTimelineEvent.value));
actions.push(userApi.recipes.createTimelineEvent(newTimelineEvent.value));

// we also update the recipe's last made value
if (!props.value || newTimelineEvent.value.timestamp > props.value) {
actions.push(userApi.recipes.updateLastMade(props.recipeSlug, newTimelineEvent.value.timestamp));
actions.push(userApi.recipes.updateLastMade(props.recipe.slug, newTimelineEvent.value.timestamp));

// update recipe in parent so the user can see it
// we remove the trailing "Z" since this is how the API returns it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div v-if="user.id" class="d-flex justify-center mt-5">
<RecipeLastMade
v-model="recipe.lastMade"
:recipe-slug="recipe.slug"
:recipe="recipe"
class="d-flex justify-center flex-wrap"
:class="true ? undefined : 'force-bottom'"
/>
Expand Down
Loading