mirror of
https://github.com/DumbWareio/DumbAssets.git
synced 2026-02-20 00:24:29 +08:00
* Update README.md Added maintenance feature Added tagging feature Added dependencies * Include Global filters for Event List Enhanced updateEventsDisplay() method - Now respects both local events filters (All, Warranty, Maintenance) AND global dashboard filters (Components, Warranties, Expired, Within 30 days, Within 60 days, Active) Updated Dashboard Card Click Handlers - Now call updateEventsDisplay() when dashboard filters are applied Enhanced initializeEventsSection() - Ensures events are properly filtered from the start Added refreshEventsDisplay() method - Public method for external refreshing of events * Updated/Fixed "Active" filtering logic The "Active" filter had an incorrect third condition that was including assets with ANY component warranties, regardless of whether those warranties were actually active or expired. * Fixed EventList updating The issue was that sectionVisibility was a local variable in the renderDashboard method, so it wasn't accessible in the click handler scope when the dashboard cards were clicked later. * add logging for event list debug * Fix Event List updating The Problem The Events list wasn't updating when global dashboard filters were clicked because of a variable scope issue: Two separate dashboardFilter variables existed: One in main script.js (returned by getDashboardFilter()) One in listRenderer.js (updated by updateDashboardFilter()) The dashboard manager was reading from one variable but updating another: getDashboardFilter() returned the main script's dashboardFilter (always stayed "all") updateDashboardFilter() updated the list renderer's dashboardFilter The Fix I created a local updateDashboardFilter function in the main script that: Updates the local dashboardFilter variable (the one getDashboardFilter() returns) Calls the list renderer's updateDashboardFilter to keep both in sync * Implement Export Function Add export CSV functionality into Settings > System modal * Fixed export button Problem: The middleware/demo.js file was using ES6 export syntax, but the server was importing it using CommonJS require() * export UI update * Add simple csv export * Removed placeholder logos with correct Removed placeholder logos and placed real logo into public > assets > images * remove white background from logo svg * enlarge svg logo * Include asset name with Warranty notifications Add asset bane to warranty notifications so its formatted as: ⏰ Warranty Expiring in 7 days Asset: Dell OptiPlex 7010 Model #: OptiPlex-7010 Warranty Expires: 2024-01-15 🔗 View Asset: http://localhost:3000?ass=12345
17 lines
612 B
JavaScript
17 lines
612 B
JavaScript
const DEMO_MODE = process.env.DEMO_MODE === 'true';
|
|
|
|
function demoModeMiddleware(req, res, next) {
|
|
if (DEMO_MODE && (req.method === 'POST' || req.method === 'PUT' || req.method === 'DELETE' || req.method === 'PATCH')) {
|
|
// If in demo mode, block write operations
|
|
console.warn(`Demo mode: Write operation attempted: METHOD: ${req.method}, IP: ${req.ip}, ORIGIN: ${req.headers.referer || req.headers.origin}`);
|
|
return res.status(403).json({
|
|
error: 'Operation disabled in demo mode 🫠',
|
|
demoMode: true
|
|
});
|
|
}
|
|
next();
|
|
}
|
|
|
|
module.exports = {
|
|
demoModeMiddleware,
|
|
} |