Skip to content

Commit

Permalink
adding a license page
Browse files Browse the repository at this point in the history
  • Loading branch information
brifordwylie committed May 19, 2024
1 parent 2d31778 commit 7216189
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
45 changes: 45 additions & 0 deletions applications/aws_dashboard/pages/license/page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""License: A SageWorks Web Interface to view License Details"""
from dash import register_page
from dash import html
from dash_bootstrap_templates import load_figure_template

# SageWorks Imports
from sageworks.web_components.plugins import license_details
from sageworks.utils.config_manager import ConfigManager
from sageworks.utils.license_manager import LicenseManager

# Register this page with Dash
register_page(
__name__,
path="/license",
name="SageWorks - License",
)

# Grab the API Key from the SageWorks ConfigManager
cm = ConfigManager()
api_key = cm.get_config("SAGEWORKS_API_KEY")
my_license_info = LicenseManager.load_api_license(aws_account_id=None, api_key=api_key)

# Put the components into 'dark' mode
load_figure_template("darkly")

# Create a Markdown component to display the license details
license_details = license_details.LicenseDetails()
details_component = license_details.create_component("license_details")
updated_properties = license_details.update_properties(my_license_info)

# Set the properties directly on the server side before initializing the layout
for (component_id, prop), value in zip(license_details.properties, updated_properties):
for child in details_component.children:
if child.id == component_id:
setattr(child, prop, value)
break

# Simple layout for the license details
layout = html.Div(
children=[
html.H2("SageWorks: License"),
details_component,
],
style={"padding": "12px 30px 30px 30px"}
)
1 change: 1 addition & 0 deletions src/sageworks/web_components/plugin_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PluginInputType(Enum):
PIPELINE = "pipeline"
MODEL_TABLE = "model_table"
PIPELINE_TABLE = "pipeline_table"
CUSTOM = "custom"


class PluginInterface(ComponentInterface):
Expand Down
2 changes: 1 addition & 1 deletion src/sageworks/web_components/plugins/license_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def update_properties(self, license: dict, **kwargs) -> list:
list: A list of the updated property values for the plugin
"""
# Update the header and the details
header = "SageWorks: License Details"
header = "License Details"

# See if we can connect to the License Server
response = LicenseManager.contact_license_server()
Expand Down

0 comments on commit 7216189

Please sign in to comment.