platform

package
v0.0.0-...-0184392 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2020 License: AGPL-3.0, AGPL-3.0-or-later Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ErrCellNotFound = Error("cell not found")

ErrCellNotFound is the error for a missing cell.

View Source
const ErrDashboardNotFound = Error("dashboard not found")

ErrDashboardNotFound is the error for a missing dashboard.

Variables

This section is empty.

Functions

func MarshalVisualizationJSON

func MarshalVisualizationJSON(v Visualization) ([]byte, error)

MarshalVisualizationJSON ...

Types

type Axis

type Axis struct {
	Bounds       []string `json:"bounds"` // bounds are an arbitrary list of client-defined strings that specify the viewport for a cell
	LegacyBounds [2]int64 `json:"-"`      // legacy bounds are for testing a migration from an earlier version of axis
	Label        string   `json:"label"`  // label is a description of this Axis
	Prefix       string   `json:"prefix"` // Prefix represents a label prefix for formatting axis values
	Suffix       string   `json:"suffix"` // Suffix represents a label suffix for formatting axis values
	Base         string   `json:"base"`   // Base represents the radix for formatting axis values
	Scale        string   `json:"scale"`  // Scale is the axis formatting scale. Supported: "log", "linear"
}

Axis represents the visible extents of a visualization

type Cell

type Cell struct {
	CellContents
	Visualization Visualization
}

Cell holds positional and visual information for a cell.

func (Cell) MarshalJSON

func (c Cell) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*Cell) UnmarshalJSON

func (c *Cell) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

type CellColor

type CellColor struct {
	ID    string `json:"id"`    // ID is the unique id of the cell color
	Type  string `json:"type"`  // Type is how the color is used. Accepted (min,max,threshold)
	Hex   string `json:"hex"`   // Hex is the hex number of the color
	Name  string `json:"name"`  // Name is the user-facing name of the hex color
	Value string `json:"value"` // Value is the data value mapped to this color
}

CellColor represents the encoding of data into visualizations

type CellContents

type CellContents struct {
	ID   ID     `json:"id"`
	Name string `json:"name"`
}

CellContents ...

type CellContentsUpdate

type CellContentsUpdate struct {
	Name *string `json:"name"`
}

CellContentsUpdate is a struct for updating the non visualization content of a cell.

type CellFilter

type CellFilter struct {
	ID *ID
}

CellFilter represents a set of filter that restrict the returned results.

type CellService

type CellService interface {
	// FindCellByID returns a single cell by ID.
	FindCellByID(ctx context.Context, id ID) (*Cell, error)

	// FindCells returns a list of cells that match filter and the total count of matching cells.
	// Additional options provide pagination & sorting.
	FindCells(ctx context.Context, filter CellFilter) ([]*Cell, int, error)

	// CreateCell creates a new cell and sets b.ID with the new identifier.
	CreateCell(ctx context.Context, b *Cell) error

	// UpdateCell updates a single cell with changeset.
	// Returns the new cell state after update.
	UpdateCell(ctx context.Context, id ID, upd CellUpdate) (*Cell, error)

	// DeleteCell removes a cell by ID.
	DeleteCell(ctx context.Context, id ID) error
}

CellService represents a service for managing cell data.

type CellUpdate

type CellUpdate struct {
	CellContentsUpdate
	Visualization Visualization
}

CellUpdate is a struct for updating cells.

func (CellUpdate) MarshalJSON

func (u CellUpdate) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*CellUpdate) UnmarshalJSON

func (u *CellUpdate) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

func (CellUpdate) Valid

func (u CellUpdate) Valid() error

Valid validates the update struct. It expects minimal values to be set.

type Dashboard

type Dashboard struct {
	ID    ID              `json:"id"`
	Name  string          `json:"name"`
	Cells []DashboardCell `json:"cells"`
}

Dashboard represents all visual and query data for a dashboard

type DashboardCell

type DashboardCell struct {
	X   int32  `json:"x"`
	Y   int32  `json:"y"`
	W   int32  `json:"w"`
	H   int32  `json:"h"`
	Ref string `json:"ref"`
}

DashboardCell holds positional information about a cell on dashboard and a reference to a cell.

type DashboardFilter

type DashboardFilter struct {
	// TODO(desa): change to be a slice of IDs
	ID *ID
}

DashboardFilter is a filter for dashboards.

type DashboardQuery

type DashboardQuery struct {
	Command     string      `json:"query"`                 // Command is the query itself
	Label       string      `json:"label,omitempty"`       // Label is the Y-Axis label for the data
	Range       *Range      `json:"range,omitempty"`       // Range is the default Y-Axis range for the data
	QueryConfig QueryConfig `json:"queryConfig,omitempty"` // QueryConfig represents the query state that is understood by the data explorer
	Source      string      `json:"source"`                // Source is the optional URI to the data source for this queryConfig
	Shifts      []TimeShift `json:"-"`                     // Shifts represents shifts to apply to an influxql query's time range.  Clients expect the shift to be in the generated QueryConfig
}

DashboardQuery includes state for the query builder. This is a transition struct while we move to the full InfluxQL AST

type DashboardService

