networks: Remove first boot steps for connectivity/topology

- We have not yet implemented the main reason they exist. To guide users to
establish reachability with Tor hidden services, Pagekite, Dynamic DNS, etc.

- We now have a 'Next steps' page that talks about configuring network
connections. The networks page linked from here has these steps prominently
listed.

- In the future we will implement a wizard for reachability and these steps will
still be used. However, they don't have to part of first setup. They can add
them as notification and as part of next steps page.

- It is good to have a simplified first setup wizard. It is seldom tested
properly.

Tests:

- Run the first setup wizard by removing /var/lib/plinth/plinth.sqlite3 and
running the service. Notice that the software update step is not shown and
wizard completes successfully.

[vexch: Minor quote fix in functional tests]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2024-10-07 06:58:49 -07:00 committed by Veiko Aasa
parent a998995f36
commit ed3363105a
No known key found for this signature in database
GPG Key ID: 478539CAE680674E
7 changed files with 2 additions and 168 deletions

View File

@ -15,24 +15,6 @@ from plinth.package import Packages
from . import privileged
first_boot_steps = [
{
'id': 'network_topology_wizard',
'url': 'networks:network-topology-first-boot',
'order': 2,
},
{
'id': 'router_setup_wizard',
'url': 'networks:router-configuration-first-boot',
'order': 3,
},
{
'id': 'internet_connectivity_type_wizard',
'url': 'networks:internet-connection-type-first-boot',
'order': 4,
},
]
_description = [
_('Configure network devices. Connect to the Internet via Ethernet, Wi-Fi '
'or PPPoE. Share that connection with other devices on the network.'),

View File

@ -1,23 +0,0 @@
{% extends "base_firstboot.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block content %}
{% include "internet_connectivity_content.html" %}
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-link" name="skip"
value="{% trans "Skip this step" %}"/>
<input type="submit" class="btn btn-primary pull-right" name="next"
value="{% trans "Next" %}"/>
</form>
{% endblock %}

View File

@ -1,24 +0,0 @@
{% extends "base_firstboot.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block content %}
{% include "network_topology_content.html" %}
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-link" name="skip"
value="{% trans "Skip this step" %}"/>
<input type="submit" class="btn btn-primary pull-right" name="next"
value="{% trans "Next" %}"/>
</form>
{% endblock %}

View File

@ -1,24 +0,0 @@
{% extends "base_firstboot.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block content %}
{% include "router_configuration_content.html" %}
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-link" name="skip"
value="{% trans "Skip this step" %}"/>
<input type="submit" class="btn btn-primary pull-right" name="next"
value="{% trans "Next" %}"/>
</form>
{% endblock %}

View File

@ -32,18 +32,9 @@ urlpatterns = [
re_path(r'^sys/networks/router-configuration/$',
views.RouterConfigurationView.as_view(),
name='router-configuration'),
re_path(r'^sys/networks/firstboot/router-configuration/$',
views.RouterConfigurationFirstBootView.as_view(),
name='router-configuration-first-boot'),
re_path(r'^sys/networks/internet-connection-type/$',
views.InternetConnectionTypeView.as_view(),
name='internet-connection-type'),
re_path(r'^sys/networks/firstboot/internet-connection-type/$',
views.InternetConnectionTypeFirstBootView.as_view(),
name='internet-connection-type-first-boot'),
re_path(r'^sys/networks/network-topology/$',
views.NetworkTopologyView.as_view(), name='network-topology'),
re_path(r'^sys/networks/firstboot/network-topology-first-boot/$',
views.NetworkTopologyFirstBootView.as_view(),
name='network-topology-first-boot'),
]

View File

@ -3,7 +3,6 @@
import logging
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.urls import reverse_lazy
@ -13,7 +12,7 @@ from django.views.decorators.http import require_POST
from django.views.generic.edit import FormView
from plinth import network
from plinth.modules import first_boot, names, networks
from plinth.modules import names, networks
from plinth.views import AppView
from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
@ -561,24 +560,6 @@ class NetworkTopologyView(FormView):
return super().form_valid(form)
class NetworkTopologyFirstBootView(NetworkTopologyView):
"""View for network topology form during first wizard."""
template_name = 'network_topology_firstboot.html'
def get_success_url(self):
"""Return next fistboot step."""
return reverse_lazy(first_boot.next_step())
def form_valid(self, form):
"""Mark the first wizard step as done, save value and redirect."""
first_boot.mark_step_done('network_topology_wizard')
if 'skip' in form.data:
first_boot.mark_step_done('router_setup_wizard')
return FormView.form_valid(self, form)
return super().form_valid(form)
class RouterConfigurationView(FormView):
"""View for router configuration form."""
template_name = 'router_configuration_update.html'
@ -597,32 +578,6 @@ class RouterConfigurationView(FormView):
return super().form_valid(form)
class RouterConfigurationFirstBootView(RouterConfigurationView):
"""View for router configuration form during first wizard."""
template_name = 'router_configuration_firstboot.html'
def dispatch(self, request, *args, **kwargs):
"""Don't show wizard step if FreedomBox is not behind a router."""
network_topology = networks.get_network_topology_type()
if network_topology != 'to_router':
first_boot.mark_step_done('router_setup_wizard')
return HttpResponseRedirect(reverse_lazy(first_boot.next_step()))
return super().dispatch(request, *args, *kwargs)
def get_success_url(self):
"""Return the next wizard step after this one."""
return reverse_lazy(first_boot.next_step())
def form_valid(self, form):
"""Mark the first wizard step as done, save value and redirect."""
first_boot.mark_step_done('router_setup_wizard')
if 'skip' in form.data:
return FormView.form_valid(self, form)
return super().form_valid(form)
class InternetConnectionTypeView(FormView):
"""View for Internet connection type form."""
template_name = 'internet_connectivity_type.html'
@ -642,20 +597,3 @@ class InternetConnectionTypeView(FormView):
logger.info('Updating internet connectivity type: %s', type_)
networks.set_internet_connection_type(type_)
return super().form_valid(form)
class InternetConnectionTypeFirstBootView(InternetConnectionTypeView):
"""View to show Internet connection type form during first wizard."""
template_name = 'internet_connectivity_firstboot.html'
def get_success_url(self):
"""Return the next wizard step after this one."""
return reverse_lazy(first_boot.next_step())
def form_valid(self, form):
"""Mark the first wizard step as done, save value and redirect."""
first_boot.mark_step_done('internet_connectivity_type_wizard')
if 'skip' in form.data:
return FormView.form_valid(self, form)
return super().form_valid(form)

View File

@ -345,12 +345,6 @@ def login_with_account(browser, url, username, password=None):
browser.visit(base_url + '/plinth/firstboot/welcome')
submit(browser, form_class='form-start') # "Start Setup" button
_create_admin_account(browser, username, password)
if '/network-topology-first-boot' in browser.url:
submit(browser, element=browser.find_by_name('skip')[0])
if '/internet-connection-type' in browser.url:
submit(browser, element=browser.find_by_name('skip')[0])
if '/firstboot/backports' in browser.url:
submit(browser, element=browser.find_by_name('next')[0])
@ -614,7 +608,7 @@ def networks_set_firewall_zone(browser, zone):
'and contains(@class, "connection-status-label")]/following::a').first
network_id = device['href'].split('/')[-3]
device.click()
edit_url = "/plinth/sys/networks/{}/edit/".format(network_id)
edit_url = '/plinth/sys/networks/{}/edit/'.format(network_id)
browser.links.find_by_href(edit_url).first.click()
browser.select('zone', zone)
submit(browser, form_class='form-connection-edit')