11"""Utilities for configuring JupyterHub services."""
22from typing import Dict , Any , Optional
33
4- from jhub_apps .service .models import PinnedService
4+ from jhub_apps .service .models import AdditionalService
55
66
77def service_for_jhub_apps (
@@ -14,15 +14,16 @@ def service_for_jhub_apps(
1414 """Create a service configuration dict for JupyterHub services.
1515
1616 This helper function creates the proper structure for external services
17- that appear in the JupyterHub UI services menu. It validates the input
18- using the PinnedService Pydantic model.
17+ that appear in the JupyterHub UI services menu. Services with pinned=True
18+ also appear in the quick access section. It validates the input using
19+ the AdditionalService Pydantic model.
1920
2021 Args:
2122 name: Display name of the service
2223 url: URL path for the service
2324 description: Optional description of the service
24- pinned: Whether the service should be pinned in the UI
25- thumbnail: Optional thumbnail URL or data URL for the service icon
25+ pinned: Whether the service should appear in the quick access section
26+ thumbnail: Optional thumbnail URL or base64-encoded data URL for the service icon
2627
2728 Returns:
2829 Dictionary with JupyterHub service configuration
@@ -40,7 +41,7 @@ def service_for_jhub_apps(
4041 ... )
4142 """
4243 # Validate inputs using Pydantic model
43- pinned_service = PinnedService (
44+ additional_service = AdditionalService (
4445 name = name ,
4546 url = url ,
4647 description = description ,
@@ -49,32 +50,32 @@ def service_for_jhub_apps(
4950 )
5051
5152 return {
52- "name" : pinned_service .name ,
53+ "name" : additional_service .name ,
5354 "display" : True ,
5455 "info" : {
55- "name" : pinned_service .name ,
56- "description" : pinned_service .description ,
57- "url" : pinned_service .url ,
56+ "name" : additional_service .name ,
57+ "description" : additional_service .description ,
58+ "url" : additional_service .url ,
5859 "external" : True ,
59- "pinned" : pinned_service .pinned ,
60- "thumbnail" : pinned_service .thumbnail ,
60+ "pinned" : additional_service .pinned ,
61+ "thumbnail" : additional_service .thumbnail ,
6162 },
6263 }
6364
6465
65- def pinned_service_to_service_dict ( pinned_service : PinnedService ) -> Dict [str , Any ]:
66- """Convert a PinnedService model to a JupyterHub service dict.
66+ def additional_service_to_service_dict ( additional_service : AdditionalService ) -> Dict [str , Any ]:
67+ """Convert an AdditionalService model to a JupyterHub service dict.
6768
6869 Args:
69- pinned_service: PinnedService model instance
70+ additional_service: AdditionalService model instance
7071
7172 Returns:
7273 Dictionary with JupyterHub service configuration
7374 """
7475 return service_for_jhub_apps (
75- name = pinned_service .name ,
76- url = pinned_service .url ,
77- description = pinned_service .description ,
78- pinned = pinned_service .pinned ,
79- thumbnail = pinned_service .thumbnail ,
76+ name = additional_service .name ,
77+ url = additional_service .url ,
78+ description = additional_service .description ,
79+ pinned = additional_service .pinned ,
80+ thumbnail = additional_service .thumbnail ,
8081 )
0 commit comments