mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-25 08:09:41 +02:00
feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
89ab7fac25
commit
c24d532608
403 changed files with 23959 additions and 19557 deletions
|
@ -1,13 +1,22 @@
|
|||
<template>
|
||||
<div>
|
||||
<!-- Create New Dialog -->
|
||||
<BaseDialog v-model="state.createDialog" :title="$t('data-pages.labels.new-label')" :icon="$globals.icons.tags" @submit="createLabel">
|
||||
<BaseDialog
|
||||
v-model="state.createDialog"
|
||||
:title="$t('data-pages.labels.new-label')"
|
||||
:icon="$globals.icons.tags"
|
||||
can-submit
|
||||
@submit="createLabel"
|
||||
>
|
||||
<v-card-text>
|
||||
<MultiPurposeLabel :label="createLabelData" />
|
||||
|
||||
<div class="mt-4">
|
||||
<v-text-field v-model="createLabelData.name" :label="$t('general.name')"> </v-text-field>
|
||||
<InputColor v-model="createLabelData.color" />
|
||||
<v-text-field
|
||||
v-model="createLabelData.name"
|
||||
:label="$t('general.name')"
|
||||
/>
|
||||
<InputColor v-model="createLabelData.color!" />
|
||||
</div>
|
||||
</v-card-text>
|
||||
</BaseDialog>
|
||||
|
@ -18,14 +27,18 @@
|
|||
:icon="$globals.icons.tags"
|
||||
:title="$t('data-pages.labels.edit-label')"
|
||||
:submit-icon="$globals.icons.save"
|
||||
:submit-text="$tc('general.save')"
|
||||
:submit-text="$t('general.save')"
|
||||
can-submit
|
||||
@submit="editSaveLabel"
|
||||
>
|
||||
<v-card-text v-if="editLabel">
|
||||
<MultiPurposeLabel :label="editLabel" />
|
||||
<div class="mt-4">
|
||||
<v-text-field v-model="editLabel.name" :label="$t('general.name')"> </v-text-field>
|
||||
<InputColor v-model="editLabel.color" />
|
||||
<v-text-field
|
||||
v-model="editLabel.name"
|
||||
:label="$t('general.name')"
|
||||
/>
|
||||
<InputColor v-model="editLabel.color!" />
|
||||
</div>
|
||||
</v-card-text>
|
||||
</BaseDialog>
|
||||
|
@ -33,15 +46,20 @@
|
|||
<!-- Delete Dialog -->
|
||||
<BaseDialog
|
||||
v-model="state.deleteDialog"
|
||||
:title="$tc('general.confirm')"
|
||||
:title="$t('general.confirm')"
|
||||
:icon="$globals.icons.alertCircle"
|
||||
color="error"
|
||||
can-confirm
|
||||
@confirm="deleteLabel"
|
||||
>
|
||||
<v-card-text>
|
||||
{{ $t("general.confirm-delete-generic") }}
|
||||
<v-row>
|
||||
<MultiPurposeLabel v-if="deleteTarget" class="mt-4 ml-4 mb-1" :label="deleteTarget" />
|
||||
<MultiPurposeLabel
|
||||
v-if="deleteTarget"
|
||||
class="mt-4 ml-4 mb-1"
|
||||
:label="deleteTarget"
|
||||
/>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</BaseDialog>
|
||||
|
@ -50,20 +68,25 @@
|
|||
<BaseDialog
|
||||
v-model="state.bulkDeleteDialog"
|
||||
width="650px"
|
||||
:title="$tc('general.confirm')"
|
||||
:title="$t('general.confirm')"
|
||||
:icon="$globals.icons.alertCircle"
|
||||
color="error"
|
||||
can-confirm
|
||||
@confirm="deleteSelected"
|
||||
>
|
||||
<v-card-text>
|
||||
<p class="h4">{{ $t('general.confirm-delete-generic-items') }}</p>
|
||||
<v-card outlined>
|
||||
<v-virtual-scroll height="400" item-height="25" :items="bulkDeleteTarget">
|
||||
<p class="h4">
|
||||
{{ $t('general.confirm-delete-generic-items') }}
|
||||
</p>
|
||||
<v-card variant="outlined">
|
||||
<v-virtual-scroll
|
||||
height="400"
|
||||
item-height="25"
|
||||
:items="bulkDeleteTarget"
|
||||
>
|
||||
<template #default="{ item }">
|
||||
<v-list-item class="pb-2">
|
||||
<v-list-item-content>
|
||||
<v-list-item-title>{{ item.name }}</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
<v-list-item-title>{{ item.name }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-virtual-scroll>
|
||||
|
@ -71,11 +94,12 @@
|
|||
</v-card-text>
|
||||
</BaseDialog>
|
||||
|
||||
<!-- Seed Dialog-->
|
||||
<!-- Seed Dialog -->
|
||||
<BaseDialog
|
||||
v-model="seedDialog"
|
||||
:icon="$globals.icons.foods"
|
||||
:title="$tc('data-pages.seed-data')"
|
||||
:title="$t('data-pages.seed-data')"
|
||||
can-confirm
|
||||
@confirm="seedDatabase"
|
||||
>
|
||||
<v-card-text>
|
||||
|
@ -85,52 +109,68 @@
|
|||
<v-autocomplete
|
||||
v-model="locale"
|
||||
:items="locales"
|
||||
item-text="name"
|
||||
item-title="name"
|
||||
:label="$t('data-pages.select-language')"
|
||||
class="my-3"
|
||||
hide-details
|
||||
outlined
|
||||
variant="outlined"
|
||||
offset
|
||||
>
|
||||
<template #item="{ item }">
|
||||
<v-list-item-content>
|
||||
<v-list-item-title> {{ item.name }} </v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
{{ item.progress }}% {{ $tc("language-dialog.translated") }}
|
||||
</v-list-item-subtitle>
|
||||
</v-list-item-content>
|
||||
<v-list-item-title> {{ item.raw.name }} </v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
{{ item.raw.progress }}% {{ $t("language-dialog.translated") }}
|
||||
</v-list-item-subtitle>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
|
||||
<v-alert v-if="labels && labels.length > 0" type="error" class="mb-0 text-body-2">
|
||||
<v-alert
|
||||
v-if="labels && labels.length > 0"
|
||||
type="error"
|
||||
class="mb-0 text-body-2"
|
||||
>
|
||||
{{ $t("data-pages.foods.seed-dialog-warning") }}
|
||||
</v-alert>
|
||||
</v-card-text>
|
||||
</BaseDialog>
|
||||
|
||||
<!-- Data Table -->
|
||||
<BaseCardSectionTitle :icon="$globals.icons.tags" section :title="$tc('data-pages.labels.labels')"> </BaseCardSectionTitle>
|
||||
<BaseCardSectionTitle
|
||||
:icon="$globals.icons.tags"
|
||||
section
|
||||
:title="$t('data-pages.labels.labels')"
|
||||
/>
|
||||
<CrudTable
|
||||
v-model:headers="tableHeaders"
|
||||
:table-config="tableConfig"
|
||||
:headers.sync="tableHeaders"
|
||||
:data="labels || []"
|
||||
:bulk-actions="[{icon: $globals.icons.delete, text: $tc('general.delete'), event: 'delete-selected'}]"
|
||||
:bulk-actions="[{ icon: $globals.icons.delete, text: $t('general.delete'), event: 'delete-selected' }]"
|
||||
initial-sort="name"
|
||||
@delete-one="deleteEventHandler"
|
||||
@edit-one="editEventHandler"
|
||||
@delete-selected="bulkDeleteEventHandler"
|
||||
>
|
||||
<template #button-row>
|
||||
<BaseButton create @click="state.createDialog = true">{{ $t("general.create") }}</BaseButton>
|
||||
<BaseButton
|
||||
create
|
||||
@click="state.createDialog = true"
|
||||
>
|
||||
{{ $t("general.create") }}
|
||||
</BaseButton>
|
||||
</template>
|
||||
<template #item.name="{ item }">
|
||||
<MultiPurposeLabel v-if="item" :label="item">
|
||||
<template #[`item.name`]="{ item }">
|
||||
<MultiPurposeLabel
|
||||
v-if="item"
|
||||
:label="item"
|
||||
>
|
||||
{{ item.name }}
|
||||
</MultiPurposeLabel>
|
||||
</template>
|
||||
<template #button-bottom>
|
||||
<BaseButton @click="seedDialog = true">
|
||||
<template #icon> {{ $globals.icons.database }} </template>
|
||||
<template #icon>
|
||||
{{ $globals.icons.database }}
|
||||
</template>
|
||||
{{ $t('data-pages.seed') }}
|
||||
</BaseButton>
|
||||
</template>
|
||||
|
@ -139,20 +179,20 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, reactive, ref, useContext } from "@nuxtjs/composition-api";
|
||||
import type { LocaleObject } from "@nuxtjs/i18n";
|
||||
import { validators } from "~/composables/use-validators";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
import MultiPurposeLabel from "~/components/Domain/ShoppingList/MultiPurposeLabel.vue";
|
||||
import { MultiPurposeLabelSummary } from "~/lib/api/types/labels";
|
||||
import type { MultiPurposeLabelSummary } from "~/lib/api/types/labels";
|
||||
import { useLocales } from "~/composables/use-locales";
|
||||
import { useLabelData, useLabelStore } from "~/composables/store";
|
||||
|
||||
export default defineComponent({
|
||||
export default defineNuxtComponent({
|
||||
components: { MultiPurposeLabel },
|
||||
setup() {
|
||||
const userApi = useUserApi();
|
||||
const { i18n } = useContext();
|
||||
const i18n = useI18n();
|
||||
|
||||
const tableConfig = {
|
||||
hideColumns: true,
|
||||
canExport: true,
|
||||
|
@ -167,6 +207,7 @@ export default defineComponent({
|
|||
text: i18n.t("general.name"),
|
||||
value: "name",
|
||||
show: true,
|
||||
sortable: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -256,8 +297,8 @@ export default defineComponent({
|
|||
locale.value = currentLocale.value;
|
||||
});
|
||||
|
||||
const locales = LOCALES.filter((locale) =>
|
||||
(i18n.locales as LocaleObject[]).map((i18nLocale) => i18nLocale.code).includes(locale.value)
|
||||
const locales = LOCALES.filter(locale =>
|
||||
(i18n.locales.value as LocaleObject[]).map(i18nLocale => i18nLocale.code).includes(locale.value),
|
||||
);
|
||||
|
||||
async function seedDatabase() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue