Skip to content

Commit 9592b9b

Browse files
authored
Improved css, updated sweetalert2, and added new config confirmation prompt (#237)
1 parent 86e8092 commit 9592b9b

File tree

8 files changed

+114
-65
lines changed

8 files changed

+114
-65
lines changed

apprise_api/api/templates/base.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h1>{% trans "Apprise API" %}</h1>
5151
<a class="collection-item" href="{% url 'config' DEFAULT_CONFIG_ID %}"><i class="material-icons">settings</i>
5252
{% trans "Configuration Manager" %}</a>
5353
{% if not CONFIG_LOCK %}
54-
<a class="collection-item" href="{% url 'config' UNIQUE_CONFIG_ID %}"><i class="material-icons">refresh</i>
54+
<a class="collection-item" id='cfg-gen' href="{% url 'config' UNIQUE_CONFIG_ID %}"><i class="material-icons">refresh</i>
5555
{% trans "New Configuration" %}</a>
5656
{% endif %}
5757
</ul>
@@ -144,6 +144,22 @@ <h4><i class="material-icons" style="color: orange">warning</i>&nbsp;{% trans "A
144144
}
145145
});
146146
}
147+
document.querySelector('#cfg-gen').addEventListener('click', function(e) {
148+
e.preventDefault();
149+
150+
Swal.fire({
151+
title: '{% trans "New Configuration" %}',
152+
html: `{% blocktrans with default_config_id=DEFAULT_CONFIG_ID %}This will generate a new Apprise configuration ID and transition over to it. It is important that you have bookmarked or noted the current ID <code>{{ default_config_id }}</code> before continuing. Do you still wish to proceed?{% endblocktrans %}`,
153+
icon: "warning",
154+
showCancelButton: true,
155+
confirmButtonText: '{% trans "Yes" %}',
156+
cancelButtonText: '{% trans "No" %}'
157+
}).then((result) => {
158+
if (result.isConfirmed) {
159+
window.location.href = e.target.href;
160+
}
161+
});
162+
});
147163
</script>
148164
</body>
149165

apprise_api/api/templates/config.html

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -515,25 +515,25 @@ <h4>{% trans "Persistent Store Endpoints" %}</h4>
515515
main_init();
516516

517517
// user notification
518-
Swal.fire(
519-
'{% trans "Save" %}',
520-
'{% trans "Successfully saved the specified URL(s)." %}',
521-
'success'
522-
);
518+
Swal.fire({
519+
title: '{% trans "Save" %}',
520+
html: '{% trans "Successfully saved the specified URL(s)." %}',
521+
icon: 'success'
522+
});
523523
} else if(response.status == 500) {
524524
// Disk issue
525-
Swal.fire(
526-
'{% trans "Save" %}',
527-
'{% trans "There was an issue writing the configuration to disk. Check your file permissions and try again." %}',
528-
'error'
529-
);
525+
Swal.fire({
526+
title: '{% trans "Save" %}',
527+
html: '{% trans "There was an issue writing the configuration to disk. Check your file permissions and try again." %}',
528+
icon: 'error'
529+
});
530530
} else {
531531
// user notification
532-
Swal.fire(
533-
'{% trans "Save" %}',
534-
'{% trans "Failed to save the specified URL(s). Check your syntax and try again." %}',
535-
'error'
536-
);
532+
Swal.fire({
533+
title: '{% trans "Save" %}',
534+
html: '{% trans "Failed to save the specified URL(s). Check your syntax and try again." %}',
535+
icon: 'error'
536+
});
537537
}
538538
});
539539
} else {
@@ -549,18 +549,18 @@ <h4>{% trans "Persistent Store Endpoints" %}</h4>
549549
main_init();
550550

551551
// user notification
552-
Swal.fire(
553-
'{% trans "Delete" %}',
554-
'{% trans "Successfully removed configuration." %}',
555-
'success'
556-
);
552+
Swal.fire({
553+
title: '{% trans "Delete" %}',
554+
html: '{% trans "Successfully removed configuration." %}',
555+
icon: 'success'
556+
});
557557
} else {
558558
// user notification
559-
Swal.fire(
560-
'{% trans "Delete" %}',
561-
'{% trans "There was an issue removing the configuration." %}',
562-
'error'
563-
);
559+
Swal.fire({
560+
title: '{% trans "Delete" %}',
561+
html: '{% trans "There was an issue removing the configuration." %}',
562+
icon: 'error'
563+
});
564564
}
565565
});
566566
}
@@ -655,10 +655,10 @@ <h4>{% trans "Persistent Store Endpoints" %}</h4>
655655
const form = new FormData(this);
656656

