mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Adds authorization roles administrator dashboard
This commit is contained in:
1 parent
290af03c83
commit
1df31515fb
191 files changed
+6189
-806
No files matched your search
@@ -176,15 +176,15 @@ main {
|
||||
}
|
||||
|
||||
.transparent {
|
||||
background-color: transparent;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0px;
|
||||
border: 0px !important;
|
||||
}
|
||||
|
||||
.no-underline {
|
||||
text-decoration: none;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
@@ -272,6 +272,13 @@ main {
|
||||
text-shadow: var(--highlight-color) 2px 2px 2px;
|
||||
}
|
||||
|
||||
.inset-panel {
|
||||
border-top: #000 1px solid;
|
||||
border-left: #000 1px solid;
|
||||
border-right: #777 1px solid;
|
||||
border-bottom: #999 1px solid;
|
||||
}
|
||||
|
||||
.engraved-panel {
|
||||
background-color: #00000033;
|
||||
border-radius: 5px;
|
||||
|
||||
@@ -417,7 +417,7 @@ function renderAddressBar(pathSegments) {
|
||||
/**
|
||||
* Handle the change event for the comboboxes inside the path-segments.
|
||||
* This function is triggered when any of the comboboxes (checkboxes) in the navigation bar is toggled.
|
||||
* @param {Event} event - The change event object.
|
||||
* @param {Event} e - The change event object.
|
||||
*/
|
||||
async function handlePathSegmentComboboxChangeAsync(e) {
|
||||
// ensure the event was triggered by an element with the 'navigator-toggle-checkbox' class
|
||||
@@ -961,7 +961,7 @@ async function handleFileSystemEntityMouseUpAsync(e) {
|
||||
|
||||
/**
|
||||
* Handler for the mouse down event of file system browser dialog files and directories elements.
|
||||
* @param {any} event
|
||||
* @param {MouseEvent} e - The mouse event whose propagation is stopped.
|
||||
*/
|
||||
function handleFileSystemEntityMouseDown(e) {
|
||||
// stop the event from bubbling up to the explorer - we dont want to start selection rectangles when clicking files or directories
|
||||
|
||||
@@ -95,6 +95,110 @@ async function callApiPostAsync(url, data, options = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a PUT request to the specified API endpoint.
|
||||
* @param {string} url - The API endpoint URL.
|
||||
* @param {Object} data - The data to send in the request body.
|
||||
* @param {Object} [options] - Additional options for the request.
|
||||
* @param {boolean} [options.useAntiForgery=true] - Whether to include anti-forgery token.
|
||||
* @param {Object} [options.headers] - Additional headers to include.
|
||||
* @returns {Promise<any>} The response data if successful, undefined otherwise.
|
||||
*/
|
||||
async function callApiPutAsync(url, data, options = {}) {
|
||||
const defaultOptions = {
|
||||
useAntiForgery: true,
|
||||
headers: {}
|
||||
};
|
||||
const finalOptions = { ...defaultOptions, ...options };
|
||||
try {
|
||||
// prepare headers
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
...finalOptions.headers
|
||||
};
|
||||
// add anti-forgery token if enabled
|
||||
if (finalOptions.useAntiForgery) {
|
||||
const token = document.querySelector('input[name="__RequestVerificationToken"]')?.value;
|
||||
if (token)
|
||||
headers['RequestVerificationToken'] = token;
|
||||
}
|
||||
// make the request
|
||||
const response = await fetch(url, {
|
||||
method: 'PUT',
|
||||
headers: headers,
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
window.location.href = response.url;
|
||||
else {
|
||||
if (!response.ok)
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
const jsonResponse = await response.json();
|
||||
if (jsonResponse.success) {
|
||||
if (jsonResponse.message)
|
||||
notificationService.show(jsonResponse.message, NotificationType.SUCCESS);
|
||||
return jsonResponse.data;
|
||||
}
|
||||
else
|
||||
notificationService.show(jsonResponse.errorMessage, NotificationType.ERROR);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
notificationService.show(error, NotificationType.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE request to the specified API endpoint.
|
||||
* @param {string} url - The API endpoint URL.
|
||||
* @param {Object} [options] - Additional options for the request.
|
||||
* @param {boolean} [options.useAntiForgery=true] - Whether to include anti-forgery token.
|
||||
* @param {Object} [options.headers] - Additional headers to include.
|
||||
* @returns {Promise<any>} The response data if successful, undefined otherwise.
|
||||
*/
|
||||
async function callApiDeleteAsync(url, options = {}) {
|
||||
const defaultOptions = {
|
||||
useAntiForgery: true,
|
||||
headers: {}
|
||||
};
|
||||
const finalOptions = { ...defaultOptions, ...options };
|
||||
try {
|
||||
// prepare headers
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
...finalOptions.headers
|
||||
};
|
||||
// add anti-forgery token if enabled
|
||||
if (finalOptions.useAntiForgery) {
|
||||
const token = document.querySelector('input[name="__RequestVerificationToken"]')?.value;
|
||||
if (token)
|
||||
headers['RequestVerificationToken'] = token;
|
||||
}
|
||||
// make the request
|
||||
const response = await fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: headers
|
||||
});
|
||||
if (response.redirected) // if a redirect is requested, perform it
|
||||
window.location.href = response.url;
|
||||
else {
|
||||
if (!response.ok)
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
const jsonResponse = await response.json();
|
||||
if (jsonResponse.success) {
|
||||
if (jsonResponse.message)
|
||||
notificationService.show(jsonResponse.message, NotificationType.SUCCESS);
|
||||
return jsonResponse.success;
|
||||
}
|
||||
else
|
||||
notificationService.show(jsonResponse.errorMessage, NotificationType.ERROR);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
notificationService.show(error, NotificationType.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
//+======================================================================================+
|
||||
//| Website navigation |
|
||||
//+======================================================================================+
|
||||
@@ -224,9 +328,9 @@ async function updateContent(url, addToHistory) {
|
||||
newScript.textContent = `
|
||||
(function() {
|
||||
const safeGetElement = (id) => document.getElementById(id);
|
||||
const safeAddEventListener = (element, event, handler) => {
|
||||
const safeAddEventListener = (element, e, handler) => {
|
||||
if (element)
|
||||
element.addEventListener(event, handler);
|
||||
element.addEventListener(e, handler);
|
||||
};
|
||||
${script.textContent}
|
||||
})();
|
||||
@@ -251,7 +355,7 @@ async function updateContent(url, addToHistory) {
|
||||
history.pushState(state, title, url);
|
||||
}
|
||||
} catch (error) {
|
||||
notificationService.show('Navigation failed', NotificationType.ERROR);
|
||||
notificationService.show(jsLocalizedMessages.navigationFailed, NotificationType.ERROR);
|
||||
console.error('Navigation failed:', error);
|
||||
}
|
||||
}
|
||||
@@ -417,11 +521,11 @@ function getScrollbarWidth() {
|
||||
|
||||
/**
|
||||
* Handles the wheel event for horizontal scrolling.
|
||||
* @param {WheelEvent} event - The wheel event object.
|
||||
* @param {WheelEvent} e - The wheel event object.
|
||||
*/
|
||||
const scrollHandler = function (event) {
|
||||
event.preventDefault();
|
||||
this.scrollLeft += (event.deltaY > 0 ? 1 : -1) * 80;
|
||||
const scrollHandler = function (e) {
|
||||
e.preventDefault();
|
||||
this.scrollLeft += (e.deltaY > 0 ? 1 : -1) * 80;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user