36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
from django.shortcuts import render
|
|
from django.views import View
|
|
from rest_framework.parsers import FormParser
|
|
from rest_framework.views import APIView
|
|
from core.db.storage import db
|
|
from mixins.views import ObjectRead
|
|
|
|
from core.views.manage.permissions import SuperUserRequiredMixin
|
|
|
|
class MonolithStats(SuperUserRequiredMixin, View):
|
|
template_name = "manage/monolith/stats/index.html"
|
|
|
|
def get(self, request):
|
|
return render(request, self.template_name)
|
|
|
|
class MonolithDBStats(SuperUserRequiredMixin, ObjectRead):
|
|
detail_template = "manage/monolith/stats/overview.html"
|
|
|
|
context_object_name_singular = "Status"
|
|
context_object_name = "Status"
|
|
|
|
detail_url_name = "monolith_stats_db"
|
|
detail_url_args = ["type"]
|
|
|
|
def get_object(self, **kwargs):
|
|
search_query = "SHOW TABLE main STATUS"
|
|
|
|
stats = db.run_query(
|
|
self.request.user,
|
|
search_query=search_query,
|
|
path="sql?mode=raw",
|
|
raw=True,
|
|
#method="get",
|
|
)
|
|
|
|
return stats |