Simple skelton for database stats view

This commit is contained in:
Oliver Walters 2020-02-02 22:03:31 +11:00
parent 91ca37c84b
commit aa210efad6
4 changed files with 22 additions and 1 deletions

View File

@ -41,6 +41,12 @@ function inventreeDocReady() {
modal.modal('show');
});
// Callback to launch the 'Database Stats' window
$('#launch-stats').click(function() {
launchModalForm("/stats/", {
});
});
}
function isFileTransfer(transfer) {

View File

@ -33,7 +33,8 @@ from django.conf.urls.static import static
from django.views.generic.base import RedirectView
from rest_framework.documentation import include_docs_urls
from .views import IndexView, SearchView, SettingsView, EditUserView, SetPasswordView
from .views import IndexView, SearchView, DatabaseStatsView
from .views import SettingsView, EditUserView, SetPasswordView
from .views import InfoView
from users.urls import user_urls
@ -97,6 +98,7 @@ urlpatterns = [
url(r'^index/', IndexView.as_view(), name='index'),
url(r'^search/', SearchView.as_view(), name='search'),
url(r'^stats/', DatabaseStatsView.as_view(), name='stats'),
url(r'^api/', include(apipatterns)),
url(r'^api-doc/', include_docs_urls(title='InvenTree API')),

View File

@ -8,6 +8,7 @@ as JSON objects and passing them to modal forms (using jQuery / bootstrap).
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import gettext_lazy as _
from django.template.loader import render_to_string
from django.http import JsonResponse, HttpResponseRedirect
@ -537,3 +538,10 @@ class SettingsView(TemplateView):
ctx['settings'] = InvenTreeSetting.objects.all().order_by('key')
return ctx
class DatabaseStatsView(AjaxView):
""" View for displaying database statistics """
ajax_template_name = "stats.html"
ajax_form_title = _("Database Statistics")

View File

@ -0,0 +1,5 @@
{% load static %}
{% load inventree_extras %}
{% load i18n %}
HELLO WORLD