From feb2426af0a72e92c03aad56d5e2d475b8452ac1 Mon Sep 17 00:00:00 2001 From: "agbarneo@optaresolutions.com" <agbarneo@optaresolutions.com> Date: Mon, 23 Sep 2024 13:15:28 +0000 Subject: [PATCH] Added qkd_app into blueprint, new line at the end of files and updated App by QKDApp --- src/webui/service/__init__.py | 2 +- src/webui/service/__main__.py | 3 ++- src/webui/service/app/routes.py | 8 ++++---- src/webui/service/device/forms.py | 3 ++- src/webui/service/device/routes.py | 2 +- src/webui/service/service/__init__.py | 1 + src/webui/service/service/forms.py | 3 ++- src/webui/service/service/routes.py | 2 +- src/webui/service/templates/app/home.html | 2 +- src/webui/service/templates/service/configure_QKD.html | 3 ++- 10 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/webui/service/__init__.py b/src/webui/service/__init__.py index be1cbce2a..a9b3e6321 100644 --- a/src/webui/service/__init__.py +++ b/src/webui/service/__init__.py @@ -124,4 +124,4 @@ def create_app(use_config=None, web_app_root=None): if web_app_root is not None: app.wsgi_app = SetSubAppMiddleware(app.wsgi_app, web_app_root) - return app \ No newline at end of file + return app diff --git a/src/webui/service/__main__.py b/src/webui/service/__main__.py index f58b815b4..13493fffb 100644 --- a/src/webui/service/__main__.py +++ b/src/webui/service/__main__.py @@ -69,4 +69,5 @@ def main(): return 0 if __name__ == '__main__': - sys.exit(main()) \ No newline at end of file + sys.exit(main()) + \ No newline at end of file diff --git a/src/webui/service/app/routes.py b/src/webui/service/app/routes.py index 52795d174..74d033c41 100644 --- a/src/webui/service/app/routes.py +++ b/src/webui/service/app/routes.py @@ -21,13 +21,13 @@ from common.tools.context_queries.Context import get_context from common.tools.context_queries.Device import get_device from common.tools.context_queries.Topology import get_topology from context.client.ContextClient import ContextClient -from app.client.AppClient import AppClient +from app.client.QKDAppClient import QKDAppClient LOGGER = logging.getLogger(__name__) -app = Blueprint('app', __name__, url_prefix='/app') +app = Blueprint('qkd_app', __name__, url_prefix='/app') -app_client = AppClient() +qkd_app_client = QKDAppClient() context_client = ContextClient() @app.get('/') @@ -47,7 +47,7 @@ def home(): apps = list() else: try: - apps = app_client.ListApps(context_obj.context_id) + apps = qkd_app_client.ListApps(context_obj.context_id) apps = apps.apps except grpc.RpcError as e: if e.code() != grpc.StatusCode.NOT_FOUND: raise diff --git a/src/webui/service/device/forms.py b/src/webui/service/device/forms.py index 38f56bc00..9edfb8302 100644 --- a/src/webui/service/device/forms.py +++ b/src/webui/service/device/forms.py @@ -57,4 +57,5 @@ class UpdateDeviceForm(FlaskForm): coerce=int, validators=[NumberRange(min=0)]) - submit = SubmitField('Update') \ No newline at end of file + submit = SubmitField('Update') + \ No newline at end of file diff --git a/src/webui/service/device/routes.py b/src/webui/service/device/routes.py index 425333648..429f4a2ea 100644 --- a/src/webui/service/device/routes.py +++ b/src/webui/service/device/routes.py @@ -262,4 +262,4 @@ def update(device_uuid): return redirect(url_for('device.home')) except Exception as e: # pylint: disable=broad-except flash(f'Problem updating the device. {e.details()}', 'danger') - return render_template('device/update.html', device=response, form=form, submit_text='Update Device') \ No newline at end of file + return render_template('device/update.html', device=response, form=form, submit_text='Update Device') diff --git a/src/webui/service/service/__init__.py b/src/webui/service/service/__init__.py index 3ee6f7071..5cf553eaa 100644 --- a/src/webui/service/service/__init__.py +++ b/src/webui/service/service/__init__.py @@ -12,3 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. + diff --git a/src/webui/service/service/forms.py b/src/webui/service/service/forms.py index 2eb9794a9..d37a9b469 100644 --- a/src/webui/service/service/forms.py +++ b/src/webui/service/service/forms.py @@ -281,4 +281,5 @@ class AddServiceForm_L3VPN(FlaskForm): Device_2_IF_mtu = IntegerField('Device_2 Interface MTU', validators=[Optional(), NumberRange(min=0, message="MTU value can't be negative")]) Device_2_IF_address_ip = StringField('Device_2 IP Address', validators=[CustomInputRequired(), validate_ipv4_address]) Device_2_IF_address_prefix = IntegerField('Device_2 IP Prefix length', validators=[CustomInputRequired(), validate_uint32]) - Device_2_IF_description = StringField ('Device_2 SubIF Description', validators=[Optional()]) \ No newline at end of file + Device_2_IF_description = StringField ('Device_2 SubIF Description', validators=[Optional()]) + \ No newline at end of file diff --git a/src/webui/service/service/routes.py b/src/webui/service/service/routes.py index d8a3747a1..c164b4177 100644 --- a/src/webui/service/service/routes.py +++ b/src/webui/service/service/routes.py @@ -746,4 +746,4 @@ def get_device_params(form, device_num, form_type): raise ValueError(f'Unsupported form type: {form_type}') params_with_data = {k: v for k, v in device_params.items() if v is not None and str(v) != 'None' and v != ''} - return params_with_data \ No newline at end of file + return params_with_data diff --git a/src/webui/service/templates/app/home.html b/src/webui/service/templates/app/home.html index ab0de316d..e138acd14 100644 --- a/src/webui/service/templates/app/home.html +++ b/src/webui/service/templates/app/home.html @@ -91,4 +91,4 @@ </tbody> </table> -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/webui/service/templates/service/configure_QKD.html b/src/webui/service/templates/service/configure_QKD.html index 3864a5c9f..c026d0674 100644 --- a/src/webui/service/templates/service/configure_QKD.html +++ b/src/webui/service/templates/service/configure_QKD.html @@ -184,4 +184,5 @@ </button> </fieldset> </form> - {% endblock %} \ No newline at end of file + {% endblock %} + \ No newline at end of file -- GitLab