-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Event Log Notification Settings UI (#295)
- Introduce UI for superadmins to manage event log notification preferences. - Allows subscriptions to specific events or critical events only.
- Loading branch information
1 parent
c02193f
commit 53e9345
Showing
9 changed files
with
183 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"course_created": { | ||
"name": "Course Created", | ||
"description": "Keep track of newly created content in the system.", | ||
"priority": "moderate" | ||
}, | ||
"course_deleted": { | ||
"name": "Course Deleted", | ||
"description": "Monitor this to prevent accidental or unauthorized deletions.", | ||
"priority": "high" | ||
}, | ||
"user_registered": { | ||
"name": "User Registered", | ||
"description": "Useful for tracking platform growth and user engagement.", | ||
"priority": "low" | ||
}, | ||
"login_failed": { | ||
"name": "Failed Login Attempt", | ||
"description": "This could indicate a potential security breach or unauthorized access attempt.", | ||
"priority": "critical" | ||
}, | ||
"admin_login": { | ||
"name": "Admin Login", | ||
"description": "Regular logins ensure accountability for administrative actions.", | ||
"priority": "critical" | ||
}, | ||
"sensitive_data_export": { | ||
"name": "Sensitive Data Export", | ||
"description": "Monitor to prevent misuse or data breaches.", | ||
"priority": "high" | ||
}, | ||
"staff_privilege_modified": { | ||
"name": "Staff Privilege Modified", | ||
"description": "Track these changes to ensure roles and permissions align with organizational policies.", | ||
"priority": "moderate" | ||
}, | ||
"course_updated": { | ||
"name": "Course Updated", | ||
"description": "Helps maintain an accurate course record.", | ||
"priority": "low" | ||
}, | ||
"account_deactivated": { | ||
"name": "Account Deactivated", | ||
"description": "Useful for tracking account management and preventing unauthorized actions.", | ||
"priority": "moderate" | ||
}, | ||
"super_admin_added": { | ||
"name": "Super Admin Added", | ||
"description": "Ensure this is authorized as super admins have elevated privileges.", | ||
"priority": "high" | ||
} | ||
} |
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,65 @@ | ||
<form action="#" method="POST" x-data="{ notificationPreference: 'all-critical-events' }"> | ||
<div class="py-6 px-8"> | ||
<fieldset> | ||
<legend class="text-base/6 font-semibold text-gray-900">What needs to be notified?</legend> | ||
<div class="mt-4 space-y-4"> | ||
<div class="flex items-start"> | ||
<div class="flex h-6 items-center"> | ||
<input id="all-critical-issues" name="notification-preference" type="radio" value="all-critical-events" x-model="notificationPreference" class="size-4 border-gray-300 text-emerald-600 focus:ring-emerald-500" checked> | ||
</div> | ||
<div class="ml-3 text-sm/6 relative "> | ||
<label for="all-critical-issues" class="font-medium text-gray-900"> | ||
All Critical Events | ||
<span class="inline-block align-middle relative group cursor-help"> | ||
<svg class="shrink-0 size-4 text-gray-500 dark:text-neutral-400" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
<circle cx="12" cy="12" r="10"></circle> | ||
<path d="M12 16v-4"></path> | ||
<path d="M12 8h.01"></path> | ||
</svg> | ||
<div class="w-52 sm:w-96 p-4 left-full top-1/2 ml-2 transform sm:-translate-y-1/2 group-hover:opacity-100 group-hover:visible opacity-0 invisible transition-opacity absolute z-10 max-w-xs bg-white border border-gray-100 text-start rounded-xl shadow-md after:absolute after:top-0 after:-start-4 after:w-4 after:h-full" role="tooltip"> | ||
<p class="text-sm text-gray-700"> | ||
Critical events include <strong class="font-semibold text-gray-900">failed logins</strong>, <strong class="font-semibold text-gray-900">admin logins</strong>, <strong class="font-semibold text-gray-900">data exports</strong>, and <strong class="font-semibold text-gray-900">new super admins</strong>. | ||
These actions require immediate attention to ensure system security. | ||
</div> | ||
</span> | ||
</label> | ||
<p class="text-gray-500">Stay informed on high-priority issues, like security breaches or failed logins.</p> | ||
</div> | ||
</div> | ||
<div> | ||
<div class="flex items-start"> | ||
<div class="flex h-6 items-center"> | ||
<input id="only-selected-events" name="notification-preference" type="radio" value="only-selected-events" x-model="notificationPreference" class="size-4 border-gray-300 text-emerald-600 focus:ring-emerald-500"> | ||
</div> | ||
<div class="ml-3 text-sm/6"> | ||
<label for="only-selected-events" class="font-medium text-gray-900">Only Selected Events</label> | ||
<p class="text-gray-500">Choose specific events that matter to you, such as course deletions or user sign-ups.</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</fieldset> | ||
<div x-show="notificationPreference === 'only-selected-events'" class="px-4 py-6 sm:p-6"> | ||
<div class="grid lg:grid-cols-2 gap-3 lg:gap-5"> | ||
<!-- Checkbox --> | ||
{% for event_key, event_data in event_registry %} | ||
<label for="event-{{ event_key }}" class="py-3 px-4 flex text-sm bg-white text-gray-800 rounded-xl cursor-pointer rounded-xl ring-1 ring-gray-200 has-[:checked]:ring-2 has-[:checked]:ring-emerald-600 dark:bg-neutral-800 dark:text-neutral-200 dark:ring-neutral-700 dark:has-[:checked]:ring-emerald-500"> | ||
<input type="checkbox" id="event-{{ event_key }}" class="bg-transparent border-gray-200 text-emerald-600 rounded-full focus:ring-white focus:ring-offset-0 dark:text-emerald-500 dark:border-neutral-700 dark:focus:ring-neutral-800"> | ||
<span class="grow px-4"> | ||
<span class="block font-medium"> | ||
{{ event_data.name }} | ||
</span> | ||
<span class="block text-sm leading-6 text-gray-500 dark:text-neutral-500"> | ||
{{ event_data.description }} | ||
</span> | ||
</span> | ||
</label> | ||
{% endfor %} | ||
<!-- End Checkbox --> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="bg-gray-50 px-4 py-3 text-right sm:px-6"> | ||
<button type="submit" class="inline-flex justify-center rounded-md bg-emerald-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-600">Save</button> | ||
</div> | ||
</form> |
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,24 @@ | ||
<div class="lg:flex lg:items-end lg:justify-between"> | ||
<div class="min-w-0 flex-1"> | ||
<nav class="flex" aria-label="Breadcrumb"> | ||
<ol role="list" class="flex items-center space-x-4"> | ||
<li> | ||
<div class="flex"> | ||
<a href="{{'/testpress/events/list/'|url}}" class="text-sm font-medium text-gray-500 hover:text-gray-700">Settings</a> | ||
</div> | ||
</li> | ||
<li> | ||
<div class="flex items-center"> | ||
<svg class="size-5 shrink-0 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon"> | ||
<path fill-rule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" /> | ||
</svg> | ||
<a href="{{'/testpress/events/settings/'|url}}" class="ml-4 text-sm font-medium text-gray-500 hover:text-gray-700">Notification Preferences</a> | ||
</div> | ||
</li> | ||
</ol> | ||
</nav> | ||
<div class=""> | ||
<h1 class="mt-2 text-lg md:text-xl font-semibold text-gray-800">Notification Preferences</h1> | ||
</div> | ||
</div> | ||
</div> |
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,29 @@ | ||
--- | ||
title: Event Log Settings | ||
date: 2023-04-28 | ||
active_tab: settings | ||
--- | ||
|
||
{% extends "layouts/admin_base.html" %} | ||
|
||
{% block body_class %}overflow-y-scroll min-h-screen bg-gray-100{% endblock body_class %} | ||
{% block content %} | ||
<div class="max-w-7xl mx-auto xl:px-8 py-8 lg:grid lg:grid-cols-12 lg:gap-x-5"> | ||
{% include "partials/admin_sidebar.html" %} | ||
<div class="space-y-6 sm:px-6 lg:px-0 lg:col-span-9"> | ||
<div class="flex flex-1 flex-col bg-gray-100"> | ||
<div class="flex-1 px-4 sm:px-0"> | ||
{% include "./heading.html" %} | ||
<div class="sm:block mt-4"> | ||
<div class="mx-auto max-w-6xl "> | ||
<div class="min-w-full overflow-hidden overflow-x-auto align-middle shadow sm:rounded-lg bg-white"> | ||
{% include "src/testpress/events/tab.html" %} | ||
{% include './form.html' %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
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 @@ | ||
<div class="border-b border-gray-200 mx-4"> | ||
<nav class="-mb-px flex space-x-4" aria-label="Tabs"> | ||
<a href="{{'/testpress/events/list/'|url}}" class="{% if active_tab == 'list' %}border-emerald-500 text-emerald-600{% else %}border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700{% endif %}flex whitespace-nowrap border-b-2 px-1 py-4 text-sm font-medium"> Overview </a> | ||
<a href="{{'/testpress/events/settings/'|url}}" class="{% if active_tab == 'settings' %}border-emerald-500 text-emerald-600{% else %}border-transparent text-gray-500 hover:border-gray-200 hover:text-gray-700{% endif %}flex whitespace-nowrap border-b-2 px-1 py-4 text-sm font-medium"> Notification Preferences </a> | ||
</nav> | ||
</div> |