-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from ca-scribner/add-kubeflow-dashboard-sideba…
…r-interface add kubeflow-dashboard-sidebar interface
- Loading branch information
Showing
5 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
docs/json_schemas/kubeflow_dashboard_sidebar/v0/requirer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"title": "RequirerSchema", | ||
"description": "Requirer schema for Ingress.", | ||
"type": "object", | ||
"properties": { | ||
"unit": { | ||
"$ref": "#/definitions/BaseModel" | ||
}, | ||
"app": { | ||
"title": "App", | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/SidebarItem" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"app" | ||
], | ||
"definitions": { | ||
"BaseModel": { | ||
"title": "BaseModel", | ||
"type": "object", | ||
"properties": {} | ||
}, | ||
"SidebarItem": { | ||
"title": "SidebarItem", | ||
"description": "Representation of a Kubeflow Dashboard sidebar entry.\n\nSee https://www.kubeflow.org/docs/components/central-dash/customizing-menu/ for more details.\n\nArgs:\n text: The text shown in the sidebar\n link: The relative link within the host (eg: /runs, not http://.../runs)\n type: A type of sidebar entry (typically, \"item\")\n icon: An icon for the link, from\n https://kevingleason.me/Polymer-Todo/bower_components/iron-icons/demo/index.html", | ||
"type": "object", | ||
"properties": { | ||
"text": { | ||
"title": "Text", | ||
"type": "string" | ||
}, | ||
"link": { | ||
"title": "Link", | ||
"type": "string" | ||
}, | ||
"type": { | ||
"title": "Type", | ||
"type": "string" | ||
}, | ||
"icon": { | ||
"title": "Icon", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"text", | ||
"link", | ||
"type", | ||
"icon" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# `kubeflow-dashboard-sidebar/v0` | ||
|
||
## Usage | ||
|
||
This relation interface describes the expected behavior of any charm claiming to be able to provide | ||
or consume the `kubeflow-dashboard-sidebar`. `kubeflow-dashboard-sidebar` is an interface for defining links in the format of Kubeflow Dashboard's sidebar. | ||
|
||
## Behavior | ||
|
||
### Provider | ||
|
||
- Is expected to create a sidebar link in the dashboard UI for each link entry sent by the `requirer` over the relation | ||
|
||
### Requirer | ||
|
||
- Is expected to send zero or more sidebar items to the `provider` in the below-defined format. | ||
|
||
## Relation Data | ||
|
||
### Requirer | ||
|
||
[\[JSON Schema\]](./schemas/requirer.json) | ||
|
||
The requirer specifies zero or more sidebar items in the required format. | ||
|
||
#### Example | ||
|
||
```json | ||
[ | ||
{ | ||
"text": "Some link text", | ||
"link": "/some-relative-link", | ||
"type": "item", | ||
"icon": "assessment" | ||
}, | ||
{ | ||
"text": "Some other link text", | ||
"link": "/some-other-relative-link", | ||
"type": "item", | ||
"icon": "book" | ||
} | ||
|
||
] | ||
``` | ||
|
||
### Provider | ||
|
||
The `provider` sends no data on this interface. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
providers: | ||
- name: kubeflow-dashboard | ||
url: https://github.com/canonical/kubeflow-dashboard-operator | ||
requirers: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2023 Canonical | ||
# See LICENSE file for licensing details. | ||
"""This file defines the schemas for the provider and requirer sides of the kubeflow-dashboard-sidebar interface. | ||
Examples: | ||
RequirerSchema: | ||
unit: <empty> | ||
app: [ | ||
{ | ||
"text": "some link text", | ||
"link": "/some-link", | ||
"type": "item", | ||
"icon": "book" | ||
} | ||
] | ||
""" | ||
from typing import List | ||
import yaml | ||
from pydantic import BaseModel, AnyHttpUrl, validator | ||
|
||
from interface_tester.schema_base import DataBagSchema | ||
|
||
|
||
class SidebarItem(BaseModel): | ||
"""Representation of a Kubeflow Dashboard sidebar entry. | ||
See https://www.kubeflow.org/docs/components/central-dash/customizing-menu/ for more details. | ||
Args: | ||
text: The text shown in the sidebar | ||
link: The relative link within the host (eg: /runs, not http://.../runs) | ||
type: A type of sidebar entry (typically, "item") | ||
icon: An icon for the link, from | ||
https://kevingleason.me/Polymer-Todo/bower_components/iron-icons/demo/index.html | ||
""" | ||
|
||
text: str | ||
link: str | ||
type: str # noqa: A003 | ||
icon: str | ||
|
||
|
||
class RequirerSchema(DataBagSchema): | ||
"""Requirer schema for Ingress.""" | ||
|
||
app: List[SidebarItem] |