New Plugins: - USB plugin: Device checkout/checkin with employee lookup, checkout history - Notifications plugin: Announcements with types, scheduling, shopfloor display - Network plugin: Network device management with subnets and VLANs - Equipment and Computers plugins: Asset type separation Frontend: - EmployeeSearch component: Reusable employee lookup with autocomplete - USB views: List, detail, checkout/checkin modals - Notifications views: List, form with recognition mode - Network views: Device list, detail, form - Calendar view with FullCalendar integration - Shopfloor and TV dashboard views - Reports index page - Map editor for asset positioning - Light/dark mode fixes for map tooltips Backend: - Employee search API with external lookup service - Collector API for PowerShell data collection - Reports API endpoints - Slides API for TV dashboard - Fixed AppVersion model (removed BaseModel inheritance) - Added checkout_name column to usbcheckouts table Styling: - Unified detail page styles - Improved pagination (page numbers instead of prev/next) - Dark/light mode theme improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
376 lines
10 KiB
JavaScript
376 lines
10 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import { useAuthStore } from '../stores/auth'
|
|
|
|
// Views
|
|
import Login from '../views/Login.vue'
|
|
import AppLayout from '../views/AppLayout.vue'
|
|
import Dashboard from '../views/Dashboard.vue'
|
|
import MachinesList from '../views/machines/MachinesList.vue'
|
|
import MachineDetail from '../views/machines/MachineDetail.vue'
|
|
import MachineForm from '../views/machines/MachineForm.vue'
|
|
import PrintersList from '../views/printers/PrintersList.vue'
|
|
import PrinterDetail from '../views/printers/PrinterDetail.vue'
|
|
import PrinterForm from '../views/printers/PrinterForm.vue'
|
|
import PCsList from '../views/pcs/PCsList.vue'
|
|
import PCDetail from '../views/pcs/PCDetail.vue'
|
|
import PCForm from '../views/pcs/PCForm.vue'
|
|
import VendorsList from '../views/vendors/VendorsList.vue'
|
|
import ApplicationsList from '../views/applications/ApplicationsList.vue'
|
|
import ApplicationDetail from '../views/applications/ApplicationDetail.vue'
|
|
import ApplicationForm from '../views/applications/ApplicationForm.vue'
|
|
import KnowledgeBaseList from '../views/knowledgebase/KnowledgeBaseList.vue'
|
|
import KnowledgeBaseDetail from '../views/knowledgebase/KnowledgeBaseDetail.vue'
|
|
import KnowledgeBaseForm from '../views/knowledgebase/KnowledgeBaseForm.vue'
|
|
import SearchResults from '../views/SearchResults.vue'
|
|
import NotificationsList from '../views/notifications/NotificationsList.vue'
|
|
import NotificationForm from '../views/notifications/NotificationForm.vue'
|
|
import USBList from '../views/usb/USBList.vue'
|
|
import USBDetail from '../views/usb/USBDetail.vue'
|
|
import USBForm from '../views/usb/USBForm.vue'
|
|
import NetworkDevicesList from '../views/network/NetworkDevicesList.vue'
|
|
import NetworkDeviceDetail from '../views/network/NetworkDeviceDetail.vue'
|
|
import NetworkDeviceForm from '../views/network/NetworkDeviceForm.vue'
|
|
import ReportsIndex from '../views/reports/ReportsIndex.vue'
|
|
import CalendarView from '../views/CalendarView.vue'
|
|
import SettingsIndex from '../views/settings/SettingsIndex.vue'
|
|
import MachineTypesList from '../views/settings/MachineTypesList.vue'
|
|
import LocationsList from '../views/settings/LocationsList.vue'
|
|
import StatusesList from '../views/settings/StatusesList.vue'
|
|
import ModelsList from '../views/settings/ModelsList.vue'
|
|
import PCTypesList from '../views/settings/PCTypesList.vue'
|
|
import OperatingSystemsList from '../views/settings/OperatingSystemsList.vue'
|
|
import BusinessUnitsList from '../views/settings/BusinessUnitsList.vue'
|
|
import VLANsList from '../views/settings/VLANsList.vue'
|
|
import SubnetsList from '../views/settings/SubnetsList.vue'
|
|
import MapView from '../views/MapView.vue'
|
|
import MapEditor from '../views/MapEditor.vue'
|
|
import ShopfloorDashboard from '../views/ShopfloorDashboard.vue'
|
|
import TVDashboard from '../views/TVDashboard.vue'
|
|
import EmployeeDetail from '../views/employees/EmployeeDetail.vue'
|
|
|
|
const routes = [
|
|
{
|
|
path: '/login',
|
|
name: 'login',
|
|
component: Login,
|
|
meta: { guest: true }
|
|
},
|
|
// Standalone full-screen dashboards (no sidebar, no auth required)
|
|
{
|
|
path: '/shopfloor',
|
|
name: 'shopfloor',
|
|
component: ShopfloorDashboard
|
|
},
|
|
{
|
|
path: '/tv',
|
|
name: 'tv',
|
|
component: TVDashboard
|
|
},
|
|
{
|
|
path: '/',
|
|
component: AppLayout,
|
|
children: [
|
|
{
|
|
path: '',
|
|
name: 'dashboard',
|
|
component: Dashboard
|
|
},
|
|
{
|
|
path: 'search',
|
|
name: 'search',
|
|
component: SearchResults
|
|
},
|
|
{
|
|
path: 'machines',
|
|
name: 'machines',
|
|
component: MachinesList
|
|
},
|
|
{
|
|
path: 'machines/new',
|
|
name: 'machine-new',
|
|
component: MachineForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'machines/:id',
|
|
name: 'machine-detail',
|
|
component: MachineDetail
|
|
},
|
|
{
|
|
path: 'machines/:id/edit',
|
|
name: 'machine-edit',
|
|
component: MachineForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'printers',
|
|
name: 'printers',
|
|
component: PrintersList
|
|
},
|
|
{
|
|
path: 'printers/new',
|
|
name: 'printer-new',
|
|
component: PrinterForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'printers/:id',
|
|
name: 'printer-detail',
|
|
component: PrinterDetail
|
|
},
|
|
{
|
|
path: 'printers/:id/edit',
|
|
name: 'printer-edit',
|
|
component: PrinterForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'pcs',
|
|
name: 'pcs',
|
|
component: PCsList
|
|
},
|
|
{
|
|
path: 'pcs/new',
|
|
name: 'pc-new',
|
|
component: PCForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'pcs/:id',
|
|
name: 'pc-detail',
|
|
component: PCDetail
|
|
},
|
|
{
|
|
path: 'pcs/:id/edit',
|
|
name: 'pc-edit',
|
|
component: PCForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'map',
|
|
name: 'map',
|
|
component: MapView
|
|
},
|
|
{
|
|
path: 'map/editor',
|
|
name: 'map-editor',
|
|
component: MapEditor,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'applications',
|
|
name: 'applications',
|
|
component: ApplicationsList
|
|
},
|
|
{
|
|
path: 'applications/new',
|
|
name: 'application-new',
|
|
component: ApplicationForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'applications/:id',
|
|
name: 'application-detail',
|
|
component: ApplicationDetail
|
|
},
|
|
{
|
|
path: 'applications/:id/edit',
|
|
name: 'application-edit',
|
|
component: ApplicationForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'knowledgebase',
|
|
name: 'knowledgebase',
|
|
component: KnowledgeBaseList
|
|
},
|
|
{
|
|
path: 'knowledgebase/new',
|
|
name: 'knowledgebase-new',
|
|
component: KnowledgeBaseForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'knowledgebase/:id',
|
|
name: 'knowledgebase-detail',
|
|
component: KnowledgeBaseDetail
|
|
},
|
|
{
|
|
path: 'knowledgebase/:id/edit',
|
|
name: 'knowledgebase-edit',
|
|
component: KnowledgeBaseForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'notifications',
|
|
name: 'notifications',
|
|
component: NotificationsList
|
|
},
|
|
{
|
|
path: 'notifications/new',
|
|
name: 'notification-new',
|
|
component: NotificationForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'notifications/:id',
|
|
name: 'notification-detail',
|
|
component: NotificationForm
|
|
},
|
|
{
|
|
path: 'notifications/:id/edit',
|
|
name: 'notification-edit',
|
|
component: NotificationForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'usb',
|
|
name: 'usb',
|
|
component: USBList
|
|
},
|
|
{
|
|
path: 'usb/new',
|
|
name: 'usb-new',
|
|
component: USBForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'usb/:id',
|
|
name: 'usb-detail',
|
|
component: USBDetail
|
|
},
|
|
{
|
|
path: 'usb/:id/edit',
|
|
name: 'usb-edit',
|
|
component: USBForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'network',
|
|
name: 'network',
|
|
component: NetworkDevicesList
|
|
},
|
|
{
|
|
path: 'network/new',
|
|
name: 'network-new',
|
|
component: NetworkDeviceForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'network/:id',
|
|
name: 'network-detail',
|
|
component: NetworkDeviceDetail
|
|
},
|
|
{
|
|
path: 'network/:id/edit',
|
|
name: 'network-edit',
|
|
component: NetworkDeviceForm,
|
|
meta: { requiresAuth: true }
|
|
},
|
|
{
|
|
path: 'reports',
|
|
name: 'reports',
|
|
component: ReportsIndex
|
|
},
|
|
{
|
|
path: 'calendar',
|
|
name: 'calendar',
|
|
component: CalendarView
|
|
},
|
|
{
|
|
path: 'settings',
|
|
name: 'settings',
|
|
component: SettingsIndex,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/vendors',
|
|
name: 'vendors',
|
|
component: VendorsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/machinetypes',
|
|
name: 'machinetypes',
|
|
component: MachineTypesList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/locations',
|
|
name: 'locations',
|
|
component: LocationsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/statuses',
|
|
name: 'statuses',
|
|
component: StatusesList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/models',
|
|
name: 'models',
|
|
component: ModelsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/pctypes',
|
|
name: 'pctypes',
|
|
component: PCTypesList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/operatingsystems',
|
|
name: 'operatingsystems',
|
|
component: OperatingSystemsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/businessunits',
|
|
name: 'businessunits',
|
|
component: BusinessUnitsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/vlans',
|
|
name: 'vlans',
|
|
component: VLANsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'settings/subnets',
|
|
name: 'subnets',
|
|
component: SubnetsList,
|
|
meta: { requiresAuth: true, requiresAdmin: true }
|
|
},
|
|
{
|
|
path: 'employees/:sso',
|
|
name: 'employee-detail',
|
|
component: EmployeeDetail
|
|
}
|
|
]
|
|
}
|
|
]
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes
|
|
})
|
|
|
|
// Navigation guard
|
|
router.beforeEach((to, from, next) => {
|
|
const authStore = useAuthStore()
|
|
|
|
if (to.meta.requiresAuth && !authStore.isAuthenticated) {
|
|
next('/login')
|
|
} else if (to.meta.requiresAdmin && !authStore.isAdmin) {
|
|
next('/')
|
|
} else if (to.meta.guest && authStore.isAuthenticated) {
|
|
next('/')
|
|
} else {
|
|
next()
|
|
}
|
|
})
|
|
|
|
export default router
|