Testdata: show settings for current simulation (#48017)
Co-authored-by: An Le <an.le@grafana.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user