networks: Add first boot step for internet connection type

Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Nektarios Katakis 2020-02-15 23:32:51 +00:00 committed by Sunil Mohan Adapa
parent eb016bc686
commit a95e59460e
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
3 changed files with 32 additions and 8 deletions

View File

@ -18,11 +18,18 @@ is_essential = True
managed_packages = ['network-manager', 'batctl']
first_boot_steps = [{
'id': 'router_setup_wizard',
'url': 'networks:firstboot_router_setup',
'order': 4,
}]
first_boot_steps = [
{
'id': 'internet_connectivity_type',
'url': 'networks:firstboot_internet_connection_type',
'order': 3,
},
{
'id': 'router_setup_wizard',
'url': 'networks:firstboot_router_setup',
'order': 4,
},
]
_description = [
_('Configure network devices. Connect to the Internet via Ethernet, Wi-Fi '

View File

@ -457,12 +457,26 @@ def internet_connection_type_help_page(request):
Show the internet connection type page.
Used for first boot step and networks page.
"""
# stub for now
is_firstboot = True \
if 'firstboot' in request.build_absolute_uri() else False
if request.method == 'POST':
resp = reverse_lazy('networks:index')
if is_firstboot:
resp = reverse_lazy(first_boot.next_step())
else:
resp = reverse_lazy('networks:index')
messages.success(request, _('Internet connection type saved.'))
else:
html = "internet_connectivity_type.html"
template_kwargs = {'form': InternetConnectionTypeForm}
if is_firstboot:
html = "internet_connectivity_type_firstboot.html"
# mark step done on firstboot visit to get the next_step
first_boot.mark_step_done('router_setup_wizard')
template_kwargs.update({
'first_boot_next_step': reverse_lazy(first_boot.next_step()),
})
resp = TemplateResponse(request, html, template_kwargs)

View File

@ -30,10 +30,13 @@ urlpatterns = [
url(r'^sys/networks/router-setup-guide/$',
views.router_configuration_help_page,
name='router_setup'),
url(r'^sys/networks/firstboot/$',
url(r'^sys/networks/firstboot/router_setup/$',
public(views.router_configuration_help_page),
name='firstboot_router_setup'),
url(r'^sys/networks/internet-connection-type/$',
views.internet_connection_type_help_page,
name='internet_connection_type_setup'),
url(r'^sys/networks/firstboot/internet_connection_type/$',
public(views.internet_connection_type_help_page),
name='firstboot_internet_connection_type'),
]