Update layouts key from telegraf_measurements to measurements

pull/214/head
Chris Goller 2016-10-11 12:48:32 -05:00
parent c2fa11c28c
commit 126fb60686
7 changed files with 30 additions and 30 deletions

View File

@ -32,7 +32,7 @@ func layoutToMrF(l *models.Layout) mrfusion.Layout {
} }
return mrfusion.Layout{ return mrfusion.Layout{
ID: l.ID, ID: l.ID,
Measurement: *l.TelegrafMeasurement, Measurement: *l.Measurement,
Application: *l.App, Application: *l.App,
Cells: cells, Cells: cells,
} }
@ -84,7 +84,7 @@ func layoutToModel(l mrfusion.Layout) *models.Layout {
Rel: &rel, Rel: &rel,
}, },
Cells: cells, Cells: cells,
TelegrafMeasurement: &l.Measurement, Measurement: &l.Measurement,
App: &l.Application, App: &l.Application,
ID: l.ID, ID: l.ID,
} }
@ -107,7 +107,7 @@ func (h *Store) Layouts(ctx context.Context, params op.GetLayoutsParams) middlew
filtered[a] = true filtered[a] = true
} }
for _, m := range params.TelegrafMeasurements { for _, m := range params.Measurements {
filtered[m] = true filtered[m] = true
} }

View File

@ -30,7 +30,7 @@ func TestNewLayout(t *testing.T) {
Desc: "Test that an error in datastore returns 500 status", Desc: "Test that an error in datastore returns 500 status",
AddError: errors.New("error"), AddError: errors.New("error"),
NewLayout: &models.Layout{ NewLayout: &models.Layout{
TelegrafMeasurement: new(string), Measurement: new(string),
App: new(string), App: new(string),
Cells: []*models.Cell{ Cells: []*models.Cell{
&models.Cell{ &models.Cell{
@ -47,7 +47,7 @@ func TestNewLayout(t *testing.T) {
Desc: "Test that creating a layout returns 201 status", Desc: "Test that creating a layout returns 201 status",
ExistingLayouts: map[string]mrfusion.Layout{}, ExistingLayouts: map[string]mrfusion.Layout{},
NewLayout: &models.Layout{ NewLayout: &models.Layout{
TelegrafMeasurement: new(string), Measurement: new(string),
App: new(string), App: new(string),
Cells: []*models.Cell{ Cells: []*models.Cell{
&models.Cell{ &models.Cell{

View File

@ -41,7 +41,7 @@ type Layout struct {
Required: true Required: true
*/ */
TelegrafMeasurement *string `json:"telegraf_measurement"` Measurement *string `json:"measurement"`
} }
// Validate validates this layout // Validate validates this layout
@ -63,7 +63,7 @@ func (m *Layout) Validate(formats strfmt.Registry) error {
res = append(res, err) res = append(res, err)
} }
if err := m.validateTelegrafMeasurement(formats); err != nil { if err := m.validateMeasurement(formats); err != nil {
// prop // prop
res = append(res, err) res = append(res, err)
} }
@ -123,9 +123,9 @@ func (m *Layout) validateLink(formats strfmt.Registry) error {
return nil 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 return err
} }

File diff suppressed because one or more lines are too long

View File

@ -35,11 +35,11 @@ type GetLayoutsParams struct {
Collection Format: csv Collection Format: csv
*/ */
Apps []string Apps []string
/*Returns layouts with this telegraf measurement /*Returns layouts with this measurement
In: query In: query
Collection Format: csv 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 // 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) res = append(res, err)
} }
qTelegrafMeasurements, qhkTelegrafMeasurements, _ := qs.GetOK("telegraf_measurements") qMeasurements, qhkMeasurements, _ := qs.GetOK("measurements")
if err := o.bindTelegrafMeasurements(qTelegrafMeasurements, qhkTelegrafMeasurements, route.Formats); err != nil { if err := o.bindMeasurements(qMeasurements, qhkMeasurements, route.Formats); err != nil {
res = append(res, err) res = append(res, err)
} }
@ -101,14 +101,14 @@ func (o *GetLayoutsParams) bindApps(rawData []string, hasKey bool, formats strfm
return nil 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 { 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) size := len(raw)
if size == 0 { if size == 0 {
@ -118,7 +118,7 @@ func (o *GetLayoutsParams) bindTelegrafMeasurements(rawData []string, hasKey boo
ic := raw ic := raw
isz := size isz := size
var ir []string var ir []string
iValidateElement := func(i int, telegrafMeasurementsI string) *errors.Validation { iValidateElement := func(i int, measurementsI string) *errors.Validation {
return nil return nil
} }
@ -131,7 +131,7 @@ func (o *GetLayoutsParams) bindTelegrafMeasurements(rawData []string, hasKey boo
ir = append(ir, ic[i]) ir = append(ir, ic[i])
} }
o.TelegrafMeasurements = ir o.Measurements = ir
return nil return nil
} }

View File

@ -101,7 +101,7 @@ type Cell struct {
type Layout struct { type Layout struct {
ID string `json:"id"` ID string `json:"id"`
Application string `json:"app"` Application string `json:"app"`
Measurement string `json:"telegraf_measurement"` Measurement string `json:"measurement"`
Cells []Cell `json:"cells"` Cells []Cell `json:"cells"`
} }

View File

@ -886,9 +886,9 @@ paths:
get: get:
summary: Pre-configured layouts summary: Pre-configured layouts
parameters: parameters:
- name: telegraf_measurements - name: measurements
in: query in: query
description: Returns layouts with this telegraf measurement description: Returns layouts with this measurement
required: false required: false
type: array type: array
items: items:
@ -1264,7 +1264,7 @@ definitions:
required: required:
- cells - cells
- app - app
- telegraf_measurement - measurement
properties: properties:
id: id:
type: string type: string
@ -1272,7 +1272,7 @@ definitions:
app: app:
type: string type: string
description: App is the user facing name of this Layout description: App is the user facing name of this Layout
telegraf_measurement: measurement:
type: string type: string
description: Measurement is the descriptive name of the time series data. description: Measurement is the descriptive name of the time series data.
cells: cells: