Commit 42f566fc authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- Minor cosmetic changes in code
- Addition of missing close methods
parent bc2b0e9e
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import base64, json, logging, re
import base64, json, logging #, re
from flask import jsonify, redirect, render_template, Blueprint, flash, session, url_for, request
from common.proto.context_pb2 import ContextList, Empty, TopologyId, TopologyList
from common.tools.descriptor.Loader import DescriptorLoader, compose_notifications
@@ -55,7 +55,7 @@ def process_descriptors(descriptors):
def home():
    context_client.connect()
    device_client.connect()
    context_topology_form: ContextTopologyForm = ContextTopologyForm()
    context_topology_form = ContextTopologyForm()
    context_topology_form.context_topology.choices.append(('', 'Select...'))

    contexts : ContextList = context_client.ListContexts(Empty())
@@ -87,6 +87,10 @@ def home():
            #session['topology_name'] = topology_name
            MSG = f'Context({context_name})/Topology({topology_name}) successfully selected.'
            flash(MSG, 'success')

            context_client.close()
            device_client.close()

            return redirect(url_for('main.home'))

            #match = re.match('ctx\[([^\]]+)\]\/topo\[([^\]]+)\]', context_topology_uuid)
@@ -101,7 +105,7 @@ def home():
    if 'context_topology_uuid' in session:
        context_topology_form.context_topology.data = session['context_topology_uuid']

    descriptor_form: DescriptorForm = DescriptorForm()
    descriptor_form = DescriptorForm()
    try:
        if descriptor_form.validate_on_submit():
            process_descriptors(descriptor_form.descriptors)