Skip to content

Commit d9cc99c

Browse files
committed
testing
1 parent cd6f02a commit d9cc99c

File tree

5 files changed

+49
-17
lines changed

5 files changed

+49
-17
lines changed

openwisp_controller/config/apps.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,18 @@ def connect_signals(self):
7878
sender=self.config_model.templates.through,
7979
dispatch_uid="config.clean_templates",
8080
)
81+
# VPN clients must be created or removed **before**
82+
# self.config_model.templates_changed is evaluated, because
83+
# the VpnClient context can influence the configuration checksum.
8184
m2m_changed.connect(
82-
self.config_model.templates_changed,
85+
self.config_model.manage_vpn_clients,
8386
sender=self.config_model.templates.through,
84-
dispatch_uid="config.templates_changed",
87+
dispatch_uid="config.manage_vpn_clients",
8588
)
8689
m2m_changed.connect(
87-
self.config_model.manage_vpn_clients,
90+
self.config_model.templates_changed,
8891
sender=self.config_model.templates.through,
89-
dispatch_uid="config.manage_vpn_clients",
92+
dispatch_uid="config.templates_changed",
9093
)
9194
# the order of the following connect() call must be maintained
9295
m2m_changed.connect(

openwisp_controller/config/static/config/css/admin.css

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ input.readonly {
177177
}
178178
.field-templates .add-related {
179179
position: relative;
180-
bottom: -7px;
181-
left: -3px;
180+
bottom: -2px;
181+
left: -12px;
182182
}
183183
#template_form #id_tags {
184184
width: 261px;
@@ -191,7 +191,7 @@ input.readonly {
191191
#device_form #id_notes {
192192
height: 42px;
193193
}
194-
#config-group .field-status .help {
194+
#config-group .field-status .help div {
195195
white-space: pre;
196196
color: #777;
197197
}
@@ -212,7 +212,6 @@ div.change-form #device_form > div > div.inline-group {
212212
> fieldset.module
213213
> div.inline-related
214214
> h3 {
215-
border-top: 0 none;
216215
padding: 1em;
217216
}
218217
.change-form
@@ -227,7 +226,11 @@ div.change-form #device_form > div > div.inline-group {
227226
margin-top: -1em;
228227
}
229228
#main .tab-content .inline-related > h3 {
230-
background: transparent;
229+
background: var(--ow-color-fg-ghost);
230+
word-spacing: 1px;
231+
text-transform: uppercase;
232+
letter-spacing: 0.2px;
233+
font-weight: normal;
231234
}
232235
ul.tabs {
233236
margin: 0;
@@ -237,19 +240,20 @@ ul.tabs {
237240
}
238241
ul.tabs li {
239242
display: inline-block;
240-
margin-right: 4px;
243+
margin-right: 3px;
241244
}
242245
ul.tabs a,
243246
ul.tabs a:hover,
244247
ul.tabs a:focus {
245248
display: inline-block;
246-
padding: 13px 16px;
249+
padding: 12px 14px;
247250
color: #333;
248251
background: rgba(0, 0, 0, 0.06);
249252
border-radius: 3px;
250253
border-bottom-right-radius: 0;
251254
border-bottom-left-radius: 0;
252255
font-size: 15px;
256+
word-spacing: -0.1px;
253257
}
254258
ul.tabs a:hover,
255259
ul.tabs a:focus {
@@ -259,16 +263,19 @@ ul.tabs a:focus {
259263
ul.tabs a.current,
260264
ul.tabs a.current:hover,
261265
ul.tabs a.current:focus {
262-
background: #fff;
266+
background: var(--ow-color-fg-ghost);
263267
color: #000;
264268
border: 1px solid rgba(0, 0, 0, 0.1);
265269
border-bottom: 0 none;
266270
border-color: rgba(0, 0, 0, 0.25);
267271
cursor: default;
272+
position: relative;
273+
z-index: 9;
274+
font-weight: bold;
268275
}
269276
div.tabs-divider {
270277
margin-top: -4px;
271-
border-top: 1px solid rgba(0, 0, 0, 0.1);
278+
border-top: 1px solid var(--hairline-color);
272279
}
273280
.tab-content {
274281
display: none;
@@ -282,12 +289,15 @@ div.tabs-divider {
282289
padding: 17em 0;
283290
font-size: 16px;
284291
}
292+
ul.tabs li:first-child .button.current {
293+
background-color: var(--body-bg);
294+
}
285295

286296
/*
287297
Prevents the overflow of large text in system
288298
defined variables such as `secret`
289299
*/
290-
.form-row.field-system_context {
300+
.form-row.field-system_context div {
291301
max-width: 51.25em;
292302
word-wrap: break-word;
293303
}

openwisp_controller/config/static/config/css/lib/advanced-mode.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ table.jsoneditor-search button.jsoneditor-previous:hover {
886886
font-size: 14px !important;
887887
}
888888
#main .property-selector .form-row {
889-
padding: 5px 0 6px 10px !important;
889+
padding: 8px 0 13px 5px !important;
890890
}
891891
#main .property-selector {
892892
text-align: left;

openwisp_controller/config/static/config/css/lib/jsonschema-ui.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ div[data-schematype="object"]
241241
> .grid-row
242242
> .inline-group {
243243
border-bottom: 1px solid #eee;
244+
border-top: 0 none;
244245
}
245246
.grid-row > .inline-group > div > .inline-group > div.form-row {
246247
border: 0 none;
@@ -363,14 +364,15 @@ div[data-schematype="object"]
363364
.jsoneditor-wrapper div.jsoneditor .grid-column > select {
364365
position: absolute;
365366
left: 0;
366-
top: 12px;
367+
top: 16px;
367368
z-index: 1;
368369
font-weight: bold;
369370
}
370371
.jsoneditor-wrapper div.jsoneditor .inline-related > select,
371372
.jsoneditor-wrapper div.jsoneditor .grid-column > select {
372373
margin-left: 188px;
373374
background-color: #fff;
375+
top: 12px;
374376
}
375377
.jsoneditor-wrapper div.jsoneditor .grid-row .grid-column {
376378
position: relative;

openwisp_controller/config/tests/test_config.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
from .. import settings as app_settings
1414
from ..base.base import logger as base_config_logger
1515
from ..signals import config_backend_changed, config_modified, config_status_changed
16-
from .utils import CreateConfigTemplateMixin, CreateDeviceGroupMixin, TestVpnX509Mixin
16+
from .utils import (
17+
CreateConfigTemplateMixin,
18+
CreateDeviceGroupMixin,
19+
TestVpnX509Mixin,
20+
TestWireguardVpnMixin,
21+
)
1722

1823
Config = load_model("config", "Config")
1924
Device = load_model("config", "Device")
@@ -906,6 +911,7 @@ def test_config_backend_changed(self):
906911
class TestTransactionConfig(
907912
CreateConfigTemplateMixin,
908913
TestVpnX509Mixin,
914+
TestWireguardVpnMixin,
909915
TransactionTestCase,
910916
):
911917
def test_multiple_vpn_client_templates_same_vpn(self):
@@ -983,3 +989,14 @@ def test_certificate_renew_invalidates_checksum_cache(self):
983989
self.assertNotEqual(config.get_cached_checksum(), old_checksum)
984990
config.refresh_from_db()
985991
self.assertEqual(config.status, "modified")
992+
993+
def test_checksum_db_accounts_for_vpnclient(self):
994+
vpn = self._create_wireguard_vpn()
995+
vpn_template = self._create_template(
996+
name="vpn1-template", type="vpn", vpn=vpn, config={}
997+
)
998+
config = self._create_config(organization=self._get_org())
999+
config.templates.add(vpn_template)
1000+
config.refresh_from_db()
1001+
config._invalidate_backend_instance_cache()
1002+
self.assertEqual(config.checksum, config.checksum_db)

0 commit comments

Comments
 (0)