fix: DockerSecretsResolver - don't normalize absolute paths like /var/www/html/...
Some checks failed
Deploy Application / deploy (push) Has been cancelled
Some checks failed
Deploy Application / deploy (push) Has been cancelled
This commit is contained in:
98
resources/js/modules/common/index.js
Normal file
98
resources/js/modules/common/index.js
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Common Utilities Module
|
||||
*
|
||||
* Provides shared utilities and helpers used across the application
|
||||
*/
|
||||
|
||||
import { ActionHandler } from './ActionHandler.js';
|
||||
import { dockerContainerHandler, genericApiHandler, bulkOperationsHandler, defaultHandler } from './ActionHandlers.js';
|
||||
|
||||
// Export ActionHandler and handlers
|
||||
export { ActionHandler };
|
||||
export { dockerContainerHandler, genericApiHandler, bulkOperationsHandler, defaultHandler };
|
||||
|
||||
// Make ActionHandler globally available for easy access
|
||||
if (typeof window !== 'undefined') {
|
||||
window.ActionHandler = ActionHandler;
|
||||
window.ActionHandlers = {
|
||||
dockerContainer: dockerContainerHandler,
|
||||
genericApi: genericApiHandler,
|
||||
bulkOperations: bulkOperationsHandler,
|
||||
default: defaultHandler
|
||||
};
|
||||
}
|
||||
|
||||
// Framework module definition
|
||||
export const definition = {
|
||||
name: 'common',
|
||||
version: '1.0.0',
|
||||
dependencies: [],
|
||||
provides: ['ActionHandler'],
|
||||
priority: 0
|
||||
};
|
||||
|
||||
// Framework module initialization
|
||||
export async function init(config = {}, state = {}) {
|
||||
console.log('[Common] Module initialized');
|
||||
|
||||
// Auto-initialize ActionHandlers for elements with data-action-handler attribute
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const containers = document.querySelectorAll('[data-action-handler-container]');
|
||||
containers.forEach(container => {
|
||||
const selector = container.dataset.actionHandlerContainer || container.className.split(' ')[0];
|
||||
const handlerName = container.dataset.actionHandler || 'default';
|
||||
|
||||
const handler = new ActionHandler(selector, {
|
||||
csrfTokenSelector: '[data-live-component]',
|
||||
autoRefresh: true
|
||||
});
|
||||
|
||||
// Register handler if specified
|
||||
if (handlerName && window.ActionHandlers[handlerName]) {
|
||||
handler.registerHandler(handlerName, window.ActionHandlers[handlerName]);
|
||||
}
|
||||
|
||||
// Store handler on element for debugging
|
||||
container.actionHandler = handler;
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
ActionHandler,
|
||||
handlers: {
|
||||
dockerContainer: dockerContainerHandler,
|
||||
genericApi: genericApiHandler,
|
||||
bulkOperations: bulkOperationsHandler,
|
||||
default: defaultHandler
|
||||
},
|
||||
state
|
||||
};
|
||||
}
|
||||
|
||||
// Framework DOM element initialization
|
||||
export function initElement(element, options = {}) {
|
||||
// Check if element needs ActionHandler
|
||||
if (element.hasAttribute('data-action-handler-container')) {
|
||||
const selector = element.dataset.actionHandlerContainer || `.${element.className.split(' ')[0]}`;
|
||||
const handlerName = element.dataset.actionHandler || 'default';
|
||||
|
||||
const handler = new ActionHandler(selector, {
|
||||
csrfTokenSelector: '[data-live-component]',
|
||||
autoRefresh: true,
|
||||
...options
|
||||
});
|
||||
|
||||
// Register handler if specified
|
||||
if (handlerName && window.ActionHandlers?.[handlerName]) {
|
||||
handler.registerHandler(handlerName, window.ActionHandlers[handlerName]);
|
||||
}
|
||||
|
||||
// Store handler on element
|
||||
element.actionHandler = handler;
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user