From 0724a91258e216d34ddec82dec94ef234e496d9f Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Wed, 23 Oct 2024 13:39:09 +0000 Subject: [PATCH] Pre-merge code cleanup --- my_deploy.sh | 2 +- src/webui/service/__init__.py | 36 ++++++++++--------- src/webui/service/optical_link/routes.py | 4 --- src/webui/service/templates/base.html | 31 ++++++---------- .../service/templates/optical_link/home.html | 8 ++--- .../opticalconfig/add_transceiver.html | 3 +- .../templates/opticalconfig/details.html | 6 ---- .../service/templates/opticalconfig/home.html | 7 ++-- .../opticalconfig/update_interface.html | 3 +- .../opticalconfig/update_status.html | 18 +++++++++- 10 files changed, 57 insertions(+), 61 deletions(-) diff --git a/my_deploy.sh b/my_deploy.sh index 9da56a929..8d2e733d4 100755 --- a/my_deploy.sh +++ b/my_deploy.sh @@ -140,7 +140,7 @@ export CRDB_DEPLOY_MODE="single" export CRDB_DROP_DATABASE_IF_EXISTS="" # Disable flag for re-deploying CockroachDB from scratch. -export CRDB_REDEPLOY="YES" +export CRDB_REDEPLOY="" # ----- NATS ------------------------------------------------------------------- diff --git a/src/webui/service/__init__.py b/src/webui/service/__init__.py index ff333a78c..4c39e3c03 100644 --- a/src/webui/service/__init__.py +++ b/src/webui/service/__init__.py @@ -21,7 +21,8 @@ from context.client.ContextClient import ContextClient from device.client.DeviceClient import DeviceClient from qkd_app.client.QKDAppClient import QKDAppClient from common.Settings import ( - is_deployed_bgpls, is_deployed_load_gen, is_deployed_policy, is_deployed_qkd_app, is_deployed_slice + is_deployed_bgpls, is_deployed_load_gen, is_deployed_optical, + is_deployed_policy, is_deployed_qkd_app, is_deployed_slice ) def get_working_context() -> str: @@ -86,43 +87,43 @@ def create_app(use_config=None, web_app_root=None): app.register_blueprint(healthz, url_prefix='/healthz') - from webui.service.js.routes import js # pylint: disable=import-outside-toplevel + from webui.service.js.routes import js # pylint: disable=import-outside-toplevel app.register_blueprint(js) - from webui.service.main.routes import main # pylint: disable=import-outside-toplevel + from webui.service.main.routes import main # pylint: disable=import-outside-toplevel app.register_blueprint(main) - from webui.service.load_gen.routes import load_gen # pylint: disable=import-outside-toplevel + from webui.service.load_gen.routes import load_gen # pylint: disable=import-outside-toplevel app.register_blueprint(load_gen) - - from webui.service.base_optical.route import base_optical # pylint: disable=import-outside-toplevel + + from webui.service.base_optical.route import base_optical # pylint: disable=import-outside-toplevel app.register_blueprint(base_optical) - - from webui.service.opticalconfig.routes import opticalconfig # pylint: disable=import-outside-toplevel + + from webui.service.opticalconfig.routes import opticalconfig # pylint: disable=import-outside-toplevel app.register_blueprint(opticalconfig) - - from webui.service.optical_link.routes import optical_link # pylint: disable=import-outside-toplevel + + from webui.service.optical_link.routes import optical_link # pylint: disable=import-outside-toplevel app.register_blueprint(optical_link) - from webui.service.service.routes import service # pylint: disable=import-outside-toplevel + from webui.service.service.routes import service # pylint: disable=import-outside-toplevel app.register_blueprint(service) - from webui.service.slice.routes import slice # pylint: disable=import-outside-toplevel,redefined-builtin + from webui.service.slice.routes import slice # pylint: disable=import-outside-toplevel,redefined-builtin app.register_blueprint(slice) - from webui.service.device.routes import device # pylint: disable=import-outside-toplevel + from webui.service.device.routes import device # pylint: disable=import-outside-toplevel app.register_blueprint(device) - from webui.service.bgpls.routes import bgpls # pylint: disable=import-outside-toplevel + from webui.service.bgpls.routes import bgpls # pylint: disable=import-outside-toplevel app.register_blueprint(bgpls) - from webui.service.link.routes import link # pylint: disable=import-outside-toplevel + from webui.service.link.routes import link # pylint: disable=import-outside-toplevel app.register_blueprint(link) - from webui.service.qkd_app.routes import qkd_app # pylint: disable=import-outside-toplevel + from webui.service.qkd_app.routes import qkd_app # pylint: disable=import-outside-toplevel app.register_blueprint(qkd_app) - from webui.service.policy_rule.routes import policy_rule # pylint: disable=import-outside-toplevel + from webui.service.policy_rule.routes import policy_rule # pylint: disable=import-outside-toplevel app.register_blueprint(policy_rule) app.jinja_env.globals.update({ # pylint: disable=no-member @@ -135,6 +136,7 @@ def create_app(use_config=None, web_app_root=None): 'is_deployed_bgpls' : is_deployed_bgpls, 'is_deployed_load_gen': is_deployed_load_gen, + 'is_deployed_optical' : is_deployed_optical, 'is_deployed_policy' : is_deployed_policy, 'is_deployed_qkd_app' : is_deployed_qkd_app, 'is_deployed_slice' : is_deployed_slice, diff --git a/src/webui/service/optical_link/routes.py b/src/webui/service/optical_link/routes.py index 0469ad7ce..dfb85c439 100644 --- a/src/webui/service/optical_link/routes.py +++ b/src/webui/service/optical_link/routes.py @@ -111,7 +111,3 @@ def delete_all () : except Exception as e : flash(f"Problem in delete all optical link => {e}",'danger') return redirect(url_for('optical_link.home')) - - - - \ No newline at end of file diff --git a/src/webui/service/templates/base.html b/src/webui/service/templates/base.html index aeba9e704..1402f40c4 100644 --- a/src/webui/service/templates/base.html +++ b/src/webui/service/templates/base.html @@ -79,27 +79,6 @@ <a class="nav-link" href="{{ url_for('service.home') }}">Service</a> {% endif %} </li> - <li class="nav-item"> - {% if '/slice/' in request.path %} - <a class="nav-link active" aria-current="page" href="{{ url_for('slice.home') }}">Slice</a> - {% else %} - <a class="nav-link" href="{{ url_for('slice.home') }}">Slice</a> - {% endif %} - </li> - <li class="nav-item"> - {% if '/base_optical/' in request.path %} - <a class="nav-link active" aria-current="page" href="{{ url_for('base_optical.home') }}">Optical Config</a> - {% else %} - <a class="nav-link" href="{{ url_for('base_optical.home') }}">Optical Config</a> - {% endif %} - </li> - <li class="nav-item"> - {% if '/policy_rule/' in request.path %} - <a class="nav-link active" aria-current="page" href="{{ url_for('policy_rule.home') }}">Policy Rules</a> - {% else %} - <a class="nav-link" href="{{ url_for('policy_rule.home') }}">Policy Rules</a> - {% endif %} - </li> {% if is_deployed_slice() %} <li class="nav-item"> @@ -111,6 +90,16 @@ </li> {% endif %} + {% if is_deployed_optical() %} + <li class="nav-item"> + {% if '/base_optical/' in request.path %} + <a class="nav-link active" aria-current="page" href="{{ url_for('base_optical.home') }}">Optical Config</a> + {% else %} + <a class="nav-link" href="{{ url_for('base_optical.home') }}">Optical Config</a> + {% endif %} + </li> + {% endif %} + {% if is_deployed_policy() %} <li class="nav-item"> {% if '/policy_rule/' in request.path %} diff --git a/src/webui/service/templates/optical_link/home.html b/src/webui/service/templates/optical_link/home.html index 4c7943925..2f1b8e4af 100644 --- a/src/webui/service/templates/optical_link/home.html +++ b/src/webui/service/templates/optical_link/home.html @@ -12,9 +12,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - --> - - {% extends 'base.html' %} +--> + +{% extends 'base.html' %} {% block content %} <h1>Optical Links</h1> @@ -119,4 +119,4 @@ </div> </div> - {% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/webui/service/templates/opticalconfig/add_transceiver.html b/src/webui/service/templates/opticalconfig/add_transceiver.html index a8cd6c361..d10faa7f1 100644 --- a/src/webui/service/templates/opticalconfig/add_transceiver.html +++ b/src/webui/service/templates/opticalconfig/add_transceiver.html @@ -52,4 +52,5 @@ </div> </fieldset> </form> -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/src/webui/service/templates/opticalconfig/details.html b/src/webui/service/templates/opticalconfig/details.html index d5d26699d..ae0f85f9f 100644 --- a/src/webui/service/templates/opticalconfig/details.html +++ b/src/webui/service/templates/opticalconfig/details.html @@ -1,4 +1,3 @@ - <!-- Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) @@ -150,9 +149,4 @@ </div> </div> - - - {% endblock %} - - diff --git a/src/webui/service/templates/opticalconfig/home.html b/src/webui/service/templates/opticalconfig/home.html index 07cbe522b..7e873f28d 100644 --- a/src/webui/service/templates/opticalconfig/home.html +++ b/src/webui/service/templates/opticalconfig/home.html @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - --> +--> {% extends 'base.html' %} @@ -109,8 +109,5 @@ </form> </div> --> </div> - - - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/src/webui/service/templates/opticalconfig/update_interface.html b/src/webui/service/templates/opticalconfig/update_interface.html index 963af8037..5c9b7b79c 100644 --- a/src/webui/service/templates/opticalconfig/update_interface.html +++ b/src/webui/service/templates/opticalconfig/update_interface.html @@ -86,4 +86,5 @@ </div> </fieldset> </form> -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/src/webui/service/templates/opticalconfig/update_status.html b/src/webui/service/templates/opticalconfig/update_status.html index 72612f86b..e52bfbebb 100644 --- a/src/webui/service/templates/opticalconfig/update_status.html +++ b/src/webui/service/templates/opticalconfig/update_status.html @@ -1,3 +1,18 @@ +<!-- + Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> {% extends 'base.html' %} @@ -48,4 +63,5 @@ </div> </fieldset> </form> -{% endblock %} \ No newline at end of file + +{% endblock %} -- GitLab