From 34525c0a56bdf533dc579843d22b8e95e203c583 Mon Sep 17 00:00:00 2001 From: Kate Pimenova Date: Fri, 23 Sep 2016 14:30:28 +0200 Subject: [PATCH] In Murano App configuration wizard move Back/Next w/o losing any data - solution uses HTML5 sessionStorage to store form data: When 'Back' is clicked on N step of wizard, its data is stored in the sessionStorage. When we return to N step from N-1 step, all its visible fields will be overwritten with the value from the sessionStorage Closes-Bug:#1629904 Change-Id: Ie419be395d3ebddb5a82ce5248ef758117fb49a5 --- muranodashboard/catalog/views.py | 6 ++ .../templates/services/_wizard_create.html | 80 ++++++++++++++++--- 2 files changed, 77 insertions(+), 9 deletions(-) diff --git a/muranodashboard/catalog/views.py b/muranodashboard/catalog/views.py index 4684e3bc1..542491cdc 100644 --- a/muranodashboard/catalog/views.py +++ b/muranodashboard/catalog/views.py @@ -17,6 +17,7 @@ import copy import functools import json import re +import uuid from django.conf import settings from django.contrib import auth @@ -432,6 +433,10 @@ class Wizard(generic_views.PageTitleMixin, views.ModalFormMixin, LazyWizard): app = mc.packages.get(app_id) self.storage.extra_data['app'] = app + wizard_id = self.request.REQUEST.get('wizard_id') + if wizard_id is None: + wizard_id = uuid.uuid4() + environment_id = self.kwargs.get('environment_id') environment_id = utils.ensure_python_obj(environment_id) if environment_id is not None: @@ -450,6 +455,7 @@ class Wizard(generic_views.PageTitleMixin, views.ModalFormMixin, LazyWizard): 'do_redirect': self.get_wizard_flag('do_redirect'), 'drop_wm_form': self.get_wizard_flag('drop_wm_form'), 'prefix': self.prefix, + 'wizard_id': wizard_id, 'field_descriptions': field_descr, 'extended_descriptions': extended_descr, }) diff --git a/muranodashboard/templates/services/_wizard_create.html b/muranodashboard/templates/services/_wizard_create.html index 9a974fcc4..0973e05f5 100644 --- a/muranodashboard/templates/services/_wizard_create.html +++ b/muranodashboard/templates/services/_wizard_create.html @@ -66,13 +66,46 @@ {{ wizard.form.media }} +