Commit aeb9da43 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- testing session management
parent ee9d0247
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,10 +19,10 @@ from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient

def get_working_context() -> str:
    return session['context_name'] if 'context_name' in session else '---'
    return session['context_uuid'] if 'context_uuid' in session else '---'

def get_working_topology() -> str:
    return session['topology_name'] if 'topology_name' in session else '---'
    return session['topology_uuid'] if 'topology_uuid' in session else '---'

def liveness():
    pass
+7 −7
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ def home():
        for topology_ in topologies.topologies:
            topology_uuid : str = topology_.topology_id.topology_uuid.uuid
            topology_name : str = topology_.name
            raw_values = context_uuid, context_name, topology_uuid, topology_name
            raw_values = context_name, topology_name
            b64_values = [base64.b64encode(v.encode('utf-8')).decode('utf-8') for v in raw_values]
            context_topology_uuid = ','.join(b64_values)
            context_topology_name  = 'Context({:s}):Topology({:s})'.format(context_name, topology_name)
@@ -77,13 +77,13 @@ def home():
            LOGGER.warning('b64_values={:s}'.format(str(b64_values)))
            raw_values = [base64.b64decode(v.encode('utf-8')).decode('utf-8') for v in b64_values]
            LOGGER.warning('raw_values={:s}'.format(str(raw_values)))
            context_uuid, context_name, topology_uuid, topology_name = raw_values
            session.clear()
            context_name, topology_name = raw_values
            #session.clear()
            session['context_topology_uuid'] = context_topology_uuid
            session['context_uuid'] = context_uuid
            session['context_name'] = context_name
            session['topology_uuid'] = topology_uuid
            session['topology_name'] = topology_name
            session['context_uuid'] = context_name
            #session['context_name'] = context_name
            session['topology_uuid'] = topology_name
            #session['topology_name'] = topology_name
            LOGGER.warning('session.items={:s}'.format(str(session.items())))
            MSG = f'Context({context_name})/Topology({topology_name}) successfully selected.'
            flash(MSG, 'success')