-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: RemoteConfig logic (decide replacement) (#26348)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f9be4fa
commit bdf92b7
Showing
45 changed files
with
4,733 additions
and
838 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
Binary file modified
BIN
+473 Bytes
(100%)
frontend/__snapshots__/scenes-app-sidepanels--side-panel-settings--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+798 Bytes
(100%)
frontend/__snapshots__/scenes-app-sidepanels--side-panel-settings--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
frontend/__snapshots__/scenes-other-settings--settings-project--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
frontend/__snapshots__/scenes-other-settings--settings-project--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.85 KB
(100%)
...pshots__/scenes-other-settings--settings-project-with-replay-features--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.36 KB
(100%)
...shots__/scenes-other-settings--settings-project-with-replay-features--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
...apshots__/scenes-other-settings--settings-session-timeout-all-options--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
...pshots__/scenes-other-settings--settings-session-timeout-all-options--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
...shots__/scenes-other-settings--settings-session-timeout-password-only--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
...hots__/scenes-other-settings--settings-session-timeout-password-only--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
..._/scenes-other-settings--settings-session-timeout-sso-enforced-github--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
.../scenes-other-settings--settings-session-timeout-sso-enforced-github--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
..._/scenes-other-settings--settings-session-timeout-sso-enforced-google--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
.../scenes-other-settings--settings-session-timeout-sso-enforced-google--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
...s__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
...__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.03 KB
(100%)
..._snapshots__/scenes-other-settings--settings-session-timeout-sso-only--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.76 KB
(100%)
...snapshots__/scenes-other-settings--settings-session-timeout-sso-only--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,38 @@ | ||
from django.http import JsonResponse, Http404, HttpResponse | ||
from rest_framework.views import APIView | ||
from posthog.models.remote_config import RemoteConfig | ||
|
||
|
||
class BaseRemoteConfigAPIView(APIView): | ||
""" | ||
Base class for RemoteConfig API views. | ||
""" | ||
|
||
authentication_classes = [] | ||
permission_classes = [] | ||
|
||
def get_object(self, token: str) -> RemoteConfig: | ||
try: | ||
return RemoteConfig.objects.get(team__api_token=token) | ||
except RemoteConfig.DoesNotExist: | ||
raise Http404() | ||
|
||
|
||
class RemoteConfigAPIView(BaseRemoteConfigAPIView): | ||
def get(self, request, token: str, *args, **kwargs): | ||
resource = self.get_object(token) | ||
return JsonResponse(resource.config) | ||
|
||
|
||
class RemoteConfigJSAPIView(BaseRemoteConfigAPIView): | ||
def get(self, request, token: str, *args, **kwargs): | ||
resource = self.get_object(token) | ||
script_content = resource.build_js_config() | ||
return HttpResponse(script_content, content_type="application/javascript") | ||
|
||
|
||
class RemoteConfigArrayJSAPIView(BaseRemoteConfigAPIView): | ||
def get(self, request, token: str, *args, **kwargs): | ||
resource = self.get_object(token) | ||
script_content = resource.build_array_js_config() | ||
return HttpResponse(script_content, content_type="application/javascript") |
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.