Update layouts key from telegraf_measurements to measurements
parent
c2fa11c28c
commit
126fb60686
|
@ -32,7 +32,7 @@ func layoutToMrF(l *models.Layout) mrfusion.Layout {
|
|||
}
|
||||
return mrfusion.Layout{
|
||||
ID: l.ID,
|
||||
Measurement: *l.TelegrafMeasurement,
|
||||
Measurement: *l.Measurement,
|
||||
Application: *l.App,
|
||||
Cells: cells,
|
||||
}
|
||||
|
@ -83,10 +83,10 @@ func layoutToModel(l mrfusion.Layout) *models.Layout {
|
|||
Href: &href,
|
||||
Rel: &rel,
|
||||
},
|
||||
Cells: cells,
|
||||
TelegrafMeasurement: &l.Measurement,
|
||||
App: &l.Application,
|
||||
ID: l.ID,
|
||||
Cells: cells,
|
||||
Measurement: &l.Measurement,
|
||||
App: &l.Application,
|
||||
ID: l.ID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ func (h *Store) Layouts(ctx context.Context, params op.GetLayoutsParams) middlew
|
|||
filtered[a] = true
|
||||
}
|
||||
|
||||
for _, m := range params.TelegrafMeasurements {
|
||||
for _, m := range params.Measurements {
|
||||
filtered[m] = true
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ func TestNewLayout(t *testing.T) {
|
|||
Desc: "Test that an error in datastore returns 500 status",
|
||||
AddError: errors.New("error"),
|
||||
NewLayout: &models.Layout{
|
||||
TelegrafMeasurement: new(string),
|
||||
App: new(string),
|
||||
Measurement: new(string),
|
||||
App: new(string),
|
||||
Cells: []*models.Cell{
|
||||
&models.Cell{
|
||||
X: new(int32),
|
||||
|
@ -47,8 +47,8 @@ func TestNewLayout(t *testing.T) {
|
|||
Desc: "Test that creating a layout returns 201 status",
|
||||
ExistingLayouts: map[string]mrfusion.Layout{},
|
||||
NewLayout: &models.Layout{
|
||||
TelegrafMeasurement: new(string),
|
||||
App: new(string),
|
||||
Measurement: new(string),
|
||||
App: new(string),
|
||||
Cells: []*models.Cell{
|
||||
&models.Cell{
|
||||
X: new(int32),
|
||||
|
|
|
@ -41,7 +41,7 @@ type Layout struct {
|
|||
|
||||
Required: true
|
||||
*/
|
||||
TelegrafMeasurement *string `json:"telegraf_measurement"`
|
||||
Measurement *string `json:"measurement"`
|
||||
}
|
||||
|
||||
// Validate validates this layout
|
||||
|
@ -63,7 +63,7 @@ func (m *Layout) Validate(formats strfmt.Registry) error {
|
|||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateTelegrafMeasurement(formats); err != nil {
|
||||
if err := m.validateMeasurement(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
@ -123,9 +123,9 @@ func (m *Layout) validateLink(formats strfmt.Registry) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *Layout) validateTelegrafMeasurement(formats strfmt.Registry) error {
|
||||
func (m *Layout) validateMeasurement(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("telegraf_measurement", "body", m.TelegrafMeasurement); err != nil {
|
||||
if err := validate.Required("measurement", "body", m.Measurement); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -35,11 +35,11 @@ type GetLayoutsParams struct {
|
|||
Collection Format: csv
|
||||
*/
|
||||
Apps []string
|
||||
/*Returns layouts with this telegraf measurement
|
||||
/*Returns layouts with this measurement
|
||||
In: query
|
||||
Collection Format: csv
|
||||
*/
|
||||
TelegrafMeasurements []string
|
||||
Measurements []string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
|
@ -55,8 +55,8 @@ func (o *GetLayoutsParams) BindRequest(r *http.Request, route *middleware.Matche
|
|||
res = append(res, err)
|
||||
}
|
||||
|
||||
qTelegrafMeasurements, qhkTelegrafMeasurements, _ := qs.GetOK("telegraf_measurements")
|
||||
if err := o.bindTelegrafMeasurements(qTelegrafMeasurements, qhkTelegrafMeasurements, route.Formats); err != nil {
|
||||
qMeasurements, qhkMeasurements, _ := qs.GetOK("measurements")
|
||||
if err := o.bindMeasurements(qMeasurements, qhkMeasurements, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
|
@ -101,14 +101,14 @@ func (o *GetLayoutsParams) bindApps(rawData []string, hasKey bool, formats strfm
|
|||
return nil
|
||||
}
|
||||
|
||||
func (o *GetLayoutsParams) bindTelegrafMeasurements(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
func (o *GetLayoutsParams) bindMeasurements(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
|
||||
var qvTelegrafMeasurements string
|
||||
var qvMeasurements string
|
||||
if len(rawData) > 0 {
|
||||
qvTelegrafMeasurements = rawData[len(rawData)-1]
|
||||
qvMeasurements = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
raw := swag.SplitByFormat(qvTelegrafMeasurements, "csv")
|
||||
raw := swag.SplitByFormat(qvMeasurements, "csv")
|
||||
size := len(raw)
|
||||
|
||||
if size == 0 {
|
||||
|
@ -118,7 +118,7 @@ func (o *GetLayoutsParams) bindTelegrafMeasurements(rawData []string, hasKey boo
|
|||
ic := raw
|
||||
isz := size
|
||||
var ir []string
|
||||
iValidateElement := func(i int, telegrafMeasurementsI string) *errors.Validation {
|
||||
iValidateElement := func(i int, measurementsI string) *errors.Validation {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ func (o *GetLayoutsParams) bindTelegrafMeasurements(rawData []string, hasKey boo
|
|||
ir = append(ir, ic[i])
|
||||
}
|
||||
|
||||
o.TelegrafMeasurements = ir
|
||||
o.Measurements = ir
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ type Cell struct {
|
|||
type Layout struct {
|
||||
ID string `json:"id"`
|
||||
Application string `json:"app"`
|
||||
Measurement string `json:"telegraf_measurement"`
|
||||
Measurement string `json:"measurement"`
|
||||
Cells []Cell `json:"cells"`
|
||||
}
|
||||
|
||||
|
|
|
@ -886,9 +886,9 @@ paths:
|
|||
get:
|
||||
summary: Pre-configured layouts
|
||||
parameters:
|
||||
- name: telegraf_measurements
|
||||
- name: measurements
|
||||
in: query
|
||||
description: Returns layouts with this telegraf measurement
|
||||
description: Returns layouts with this measurement
|
||||
required: false
|
||||
type: array
|
||||
items:
|
||||
|
@ -1264,7 +1264,7 @@ definitions:
|
|||
required:
|
||||
- cells
|
||||
- app
|
||||
- telegraf_measurement
|
||||
- measurement
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
|
@ -1272,7 +1272,7 @@ definitions:
|
|||
app:
|
||||
type: string
|
||||
description: App is the user facing name of this Layout
|
||||
telegraf_measurement:
|
||||
measurement:
|
||||
type: string
|
||||
description: Measurement is the descriptive name of the time series data.
|
||||
cells:
|
||||
|
|
Loading…
Reference in New Issue