657657
// perform our notification
658-
Swal.fire(
659-
'{% trans "Notification" %}',
660-
'{% trans "Sending notification(s)..." %}',
661-
);
658+
Swal.fire({
659+
title: '{% trans "Notification" %}',
660+
html: '{% trans "Sending notification(s)..." %}',
661+
});
662662
Swal.showLoading()
663663
let response = fetch('{% url "notify" key %}', {
664664
method: 'POST',
@@ -672,25 +672,28 @@ <h4>{% trans "Persistent Store Endpoints" %}</h4>
672672
if(response.status == 200)
673673
{
674674
// user notification
675-
Swal.fire(
676-
'{% trans "Notification" %}',
677-
'{% trans "Successfully sent the notification(s)." %}' + html,
678-
'success'
679-
);
675+
Swal.fire({
676+
title: '{% trans "Notification" %}',
677+
html: '{% trans "Successfully sent the notification(s)." %}' + html,
678+
icon: 'success',
679+
width: '80em'
680+
});
680681
} else if(response.status == 424) {
681682
// user notification
682-
Swal.fire(
683-
'{% trans "Notification" %}',
684-
'{% trans "One or more of the notification(s) were not sent." %}' + html,
685-
'warning'
686-
);
683+
Swal.fire({
684+
title: '{% trans "Notification" %}',
685+
html: '{% trans "One or more of the notification(s) were not sent." %}' + html,
686+
icon: 'warning',
687+
width: '80em'
688+
});
687689
} else {
688690
// user notification
689-
Swal.fire(
690-
'{% trans "Notification" %}',
691-
'{% trans "Failed to send the notification(s)." %}' + html,
692-
'error'
693-
);
691+
Swal.fire({
692+
title: '{% trans "Notification" %}',
693+
html: '{% trans "Failed to send the notification(s)." %}' + html,
694+
icon: 'error',
695+
width: '80em'
696+
});
694697
}
695698
});
696699
});

apprise_api/api/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,11 +783,13 @@ def post(self, request, key):
783783
if not content.get('attachment'):
784784
if 'attachment' in request.POST:
785785
# Acquire attachments to work with them
786-
content['attachment'] = request.POST.getlist('attachment')
786+
content['attachment'] = \
787+
[a for a in request.POST.getlist('attachment') if isinstance(a, str) and a.strip()]
787788

788789
elif 'attach' in request.POST:
789790
# Acquire kw (alias) attach to work with them
790-
content['attachment'] = request.POST.getlist('attach')
791+
content['attachment'] = \
792+
[a for a in request.POST.getlist('attach') if isinstance(a, str) and a.strip()]
791793

792794
elif content.get('attach'):
793795
# Acquire kw (alias) attach from payload to work with

apprise_api/static/css/base.css

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -189,22 +189,6 @@ ul.logs li div.log_msg {
189189
flex: 1;
190190
}
191191

192-
ul.logs li.log_INFO {
193-
color: black;
194-
}
195-
196-
ul.logs li.log_DEBUG {
197-
color: #606060;
198-
}
199-
200-
ul.logs li.log_WARNING {
201-
color: orange;
202-
}
203-
204-
ul.logs li.log_ERROR {
205-
color: #8B0000;
206-
}
207-
208192
.url-enabled {
209193
color:#004d40;
210194
}

apprise_api/static/css/theme-dark.min.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,8 +1335,10 @@ input[type=range]::-ms-thumb {
13351335

13361336
.swal2-popup {
13371337
background-color: #2e3440;
1338+
color: #e5e9f0;
13381339
}
13391340

1341+
13401342
.swal-icon--success__ring {
13411343
border: 4px solid rgba(194, 26, 90, 0.2);
13421344
}
@@ -1380,3 +1382,24 @@ input[type=range]::-ms-thumb {
13801382
.swal-icon--info:before {
13811383
background-color: #d119c8;
13821384
}
1385+
1386+
ul.logs {
1387+
background-color: #1b1e26;
1388+
color: #e5e9f0;
1389+
}
1390+
1391+
ul.logs li.log_INFO {
1392+
color: #e5e9f0;
1393+
}
1394+
1395+
ul.logs li.log_DEBUG {
1396+
color: #606060;
1397+
}
1398+
1399+
ul.logs li.log_WARNING {
1400+
color: orange;
1401+
}
1402+
1403+
ul.logs li.log_ERROR {
1404+
color: #8B0000;
1405+
}

apprise_api/static/css/theme-light.min.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@
2727
color: #fff;
2828
background-color: #258528!important;
2929
}
30+
31+
32+
ul.logs li.log_INFO {
33+
color: black;
34+
}
35+
36+
ul.logs li.log_DEBUG {
37+
color: #606060;
38+
}
39+
40+
ul.logs li.log_WARNING {
41+
color: orange;
42+
}
43+
44+
ul.logs li.log_ERROR {
45+
color: #8B0000;
46+
}

apprise_api/static/js/sweetalert2.all.min.js

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apprise_api/static/licenses/sweetalert2-9.5.4.LICENSE renamed to apprise_api/static/licenses/sweetalert2-11.17.2.LICENSE

File renamed without changes.

0 commit comments

Comments
 (0)