Update parser and project changes
This commit is contained in:
@@ -320,8 +320,8 @@ func (s *Server) handleGetSerials(w http.ResponseWriter, r *http.Request) {
|
||||
name = fru.Description
|
||||
}
|
||||
serials = append(serials, SerialEntry{
|
||||
Component: name,
|
||||
SerialNumber: strings.TrimSpace(fru.SerialNumber),
|
||||
Component: name,
|
||||
SerialNumber: strings.TrimSpace(fru.SerialNumber),
|
||||
Manufacturer: fru.Manufacturer,
|
||||
PartNumber: fru.PartNumber,
|
||||
Category: "FRU",
|
||||
@@ -591,16 +591,6 @@ func (s *Server) handleExportJSON(w http.ResponseWriter, r *http.Request) {
|
||||
exp.ExportJSON(w)
|
||||
}
|
||||
|
||||
func (s *Server) handleExportTXT(w http.ResponseWriter, r *http.Request) {
|
||||
result := s.GetResult()
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%q", exportFilename(result, "txt")))
|
||||
|
||||
exp := exporter.New(result)
|
||||
exp.ExportTXT(w)
|
||||
}
|
||||
|
||||
func (s *Server) handleExportReanimator(w http.ResponseWriter, r *http.Request) {
|
||||
result := s.GetResult()
|
||||
if result == nil || result.Hardware == nil {
|
||||
@@ -942,7 +932,7 @@ func exportFilename(result *models.AnalysisResult, ext string) string {
|
||||
sn = sanitizeFilenamePart(sn)
|
||||
ext = strings.TrimPrefix(strings.TrimSpace(ext), ".")
|
||||
if ext == "" {
|
||||
ext = "txt"
|
||||
ext = "json"
|
||||
}
|
||||
return fmt.Sprintf("%s (%s) - %s.%s", date, model, sn, ext)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type Server struct {
|
||||
result *models.AnalysisResult
|
||||
detectedVendor string
|
||||
|
||||
jobManager *JobManager
|
||||
jobManager *JobManager
|
||||
collectors *collector.Registry
|
||||
}
|
||||
|
||||
@@ -67,7 +67,6 @@ func (s *Server) setupRoutes() {
|
||||
s.mux.HandleFunc("GET /api/firmware", s.handleGetFirmware)
|
||||
s.mux.HandleFunc("GET /api/export/csv", s.handleExportCSV)
|
||||
s.mux.HandleFunc("GET /api/export/json", s.handleExportJSON)
|
||||
s.mux.HandleFunc("GET /api/export/txt", s.handleExportTXT)
|
||||
s.mux.HandleFunc("GET /api/export/reanimator", s.handleExportReanimator)
|
||||
s.mux.HandleFunc("DELETE /api/clear", s.handleClear)
|
||||
s.mux.HandleFunc("POST /api/shutdown", s.handleShutdown)
|
||||
|
||||
Reference in New Issue
Block a user