Migrate frontend to plugin-based asset architecture
- Add equipmentApi and computersApi to replace legacy machinesApi - Add controller vendor/model fields to Equipment model and forms - Fix map marker navigation to use plugin-specific IDs (equipmentid, computerid, printerid, networkdeviceid) instead of assetid - Fix search to use unified Asset table with correct plugin IDs - Remove legacy printer search that used non-existent field names - Enable optional JWT auth for detail endpoints (public read access) - Clean up USB plugin models (remove unused checkout model) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,7 @@ export const authApi = {
|
||||
}
|
||||
}
|
||||
|
||||
// Machines API
|
||||
// Machines API (legacy - use equipmentApi or computersApi instead)
|
||||
export const machinesApi = {
|
||||
list(params = {}) {
|
||||
return api.get('/machines', { params })
|
||||
@@ -86,6 +86,89 @@ export const machinesApi = {
|
||||
}
|
||||
}
|
||||
|
||||
// Equipment API (plugin)
|
||||
export const equipmentApi = {
|
||||
list(params = {}) {
|
||||
return api.get('/equipment', { params })
|
||||
},
|
||||
get(id) {
|
||||
return api.get(`/equipment/${id}`)
|
||||
},
|
||||
getByAsset(assetId) {
|
||||
return api.get(`/equipment/by-asset/${assetId}`)
|
||||
},
|
||||
create(data) {
|
||||
return api.post('/equipment', data)
|
||||
},
|
||||
update(id, data) {
|
||||
return api.put(`/equipment/${id}`, data)
|
||||
},
|
||||
delete(id) {
|
||||
return api.delete(`/equipment/${id}`)
|
||||
},
|
||||
dashboardSummary() {
|
||||
return api.get('/equipment/dashboard/summary')
|
||||
},
|
||||
// Equipment types
|
||||
types: {
|
||||
list(params = {}) {
|
||||
return api.get('/equipment/types', { params })
|
||||
},
|
||||
get(id) {
|
||||
return api.get(`/equipment/types/${id}`)
|
||||
},
|
||||
create(data) {
|
||||
return api.post('/equipment/types', data)
|
||||
},
|
||||
update(id, data) {
|
||||
return api.put(`/equipment/types/${id}`, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Computers API (plugin)
|
||||
export const computersApi = {
|
||||
list(params = {}) {
|
||||
return api.get('/computers', { params })
|
||||
},
|
||||
get(id) {
|
||||
return api.get(`/computers/${id}`)
|
||||
},
|
||||
getByAsset(assetId) {
|
||||
return api.get(`/computers/by-asset/${assetId}`)
|
||||
},
|
||||
getByHostname(hostname) {
|
||||
return api.get(`/computers/by-hostname/${hostname}`)
|
||||
},
|
||||
create(data) {
|
||||
return api.post('/computers', data)
|
||||
},
|
||||
update(id, data) {
|
||||
return api.put(`/computers/${id}`, data)
|
||||
},
|
||||
delete(id) {
|
||||
return api.delete(`/computers/${id}`)
|
||||
},
|
||||
dashboardSummary() {
|
||||
return api.get('/computers/dashboard/summary')
|
||||
},
|
||||
// Computer types
|
||||
types: {
|
||||
list(params = {}) {
|
||||
return api.get('/computers/types', { params })
|
||||
},
|
||||
get(id) {
|
||||
return api.get(`/computers/types/${id}`)
|
||||
},
|
||||
create(data) {
|
||||
return api.post('/computers/types', data)
|
||||
},
|
||||
update(id, data) {
|
||||
return api.put(`/computers/types/${id}`, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Relationship Types API
|
||||
export const relationshipTypesApi = {
|
||||
list() {
|
||||
|
||||
Reference in New Issue
Block a user