From 06116cdde7dc0dc4aabc6802b4e306f2ff27cbe7 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 30 Mar 2020 15:31:13 -0400 Subject: [PATCH] Add developer docs for application registry --- docs/development/application-registry.md | 55 ++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 56 insertions(+) create mode 100644 docs/development/application-registry.md diff --git a/docs/development/application-registry.md b/docs/development/application-registry.md new file mode 100644 index 000000000..67479b6fb --- /dev/null +++ b/docs/development/application-registry.md @@ -0,0 +1,55 @@ +# Application Registry + +The registry is an in-memory data structure which houses various miscellaneous application-wide parameters, such as installed plugins. It is not exposed to the user and is not intended to be modified by any code outside of NetBox core. + +The registry behaves essentially like a Python dictionary, with the notable exception that once a store (key) has been declared, it cannot be deleted or overwritten. The value of a store can, however, me modified; e.g. by appending a value to a list. Store values generally do not change once the application has been initialized. + +## Stores + +### `model_features` + +A dictionary of particular features (e.g. custom fields) mapped to the NetBox models which support them, arranged by app. For example: + +```python +{ + 'custom_fields': { + 'circuits': ['provider', 'circuit'], + 'dcim': ['site', 'rack', 'devicetype', ...], + ... + }, + 'webhooks': { + ... + }, + ... +} +``` + +### `plugin_menu_items` + +Navigation menu items provided by NetBox plugins. Each plugin is registered as a key with the list of menu items it provides. An example: + +```python +{ + 'Plugin A': ( + , , , + ), + 'Plugin B': ( + , , , + ), +} +``` + +### `plugin_template_extensions` + +Plugin content that gets embedded into core NetBox templates. The store comprises NetBox models registered as dictionary keys, each pointing to a list of applicable template extension classes that exist. An example: + +```python +{ + 'dcim.site': [ + , , , + ], + 'dcim.rack': [ + , , + ], +} +``` diff --git a/mkdocs.yml b/mkdocs.yml index 69744ad2f..d1ced6d8c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -71,6 +71,7 @@ nav: - Style Guide: 'development/style-guide.md' - Utility Views: 'development/utility-views.md' - Extending Models: 'development/extending-models.md' + - Application Registry: 'development/application-registry.md' - Release Checklist: 'development/release-checklist.md' - Squashing Migrations: 'development/squashing-migrations.md' - Release Notes: