mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
cleanup: remove docker volume validation (#2830)
* remove docker volume validation * remove imports & linting * remove missed
This commit is contained in:
parent
95bb6d0184
commit
ef2918c85b
File diff suppressed because one or more lines are too long
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container fluid class="narrow-container">
|
<v-container fluid class="narrow-container">
|
||||||
|
<!-- Image -->
|
||||||
<BasePageTitle divider>
|
<BasePageTitle divider>
|
||||||
<template #header>
|
<template #header>
|
||||||
<v-img max-height="200" max-width="150" :src="require('~/static/svgs/admin-site-settings.svg')"></v-img>
|
<v-img max-height="200" max-width="150" :src="require('~/static/svgs/admin-site-settings.svg')"></v-img>
|
||||||
@ -7,6 +8,7 @@
|
|||||||
<template #title> {{ $t("settings.site-settings") }} </template>
|
<template #title> {{ $t("settings.site-settings") }} </template>
|
||||||
</BasePageTitle>
|
</BasePageTitle>
|
||||||
|
|
||||||
|
<!-- Bug Report -->
|
||||||
<BaseDialog v-model="bugReportDialog" :title="$t('settings.bug-report')" :width="800" :icon="$globals.icons.github">
|
<BaseDialog v-model="bugReportDialog" :title="$t('settings.bug-report')" :width="800" :icon="$globals.icons.github">
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<div class="pb-4">
|
<div class="pb-4">
|
||||||
@ -27,7 +29,6 @@
|
|||||||
<BaseButton
|
<BaseButton
|
||||||
color="info"
|
color="info"
|
||||||
@click="
|
@click="
|
||||||
dockerValidate();
|
|
||||||
bugReportDialog = true;
|
bugReportDialog = true;
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
@ -36,6 +37,7 @@
|
|||||||
</BaseButton>
|
</BaseButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Configuration -->
|
||||||
<section>
|
<section>
|
||||||
<BaseCardSectionTitle class="pb-0" :icon="$globals.icons.cog" :title="$tc('settings.configuration')"> </BaseCardSectionTitle>
|
<BaseCardSectionTitle class="pb-0" :icon="$globals.icons.cog" :title="$tc('settings.configuration')"> </BaseCardSectionTitle>
|
||||||
<v-card class="mb-4">
|
<v-card class="mb-4">
|
||||||
@ -60,40 +62,7 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<!-- Email -->
|
||||||
<BaseCardSectionTitle class="pt-2" :icon="$globals.icons.docker" :title="$tc('settings.docker-volume')" />
|
|
||||||
<v-alert
|
|
||||||
border="left"
|
|
||||||
colored-border
|
|
||||||
:type="docker.state === DockerVolumeState.Error ? 'error' : 'info'"
|
|
||||||
:icon="$globals.icons.docker"
|
|
||||||
elevation="2"
|
|
||||||
:loading="docker.loading"
|
|
||||||
>
|
|
||||||
<div class="d-flex align-center font-weight-medium">
|
|
||||||
{{ $t('settings.docker-volume') }}
|
|
||||||
<HelpIcon small class="my-n3">
|
|
||||||
{{ $t('settings.docker-volume-help') }}
|
|
||||||
</HelpIcon>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<template v-if="docker.state === DockerVolumeState.Error"> {{ $t('settings.volumes-are-misconfigured') }} </template>
|
|
||||||
<template v-else-if="docker.state === DockerVolumeState.Success">
|
|
||||||
{{ $t('settings.volumes-are-configured-correctly') }}
|
|
||||||
</template>
|
|
||||||
<template v-else-if="docker.state === DockerVolumeState.Unknown">
|
|
||||||
{{ $t('settings.status-unknown-try-running-a-validation') }}
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<div class="mt-4">
|
|
||||||
<BaseButton color="info" :loading="docker.loading" @click="dockerValidate">
|
|
||||||
<template #icon> {{ $globals.icons.checkboxMarkedCircle }} </template>
|
|
||||||
{{ $t('settings.validate') }}
|
|
||||||
</BaseButton>
|
|
||||||
</div>
|
|
||||||
</v-alert>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<BaseCardSectionTitle class="pt-2" :icon="$globals.icons.email" :title="$tc('user.email')" />
|
<BaseCardSectionTitle class="pt-2" :icon="$globals.icons.email" :title="$tc('user.email')" />
|
||||||
<v-alert border="left" colored-border :type="appConfig.emailReady ? 'success' : 'error'" elevation="2">
|
<v-alert border="left" colored-border :type="appConfig.emailReady ? 'success' : 'error'" elevation="2">
|
||||||
@ -219,30 +188,6 @@ export default defineComponent({
|
|||||||
components: { AppLoader },
|
components: { AppLoader },
|
||||||
layout: "admin",
|
layout: "admin",
|
||||||
setup() {
|
setup() {
|
||||||
// ==========================================================
|
|
||||||
// Docker Volume Validation
|
|
||||||
const docker = reactive({
|
|
||||||
loading: false,
|
|
||||||
state: DockerVolumeState.Unknown,
|
|
||||||
});
|
|
||||||
async function dockerValidate() {
|
|
||||||
docker.loading = true;
|
|
||||||
// Do API Check
|
|
||||||
const { data } = await adminApi.about.checkDocker();
|
|
||||||
if (data == null) {
|
|
||||||
docker.state = DockerVolumeState.Error;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Get File Contents
|
|
||||||
const { data: fileContents } = await adminApi.about.getDockerValidateFileContents();
|
|
||||||
if (data.text === fileContents) {
|
|
||||||
docker.state = DockerVolumeState.Success;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
docker.state = DockerVolumeState.Error;
|
|
||||||
}
|
|
||||||
docker.loading = false;
|
|
||||||
}
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: false,
|
loading: false,
|
||||||
address: "",
|
address: "",
|
||||||
@ -444,15 +389,12 @@ export default defineComponent({
|
|||||||
text += `${item.text.toString()}: ${status}\n`;
|
text += `${item.text.toString()}: ${status}\n`;
|
||||||
});
|
});
|
||||||
text += `${i18n.tc("settings.email-configured")}: ${appConfig.value.emailReady ? i18n.tc("general.yes") : i18n.tc("general.no")}\n`;
|
text += `${i18n.tc("settings.email-configured")}: ${appConfig.value.emailReady ? i18n.tc("general.yes") : i18n.tc("general.no")}\n`;
|
||||||
text += `${i18n.tc("settings.docker-volume")}: ${docker.state}`;
|
|
||||||
return text;
|
return text;
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
bugReportDialog,
|
bugReportDialog,
|
||||||
bugReportText,
|
bugReportText,
|
||||||
DockerVolumeState,
|
DockerVolumeState,
|
||||||
docker,
|
|
||||||
dockerValidate,
|
|
||||||
simpleChecks,
|
simpleChecks,
|
||||||
appConfig,
|
appConfig,
|
||||||
validEmail,
|
validEmail,
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
import asyncio
|
from fastapi import APIRouter
|
||||||
import random
|
|
||||||
import shutil
|
|
||||||
import string
|
|
||||||
|
|
||||||
from fastapi import APIRouter, BackgroundTasks
|
|
||||||
from recipe_scrapers import __version__ as recipe_scraper_version
|
from recipe_scrapers import __version__ as recipe_scraper_version
|
||||||
|
|
||||||
from mealie.core.release_checker import get_latest_version
|
from mealie.core.release_checker import get_latest_version
|
||||||
from mealie.core.settings.static import APP_VERSION
|
from mealie.core.settings.static import APP_VERSION
|
||||||
from mealie.routes._base import BaseAdminController, controller
|
from mealie.routes._base import BaseAdminController, controller
|
||||||
from mealie.schema.admin.about import AdminAboutInfo, AppStatistics, CheckAppConfig, DockerVolumeText
|
from mealie.schema.admin.about import AdminAboutInfo, AppStatistics, CheckAppConfig
|
||||||
|
|
||||||
router = APIRouter(prefix="/about")
|
router = APIRouter(prefix="/about")
|
||||||
|
|
||||||
@ -57,25 +52,3 @@ class AdminAboutController(BaseAdminController):
|
|||||||
base_url_set=settings.BASE_URL != "http://localhost:8080",
|
base_url_set=settings.BASE_URL != "http://localhost:8080",
|
||||||
is_up_to_date=APP_VERSION == "develop" or APP_VERSION == "nightly" or get_latest_version() == APP_VERSION,
|
is_up_to_date=APP_VERSION == "develop" or APP_VERSION == "nightly" or get_latest_version() == APP_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
@router.get("/docker/validate", response_model=DockerVolumeText)
|
|
||||||
def validate_docker_volume(self, bg: BackgroundTasks):
|
|
||||||
validation_dir = self.folders.DATA_DIR / "docker-validation"
|
|
||||||
validation_dir.mkdir(exist_ok=True)
|
|
||||||
|
|
||||||
random_string = "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(100))
|
|
||||||
|
|
||||||
with validation_dir.joinpath("validate.txt").open("w") as f:
|
|
||||||
f.write(random_string)
|
|
||||||
|
|
||||||
async def cleanup():
|
|
||||||
await asyncio.sleep(60)
|
|
||||||
|
|
||||||
try:
|
|
||||||
shutil.rmtree(validation_dir)
|
|
||||||
except Exception as e:
|
|
||||||
self.logger.error(f"Failed to remove docker validation directory: {e}")
|
|
||||||
|
|
||||||
bg.add_task(cleanup)
|
|
||||||
|
|
||||||
return DockerVolumeText(text=random_string)
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# This file is auto-generated by gen_schema_exports.py
|
# This file is auto-generated by gen_schema_exports.py
|
||||||
from .about import AdminAboutInfo, AppInfo, AppStartupInfo, AppStatistics, AppTheme, CheckAppConfig, DockerVolumeText
|
from .about import AdminAboutInfo, AppInfo, AppStartupInfo, AppStatistics, AppTheme, CheckAppConfig
|
||||||
from .backup import AllBackups, BackupFile, BackupOptions, CreateBackup, ImportJob
|
from .backup import AllBackups, BackupFile, BackupOptions, CreateBackup, ImportJob
|
||||||
from .email import EmailReady, EmailSuccess, EmailTest
|
from .email import EmailReady, EmailSuccess, EmailTest
|
||||||
from .maintenance import MaintenanceLogs, MaintenanceStorageDetails, MaintenanceSummary
|
from .maintenance import MaintenanceLogs, MaintenanceStorageDetails, MaintenanceSummary
|
||||||
@ -31,7 +31,6 @@ __all__ = [
|
|||||||
"AppStatistics",
|
"AppStatistics",
|
||||||
"AppTheme",
|
"AppTheme",
|
||||||
"CheckAppConfig",
|
"CheckAppConfig",
|
||||||
"DockerVolumeText",
|
|
||||||
"EmailReady",
|
"EmailReady",
|
||||||
"EmailSuccess",
|
"EmailSuccess",
|
||||||
"EmailTest",
|
"EmailTest",
|
||||||
|
@ -59,7 +59,3 @@ class CheckAppConfig(MealieModel):
|
|||||||
ldap_ready: bool
|
ldap_ready: bool
|
||||||
base_url_set: bool
|
base_url_set: bool
|
||||||
is_up_to_date: bool
|
is_up_to_date: bool
|
||||||
|
|
||||||
|
|
||||||
class DockerVolumeText(MealieModel):
|
|
||||||
text: str
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user