summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pages/admin/index.vue39
-rw-r--r--pages/admin/models.vue39
-rw-r--r--pages/admin/reports.vue38
3 files changed, 116 insertions, 0 deletions
diff --git a/pages/admin/index.vue b/pages/admin/index.vue
new file mode 100644
index 0000000..679f82f
--- /dev/null
+++ b/pages/admin/index.vue
@@ -0,0 +1,39 @@
+<template lang="pug">
+ .mx-auto.w-90p.py-6(class="sm:px-6 lg:px-8 md:max-w-7xl")
+ h1.text-3xl.font-bold(class="dark:text-white") Users
+ .grid.grid-cols-6.mt-3
+ div
+ admin-sidebar
+ section#tables.col-span-5
+ v-table(
+ :keys="['id', 'avatar', 'username', 'email', 'is_staff', 'name']"
+ :fields="users"
+ path="/users/"
+ )
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+
+import AdminSidebar from "@/components/AdminSidebar.vue";
+import VTable from "@/components/VTable.vue";
+
+export default {
+ name: "AdminView",
+ head: { title: "Admin panel · Verden" },
+ computed: {
+ ...mapGetters("auth", ["isLogged", "me"]),
+ ...mapGetters("users", ["users"]),
+ },
+ components: { AdminSidebar, "v-table": VTable },
+ async mounted() {
+ await this.$store.dispatch("auth/findMe");
+
+ if (!(this.isLogged && this.me && this.me.is_staff)) {
+ window.location.href = "/";
+ }
+
+ this.$store.dispatch("users/getUsers", { page: 0 });
+ },
+};
+</script>
diff --git a/pages/admin/models.vue b/pages/admin/models.vue
new file mode 100644
index 0000000..86b463b
--- /dev/null
+++ b/pages/admin/models.vue
@@ -0,0 +1,39 @@
+<template lang="pug">
+ .mx-auto.w-90p.py-6(class="sm:px-6 lg:px-8 md:max-w-7xl")
+ h1.text-3xl.font-bold(class="dark:text-white") Models
+ .grid.grid-cols-6.mt-3
+ div
+ admin-sidebar
+ section#tables.col-span-5
+ v-table(
+ :keys="['id', 'name', 'created', 'author', 'likes']"
+ :fields="models"
+ path="/models/"
+ )
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+
+import AdminSidebar from "@/components/AdminSidebar.vue";
+import VTable from "@/components/VTable.vue";
+
+export default {
+ name: "AdminView",
+ head: { title: "Models · Verden" },
+ computed: {
+ ...mapGetters("auth", ["isLogged", "me"]),
+ ...mapGetters("models", ["models"]),
+ },
+ components: { AdminSidebar, "v-table": VTable },
+ async mounted() {
+ await this.$store.dispatch("auth/findMe");
+
+ if (!(this.isLogged && this.me && this.me.is_staff)) {
+ window.location.href = "/";
+ }
+
+ this.$store.dispatch("models/getModels", 0);
+ },
+};
+</script>
diff --git a/pages/admin/reports.vue b/pages/admin/reports.vue
new file mode 100644
index 0000000..7d49a40
--- /dev/null
+++ b/pages/admin/reports.vue
@@ -0,0 +1,38 @@
+<template lang="pug">
+ .mx-auto.w-90p.py-6(class="sm:px-6 lg:px-8 md:max-w-7xl")
+ h1.text-3xl.font-bold(class="dark:text-white") Models
+ .grid.grid-cols-6.mt-3
+ div
+ admin-sidebar
+ section#tables.col-span-5
+ v-table(
+ :keys="['id', 'model_id', 'created', 'updated', 'user', 'resolved', 'note', 'admin_note']"
+ :fields="warnings"
+ )
+</template>
+
+<script>
+import { mapGetters } from "vuex";
+
+import AdminSidebar from "@/components/AdminSidebar.vue";
+import VTable from "@/components/VTable.vue";
+
+export default {
+ name: "AdminView",
+ head: { title: "Models · Verden" },
+ computed: {
+ ...mapGetters("auth", ["isLogged", "me"]),
+ ...mapGetters("warnings", ["warnings"]),
+ },
+ components: { AdminSidebar, "v-table": VTable },
+ async mounted() {
+ await this.$store.dispatch("auth/findMe");
+
+ if (!(this.isLogged && this.me && this.me.is_staff)) {
+ window.location.href = "/";
+ }
+
+ this.$store.dispatch("warnings/getWarnings", 0);
+ },
+};
+</script>