Skip to content

Commit

Permalink
Merge branch 'main' into add_components_commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nvkevlu authored Jan 13, 2025
2 parents 20e1a9e + 4307196 commit 7c9a5b7
Show file tree
Hide file tree
Showing 80 changed files with 4,606 additions and 1,488 deletions.
12 changes: 7 additions & 5 deletions nvflare/dashboard/application/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
from flask import jsonify, make_response, request
from flask_jwt_extended import get_jwt, get_jwt_identity, jwt_required

from nvflare.dashboard.application.constants import FLARE_DASHBOARD_NAMESPACE

from .store import Store, check_role


@app.route("/api/v1/clients", methods=["POST"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/clients", methods=["POST"])
@jwt_required()
def create_one_client():
creator = get_jwt_identity()
Expand All @@ -31,21 +33,21 @@ def create_one_client():
return jsonify({"status": "conflicting"}), 409


@app.route("/api/v1/clients", methods=["GET"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/clients", methods=["GET"])
@jwt_required()
def get_all_clients():
result = Store.get_clients()
return jsonify(result)


@app.route("/api/v1/clients/<id>", methods=["GET"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/clients/<id>", methods=["GET"])
@jwt_required()
def get_one_client(id):
result = Store.get_client(id)
return jsonify(result)


@app.route("/api/v1/clients/<id>", methods=["PATCH", "DELETE"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/clients/<id>", methods=["PATCH", "DELETE"])
@jwt_required()
def update_client(id):
creator_id = Store.get_creator_id_by_client_id(id)
Expand All @@ -71,7 +73,7 @@ def update_client(id):
return jsonify({"status": "conflicting"}), 409


@app.route("/api/v1/clients/<int:id>/blob", methods=["POST"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/clients/<int:id>/blob", methods=["POST"])
@jwt_required()
def client_blob(id):
if not Store._is_approved_by_client_id(id):
Expand Down
15 changes: 15 additions & 0 deletions nvflare/dashboard/application/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# 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.

FLARE_DASHBOARD_NAMESPACE = "/nvflare-dashboard"
57 changes: 32 additions & 25 deletions nvflare/dashboard/application/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from flask import jsonify, make_response, request
from flask_jwt_extended import create_access_token, get_jwt, jwt_required

from nvflare.dashboard.application.constants import FLARE_DASHBOARD_NAMESPACE

from . import jwt
from .store import Store

Expand All @@ -26,57 +28,62 @@ def my_expired_token_callback(jwt_header, jwt_payload):
return jsonify({"status": "unauthenticated"}), 401


@app.route("/application-config")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/application-config")
def application_config_html():
return app.send_static_file("application-config.html")
return app.send_static_file("nvflare-dashboard/application-config.html")


@app.route("/downloads")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/downloads")
def downloads_html():
return app.send_static_file("downloads.html")
return app.send_static_file("nvflare-dashboard/downloads.html")


@app.route(FLARE_DASHBOARD_NAMESPACE, strict_slashes=False)
def index_html_dashboard():
return app.send_static_file("nvflare-dashboard/index.html")


@app.route("/")
def index_html():
return app.send_static_file("index.html")
return app.send_static_file("nvflare-dashboard/index.html")


@app.route("/logout")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/logout")
def logout_html():
return app.send_static_file("logout.html")
return app.send_static_file("nvflare-dashboard/logout.html")


@app.route("/project-admin-dashboard")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/project-admin-dashboard")
def project_admin_dashboard_html():
return app.send_static_file("project-admin-dashboard.html")
return app.send_static_file("nvflare-dashboard/project-admin-dashboard.html")


@app.route("/project-configuration")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/project-configuration")
def project_configuration_html():
return app.send_static_file("project-configuration.html")
return app.send_static_file("nvflare-dashboard/project-configuration.html")


@app.route("/registration-form")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/registration-form")
def registration_form_html():
return app.send_static_file("registration-form.html")
return app.send_static_file("nvflare-dashboard/registration-form.html")


@app.route("/server-config")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/server-config")
def server_config_html():
return app.send_static_file("server-config.html")
return app.send_static_file("nvflare-dashboard/server-config.html")


@app.route("/site-dashboard")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/site-dashboard")
def site_dashboard_html():
return app.send_static_file("site-dashboard.html")
return app.send_static_file("nvflare-dashboard/site-dashboard.html")


@app.route("/user-dashboard")
@app.route(FLARE_DASHBOARD_NAMESPACE + "/user-dashboard")
def user_dashboard_html():
return app.send_static_file("user-dashboard.html")
return app.send_static_file("nvflare-dashboard/user-dashboard.html")


@app.route("/api/v1/login", methods=["POST"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/login", methods=["POST"])
def login():
req = request.json
email = req.get("email", None)
Expand All @@ -96,7 +103,7 @@ def login():
return jsonify({"status": "unauthenticated"}), 401


@app.route("/api/v1/overseer/blob", methods=["POST"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/overseer/blob", methods=["POST"])
@jwt_required()
def overseer_blob():
claims = get_jwt()
Expand All @@ -111,7 +118,7 @@ def overseer_blob():
return jsonify({"status": "unauthorized"}), 403


@app.route("/api/v1/servers/<int:id>/blob", methods=["POST"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/servers/<int:id>/blob", methods=["POST"])
@jwt_required()
def server_blob(id):
claims = get_jwt()
Expand All @@ -126,7 +133,7 @@ def server_blob(id):
return jsonify({"status": "unauthorized"}), 403


@app.route("/api/v1/project", methods=["PATCH"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/project", methods=["PATCH"])
@jwt_required()
def set_project():
claims = get_jwt()
Expand All @@ -137,11 +144,11 @@ def set_project():
return jsonify({"status": "unauthorized"}), 403


@app.route("/api/v1/project", methods=["GET"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/project", methods=["GET"])
def get_project():
return jsonify(Store.get_project())


@app.route("/api/v1/organizations", methods=["GET"])
@app.route(FLARE_DASHBOARD_NAMESPACE + "/api/v1/organizations", methods=["GET"])
def get_orgs():
return jsonify(Store.get_orgs())
1 change: 0 additions & 1 deletion nvflare/dashboard/application/static/404.html

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7c9a5b7

Please sign in to comment.