diff --git a/plinth/modules/networks/templates/network_topology_main.html b/plinth/modules/networks/templates/network_topology_main.html new file mode 100644 index 000000000..731884da0 --- /dev/null +++ b/plinth/modules/networks/templates/network_topology_main.html @@ -0,0 +1,43 @@ +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load bootstrap %} +{% load i18n %} + +
+ {% blocktrans trimmed %} + The following best describes how your {{ box_name }} is connected in your + network. This information is used only to suggest necessary configuration + actions. + {% endblocktrans %} +
+ ++ {% if network_topology == "to_router" %} + {% blocktrans trimmed %} + Your {{ box_name }} gets its Internet connection from your router via Wi-Fi + or Ethernet cable. This is a typical home setup. + {% endblocktrans %} + {% elif network_topology == "as_router" %} + {% blocktrans trimmed %} + Your {{ box_name }} is directly connected to the Internet and all your + devices connect to {{ box_name }} for their Internet connectivity. + {% endblocktrans %} + {% else %} + {% blocktrans trimmed %} + Your Internet connection is directly attached to your {{ box_name }} and there + are no other devices on the network. + {% endblocktrans %} + {% endif %} + + {% trans 'Update...' %} + +
diff --git a/plinth/modules/networks/templates/networks_configuration.html b/plinth/modules/networks/templates/networks_configuration.html index 01d7c7b30..5da805ef8 100644 --- a/plinth/modules/networks/templates/networks_configuration.html +++ b/plinth/modules/networks/templates/networks_configuration.html @@ -42,7 +42,7 @@ {% block configuration %} {% include "connections_list.html" %} - {% include "router_configuration_main.html" %} + {% include "network_topology_main.html" %} {% include "internet_connectivity_main.html" %} {% endblock %} diff --git a/plinth/modules/networks/templates/router_configuration_main.html b/plinth/modules/networks/templates/router_configuration_main.html deleted file mode 100644 index b8c4369ed..000000000 --- a/plinth/modules/networks/templates/router_configuration_main.html +++ /dev/null @@ -1,31 +0,0 @@ -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load bootstrap %} -{% load i18n %} - -- {% blocktrans trimmed %} - The following best describes how your {{ box_name }} is connected in your - network. This information is used only to suggest necessary configuration - actions. - {% endblocktrans %} -
- -- {% blocktrans trimmed %} - Your {{ box_name }} gets its Internet from your Router via Wi-Fi or - Ethernet cable. This is a typical home setup. - {% endblocktrans %} - - {% trans 'Update...' %} - -
diff --git a/plinth/modules/networks/views.py b/plinth/modules/networks/views.py index f1c4ce0f1..3d55fbd35 100644 --- a/plinth/modules/networks/views.py +++ b/plinth/modules/networks/views.py @@ -24,6 +24,8 @@ def index(request): """Show connection list.""" connections = network.get_connection_list() + network_topology = kvstore.get_default(networks.NETWORK_TOPOLOGY_TYPE_KEY, + 'to_router') internet_connection_type = kvstore.get_default( networks.INTERNET_CONNECTION_TYPE_KEY, 'unknown') return TemplateResponse( @@ -34,7 +36,8 @@ def index(request): 'has_diagnostics': True, 'is_enabled': True, 'connections': connections, - 'internet_connectivity_type': internet_connection_type + 'network_topology': network_topology, + 'internet_connectivity_type': internet_connection_type, }) @@ -426,6 +429,9 @@ class NetworkTopologyView(FormView): logger.info('Updating network topology type with value %s' % network_topology) kvstore.set(networks.NETWORK_TOPOLOGY_TYPE_KEY, network_topology) + if network_topology == 'to_router': + self.success_url = reverse_lazy('networks:router-configuration') + return super().form_valid(form)