Skip to content

Commit 480ad45

Browse files
sagnewWillNilges
andauthored
Add feature flag for the admin map panel (#1125)
* Add feature flag for the admin map panel * Update test for the admin map panel --------- Co-authored-by: Willard Nilges <willardnilges@gmail.com>
1 parent 973d88b commit 480ad45

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/meshapi/tests/test_admin_panel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from bs4 import BeautifulSoup
44
from django.contrib.auth.models import Group, User
5-
from django.test import Client, TestCase
5+
from django.test import Client, TestCase, override_settings
66
from rest_framework.authtoken.models import TokenProxy
77

88
from meshapi.models import LOS, AccessPoint, Building, Device, Install, Link, Member, Node, Sector
@@ -87,6 +87,7 @@ def setUp(self) -> None:
8787
user=self.admin_user, target="http://example.com", event="building.created", headers=""
8888
)
8989

90+
@override_settings(FLAGS={"ADMIN_MAP_PANEL": [("boolean", True)]})
9091
def test_iframe_loads(self):
9192
route = "/admin/iframe_wrapper/"
9293
code = 200

src/meshdb/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
FLAGS: Dict[str, Any] = {
5050
"MAINTENANCE_MODE": [],
51+
"ADMIN_MAP_PANEL": [],
5152
"EDIT_PANORAMAS": [],
5253
"JOIN_FORM_FAIL_ALL_INVISIBLE_RECAPTCHAS": [],
5354
"INTEGRATION_ENABLED_SEND_JOIN_REQUEST_SLACK_MESSAGES": [],

src/meshdb/templates/admin/base.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
33
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" dir="{{ LANGUAGE_BIDI|yesno:'rtl,ltr,auto' }}">
44
<head>
5-
<script>const PANEL_URL = "/admin/iframe_wrapper/";</script>
6-
<script src="{% static '/admin/mobile_check.js' %}"></script>
7-
<script src="{% static '/admin/iframe_check.js' %}"></script>
5+
6+
{% load feature_flags %}
7+
{% flag_enabled 'ADMIN_MAP_PANEL' as admin_map_panel_enabled %}
8+
9+
{% if admin_map_panel_enabled %}
10+
<script>const PANEL_URL = "/admin/iframe_wrapper/";</script>
11+
<script src="{% static '/admin/mobile_check.js' %}"></script>
12+
<script src="{% static '/admin/iframe_check.js' %}"></script>
13+
{% endif %}
14+
15+
816
<title>{% block title %}{% endblock %}</title>
917
<link rel="stylesheet" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}">
1018
{% block dark-mode-vars %}

0 commit comments

Comments
 (0)