type DashboardService interface {
	// FindDashboardByID returns a single dashboard by ID.
	FindDashboardByID(ctx context.Context, id ID) (*Dashboard, error)

	// FindDashboards returns a list of dashboards that match filter and the total count of matching dashboards.
	// Additional options provide pagination & sorting.
	FindDashboards(ctx context.Context, filter DashboardFilter) ([]*Dashboard, int, error)

	// CreateDashboard creates a new dashboard and sets b.ID with the new identifier.
	CreateDashboard(ctx context.Context, b *Dashboard) error

	// UpdateDashboard updates a single dashboard with changeset.
	// Returns the new dashboard state after update.
	UpdateDashboard(ctx context.Context, id ID, upd DashboardUpdate) (*Dashboard, error)

	// DeleteDashboard removes a dashboard by ID.
	DeleteDashboard(ctx context.Context, id ID) error
}

DashboardService represents a service for managing dashboard data.

type DashboardUpdate

type DashboardUpdate struct {
	Name  *string         `json:"name"`
	Cells []DashboardCell `json:"cells"`
}

DashboardUpdate is the patch structure for a dashboard.

func (DashboardUpdate) Valid

func (u DashboardUpdate) Valid() error

Valid returns an error if the dashboard update is invalid.

type DecimalPlaces

type DecimalPlaces struct {
	IsEnforced bool  `json:"isEnforced"`
	Digits     int32 `json:"digits"`
}

DecimalPlaces indicates whether decimal places should be enforced, and how many digits it should show.

type DurationRange

type DurationRange struct {
	Upper string `json:"upper"`
	Lower string `json:"lower"`
}

DurationRange represents the lower and upper durations of the query config

type EmptyVisualization

type EmptyVisualization struct{}

EmptyVisualization is visuaization that has no values

func (EmptyVisualization) Visualization

func (v EmptyVisualization) Visualization()

Visualization ...

type Error

type Error string

Error is a domain error encountered while processing CMP requests.

func (Error) Error

func (e Error) Error() string

Error returns the string of an error.

type Field

type Field struct {
	Value interface{} `json:"value"`
	Type  string      `json:"type"`
	Alias string      `json:"alias"`
	Args  []Field     `json:"args,omitempty"`
}

Field represent influxql fields and functions from the UI

type GroupBy

type GroupBy struct {
	Time string   `json:"time"`
	Tags []string `json:"tags"`
}

GroupBy represents influxql group by tags from the UI

type ID

type ID string

ID is an ID

type Legend

type Legend struct {
	Type        string `json:"type,omitempty"`
	Orientation string `json:"orientation,omitempty"`
}

Legend represents the encoding of data into a legend

type QueryConfig

type QueryConfig struct {
	ID              string              `json:"id,omitempty"`
	Database        string              `json:"database"`
	Measurement     string              `json:"measurement"`
	RetentionPolicy string              `json:"retentionPolicy"`
	Fields          []Field             `json:"fields"`
	Tags            map[string][]string `json:"tags"`
	GroupBy         GroupBy             `json:"groupBy"`
	AreTagsAccepted bool                `json:"areTagsAccepted"`
	Fill            string              `json:"fill,omitempty"`
	RawText         *string             `json:"rawText"`
	Range           *DurationRange      `json:"range"`
	Shifts          []TimeShift         `json:"shifts"`
}

QueryConfig represents UI query from the data explorer

type Range

type Range struct {
	Upper int64 `json:"upper"` // Upper is the upper bound
	Lower int64 `json:"lower"` // Lower is the lower bound
}

Range represents an upper and lower bound for data

type RenamableField

type RenamableField struct {
	InternalName string `json:"internalName"`
	DisplayName  string `json:"displayName"`
	Visible      bool   `json:"visible"`
}

RenamableField is a column/row field in a DashboardCell of type Table

type TableOptions

type TableOptions struct {
	VerticalTimeAxis bool           `json:"verticalTimeAxis"`
	SortBy           RenamableField `json:"sortBy"`
	Wrapping         string         `json:"wrapping"`
	FixFirstColumn   bool           `json:"fixFirstColumn"`
}

TableOptions is a type of options for a DashboardCell with type Table

type TimeShift

type TimeShift struct {
	Label    string `json:"label"`    // Label user facing description
	Unit     string `json:"unit"`     // Unit influxql time unit representation i.e. ms, s, m, h, d
	Quantity string `json:"quantity"` // Quantity number of units
}

TimeShift represents a shift to apply to an influxql query's time range

type V1Visualization

type V1Visualization struct {
	Queries []DashboardQuery `json:"queries"`
	Axes    map[string]Axis  `json:"axes"`
	// TODO: cmp will have to use visualizationType rather than type
	Type          string           `json:"visualizationType"`
	CellColors    []CellColor      `json:"colors"`
	Legend        Legend           `json:"legend"`
	TableOptions  TableOptions     `json:"tableOptions,omitempty"`
	FieldOptions  []RenamableField `json:"fieldOptions"`
	TimeFormat    string           `json:"timeFormat"`
	DecimalPlaces DecimalPlaces    `json:"decimalPlaces"`
}

V1Visualization ...

func (V1Visualization) Visualization

func (V1Visualization) Visualization()

Visualization ...

type Visualization

type Visualization interface {
	Visualization()
}

Visualization ...

func UnmarshalVisualizationJSON

func UnmarshalVisualizationJSON(b []byte) (Visualization, error)

UnmarshalVisualizationJSON ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL