Verified Commit 0045cff0 authored by Štěpán Henek's avatar Štěpán Henek 🌩

reflect menu api updates + rename 'netmetr_plugin' to 'netmetr'

parent 5d03ad2b
......@@ -68,8 +68,9 @@ class NetmetrPluginConfigHandler(BaseConfigHandler):
class NetmetrPluginPage(ConfigPageMixin, NetmetrPluginConfigHandler):
slug = "netmetr"
menu_order = 80
template = "netmetr/netmetr_plugin"
template = "netmetr/netmetr"
template_type = "jinja2"
userfriendly_title = gettext("Netmetr")
......@@ -118,16 +119,16 @@ class NetmetrPluginPage(ConfigPageMixin, NetmetrPluginConfigHandler):
def _action_download_data(self):
current_state.backend.perform("netmetr", "download_data")
bottle.redirect(reverse("config_page", page_name="netmetr_plugin"))
bottle.redirect(reverse("config_page", page_name="netmetr"))
def _action_measure_and_download_data(self):
current_state.backend.perform("netmetr", "measure_and_download_data")
bottle.redirect(reverse("config_page", page_name="netmetr_plugin"))
bottle.redirect(reverse("config_page", page_name="netmetr"))
def call_action(self, action):
if bottle.request.method != 'POST':
messages.error("Wrong HTTP method.")
bottle.redirect(reverse("config_page", page_name="netmetr_plugin"))
bottle.redirect(reverse("config_page", page_name="netmetr"))
if action == "redownload":
self._action_download_data()
......@@ -142,14 +143,14 @@ class NetmetrPlugin(ForisPlugin):
DIRNAME = os.path.dirname(os.path.abspath(__file__))
PLUGIN_STYLES = [
"css/netmetr_plugin.css"
"css/netmetr.css"
]
PLUGIN_STATIC_SCRIPTS = [
]
PLUGIN_DYNAMIC_SCRIPTS = [
"netmetr_plugin.js"
"netmetr.js"
]
def __init__(self, app):
super(NetmetrPlugin, self).__init__(app)
add_config_page("netmetr_plugin", NetmetrPluginPage, top_level=True)
add_config_page(NetmetrPluginPage)
......@@ -2,7 +2,7 @@ Foris.watched_process = null;
Foris.update_data = function(newItem) {
const NEW_ITEM_CLASSNAME = "new-item";
document.getElementById('netmetr-results').classList.remove(NEW_ITEM_CLASSNAME);
$.get('{{ url("config_ajax", page_name="netmetr_plugin") }}', {action: "get_data"})
$.get('{{ url("config_ajax", page_name="netmetr") }}', {action: "get_data"})
.done(function(response, status, xhr) {
if (xhr.status == 200) {
$("#netmetr-results").replaceWith(response); // replace the table
......@@ -53,7 +53,7 @@ Foris.WS["netmetr"] = function(msg) {
$(document).ready(function() {
$("#redownload-trigger").click(function(e) {
e.preventDefault();
$.get('{{ url("config_ajax", page_name="netmetr_plugin") }}', {action: "redownload"})
$.get('{{ url("config_ajax", page_name="netmetr") }}', {action: "redownload"})
.done(function(response) {
Foris.watched_process = response["async_id"];
$("#start-trigger").hide()
......@@ -63,7 +63,7 @@ $(document).ready(function() {
});
$("#start-trigger").click(function(e) {
e.preventDefault();
$.get('{{ url("config_ajax", page_name="netmetr_plugin") }}', {action: "start"})
$.get('{{ url("config_ajax", page_name="netmetr") }}', {action: "start"})
.done(function(response) {
Foris.watched_process = response["async_id"];
$("#start-trigger").hide()
......
......@@ -37,7 +37,7 @@
<h3>{% trans %}Controls{% endtrans %}</h3>
<p id="netmetr-control-status"></p>
<progress id="netmetr-control-progress" max="100" value="0" hidden></progress>
<form action="{{ url("config_action", page_name="netmetr_plugin", action="perform") }}" class="config-form" id="netmetr-controls" method="post">
<form action="{{ url("config_action", page_name="netmetr", action="perform") }}" class="config-form" id="netmetr-controls" method="post">
<input type="hidden" name="csrf_token" value="{{ get_csrf_token() }}">
<button type="submit" name="action" id="redownload-trigger" value="redownload" class="button">{% trans %}Redownload data{% endtrans %}</button>
<button type="submit" name="action" id="start-trigger" value="start" class="button">{% trans %}Start test{% endtrans %}</button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment