53c641800f
- GET /operational-states endpoint (9 States + 20 Transitions) - Frontend: Operational States page with state cards, transitions graph, delta preview - Navigation: Betriebszustaende entry between Grenzen and Normenrecherche - E2E: 60+ new Phase 5 tests (operational states, hazards, mitigations, classification) - E2E: Updated expected counts for expanded libraries (476 measures, 1114 patterns) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/breakpilot/ai-compliance-sdk/internal/iace"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// ListOperationalStates handles GET /operational-states
|
|
// Returns the 9 machine operational states with DE/EN labels and
|
|
// the 20 standard state transitions (directed edges of the state graph).
|
|
func (h *IACEHandler) ListOperationalStates(c *gin.Context) {
|
|
type stateInfo struct {
|
|
ID string `json:"id"`
|
|
LabelDE string `json:"label_de"`
|
|
LabelEN string `json:"label_en"`
|
|
Sort int `json:"sort_order"`
|
|
}
|
|
|
|
labels := []stateInfo{
|
|
{ID: "startup", LabelDE: "Hochfahren", LabelEN: "Startup", Sort: 1},
|
|
{ID: "homing", LabelDE: "Referenzfahrt", LabelEN: "Homing", Sort: 2},
|
|
{ID: "automatic_operation", LabelDE: "Automatikbetrieb", LabelEN: "Automatic Operation", Sort: 3},
|
|
{ID: "manual_operation", LabelDE: "Handbetrieb", LabelEN: "Manual Operation", Sort: 4},
|
|
{ID: "teach_mode", LabelDE: "Einrichtbetrieb", LabelEN: "Teach Mode", Sort: 5},
|
|
{ID: "maintenance", LabelDE: "Wartung", LabelEN: "Maintenance", Sort: 6},
|
|
{ID: "cleaning", LabelDE: "Reinigung", LabelEN: "Cleaning", Sort: 7},
|
|
{ID: "emergency_stop", LabelDE: "Not-Halt", LabelEN: "Emergency Stop", Sort: 8},
|
|
{ID: "recovery_mode", LabelDE: "Wiederanlauf", LabelEN: "Recovery Mode", Sort: 9},
|
|
}
|
|
|
|
transitions := iace.StandardStateTransitions()
|
|
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"operational_states": labels,
|
|
"transitions": transitions,
|
|
"total_states": len(labels),
|
|
"total_transitions": len(transitions),
|
|
})
|
|
}
|