-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Backend support for feature health (#5023)
- Loading branch information
Showing
33 changed files
with
1,521 additions
and
14 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
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
Empty file.
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,35 @@ | ||
import typing | ||
|
||
from django.contrib import admin | ||
from django.http import HttpRequest | ||
|
||
from features.feature_health.models import FeatureHealthProvider | ||
from features.feature_health.providers.services import ( | ||
get_webhook_path_from_provider, | ||
) | ||
|
||
|
||
@admin.register(FeatureHealthProvider) | ||
class FeatureHealthProviderAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
"project", | ||
"name", | ||
"created_by", | ||
"webhook_url", | ||
) | ||
|
||
def changelist_view( | ||
self, | ||
request: HttpRequest, | ||
*args: typing.Any, | ||
**kwargs: typing.Any, | ||
) -> None: | ||
self.request = request | ||
return super().changelist_view(request, *args, **kwargs) | ||
|
||
def webhook_url( | ||
self, | ||
instance: FeatureHealthProvider, | ||
) -> str: | ||
path = get_webhook_path_from_provider(instance) | ||
return self.request.build_absolute_uri(path) |
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,6 @@ | ||
from core.apps import BaseAppConfig | ||
|
||
|
||
class FeatureHealthConfig(BaseAppConfig): | ||
name = "features.feature_health" | ||
default = True |
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,12 @@ | ||
FEATURE_HEALTH_PROVIDER_CREATED_MESSAGE = "Health provider %s set up for project %s." | ||
FEATURE_HEALTH_PROVIDER_DELETED_MESSAGE = "Health provider %s removed from project %s." | ||
|
||
FEATURE_HEALTH_EVENT_CREATED_MESSAGE = "Health status changed to %s for feature %s." | ||
FEATURE_HEALTH_EVENT_CREATED_FOR_ENVIRONMENT_MESSAGE = ( | ||
"Health status changed to %s for feature %s in environment %s." | ||
) | ||
FEATURE_HEALTH_EVENT_CREATED_PROVIDER_MESSAGE = "\n\nProvided by %s" | ||
FEATURE_HEALTH_EVENT_CREATED_REASON_MESSAGE = "\n\nReason:\n%s" | ||
|
||
UNHEALTHY_TAG_LABEL = "Unhealthy" | ||
UNHEALTHY_TAG_COLOUR = "#FFC0CB" |
Oops, something went wrong.