feat: admin maintenance and analytics stubs (#1107)

* add tail log viewer routes

* add log viewer

* add _mealie to ignore directories

* add detailed breakdown of storage

* generate types

* add dialog to view breakdown

* cleanup mobile UI

* move migrations page

* spelling

* init analytics page

* move route up

* add remove temp files function

* analytics API client

* stub out analytics pages

* generate types

* stub out analytics routes

* update names

* ignore types

* temporary remove analytics from sidebar
This commit is contained in:
Hayden
2022-03-29 08:25:28 -08:00
committed by GitHub
parent 6f309d7a89
commit 1a23f867da
23 changed files with 536 additions and 59 deletions

View File

@@ -0,0 +1,33 @@
import uuid
from mealie.core.settings.static import APP_VERSION
from mealie.repos.repository_factory import AllRepositories
from mealie.schema.analytics.analytics import MealieAnalytics
from mealie.services._base_service import BaseService
class AnalyticsService(BaseService):
def __init__(self, repos: AllRepositories):
self.repos = repos
super().__init__()
def _databate_type(self) -> str:
return "sqlite" if "sqlite" in self.settings.DB_URL else "postgres" # type: ignore
def calculate_analytics(self) -> MealieAnalytics:
return MealieAnalytics(
# Site Wide Analytics
installation_id=uuid.uuid4(),
version=APP_VERSION,
database_type=self._databate_type(),
# Optional Configs
using_ldap=self.settings.LDAP_ENABLED,
using_email=self.settings.SMTP_ENABLE,
# Stats
api_tokens=0,
users=0,
groups=0,
recipes=0,
shopping_lists=0,
cookbooks=0,
)