diff --git a/frontend/src/pages/Admin/About/index.vue b/frontend/src/pages/Admin/About/index.vue index 222533a71..b410b3bfe 100644 --- a/frontend/src/pages/Admin/About/index.vue +++ b/frontend/src/pages/Admin/About/index.vue @@ -22,19 +22,26 @@ - - + + + + mdi-code-braces {{ $t("about.download-recipe-json") }} + + + + + + diff --git a/frontend/src/pages/Admin/Dashboard/index.vue b/frontend/src/pages/Admin/Dashboard/index.vue new file mode 100644 index 000000000..9b6e5cb9c --- /dev/null +++ b/frontend/src/pages/Admin/Dashboard/index.vue @@ -0,0 +1,108 @@ + + + + + + + + + + + {{ statistics.totalRecipes }} + + + + + + + mdi-tag Untagged {{ statistics.untaggedRecipes }} + + + mdi-tag Uncategorized {{ statistics.uncategorizedRecipes }} + + + + + + + + + + + + + {{ statistics.totalUsers }} + + + + + + + mdi-account + Manage Users + + + + + + + + + + + + + {{ statistics.totalGroups }} + + + + + + + mdi-account-group + Manage Groups + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/pages/Admin/ManageUsers/index.vue b/frontend/src/pages/Admin/ManageUsers/index.vue index fbbb1aef5..74aa8bd27 100644 --- a/frontend/src/pages/Admin/ManageUsers/index.vue +++ b/frontend/src/pages/Admin/ManageUsers/index.vue @@ -4,30 +4,30 @@ - + {{ $t("user.users") }} mdi-account - + {{ $t("signup.sign-up-links") }} mdi-account-plus-outline - + {{ $t("group.groups") }} mdi-account-group - + - + - + @@ -42,9 +42,17 @@ import TheSignUpTable from "./TheSignUpTable"; export default { components: { TheUserTable, GroupDashboard, TheSignUpTable }, data() { - return { - tab: 0, - }; + return {}; + }, + computed: { + tab: { + set(tab) { + this.$router.replace({ query: { ...this.$route.query, tab } }); + }, + get() { + return this.$route.query.tab; + }, + }, }, mounted() { this.$store.dispatch("requestAllGroups"); diff --git a/frontend/src/routes/admin.js b/frontend/src/routes/admin.js index 0c2a60428..1e705fd78 100644 --- a/frontend/src/routes/admin.js +++ b/frontend/src/routes/admin.js @@ -8,6 +8,7 @@ import ManageUsers from "@/pages/Admin/ManageUsers"; import Settings from "@/pages/Admin/Settings"; import About from "@/pages/Admin/About"; import ToolBox from "@/pages/Admin/ToolBox"; +import Dashboard from "@/pages/Admin/Dashboard"; import { store } from "../store"; export const adminRoutes = { @@ -87,5 +88,12 @@ export const adminRoutes = { title: "general.about", }, }, + { + path: "dashboard", + component: Dashboard, + meta: { + title: "general.dashboard", + }, + }, ], }; diff --git a/mealie/db/database.py b/mealie/db/database.py index 31aad381a..dd8605889 100644 --- a/mealie/db/database.py +++ b/mealie/db/database.py @@ -18,7 +18,6 @@ from mealie.schema.theme import SiteTheme from mealie.schema.user import GroupInDB, UserInDB from sqlalchemy.orm.session import Session - logger = getLogger() @@ -35,6 +34,12 @@ class _Recipes(BaseDocument): return f"{slug}.{extension}" + def count_uncategorized(self, session: Session) -> int: + return session.query(self.sql_model).filter(RecipeModel.recipe_category == None).count() + + def count_untagged(self, session: Session) -> int: + return session.query(self.sql_model).filter(RecipeModel.tags == None).count() + class _Categories(BaseDocument): def __init__(self) -> None: diff --git a/mealie/db/db_base.py b/mealie/db/db_base.py index b2c239ef8..3245030bd 100644 --- a/mealie/db/db_base.py +++ b/mealie/db/db_base.py @@ -154,3 +154,10 @@ class BaseDocument: session.commit() return results_as_model + + def count_all(self, session: Session, match_key=None, match_value=None) -> int: + + if None in [match_key, match_value]: + return session.query(self.sql_model).count() + else: + return session.query(self.sql_model).filter_by(**{match_key: match_value}).count()