Testdata: show settings for current simulation (#48017)

Co-authored-by: An Le <an.le@grafana.com>
This commit is contained in:
Ryan McKinley
2022-04-26 13:45:42 -07:00
committed by GitHub
co-authored by An Le
parent 0da50294fe
commit 5294a2af48
7 changed files with 116 additions and 41 deletions
-1
View File
@@ -224,7 +224,6 @@ func (s *SimulationEngine) GetSimulationHandler(rw http.ResponseWriter, req *htt
}
result = v
} else if strings.HasPrefix(path, "/sim/") {
rw.WriteHeader(400)
sim, err := s.getSimFromPath(path)
if err != nil {
http.Error(rw, err.Error(), http.StatusNotFound)
+5 -5
View File
@@ -98,11 +98,11 @@ func newFlightSimInfo() simulationInfo {
df.Fields = append(df.Fields, f)
return simulationInfo{
Type: "flight",
Name: "Flight",
Description: "simple circling airplain",
SetupFields: df,
OnlyForward: false,
Type: "flight",
Name: "Flight",
Description: "simple circling airplain",
ConfigFields: df,
OnlyForward: false,
create: func(cfg simulationState) (Simulation, error) {
s := &flightSim{
key: cfg.Key,
+5 -5
View File
@@ -134,11 +134,11 @@ func newTankSimInfo() simulationInfo {
df.Fields = append(df.Fields, data.NewField("pumpOn", nil, []bool{tc.PumpOn}))
return simulationInfo{
Type: "tank",
Name: "Tank",
Description: "Fill and drain a water tank",
SetupFields: df,
OnlyForward: false,
Type: "tank",
Name: "Tank",
Description: "Fill and drain a water tank",
ConfigFields: df,
OnlyForward: false,
create: func(cfg simulationState) (Simulation, error) {
s := &tankSim{
key: cfg.Key,
+5 -5
View File
@@ -32,11 +32,11 @@ type simulationState struct {
}
type simulationInfo struct {
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
OnlyForward bool `json:"forward"`
SetupFields *data.Frame `json:"setup"` // the default setup fields (and types)
Type string `json:"type"`
Name string `json:"name"`
Description string `json:"description"`
OnlyForward bool `json:"forward"`
ConfigFields *data.Frame `json:"config"`
// Create a simulation instance
create func(q simulationState) (Simulation, error)
+5 -5
View File
@@ -93,11 +93,11 @@ func newSinewaveInfo() simulationInfo {
df.Fields = append(df.Fields, f)
return simulationInfo{
Type: "sine",
Name: "Sine",
Description: "Sinewave generator",
SetupFields: df,
OnlyForward: false,
Type: "sine",
Name: "Sine",
Description: "Sinewave generator",
ConfigFields: df,
OnlyForward: false,
create: func(cfg simulationState) (Simulation, error) {
s := &waveformSim{
key: cfg.Key,