add dashboard
This commit is contained in:
parent
bb236ff1be
commit
9e20bb65bd
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,6 +20,6 @@ var/run/*
|
||||
venv/
|
||||
node_modules
|
||||
tmp.py
|
||||
!/plugins/user/Dashboard/*
|
||||
!/plugins/user/Dashboard
|
||||
data/www/plugins/*
|
||||
!data/www/plugins/.gitkeep
|
||||
29
plugins/user/Dashboard/Dashboard.py
Normal file
29
plugins/user/Dashboard/Dashboard.py
Normal file
@ -0,0 +1,29 @@
|
||||
from src.interface.ObPlugin import ObPlugin
|
||||
|
||||
from typing import List, Dict
|
||||
from src.model.entity.Variable import Variable
|
||||
from src.model.enum.HookType import HookType
|
||||
from src.model.hook.HookRegistration import HookRegistration
|
||||
|
||||
|
||||
class Dashboard(ObPlugin):
|
||||
|
||||
def use_id(self):
|
||||
return 'dashboard'
|
||||
|
||||
def use_title(self):
|
||||
return self.translate('plugin_title')
|
||||
|
||||
def use_description(self):
|
||||
return self.translate('plugin_description')
|
||||
|
||||
def use_variables(self) -> List[Variable]:
|
||||
return []
|
||||
|
||||
def use_hooks_registrations(self) -> List[HookRegistration]:
|
||||
return [
|
||||
super().add_functional_hook_registration(hook=HookType.H_ROOT_NAV_ELEMENT_START, priority=10, function=self.hook_navigation),
|
||||
]
|
||||
|
||||
def hook_navigation(self) -> str:
|
||||
return self.render_view('@hook_navigation.jinja.html')
|
||||
15
plugins/user/Dashboard/controller/DashboardController.py
Normal file
15
plugins/user/Dashboard/controller/DashboardController.py
Normal file
@ -0,0 +1,15 @@
|
||||
from flask import Flask, render_template
|
||||
|
||||
from src.interface.ObController import ObController
|
||||
|
||||
|
||||
class DashboardController(ObController):
|
||||
|
||||
def register(self):
|
||||
self._app.add_url_rule('/dashboard', 'dashboard', self._auth(self.dashboard), methods=['GET'])
|
||||
|
||||
def dashboard(self):
|
||||
return self.render_view(
|
||||
'@dashboard.jinja.html',
|
||||
count_players=len(self._model_store.node_player().get_node_players())
|
||||
)
|
||||
5
plugins/user/Dashboard/lang/en.json
Normal file
5
plugins/user/Dashboard/lang/en.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugin_title": "Dashboard",
|
||||
"plugin_description": "Adds a dashboard reachable from navigation (has no use - developer demo plugin only)",
|
||||
"menu_title": "Dashboard"
|
||||
}
|
||||
5
plugins/user/Dashboard/lang/es.json
Normal file
5
plugins/user/Dashboard/lang/es.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugin_title": "Panel de control",
|
||||
"plugin_description": "Agrega un panel de control accesible desde la navegación (no utilizado, solo complemento de demostración para desarrolladores)",
|
||||
"menu_title": "Panel de control"
|
||||
}
|
||||
5
plugins/user/Dashboard/lang/fr.json
Normal file
5
plugins/user/Dashboard/lang/fr.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugin_title": "Tableau de bord",
|
||||
"plugin_description": "Ajoute un tableau de bord accessible depuis la navigation (n'a aucune utilisé - plugin de démo développeur seulement)",
|
||||
"menu_title": "Tableau de bord"
|
||||
}
|
||||
5
plugins/user/Dashboard/lang/it.json
Normal file
5
plugins/user/Dashboard/lang/it.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugin_title": "Dashboard",
|
||||
"plugin_description": "Aggiunge una dashboard raggiungibile dalla navigazione (non utilizzato - solo plug-in demo per sviluppatori)",
|
||||
"menu_title": "Dashboard"
|
||||
}
|
||||
3
plugins/user/Dashboard/static/css/dashboard.css
Normal file
3
plugins/user/Dashboard/static/css/dashboard.css
Normal file
@ -0,0 +1,3 @@
|
||||
.inner h3 {
|
||||
color: red !important;
|
||||
}
|
||||
52
plugins/user/Dashboard/views/dashboard.jinja.html
Normal file
52
plugins/user/Dashboard/views/dashboard.jinja.html
Normal file
@ -0,0 +1,52 @@
|
||||
{% extends '::base.jinja.html' %}
|
||||
|
||||
{% block page_title %}
|
||||
{{ l.dashboard_menu_title }}
|
||||
{% endblock %}
|
||||
|
||||
{% block add_css %}
|
||||
<link rel="stylesheet" href="{{ STATIC_PLUGIN_PREFIX }}css/dashboard.css"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block add_js %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block body_class %}view-dashboard{% endblock %}
|
||||
|
||||
{% block pill_menu %}
|
||||
{% with pills=[
|
||||
{"name": l.dashboard_menu_title, "route": "dashboard", "icon": "fa-dashboard"},
|
||||
] %}
|
||||
{% include '::core/pill-menu.jinja.html' %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
{% block page %}
|
||||
|
||||
<div class="top-content">
|
||||
<div class="top-actions">
|
||||
|
||||
<button type="button" class="btn btn-neutral">
|
||||
<i class="fa fa-hand"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bottom-content">
|
||||
|
||||
<div class="page-content">
|
||||
<div class="inner">
|
||||
<div class="vertical">
|
||||
<h3>
|
||||
{{ l.dashboard_menu_title }}
|
||||
</h3>
|
||||
|
||||
<p>Hello world ! You have {{ count_players }} player(s)</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
5
plugins/user/Dashboard/views/hook_navigation.jinja.html
Normal file
5
plugins/user/Dashboard/views/hook_navigation.jinja.html
Normal file
@ -0,0 +1,5 @@
|
||||
<li class="{{ 'active' if request.url_rule.endpoint == 'dashboard' }}">
|
||||
<a href="{{ url_for('dashboard') }}">
|
||||
<i class="fa fa-dashboard"></i> {{ l.dashboard_menu_title }}
|
||||
</a>
|
||||
</li>
|
||||
Loading…
Reference in New Issue
Block a user