-
Notifications
You must be signed in to change notification settings - Fork 4
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 #1696 from DSD-DBS/custom-nav-links
feat: Allow customizing Nav URLs
- Loading branch information
Showing
26 changed files
with
645 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import fastapi | ||
from sqlalchemy import orm | ||
|
||
from capellacollab.core import database | ||
from capellacollab.settings.configuration import core as config_core | ||
from capellacollab.settings.configuration import ( | ||
models as settings_config_models, | ||
) | ||
from capellacollab.settings.configuration.models import NavbarConfiguration | ||
|
||
router = fastapi.APIRouter() | ||
|
||
|
||
@router.get( | ||
"/navbar", | ||
response_model=NavbarConfiguration, | ||
) | ||
def get_navbar(db: orm.Session = fastapi.Depends(database.get_db)): | ||
cfg = config_core.get_config(db, "global") | ||
assert isinstance(cfg, settings_config_models.GlobalConfiguration) | ||
|
||
return NavbarConfiguration.model_validate(cfg.navbar.model_dump()) |
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
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
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
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
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,53 @@ | ||
<!-- | ||
~ SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
# Configure for your Organization | ||
|
||
When running the Collaboration Manager in production, you may want to provide | ||
information about the team responsible for it, as well as an imprint and | ||
privacy policy. | ||
|
||
You can set this information from the configuration page in the admin | ||
interface. Navigate to _Settings_, then _Configuration_, then edit the file to | ||
your liking. | ||
|
||
Here, you can also edit the links in the navigation bar if you are not using | ||
the default monitoring services. | ||
|
||
```yaml | ||
metadata: | ||
privacy_policy_url: https://example.com/privacy | ||
imprint_url: https://example.com/imprint | ||
provider: Systems Engineering Toolchain team | ||
authentication_provider: OAuth2 | ||
environment: '-' | ||
navbar: | ||
external_links: | ||
- name: Grafana | ||
service: grafana | ||
role: administrator | ||
- name: Prometheus | ||
service: prometheus | ||
role: administrator | ||
- name: Documentation | ||
service: documentation | ||
role: user | ||
``` | ||
In addition to the default service links, you can add your own by using `href` | ||
instead of `service`. | ||
|
||
```yaml | ||
navbar: | ||
external_links: | ||
- name: Example | ||
href: https://example.com | ||
role: user | ||
``` | ||
|
||
The `role` field and can be one of `user` or `administrator`. While this will | ||
hide the link from users without the appropriate role, it is not a security | ||
feature, and you should make sure that the linked service enforces the | ||
necessary access controls. |
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
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
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
Oops, something went wrong.