diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e2f2fd89..5214e28ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,14 @@ ### Upcoming Bug Fixes 1. [#788](https://github.com/influxdata/chronograf/pull/788): Fix missing fields in data explorer when using non-default retention policy - 1. [#774](https://github.com/influxdata/chronograf/issues/774): Fix gaps in layouts for hosts + 2. [#774](https://github.com/influxdata/chronograf/issues/774): Fix gaps in layouts for hosts ### Upcoming Features 1. [#779](https://github.com/influxdata/chronograf/issues/779): Add layout for telegraf's diskio system plugin - 1. [#810](https://github.com/influxdata/chronograf/issues/810): Add layout for telegraf's net system plugin - 1. [#811](https://github.com/influxdata/chronograf/issues/811): Add layout for telegraf's procstat plugin - 1. [#814](https://github.com/influxdata/chronograf/issues/814): Allows Chronograf to be mounted under any arbitrary URL path using the `--basepath` flag. + 2. [#810](https://github.com/influxdata/chronograf/issues/810): Add layout for telegraf's net system plugin + 3. [#811](https://github.com/influxdata/chronograf/issues/811): Add layout for telegraf's procstat plugin + 4. [#737](https://github.com/influxdata/chronograf/issues/737): Add GUI for OpsGenie kapacitor alert service + 5. [#814](https://github.com/influxdata/chronograf/issues/814): Allows Chronograf to be mounted under any arbitrary URL path using the `--basepath` flag. ### Upcoming UI Improvements diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8b186652a..27f84f45c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,8 +58,8 @@ After installing gvm you can install and set the default go version by running the following: ```bash - gvm install go1.7.4 - gvm use go1.7.4 --default + gvm install go1.7.5 + gvm use go1.7.5 --default ``` Installing GDM diff --git a/README.md b/README.md index 0d6804836..9dc2a7a2d 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,12 @@ A UI for [Kapacitor](https://github.com/influxdata/kapacitor) alert creation and * Preview data and alert boundaries while creating an alert * Configure alert destinations - Currently, Chronograf supports sending alerts to: * HipChat + * OpsGenie * PagerDuty * Sensu * Slack * SMTP + * Talk * Telegram * VictorOps * View all active alerts at a glance on the alerting dashboard @@ -113,7 +115,7 @@ docker pull quay.io/influxdb/chronograf:latest ### From Source -* Chronograf works with go 1.7.4, npm 3.10.7 and node v6.6.0. Additional version support of these projects will be implemented soon, but these are the only supported versions to date. +* Chronograf works with go 1.7.x, node 6.x/7.x, and npm 3.x. * Chronograf requires [Kapacitor](https://github.com/influxdata/kapacitor) 1.1.x to create and store alerts. 1. [Install Go](https://golang.org/doc/install) diff --git a/bolt/internal/internal.go b/bolt/internal/internal.go index 20d24d87a..f18734a49 100644 --- a/bolt/internal/internal.go +++ b/bolt/internal/internal.go @@ -194,6 +194,22 @@ func UnmarshalLayout(data []byte, l *chronograf.Layout) error { func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { cells := make([]*DashboardCell, len(d.Cells)) for i, c := range d.Cells { + queries := make([]*Query, len(c.Queries)) + for j, q := range c.Queries { + r := new(Range) + if q.Range != nil { + r.Upper, r.Lower = q.Range.Upper, q.Range.Lower + } + queries[j] = &Query{ + Command: q.Command, + DB: q.DB, + RP: q.RP, + GroupBys: q.GroupBys, + Wheres: q.Wheres, + Label: q.Label, + Range: r, + } + } cells[i] = &DashboardCell{ X: c.X, @@ -201,7 +217,7 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { W: c.W, H: c.H, Name: c.Name, - Queries: c.Queries, + Queries: queries, Type: c.Type, } } @@ -220,23 +236,39 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { return err } - cells := make([]chronograf.DashboardCell, len(d.Cells)) - for i, c := range d.Cells { + cells := make([]chronograf.DashboardCell, len(pb.Cells)) + for i, c := range pb.Cells { + queries := make([]chronograf.Query, len(c.Queries)) + for j, q := range c.Queries { + queries[j] = chronograf.Query{ + Command: q.Command, + DB: q.DB, + RP: q.RP, + GroupBys: q.GroupBys, + Wheres: q.Wheres, + Label: q.Label, + } + if q.Range.Upper != q.Range.Lower { + queries[j].Range = &chronograf.Range{ + Upper: q.Range.Upper, + Lower: q.Range.Lower, + } + } + } + cells[i] = chronograf.DashboardCell{ X: c.X, Y: c.Y, W: c.W, H: c.H, Name: c.Name, - Queries: c.Queries, + Queries: queries, Type: c.Type, } } - d.ID = chronograf.DashboardID(pb.ID) d.Cells = cells d.Name = pb.Name - return nil } diff --git a/bolt/internal/internal.pb.go b/bolt/internal/internal.pb.go index 39291210e..b7544d99c 100644 --- a/bolt/internal/internal.pb.go +++ b/bolt/internal/internal.pb.go @@ -39,13 +39,13 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type Exploration struct { - ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` - UserID int64 `protobuf:"varint,3,opt,name=UserID,json=userID,proto3" json:"UserID,omitempty"` - Data string `protobuf:"bytes,4,opt,name=Data,json=data,proto3" json:"Data,omitempty"` - CreatedAt int64 `protobuf:"varint,5,opt,name=CreatedAt,json=createdAt,proto3" json:"CreatedAt,omitempty"` - UpdatedAt int64 `protobuf:"varint,6,opt,name=UpdatedAt,json=updatedAt,proto3" json:"UpdatedAt,omitempty"` - Default bool `protobuf:"varint,7,opt,name=Default,json=default,proto3" json:"Default,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + UserID int64 `protobuf:"varint,3,opt,name=UserID,proto3" json:"UserID,omitempty"` + Data string `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` + CreatedAt int64 `protobuf:"varint,5,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` + UpdatedAt int64 `protobuf:"varint,6,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` + Default bool `protobuf:"varint,7,opt,name=Default,proto3" json:"Default,omitempty"` } func (m *Exploration) Reset() { *m = Exploration{} } @@ -54,15 +54,15 @@ func (*Exploration) ProtoMessage() {} func (*Exploration) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{0} } type Source struct { - ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` - Type string `protobuf:"bytes,3,opt,name=Type,json=type,proto3" json:"Type,omitempty"` - Username string `protobuf:"bytes,4,opt,name=Username,json=username,proto3" json:"Username,omitempty"` - Password string `protobuf:"bytes,5,opt,name=Password,json=password,proto3" json:"Password,omitempty"` - URL string `protobuf:"bytes,6,opt,name=URL,json=uRL,proto3" json:"URL,omitempty"` - Default bool `protobuf:"varint,7,opt,name=Default,json=default,proto3" json:"Default,omitempty"` - Telegraf string `protobuf:"bytes,8,opt,name=Telegraf,json=telegraf,proto3" json:"Telegraf,omitempty"` - InsecureSkipVerify bool `protobuf:"varint,9,opt,name=InsecureSkipVerify,json=insecureSkipVerify,proto3" json:"InsecureSkipVerify,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + Type string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"` + Username string `protobuf:"bytes,4,opt,name=Username,proto3" json:"Username,omitempty"` + Password string `protobuf:"bytes,5,opt,name=Password,proto3" json:"Password,omitempty"` + URL string `protobuf:"bytes,6,opt,name=URL,proto3" json:"URL,omitempty"` + Default bool `protobuf:"varint,7,opt,name=Default,proto3" json:"Default,omitempty"` + Telegraf string `protobuf:"bytes,8,opt,name=Telegraf,proto3" json:"Telegraf,omitempty"` + InsecureSkipVerify bool `protobuf:"varint,9,opt,name=InsecureSkipVerify,proto3" json:"InsecureSkipVerify,omitempty"` } func (m *Source) Reset() { *m = Source{} } @@ -71,8 +71,8 @@ func (*Source) ProtoMessage() {} func (*Source) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{1} } type Dashboard struct { - ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` Cells []*DashboardCell `protobuf:"bytes,3,rep,name=cells" json:"cells,omitempty"` } @@ -93,7 +93,7 @@ type DashboardCell struct { Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"` W int32 `protobuf:"varint,3,opt,name=w,proto3" json:"w,omitempty"` H int32 `protobuf:"varint,4,opt,name=h,proto3" json:"h,omitempty"` - Queries []string `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"` + Queries []*Query `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"` Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` Type string `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"` } @@ -103,13 +103,20 @@ func (m *DashboardCell) String() string { return proto.CompactTextStr func (*DashboardCell) ProtoMessage() {} func (*DashboardCell) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{3} } +func (m *DashboardCell) GetQueries() []*Query { + if m != nil { + return m.Queries + } + return nil +} + type Server struct { - ID int64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` - Username string `protobuf:"bytes,3,opt,name=Username,json=username,proto3" json:"Username,omitempty"` - Password string `protobuf:"bytes,4,opt,name=Password,json=password,proto3" json:"Password,omitempty"` - URL string `protobuf:"bytes,5,opt,name=URL,json=uRL,proto3" json:"URL,omitempty"` - SrcID int64 `protobuf:"varint,6,opt,name=SrcID,json=srcID,proto3" json:"SrcID,omitempty"` + ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` + Username string `protobuf:"bytes,3,opt,name=Username,proto3" json:"Username,omitempty"` + Password string `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"` + URL string `protobuf:"bytes,5,opt,name=URL,proto3" json:"URL,omitempty"` + SrcID int64 `protobuf:"varint,6,opt,name=SrcID,proto3" json:"SrcID,omitempty"` } func (m *Server) Reset() { *m = Server{} } @@ -118,11 +125,11 @@ func (*Server) ProtoMessage() {} func (*Server) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{4} } type Layout struct { - ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - Application string `protobuf:"bytes,2,opt,name=Application,json=application,proto3" json:"Application,omitempty"` - Measurement string `protobuf:"bytes,3,opt,name=Measurement,json=measurement,proto3" json:"Measurement,omitempty"` - Cells []*Cell `protobuf:"bytes,4,rep,name=Cells,json=cells" json:"Cells,omitempty"` - Autoflow bool `protobuf:"varint,5,opt,name=Autoflow,json=autoflow,proto3" json:"Autoflow,omitempty"` + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + Application string `protobuf:"bytes,2,opt,name=Application,proto3" json:"Application,omitempty"` + Measurement string `protobuf:"bytes,3,opt,name=Measurement,proto3" json:"Measurement,omitempty"` + Cells []*Cell `protobuf:"bytes,4,rep,name=Cells" json:"Cells,omitempty"` + Autoflow bool `protobuf:"varint,5,opt,name=Autoflow,proto3" json:"Autoflow,omitempty"` } func (m *Layout) Reset() { *m = Layout{} } @@ -163,13 +170,13 @@ func (m *Cell) GetQueries() []*Query { } type Query struct { - Command string `protobuf:"bytes,1,opt,name=Command,json=command,proto3" json:"Command,omitempty"` - DB string `protobuf:"bytes,2,opt,name=DB,json=dB,proto3" json:"DB,omitempty"` - RP string `protobuf:"bytes,3,opt,name=RP,json=rP,proto3" json:"RP,omitempty"` - GroupBys []string `protobuf:"bytes,4,rep,name=GroupBys,json=groupBys" json:"GroupBys,omitempty"` - Wheres []string `protobuf:"bytes,5,rep,name=Wheres,json=wheres" json:"Wheres,omitempty"` - Label string `protobuf:"bytes,6,opt,name=Label,json=label,proto3" json:"Label,omitempty"` - Range *Range `protobuf:"bytes,7,opt,name=Range,json=range" json:"Range,omitempty"` + Command string `protobuf:"bytes,1,opt,name=Command,proto3" json:"Command,omitempty"` + DB string `protobuf:"bytes,2,opt,name=DB,proto3" json:"DB,omitempty"` + RP string `protobuf:"bytes,3,opt,name=RP,proto3" json:"RP,omitempty"` + GroupBys []string `protobuf:"bytes,4,rep,name=GroupBys" json:"GroupBys,omitempty"` + Wheres []string `protobuf:"bytes,5,rep,name=Wheres" json:"Wheres,omitempty"` + Label string `protobuf:"bytes,6,opt,name=Label,proto3" json:"Label,omitempty"` + Range *Range `protobuf:"bytes,7,opt,name=Range" json:"Range,omitempty"` } func (m *Query) Reset() { *m = Query{} } @@ -185,8 +192,8 @@ func (m *Query) GetRange() *Range { } type Range struct { - Upper int64 `protobuf:"varint,1,opt,name=Upper,json=upper,proto3" json:"Upper,omitempty"` - Lower int64 `protobuf:"varint,2,opt,name=Lower,json=lower,proto3" json:"Lower,omitempty"` + Upper int64 `protobuf:"varint,1,opt,name=Upper,proto3" json:"Upper,omitempty"` + Lower int64 `protobuf:"varint,2,opt,name=Lower,proto3" json:"Lower,omitempty"` } func (m *Range) Reset() { *m = Range{} } @@ -195,10 +202,10 @@ func (*Range) ProtoMessage() {} func (*Range) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{8} } type AlertRule struct { - ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - JSON string `protobuf:"bytes,2,opt,name=JSON,json=jSON,proto3" json:"JSON,omitempty"` - SrcID int64 `protobuf:"varint,3,opt,name=SrcID,json=srcID,proto3" json:"SrcID,omitempty"` - KapaID int64 `protobuf:"varint,4,opt,name=KapaID,json=kapaID,proto3" json:"KapaID,omitempty"` + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` + JSON string `protobuf:"bytes,2,opt,name=JSON,proto3" json:"JSON,omitempty"` + SrcID int64 `protobuf:"varint,3,opt,name=SrcID,proto3" json:"SrcID,omitempty"` + KapaID int64 `protobuf:"varint,4,opt,name=KapaID,proto3" json:"KapaID,omitempty"` } func (m *AlertRule) Reset() { *m = AlertRule{} } @@ -207,8 +214,8 @@ func (*AlertRule) ProtoMessage() {} func (*AlertRule) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{9} } type User struct { - ID uint64 `protobuf:"varint,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"` - Email string `protobuf:"bytes,2,opt,name=Email,json=email,proto3" json:"Email,omitempty"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Email string `protobuf:"bytes,2,opt,name=Email,proto3" json:"Email,omitempty"` } func (m *User) Reset() { *m = User{} } @@ -233,52 +240,50 @@ func init() { func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) } var fileDescriptorInternal = []byte{ - // 750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x55, 0x6d, 0x6e, 0xdb, 0x46, - 0x10, 0xc5, 0x8a, 0x5c, 0x8a, 0x5c, 0xb9, 0x6e, 0xb1, 0x30, 0x5a, 0xa2, 0xe8, 0x0f, 0x81, 0x68, - 0x01, 0x15, 0x68, 0xfd, 0xc3, 0x3e, 0x81, 0x2c, 0x1a, 0x85, 0x5a, 0xd5, 0x76, 0x57, 0x56, 0xfb, - 0xab, 0x05, 0xd6, 0xe2, 0xc8, 0x62, 0xbd, 0x22, 0xd9, 0x25, 0x59, 0x99, 0x47, 0x08, 0x90, 0x33, - 0xe4, 0x10, 0xc9, 0x51, 0x72, 0x91, 0x1c, 0x21, 0xd8, 0xe1, 0xea, 0x0b, 0x4e, 0x02, 0x03, 0xf9, - 0xf9, 0x66, 0x46, 0xc3, 0x37, 0xef, 0x3d, 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 0x8c, 0x0a, 0x73, 0x05, 0x9e, 0x7a, 0x20, - 0x10, 0x96, 0x05, 0xc5, 0x1b, 0xa3, 0x73, 0x3b, 0x66, 0xb6, 0xcc, 0x8a, 0x02, 0xb4, 0xcd, 0x2e, - 0xad, 0x0d, 0xc0, 0xdd, 0xf9, 0x1a, 0x34, 0x52, 0x76, 0x04, 0x55, 0x06, 0x44, 0x7f, 0xb3, 0x60, - 0xa8, 0x40, 0x57, 0xa2, 0x56, 0xf0, 0x24, 0x62, 0x9c, 0xb9, 0xbf, 0x4e, 0xaf, 0xaf, 0x36, 0x89, - 0xff, 0x77, 0x7a, 0x7d, 0xb5, 0xcb, 0xa9, 0xb3, 0x97, 0x53, 0x73, 0xd0, 0x6f, 0xb2, 0x90, 0xe3, - 0x18, 0x8d, 0x75, 0x84, 0xf7, 0x80, 0x28, 0xfa, 0x89, 0xb9, 0xe6, 0xfd, 0xd8, 0xdb, 0xec, 0xe2, - 0xe6, 0x13, 0x46, 0x2f, 0x57, 0x32, 0x55, 0x76, 0x35, 0x05, 0x03, 0xee, 0x3c, 0xfc, 0x44, 0x9c, - 0xbf, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x83, 0xb5, 0x2a, 0x34, 0x06, 0x00, 0x00, + // 712 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x55, 0xd1, 0x6e, 0xd3, 0x4a, + 0x10, 0xd5, 0xc6, 0x76, 0x12, 0x4f, 0x7b, 0x7b, 0xaf, 0x56, 0xd5, 0xc5, 0x42, 0x3c, 0x44, 0x16, + 0x48, 0x41, 0x82, 0x3e, 0xd0, 0x2f, 0x48, 0xe3, 0x0a, 0x05, 0x4a, 0x29, 0x9b, 0x06, 0x9e, 0x40, + 0xda, 0x26, 0x9b, 0xc6, 0xc2, 0xb1, 0xcd, 0xda, 0x26, 0xf5, 0x3f, 0xf0, 0x05, 0x3c, 0xf0, 0x11, + 0xf0, 0x29, 0xfc, 0x08, 0x9f, 0x80, 0x66, 0xbc, 0x76, 0x5c, 0x51, 0x50, 0x9f, 0x78, 0x9b, 0x33, + 0x33, 0x9d, 0x3d, 0x73, 0xce, 0xb8, 0x81, 0xbd, 0x30, 0xce, 0x95, 0x8e, 0x65, 0x74, 0x90, 0xea, + 0x24, 0x4f, 0x78, 0xbf, 0xc6, 0xfe, 0x37, 0x06, 0x3b, 0xc7, 0x57, 0x69, 0x94, 0x68, 0x99, 0x87, + 0x49, 0xcc, 0xf7, 0xa0, 0x33, 0x09, 0x3c, 0x36, 0x60, 0x43, 0x4b, 0x74, 0x26, 0x01, 0xe7, 0x60, + 0x9f, 0xca, 0xb5, 0xf2, 0x3a, 0x03, 0x36, 0x74, 0x05, 0xc5, 0xfc, 0x7f, 0xe8, 0xce, 0x32, 0xa5, + 0x27, 0x81, 0x67, 0x51, 0x9f, 0x41, 0xd8, 0x1b, 0xc8, 0x5c, 0x7a, 0x76, 0xd5, 0x8b, 0x31, 0xbf, + 0x07, 0xee, 0x58, 0x2b, 0x99, 0xab, 0xc5, 0x28, 0xf7, 0x1c, 0x6a, 0xdf, 0x26, 0xb0, 0x3a, 0x4b, + 0x17, 0xa6, 0xda, 0xad, 0xaa, 0x4d, 0x82, 0x7b, 0xd0, 0x0b, 0xd4, 0x52, 0x16, 0x51, 0xee, 0xf5, + 0x06, 0x6c, 0xd8, 0x17, 0x35, 0xf4, 0x7f, 0x30, 0xe8, 0x4e, 0x93, 0x42, 0xcf, 0xd5, 0xad, 0x08, + 0x73, 0xb0, 0xcf, 0xcb, 0x54, 0x11, 0x5d, 0x57, 0x50, 0xcc, 0xef, 0x42, 0x1f, 0x69, 0xc7, 0xd8, + 0x5b, 0x11, 0x6e, 0x30, 0xd6, 0xce, 0x64, 0x96, 0x6d, 0x12, 0xbd, 0x20, 0xce, 0xae, 0x68, 0x30, + 0xff, 0x0f, 0xac, 0x99, 0x38, 0x21, 0xb2, 0xae, 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5, 0x45, 0x55, 0xf5, 0x0f, 0x4d, 0x1b, 0x4e, 0x99, 0xa5, 0xa9, 0xd2, 0xe6, + 0x76, 0x2b, 0x40, 0xb3, 0x93, 0x8d, 0xd2, 0x44, 0xd9, 0x12, 0x15, 0xf0, 0xdf, 0x82, 0x3b, 0x8a, + 0x94, 0xce, 0x45, 0x11, 0xa9, 0x5f, 0x4e, 0x8c, 0x83, 0xfd, 0x6c, 0xfa, 0xf2, 0xb4, 0xbe, 0x78, + 0x8c, 0xb7, 0x77, 0x6a, 0xb5, 0xee, 0x14, 0x17, 0x7a, 0x2e, 0x53, 0x39, 0x09, 0xc8, 0x58, 0x4b, + 0x18, 0xe4, 0x3f, 0x02, 0x1b, 0xbf, 0x87, 0xd6, 0x64, 0x9b, 0x26, 0xef, 0x83, 0x73, 0xbc, 0x96, + 0x61, 0x64, 0x46, 0x57, 0xe0, 0xa2, 0x4b, 0xbf, 0x19, 0x87, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x6d, 0xf2, 0xe7, 0x54, 0x45, 0x06, 0x00, 0x00, } diff --git a/bolt/internal/internal.proto b/bolt/internal/internal.proto index 94a17b2d2..c840bc5bc 100644 --- a/bolt/internal/internal.proto +++ b/bolt/internal/internal.proto @@ -34,7 +34,7 @@ message DashboardCell { int32 y = 2; // Y-coordinate of Cell in the Dashboard int32 w = 3; // Width of Cell in the Dashboard int32 h = 4; // Height of Cell in the Dashboard - repeated string queries = 5; // Time-series data queries for Dashboard + repeated Query queries = 5; // Time-series data queries for Dashboard string name = 6; // User-facing name for this Dashboard string type = 7; // Dashboard visualization type } diff --git a/chronograf.go b/chronograf.go index 1244caaad..25f53c870 100644 --- a/chronograf.go +++ b/chronograf.go @@ -243,7 +243,7 @@ type DashboardCell struct { W int32 `json:"w"` H int32 `json:"h"` Name string `json:"name"` - Queries []string `json:"queries"` + Queries []Query `json:"queries"` Type string `json:"type"` } diff --git a/circle.yml b/circle.yml index 881ead70f..9c19dccdd 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ machine: services: - docker environment: - DOCKER_TAG: chronograf-20161207 + DOCKER_TAG: chronograf-20170127 dependencies: override: @@ -26,7 +26,7 @@ deployment: --package --platform all --arch all - --upload + --upload-overwrite - sudo chown -R ubuntu:ubuntu /home/ubuntu - cp build/linux/static_amd64/chronograf . - docker build -t chronograf . @@ -46,7 +46,7 @@ deployment: --package --platform all --arch all - --upload + --upload-overwrite --bucket dl.influxdata.com/chronograf/releases - sudo chown -R ubuntu:ubuntu /home/ubuntu - cp build/linux/static_amd64/chronograf . @@ -67,7 +67,7 @@ deployment: --package --platform all --arch all - --upload + --upload-overwrite --bucket dl.influxdata.com/chronograf/releases - sudo chown -R ubuntu:ubuntu /home/ubuntu - cp build/linux/static_amd64/chronograf . diff --git a/etc/Dockerfile_build b/etc/Dockerfile_build index 7d4bc576c..72d8daa23 100644 --- a/etc/Dockerfile_build +++ b/etc/Dockerfile_build @@ -16,9 +16,9 @@ RUN pip install boto requests python-jose --upgrade RUN gem install fpm # Install node -RUN wget -q https://nodejs.org/dist/latest-v6.x/node-v6.9.1-linux-x64.tar.gz; \ - tar -xvf node-v6.9.1-linux-x64.tar.gz -C / --strip-components=1; \ - rm -f node-v6.9.1-linux-x64.tar.gz +RUN wget -q https://nodejs.org/dist/latest-v6.x/node-v6.9.4-linux-x64.tar.gz; \ + tar -xvf node-v6.9.4-linux-x64.tar.gz -C / --strip-components=1; \ + rm -f node-v6.9.4-linux-x64.tar.gz # Update npm RUN cd $(npm root -g)/npm \ @@ -28,7 +28,7 @@ RUN npm install npm -g # Install go ENV GOPATH /root/go -ENV GO_VERSION 1.7.4 +ENV GO_VERSION 1.7.5 ENV GO_ARCH amd64 RUN wget https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz; \ tar -C /usr/local/ -xf /go${GO_VERSION}.linux-${GO_ARCH}.tar.gz ; \ diff --git a/etc/README.md b/etc/README.md new file mode 100644 index 000000000..1f4f9d013 --- /dev/null +++ b/etc/README.md @@ -0,0 +1,12 @@ +## Builds + +Builds are run from a docker build image that is configured with the node and go we support. +Our circle.yml uses this docker container to build, test and create release packages. + +### Updating new node/go versions +After updating the Dockerfile_build run + +`docker build -t quay.io/influxdb/builder:chronograf-$(date "+%Y%m%d") -f Dockerfile_build` + +and push to quay with: +`docker push quay.io/influxdb/builder:chronograf-$(date "+%Y%m%d")` diff --git a/server/dashboards.go b/server/dashboards.go index f12040f82..c56aa2c75 100644 --- a/server/dashboards.go +++ b/server/dashboards.go @@ -164,10 +164,8 @@ func ValidDashboardRequest(d chronograf.Dashboard) error { } for _, c := range d.Cells { - for _, q := range c.Queries { - if len(q) == 0 { - return fmt.Errorf("query required") - } + if (len(c.Queries) == 0) { + return fmt.Errorf("query required") } } diff --git a/server/mux.go b/server/mux.go index 4944e945c..b84295476 100644 --- a/server/mux.go +++ b/server/mux.go @@ -119,8 +119,8 @@ func NewMux(opts MuxOpts, service Service) http.Handler { router.POST("/chronograf/v1/dashboards", service.NewDashboard) router.GET("/chronograf/v1/dashboards/:id", service.DashboardID) - router.DELETE("/chronograf/v1/dashboard/:id", service.RemoveDashboard) - router.PUT("/chronograf/v1/dashboard/:id", service.UpdateDashboard) + router.DELETE("/chronograf/v1/dashboards/:id", service.RemoveDashboard) + router.PUT("/chronograf/v1/dashboards/:id", service.UpdateDashboard) /* Authentication */ if opts.UseAuth { diff --git a/ui/src/dashboards/apis/index.js b/ui/src/dashboards/apis/index.js index f0106f76b..82b58aab3 100644 --- a/ui/src/dashboards/apis/index.js +++ b/ui/src/dashboards/apis/index.js @@ -6,3 +6,10 @@ export function getDashboards() { url: `/chronograf/v1/dashboards`, }); } + +export function getDashboard(id) { + return AJAX({ + method: 'GET', + url: `/chronograf/v1/dashboards/${id}`, + }); +} diff --git a/ui/src/dashboards/containers/DashboardPage.js b/ui/src/dashboards/containers/DashboardPage.js new file mode 100644 index 000000000..a7579ccc6 --- /dev/null +++ b/ui/src/dashboards/containers/DashboardPage.js @@ -0,0 +1,111 @@ +import React, {PropTypes} from 'react'; +import ReactTooltip from 'react-tooltip'; + +import LayoutRenderer from 'shared/components/LayoutRenderer'; +import TimeRangeDropdown from '../../shared/components/TimeRangeDropdown'; +import timeRanges from 'hson!../../shared/data/timeRanges.hson'; + +import {getDashboard} from '../apis'; +import {getSource} from 'shared/apis'; + +const DashboardPage = React.createClass({ + propTypes: { + params: PropTypes.shape({ + sourceID: PropTypes.string.isRequired, + dashboardID: PropTypes.string.isRequired, + }).isRequired, + }, + + getInitialState() { + const fifteenMinutesIndex = 1; + + return { + timeRange: timeRanges[fifteenMinutesIndex], + }; + }, + + componentDidMount() { + getDashboard(this.props.params.dashboardID).then((resp) => { + getSource(this.props.params.sourceID).then(({data: source}) => { + this.setState({ + dashboard: resp.data, + source, + }); + }); + }); + }, + + renderDashboard(dashboard) { + const autoRefreshMs = 15000; + const {timeRange} = this.state; + const {source} = this.state; + + const cellWidth = 4; + const cellHeight = 4; + + const cells = dashboard.cells.map((cell, i) => { + const dashboardCell = Object.assign(cell, { + w: cellWidth, + h: cellHeight, + queries: cell.queries, + i: i.toString(), + }); + + dashboardCell.queries.forEach((q) => { + q.text = q.query; + q.database = source.telegraf; + }); + return dashboardCell; + }); + + return ( + + ); + }, + + handleChooseTimeRange({lower}) { + const timeRange = timeRanges.find((range) => range.queryValue === lower); + this.setState({timeRange}); + }, + + render() { + const {dashboard, timeRange} = this.state; + const dashboardName = dashboard ? dashboard.name : ''; + + return ( +
+
+
+
+
+ +
+
+
+
+ + Graph Tips +
+ + +
+
+
+
+
+ { dashboard ? this.renderDashboard(dashboard) : '' } +
+
+
+ ); + }, +}); + +export default DashboardPage; diff --git a/ui/src/dashboards/containers/DashboardsPage.js b/ui/src/dashboards/containers/DashboardsPage.js index b3f0a4285..4bc59e374 100644 --- a/ui/src/dashboards/containers/DashboardsPage.js +++ b/ui/src/dashboards/containers/DashboardsPage.js @@ -1,26 +1,44 @@ -import React from 'react'; +import React, {PropTypes} from 'react'; +import {Link} from 'react-router'; import {getDashboards} from '../apis'; const DashboardsPage = React.createClass({ + propTypes: { + source: PropTypes.shape({ + id: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + type: PropTypes.string, + links: PropTypes.shape({ + proxy: PropTypes.string.isRequired, + }).isRequired, + telegraf: PropTypes.string.isRequired, + }), + addFlashMessage: PropTypes.func, + }, + getInitialState() { return { dashboards: [], + waiting: true, }; }, componentDidMount() { - getDashboards().then((dashboards) => { + getDashboards().then((resp) => { this.setState({ - dashboards, + dashboards: resp.data.dashboards, + waiting: false, }); }); }, render() { let tableHeader; - if (this.state.dashboards.length === 0) { + if (this.state.waiting) { tableHeader = "Loading Dashboards..."; + } else if (this.state.dashboards.length === 0) { + tableHeader = "No Dashboards"; } else { tableHeader = `${this.state.dashboards.length} Dashboards`; } @@ -56,7 +74,11 @@ const DashboardsPage = React.createClass({ this.state.dashboards.map((dashboard) => { return ( - {dashboard.name} + + + {dashboard.name} + + ); }) diff --git a/ui/src/dashboards/index.js b/ui/src/dashboards/index.js index 13fd48331..150685d90 100644 --- a/ui/src/dashboards/index.js +++ b/ui/src/dashboards/index.js @@ -1,2 +1,3 @@ import DashboardsPage from './containers/DashboardsPage'; -export {DashboardsPage}; +import DashboardPage from './containers/DashboardPage'; +export {DashboardsPage, DashboardPage}; diff --git a/ui/src/index.js b/ui/src/index.js index 45d13740c..fced489af 100644 --- a/ui/src/index.js +++ b/ui/src/index.js @@ -12,7 +12,7 @@ import {KubernetesPage} from 'src/kubernetes'; import {Login} from 'src/auth'; import {KapacitorPage, KapacitorRulePage, KapacitorRulesPage, KapacitorTasksPage} from 'src/kapacitor'; import DataExplorer from 'src/data_explorer'; -import {DashboardsPage} from 'src/dashboards'; +import {DashboardsPage, DashboardPage} from 'src/dashboards'; import {CreateSource, SourcePage, ManageSources} from 'src/sources'; import NotFound from 'src/shared/components/NotFound'; import configureStore from 'src/store/configureStore'; @@ -120,6 +120,7 @@ const Root = React.createClass({ + diff --git a/ui/src/kapacitor/components/AlertOutputs.js b/ui/src/kapacitor/components/AlertOutputs.js index a2137503b..0d34e4942 100644 --- a/ui/src/kapacitor/components/AlertOutputs.js +++ b/ui/src/kapacitor/components/AlertOutputs.js @@ -3,6 +3,7 @@ import _ from 'lodash'; import {getKapacitorConfig, updateKapacitorConfigSection, testAlertOutput} from 'shared/apis'; import AlertaConfig from './AlertaConfig'; import HipChatConfig from './HipChatConfig'; +import OpsGenieConfig from './OpsGenieConfig'; import PagerDutyConfig from './PagerDutyConfig'; import SensuConfig from './SensuConfig'; import SlackConfig from './SlackConfig'; @@ -111,6 +112,7 @@ const AlertOutputs = React.createClass({ this.apiKey = r} defaultValue={apiKey || ''}> + + + + + + +
+ +
+ + + ); + }, +}); + +const TagInput = React.createClass({ + propTypes: { + onAddTag: func.isRequired, + onDeleteTag: func.isRequired, + tags: arrayOf(string).isRequired, + title: string.isRequired, + }, + + handleAddTag(e) { + if (e.key === 'Enter') { + e.preventDefault(); + const newItem = e.target.value.trim(); + const {tags, onAddTag} = this.props; + if (!this.shouldAddToList(newItem, tags)) { + return; + } + + this.input.value = ''; + onAddTag(newItem); + } + }, + + shouldAddToList(item, tags) { + return (!_.isEmpty(item) && !tags.find(l => l === item)); + }, + + render() { + const {title, tags, onDeleteTag} = this.props; + + return ( +
+ + this.input = r} + onKeyDown={this.handleAddTag}> + + +
+ ); + }, +}); + +const Tags = React.createClass({ + propTypes: { + tags: arrayOf(string), + onDeleteTag: func, + }, + + render() { + const {tags, onDeleteTag} = this.props; + return ( +
+ { + tags.map((item) => { + return ( + + ); + }) + } +
+ ); + }, +}); + +const Tag = React.createClass({ + propTypes: { + item: string, + onDelete: func, + }, + + render() { + const {item, onDelete} = this.props; + + return ( + + {item} + onDelete(item)}> + + ); + }, +}); + + +export default OpsGenieConfig; diff --git a/ui/src/kapacitor/components/TelegramConfig.js b/ui/src/kapacitor/components/TelegramConfig.js index 917a41ae5..11e3147a1 100644 --- a/ui/src/kapacitor/components/TelegramConfig.js +++ b/ui/src/kapacitor/components/TelegramConfig.js @@ -18,11 +18,19 @@ const TelegramConfig = React.createClass({ handleSaveAlert(e) { e.preventDefault(); + let parseMode; + if (this.parseModeHTML.checked) { + parseMode = 'HTML'; + } + if (this.parseModeMarkdown.checked) { + parseMode = 'Markdown'; + } + const properties = { - chatID: this.chatID.value, - disableNotification: this.disableNotification.checked, - disableWebPagePreview: this.disableWebPagePreview.checked, - parseMode: this.parseMode.checked, + 'chat-id': this.chatID.value, + 'disable-notification': this.disableNotification.checked, + 'disable-web-page-preview': this.disableWebPagePreview.checked, + 'parse-mode': parseMode, token: this.token.value, url: this.url.value, }; @@ -61,9 +69,16 @@ const TelegramConfig = React.createClass({
+
- this.parseMode = r} /> - +
+ this.parseModeHTML = r} /> + +
+
+ this.parseModeMarkdown = r} /> + +
diff --git a/ui/src/style/chronograf.scss b/ui/src/style/chronograf.scss index da84df737..901fa020c 100644 --- a/ui/src/style/chronograf.scss +++ b/ui/src/style/chronograf.scss @@ -26,6 +26,7 @@ @import 'layout/sidebar.scss'; // Components +@import 'components/input-tag-list'; @import 'components/group-by-time-dropdown'; @import 'components/page-header-dropdown'; @import 'components/multi-select-dropdown'; diff --git a/ui/src/style/components/input-tag-list.scss b/ui/src/style/components/input-tag-list.scss new file mode 100644 index 000000000..43cd07091 --- /dev/null +++ b/ui/src/style/components/input-tag-list.scss @@ -0,0 +1,32 @@ +.input-tag-list { + padding: 0 11px; + margin: 2px 0px; + font-size: 0; +} +$input-tag-item-height: 24px; +.input-tag-item { + display: inline-block; + white-space: nowrap; + height: $input-tag-item-height; + line-height: $input-tag-item-height; + padding: 0 9px; + border-radius: 3px; + font-size: 12px; + font-weight: 600; + background-color: $g5-pepper; + color: $g18-cloud; + cursor: default; + margin: 2px; +} + +.input-tag-item .icon { + transition: color 0.25s ease; + margin-left: 6px; + position: relative; + top: -0.5px; + + &:hover { + color: $c-dreamsicle; + cursor: pointer; + } +} diff --git a/ui/src/style/theme/theme-dark.scss b/ui/src/style/theme/theme-dark.scss index bfd042d7b..80fccd25d 100644 --- a/ui/src/style/theme/theme-dark.scss +++ b/ui/src/style/theme/theme-dark.scss @@ -528,6 +528,83 @@ $form-static-checkbox-size: 16px; &:checked + label { color: $g20-white; + &:after { + opacity: 1; + transform: translate(-50%,-50%) scale(1,1); + } + } + } +} + +.form-control-static .radio { + margin: 0; + + input[type="radio"] { + position: relative; + left: -9999px; + visibility: hidden; + width: 0; + height: 0; + margin: 0; + + // Faux Checkbox + & + label { + font-size: 14px !important; + line-height: 16px; + color: $g11-sidewalk; + font-weight: 500; + transition: color 0.25s ease; + margin: 0; + padding: 0 0 0 (12px + $form-static-checkbox-size) !important; + user-select: none; + -ms-user-select: none; + -moz-user-selct: none; + -webkit-user-select: none; + + &:before { + content: ''; + position: absolute; + top: 50%; + left: 0; + transform: translateY(-50%); + width: $form-static-checkbox-size; + height: $form-static-checkbox-size; + background-color: $g2-kevlar; + border: 2px solid $g5-pepper; + border-radius: 50%; + z-index: 2; + transition: + border-color 0.25s ease; + } + &:after { + content: ''; + position: absolute; + top: 50%; + left: ($form-static-checkbox-size / 2); + transform: translate(-50%,-50%) scale(2,2); + opacity: 0; + width: 6px; + height: 6px; + border-radius: 50%; + background-color: $c-pool; + z-index: 3; + transition: + opacity 0.25s ease, + transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); + } + &:hover { + cursor: pointer; + color: $g20-white; + + &:before { + border-color: $g6-smoke; + } + } + } + // Faux Checkbox (Checked) + &:checked + label { + color: $g20-white; + &:after { opacity: 1; transform: translate(-50%,-50%) scale(1,1);