refactor: clean up bag javascript

This commit is contained in:
Hayden 2021-01-20 20:53:46 -09:00
commit 75d140849b
7 changed files with 67 additions and 52 deletions

View file

@ -22,6 +22,7 @@
<v-spacer></v-spacer> <v-spacer></v-spacer>
<span> <span>
<UploadBtn <UploadBtn
class="mt-1"
url="/api/backups/upload/" url="/api/backups/upload/"
@uploaded="getAvailableBackups" @uploaded="getAvailableBackups"
/> />

View file

@ -1,7 +1,11 @@
<template> <template>
<v-card-text> <v-card-text>
<p> <p>
{{$t('migration.you-can-import-recipes-from-either-a-zip-file-or-a-directory-located-in-the-app-data-migraiton-folder-please-review-the-documentation-to-ensure-your-directory-structure-matches-what-is-expected')}} {{
$t(
"migration.you-can-import-recipes-from-either-a-zip-file-or-a-directory-located-in-the-app-data-migraiton-folder-please-review-the-documentation-to-ensure-your-directory-structure-matches-what-is-expected"
)
}}
</p> </p>
<v-form ref="form"> <v-form ref="form">
<v-row align="center"> <v-row align="center">
@ -13,13 +17,20 @@
:rules="[rules.required]" :rules="[rules.required]"
></v-select> ></v-select>
</v-col> </v-col>
<v-col cols="12" md="2" sm="12"> <v-col md="1" sm="12">
<v-btn text color="info" @click="importRecipes"> {{$t('migration.migrate')}} </v-btn> <v-btn-toggle group>
</v-col> <v-btn text color="info" @click="importRecipes">
<v-col cols="12" md="1" sm="12"> {{ $t("migration.migrate") }}
<v-btn text color="error" @click="deleteImportValidation">
{{$t('general.delete')}}
</v-btn> </v-btn>
<v-btn text color="error" @click="deleteImportValidation">
{{ $t("general.delete") }}
</v-btn>
<UploadBtn
url="/api/migration/upload/"
class="mt-1"
@uploaded="getAvaiableImports"
/>
<Confirmation <Confirmation
:title="$t('general.delete-data')" :title="$t('general.delete-data')"
:message="$t('migration.delete-confirmation')" :message="$t('migration.delete-confirmation')"
@ -28,12 +39,10 @@
ref="deleteThemeConfirm" ref="deleteThemeConfirm"
v-on:confirm="deleteImport()" v-on:confirm="deleteImport()"
/> />
</v-btn-toggle>
</v-col> </v-col>
</v-row>
<v-row> <v-spacer></v-spacer>
<v-col cols="12" md="5" sm="12">
<UploadMigrationButton @uploaded="getAvaiableImports" />
</v-col>
</v-row> </v-row>
</v-form> </v-form>
<SuccessFailureAlert <SuccessFailureAlert
@ -48,13 +57,13 @@
<script> <script>
import api from "../../../api"; import api from "../../../api";
import SuccessFailureAlert from "../../UI/SuccessFailureAlert"; import SuccessFailureAlert from "../../UI/SuccessFailureAlert";
import UploadMigrationButton from "./UploadMigrationButton";
import Confirmation from "../../UI/Confirmation"; import Confirmation from "../../UI/Confirmation";
import UploadBtn from "../../UI/UploadBtn";
export default { export default {
components: { components: {
SuccessFailureAlert, SuccessFailureAlert,
UploadMigrationButton,
Confirmation, Confirmation,
UploadBtn,
}, },
data() { data() {
return { return {
@ -63,7 +72,7 @@ export default {
availableImports: [], availableImports: [],
selectedImport: null, selectedImport: null,
rules: { rules: {
required: (v) => !!v || "Selection Required", required: v => !!v || "Selection Required",
}, },
}; };
}, },

View file

@ -43,7 +43,7 @@
<v-form ref="form" lazy-validation> <v-form ref="form" lazy-validation>
<v-row dense align="center"> <v-row dense align="center">
<v-col cols="12" md="4" sm="3"> <v-col md="4" sm="3">
<v-select <v-select
:label="$t('settings.theme.saved-color-theme')" :label="$t('settings.theme.saved-color-theme')"
:items="availableThemes" :items="availableThemes"
@ -51,18 +51,18 @@
return-object return-object
v-model="selectedTheme" v-model="selectedTheme"
@change="themeSelected" @change="themeSelected"
:rules="[(v) => !!v || $t('settings.theme.theme-is-required')]" :rules="[v => !!v || $t('settings.theme.theme-is-required')]"
required required
> >
</v-select> </v-select>
</v-col> </v-col>
<v-col cols="12" sm="1"> <v-col>
<NewThemeDialog @new-theme="appendTheme" /> <v-btn-toggle group>
</v-col> <NewThemeDialog @new-theme="appendTheme" class="mt-1" />
<v-col cols="12" sm="1">
<v-btn text color="error" @click="deleteSelectedThemeValidation"> <v-btn text color="error" @click="deleteSelectedThemeValidation">
Delete Delete
</v-btn> </v-btn>
</v-btn-toggle>
<Confirmation <Confirmation
:title="$t('settings.theme.delete-theme')" :title="$t('settings.theme.delete-theme')"
:message=" :message="
@ -74,6 +74,7 @@
v-on:confirm="deleteSelectedTheme()" v-on:confirm="deleteSelectedTheme()"
/> />
</v-col> </v-col>
<v-spacer></v-spacer>
</v-row> </v-row>
</v-form> </v-form>
<v-row dense align-content="center" v-if="selectedTheme.colors"> <v-row dense align-content="center" v-if="selectedTheme.colors">
@ -123,15 +124,10 @@
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-row> <v-spacer></v-spacer>
<v-col> </v-col> <v-btn color="success" @click="saveThemes" class="mr-2">
<v-col></v-col> {{ $t("general.save") }}
<v-col align="end">
<v-btn text color="success" @click="saveThemes">
{{ $t("settings.theme.save-colors-and-apply-theme") }}
</v-btn> </v-btn>
</v-col>
</v-row>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template> </template>
@ -187,7 +183,7 @@ export default {
//Change to default if deleting current theme. //Change to default if deleting current theme.
if ( if (
!this.availableThemes.some( !this.availableThemes.some(
(theme) => theme.name === this.selectedTheme.name theme => theme.name === this.selectedTheme.name
) )
) { ) {
await this.$store.dispatch("resetTheme"); await this.$store.dispatch("resetTheme");

View file

@ -1,10 +1,17 @@
<template> <template>
<v-card> <v-card>
<v-card-title class="headline"> <v-card-title class="headline">
{{$t('settings.webhooks.meal-planner-webhooks')}} {{ $t("settings.webhooks.meal-planner-webhooks") }}
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<p v-html="$t('settings.webhooks.the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at', {time: time})"></p> <p
v-html="
$t(
'settings.webhooks.the-urls-listed-below-will-recieve-webhooks-containing-the-recipe-data-for-the-meal-plan-on-its-scheduled-day-currently-webhooks-will-execute-at',
{ time: time }
)
"
></p>
<v-row dense align="center"> <v-row dense align="center">
<v-col cols="12" md="2" sm="5"> <v-col cols="12" md="2" sm="5">
@ -19,7 +26,9 @@
<TimePickerDialog @save-time="saveTime" /> <TimePickerDialog @save-time="saveTime" />
</v-col> </v-col>
<v-col cols="12" md="4" sm="5"> <v-col cols="12" md="4" sm="5">
<v-btn text color="info" @click="testWebhooks"> {{$t('settings.webhooks.test-webhooks')}} </v-btn> <v-btn text color="info" @click="testWebhooks">
{{ $t("settings.webhooks.test-webhooks") }}
</v-btn>
</v-col> </v-col>
</v-row> </v-row>
@ -46,8 +55,8 @@
</v-col> </v-col>
<v-col> </v-col> <v-col> </v-col>
<v-col align="end"> <v-col align="end">
<v-btn text color="success" @click="saveWebhooks"> <v-btn color="success" @click="saveWebhooks" class="mr-2 mb-1">
{{$t('settings.webhooks.save-webhooks')}} {{ $t("settings.webhooks.save-webhooks") }}
</v-btn> </v-btn>
</v-col> </v-col>
</v-row> </v-row>

View file

@ -6,9 +6,8 @@
@click="onButtonClick" @click="onButtonClick"
color="success" color="success"
text text
class="ma-2 white--text"
> >
<v-icon left dark> mdi-cloud-upload </v-icon> <v-icon left > mdi-cloud-upload </v-icon>
Upload Upload
</v-btn> </v-btn>
</v-form> </v-form>

View file

@ -11,6 +11,7 @@
"paste-in-your-recipe-data-each-line-will-be-treated-as-an-item-in-a-list": "Paste in your recipe data. Each line will be treated as an item in a list" "paste-in-your-recipe-data-each-line-will-be-treated-as-an-item-in-a-list": "Paste in your recipe data. Each line will be treated as an item in a list"
}, },
"general": { "general": {
"upload": "Upload",
"submit": "Submit", "submit": "Submit",
"name": "Name", "name": "Name",
"settings": "Settings", "settings": "Settings",

View file

@ -109,7 +109,7 @@ export default {
}, },
editPlan(id) { editPlan(id) {
this.plannedMeals.forEach((element) => { this.plannedMeals.forEach(element => {
if (element.uid === id) { if (element.uid === id) {
this.editMealPlan = element; this.editMealPlan = element;
} }