diff --git a/gen/proto/go/prehog/v1alpha/connect.pb.go b/gen/proto/go/prehog/v1alpha/connect.pb.go index 5a1914c9da6e7..627647f46916e 100644 --- a/gen/proto/go/prehog/v1alpha/connect.pb.go +++ b/gen/proto/go/prehog/v1alpha/connect.pb.go @@ -144,6 +144,8 @@ type ConnectProtocolUseEvent struct { UserName string `protobuf:"bytes,2,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty"` // one of ssh/db/kube Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` + // one of resource_table/search_bar/connection_list/reopened_session (optional) + Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` } func (x *ConnectProtocolUseEvent) Reset() { @@ -199,6 +201,13 @@ func (x *ConnectProtocolUseEvent) GetProtocol() string { return "" } +func (x *ConnectProtocolUseEvent) GetOrigin() string { + if x != nil { + return x.Origin + } + return "" +} + type ConnectAccessRequestCreateEvent struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -721,111 +730,113 @@ var file_prehog_v1alpha_connect_proto_rawDesc = []byte{ 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x70, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x75, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x55, 0x73, 0x65, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x75, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8d, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x55, 0x73, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, + 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0x75, 0x0a, 0x1f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, + 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, + 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x61, 0x0a, 0x1f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x61, 0x0a, 0x1f, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x76, - 0x69, 0x65, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, + 0x65, 0x22, 0x65, 0x0a, 0x23, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x52, + 0x6f, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x65, 0x0a, 0x23, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, - 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, - 0x7a, 0x0a, 0x1b, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x75, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x21, - 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, - 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x69, 0x73, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x3a, 0x0a, 0x1d, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, - 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, - 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x6a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, 0x65, 0x22, 0x9d, 0x06, 0x0a, 0x19, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x63, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x74, - 0x69, 0x6e, 0x63, 0x74, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x12, 0x4f, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x67, 0x69, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, + 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x7a, 0x0a, 0x1b, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, + 0x75, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, + 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, + 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, + 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x75, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x3a, 0x0a, 0x1d, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x4a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x6f, 0x6c, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, 0x65, + 0x22, 0x9d, 0x06, 0x0a, 0x19, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x69, 0x73, 0x74, 0x69, 0x6e, 0x63, 0x74, 0x49, 0x64, 0x12, + 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x4f, 0x0a, 0x0d, 0x63, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6c, + 0x75, 0x73, 0x74, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x4c, 0x0a, 0x0c, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x27, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x55, 0x73, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x55, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x15, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, - 0x6e, 0x12, 0x4c, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x75, 0x73, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x55, 0x73, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x48, 0x00, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x55, 0x73, 0x65, 0x12, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x65, 0x0a, 0x15, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, + 0x74, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, + 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x65, 0x0a, 0x15, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, - 0x77, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x13, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x72, 0x0a, - 0x1a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, - 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x33, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x6f, 0x6c, - 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x17, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x6f, 0x6c, - 0x65, 0x12, 0x59, 0x0a, 0x11, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, - 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, - 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, - 0x72, 0x52, 0x75, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x66, 0x69, 0x6c, - 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x75, 0x6e, 0x12, 0x60, 0x0a, 0x14, - 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x65, + 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x72, 0x0a, 0x1a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x5f, + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x11, 0x75, 0x73, 0x65, - 0x72, 0x4a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x07, - 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6d, 0x69, - 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x88, 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x6d, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x29, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, - 0x72, 0x61, 0x76, 0x69, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x6c, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x63, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, + 0x00, 0x52, 0x17, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x41, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x59, 0x0a, 0x11, 0x66, 0x69, + 0x6c, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x72, 0x75, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x46, 0x69, + 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x52, 0x75, 0x6e, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x65, 0x72, 0x52, 0x75, 0x6e, 0x12, 0x60, 0x0a, 0x14, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6a, 0x6f, + 0x62, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x4a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x48, 0x00, 0x52, 0x11, 0x75, 0x73, 0x65, 0x72, 0x4a, 0x6f, 0x62, 0x52, 0x6f, 0x6c, + 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x88, + 0x01, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6d, 0x0a, 0x12, 0x53, 0x75, + 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x29, 0x2e, 0x70, 0x72, 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x70, 0x72, + 0x65, 0x68, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x75, 0x62, + 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x3f, 0x5a, 0x3d, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, 0x76, 0x69, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x65, 0x68, + 0x6f, 0x67, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/gen/proto/js/prehog/v1alpha/connect_pb.d.ts b/gen/proto/js/prehog/v1alpha/connect_pb.d.ts index b3995986e7f95..ff5eda22009a8 100644 --- a/gen/proto/js/prehog/v1alpha/connect_pb.d.ts +++ b/gen/proto/js/prehog/v1alpha/connect_pb.d.ts @@ -62,6 +62,9 @@ export class ConnectProtocolUseEvent extends jspb.Message { getProtocol(): string; setProtocol(value: string): ConnectProtocolUseEvent; + getOrigin(): string; + setOrigin(value: string): ConnectProtocolUseEvent; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ConnectProtocolUseEvent.AsObject; @@ -78,6 +81,7 @@ export namespace ConnectProtocolUseEvent { clusterName: string, userName: string, protocol: string, + origin: string, } } diff --git a/gen/proto/js/prehog/v1alpha/connect_pb.js b/gen/proto/js/prehog/v1alpha/connect_pb.js index 31114b8c9c074..7e365b0ad48cc 100644 --- a/gen/proto/js/prehog/v1alpha/connect_pb.js +++ b/gen/proto/js/prehog/v1alpha/connect_pb.js @@ -560,7 +560,8 @@ proto.prehog.v1alpha.ConnectProtocolUseEvent.toObject = function(includeInstance var f, obj = { clusterName: jspb.Message.getFieldWithDefault(msg, 1, ""), userName: jspb.Message.getFieldWithDefault(msg, 2, ""), - protocol: jspb.Message.getFieldWithDefault(msg, 3, "") + protocol: jspb.Message.getFieldWithDefault(msg, 3, ""), + origin: jspb.Message.getFieldWithDefault(msg, 4, "") }; if (includeInstance) { @@ -609,6 +610,10 @@ proto.prehog.v1alpha.ConnectProtocolUseEvent.deserializeBinaryFromReader = funct var value = /** @type {string} */ (reader.readString()); msg.setProtocol(value); break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setOrigin(value); + break; default: reader.skipField(); break; @@ -659,6 +664,13 @@ proto.prehog.v1alpha.ConnectProtocolUseEvent.serializeBinaryToWriter = function( f ); } + f = message.getOrigin(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } }; @@ -716,6 +728,24 @@ proto.prehog.v1alpha.ConnectProtocolUseEvent.prototype.setProtocol = function(va }; +/** + * optional string origin = 4; + * @return {string} + */ +proto.prehog.v1alpha.ConnectProtocolUseEvent.prototype.getOrigin = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.prehog.v1alpha.ConnectProtocolUseEvent} returns this + */ +proto.prehog.v1alpha.ConnectProtocolUseEvent.prototype.setOrigin = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + diff --git a/proto/prehog/v1alpha/connect.proto b/proto/prehog/v1alpha/connect.proto index bbc744de10d3b..36237c4b67f2d 100644 --- a/proto/prehog/v1alpha/connect.proto +++ b/proto/prehog/v1alpha/connect.proto @@ -40,6 +40,8 @@ message ConnectProtocolUseEvent { string user_name = 2; // one of ssh/db/kube string protocol = 3; + // one of resource_table/search_bar/connection_list/reopened_session (optional) + string origin = 4; } message ConnectAccessRequestCreateEvent { diff --git a/web/packages/teleterm/src/services/tshd/mapUsageEvent.ts b/web/packages/teleterm/src/services/tshd/mapUsageEvent.ts index 269e97caa928a..c23c1a9ad7f3a 100644 --- a/web/packages/teleterm/src/services/tshd/mapUsageEvent.ts +++ b/web/packages/teleterm/src/services/tshd/mapUsageEvent.ts @@ -65,7 +65,8 @@ function mapPrehogBody( const reqEvent = new prehogApi.ConnectProtocolUseEvent() .setClusterName(event.clusterName) .setUserName(event.userName) - .setProtocol(event.protocol); + .setProtocol(event.protocol) + .setOrigin(event.origin); return req.setProtocolUse(reqEvent); } diff --git a/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Databases/useDatabases.ts b/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Databases/useDatabases.ts index abeea60105821..f31403726796d 100644 --- a/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Databases/useDatabases.ts +++ b/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Databases/useDatabases.ts @@ -46,13 +46,16 @@ export function useDatabases() { targetUri: db.uri, targetName: db.name, targetUser: getTargetUser(db.protocol as GatewayProtocol, dbUser), + origin: 'resource_table', }); const connectionToReuse = appContext.connectionTracker.findConnectionByDocument(doc); if (connectionToReuse) { - appContext.connectionTracker.activateItem(connectionToReuse.id); + appContext.connectionTracker.activateItem(connectionToReuse.id, { + origin: 'resource_table', + }); } else { documentsService.add(doc); documentsService.open(doc.uri); diff --git a/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Kubes/useKubes.ts b/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Kubes/useKubes.ts index 58f5f7b5e5347..268397366d21e 100644 --- a/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Kubes/useKubes.ts +++ b/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Kubes/useKubes.ts @@ -17,6 +17,7 @@ limitations under the License. import { Kube, ServerSideParams } from 'teleterm/services/tshd/types'; import { useAppContext } from 'teleterm/ui/appContextProvider'; import { useClusterContext } from 'teleterm/ui/DocumentCluster/clusterContext'; +import { KubeUri } from 'teleterm/ui/uri'; import { useServerSideResources } from '../useServerSideResources'; @@ -29,7 +30,8 @@ export function useKubes() { ); return { - connect: ctx.connectKube, + connect: (kubeUri: KubeUri) => + ctx.connectKube(kubeUri, { origin: 'resource_table' }), fetchAttempt, ...serversideResources, }; diff --git a/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Servers/useServers.ts b/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Servers/useServers.ts index 9dad56feb3f26..d9d0ec7f16989 100644 --- a/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Servers/useServers.ts +++ b/web/packages/teleterm/src/ui/DocumentCluster/ClusterResources/Servers/useServers.ts @@ -42,7 +42,9 @@ export function useServers() { ); const documentsService = appContext.workspacesService.getWorkspaceDocumentService(rootCluster.uri); - const doc = documentsService.createTshNodeDocument(server.uri); + const doc = documentsService.createTshNodeDocument(server.uri, { + origin: 'resource_table', + }); doc.title = `${login}@${server.hostname}`; doc.login = login; diff --git a/web/packages/teleterm/src/ui/DocumentCluster/clusterContext.tsx b/web/packages/teleterm/src/ui/DocumentCluster/clusterContext.tsx index e2057ee613532..2c90902b45da8 100644 --- a/web/packages/teleterm/src/ui/DocumentCluster/clusterContext.tsx +++ b/web/packages/teleterm/src/ui/DocumentCluster/clusterContext.tsx @@ -20,6 +20,7 @@ import { useStore, Store } from 'shared/libs/stores'; import { IAppContext } from 'teleterm/ui/types'; import { ClusterUri, DocumentUri, KubeUri, routing } from 'teleterm/ui/uri'; +import { DocumentOrigin } from 'teleterm/ui/services/workspacesService'; import type * as tsh from 'teleterm/services/tshd/types'; @@ -71,8 +72,11 @@ class ClusterContext extends Store { }); }; - connectKube = (kubeUri: KubeUri) => { - this.appCtx.commandLauncher.executeCommand('kube-connect', { kubeUri }); + connectKube = (kubeUri: KubeUri, params: { origin: DocumentOrigin }) => { + this.appCtx.commandLauncher.executeCommand('kube-connect', { + kubeUri, + origin: params.origin, + }); }; refresh = () => { diff --git a/web/packages/teleterm/src/ui/DocumentGateway/useDocumentGateway.ts b/web/packages/teleterm/src/ui/DocumentGateway/useDocumentGateway.ts index 0450cfb9f1a5c..eb7d0408a70b7 100644 --- a/web/packages/teleterm/src/ui/DocumentGateway/useDocumentGateway.ts +++ b/web/packages/teleterm/src/ui/DocumentGateway/useDocumentGateway.ts @@ -62,6 +62,7 @@ export default function useGateway(doc: types.DocumentGateway) { // same port number. port: gw.localPort, }); + ctx.usageService.captureProtocolUse(doc.targetUri, 'db', doc.origin); }); const [disconnectAttempt, disconnect] = useAsync(async () => { diff --git a/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.test.tsx b/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.test.tsx index c1f0edce17155..aa57f69678873 100644 --- a/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.test.tsx +++ b/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.test.tsx @@ -82,6 +82,7 @@ const getDocTshNodeWithServerId: () => DocumentTshNodeWithServerId = () => ({ rootClusterId: 'test', leafClusterId: undefined, login: 'user', + origin: 'resource_table', }); const getDocTshNodeWithLoginHost: () => DocumentTshNodeWithLoginHost = () => { diff --git a/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.ts b/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.ts index 72807f0309b78..471df9495ddeb 100644 --- a/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.ts +++ b/web/packages/teleterm/src/ui/DocumentTerminal/useDocumentTerminal.ts @@ -216,11 +216,11 @@ async function setUpPtyProcess( const cmd = createCmd(doc, rootCluster.proxyHost, getClusterName()); const ptyProcess = await createPtyProcess(ctx, cmd); - if (cmd.kind === 'pty.tsh-login') { - ctx.usageService.captureProtocolUse(clusterUri, 'ssh'); + if (doc.kind === 'doc.terminal_tsh_node') { + ctx.usageService.captureProtocolUse(clusterUri, 'ssh', doc.origin); } - if (cmd.kind === 'pty.tsh-kube-login') { - ctx.usageService.captureProtocolUse(clusterUri, 'kube'); + if (doc.kind === 'doc.terminal_tsh_kube') { + ctx.usageService.captureProtocolUse(clusterUri, 'kube', doc.origin); } const openContextMenu = () => ctx.mainProcessClient.openTerminalContextMenu(); diff --git a/web/packages/teleterm/src/ui/QuickInput/useQuickInput.ts b/web/packages/teleterm/src/ui/QuickInput/useQuickInput.ts index 621ae556039bc..dfed5e5e7daae 100644 --- a/web/packages/teleterm/src/ui/QuickInput/useQuickInput.ts +++ b/web/packages/teleterm/src/ui/QuickInput/useQuickInput.ts @@ -35,7 +35,12 @@ import { assertUnreachable, retryWithRelogin } from '../utils'; export default function useQuickInput() { const appContext = useAppContext(); - const { quickInputService, workspacesService, commandLauncher } = appContext; + const { + quickInputService, + workspacesService, + commandLauncher, + usageService, + } = appContext; workspacesService.useState(); const documentsService = workspacesService.getActiveWorkspaceDocumentService(); @@ -105,6 +110,14 @@ export default function useQuickInput() { const params = routing.parseClusterUri( workspacesService.getActiveWorkspace()?.localClusterUri ).params; + // ugly hack but QuickInput will be removed in v13 + if (inputValue.startsWith('tsh proxy db')) { + usageService.captureProtocolUse( + workspacesService.getRootClusterUri(), + 'db', + 'search_bar' + ); + } documentsService.openNewTerminal({ initCommand: inputValue, rootClusterId: routing.parseClusterUri( @@ -120,6 +133,7 @@ export default function useQuickInput() { commandLauncher.executeCommand('tsh-ssh', { loginHost: command.loginHost, localClusterUri, + origin: 'search_bar', }); break; } diff --git a/web/packages/teleterm/src/ui/TabHost/useTabShortcuts.test.tsx b/web/packages/teleterm/src/ui/TabHost/useTabShortcuts.test.tsx index 2960113e6c6ec..4270c4f70fea0 100644 --- a/web/packages/teleterm/src/ui/TabHost/useTabShortcuts.test.tsx +++ b/web/packages/teleterm/src/ui/TabHost/useTabShortcuts.test.tsx @@ -59,6 +59,7 @@ function getMockDocuments(): Document[] { targetUri: '/clusters/bar/dbs/foobar', targetName: 'foobar', targetUser: 'foo', + origin: 'resource_table', }, { kind: 'doc.gateway', @@ -68,6 +69,7 @@ function getMockDocuments(): Document[] { targetUri: '/clusters/bar/dbs/foobar', targetName: 'foobar', targetUser: 'bar', + origin: 'resource_table', }, { kind: 'doc.cluster', diff --git a/web/packages/teleterm/src/ui/TopBar/Connections/useConnections.ts b/web/packages/teleterm/src/ui/TopBar/Connections/useConnections.ts index 843ab007406c0..aee4443f8d0b2 100644 --- a/web/packages/teleterm/src/ui/TopBar/Connections/useConnections.ts +++ b/web/packages/teleterm/src/ui/TopBar/Connections/useConnections.ts @@ -56,7 +56,8 @@ export function useConnections() { return { isAnyConnectionActive: items.some(c => c.connected), removeItem: (id: string) => connectionTracker.removeItem(id), - activateItem: (id: string) => connectionTracker.activateItem(id), + activateItem: (id: string) => + connectionTracker.activateItem(id, { origin: 'connection_list' }), disconnectItem: (id: string) => connectionTracker.disconnectItem(id), updateSorting, items: getSortedItems(), diff --git a/web/packages/teleterm/src/ui/commandLauncher.ts b/web/packages/teleterm/src/ui/commandLauncher.ts index 301d4502bdf4f..e9210ebe66cf0 100644 --- a/web/packages/teleterm/src/ui/commandLauncher.ts +++ b/web/packages/teleterm/src/ui/commandLauncher.ts @@ -18,6 +18,7 @@ import { IAppContext } from 'teleterm/ui/types'; import { ClusterUri, KubeUri, RootClusterUri, routing } from 'teleterm/ui/uri'; import { TrackedKubeConnection } from 'teleterm/ui/services/connectionTracker'; import { Platform } from 'teleterm/mainProcess/types'; +import { DocumentOrigin } from 'teleterm/ui/services/workspacesService'; const commands = { // For handling "tsh ssh" executed from the command bar. @@ -26,16 +27,21 @@ const commands = { description: '', run( ctx: IAppContext, - args: { loginHost: string; localClusterUri: ClusterUri } + args: { + loginHost: string; + localClusterUri: ClusterUri; + origin: DocumentOrigin; + } ) { - const { loginHost, localClusterUri } = args; + const { loginHost, localClusterUri, origin } = args; const rootClusterUri = routing.ensureRootClusterUri(localClusterUri); const documentsService = ctx.workspacesService.getWorkspaceDocumentService(rootClusterUri); const doc = documentsService.createTshNodeDocumentFromLoginHost( localClusterUri, - loginHost + loginHost, + { origin } ); documentsService.add(doc); documentsService.setLocation(doc.uri); @@ -89,11 +95,12 @@ const commands = { 'kube-connect': { displayName: '', description: '', - run(ctx: IAppContext, args: { kubeUri: KubeUri }) { + run(ctx: IAppContext, args: { kubeUri: KubeUri; origin: DocumentOrigin }) { const documentsService = ctx.workspacesService.getActiveWorkspaceDocumentService(); const kubeDoc = documentsService.createTshKubeDocument({ kubeUri: args.kubeUri, + origin: args.origin, }); const connection = ctx.connectionTracker.findConnectionByDocument( kubeDoc diff --git a/web/packages/teleterm/src/ui/services/clusters/clustersService.ts b/web/packages/teleterm/src/ui/services/clusters/clustersService.ts index e7760a6db96fd..fe38f23b3af05 100644 --- a/web/packages/teleterm/src/ui/services/clusters/clustersService.ts +++ b/web/packages/teleterm/src/ui/services/clusters/clustersService.ts @@ -320,7 +320,6 @@ export class ClustersService extends ImmutableStore async createGateway(params: tsh.CreateGatewayParams) { const gateway = await this.client.createGateway(params); - this.usageService.captureProtocolUse(params.targetUri, 'db'); this.setState(draft => { draft.gateways.set(gateway.uri, gateway); }); diff --git a/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.test.ts b/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.test.ts index 135ae9d2d0748..48b4daa1de545 100644 --- a/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.test.ts +++ b/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.test.ts @@ -105,6 +105,7 @@ it('updates the port of a gateway connection when the underlying doc gets update targetName: 'test', targetSubresourceName: 'pg', port: '12345', + origin: 'resource_table', }; const { connectionTrackerService, workspacesService } = @@ -142,6 +143,7 @@ it('creates a connection for doc.terminal_tsh_node docs with serverUri', () => { rootClusterId: 'localhost', leafClusterId: undefined, login: 'user', + origin: 'resource_table', }; const { connectionTrackerService } = getTestSetupWithMockedDocuments([ @@ -170,6 +172,7 @@ it('ignores doc.terminal_tsh_node docs with no serverUri', () => { loginHost: 'user@foo', rootClusterId: 'test', leafClusterId: undefined, + origin: 'resource_table', }; const { connectionTrackerService } = getTestSetupWithMockedDocuments([ diff --git a/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.ts b/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.ts index 358cb20d79cc3..3343447d78947 100644 --- a/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.ts +++ b/web/packages/teleterm/src/ui/services/connectionTracker/connectionTrackerService.ts @@ -19,6 +19,7 @@ import { useStore } from 'shared/libs/stores'; import { ClustersService } from 'teleterm/ui/services/clusters'; import { Document, + DocumentOrigin, isDocumentTshNodeWithLoginHost, WorkspacesService, } from 'teleterm/ui/services/workspacesService'; @@ -81,7 +82,10 @@ export class ConnectionTrackerService extends ImmutableStore { + async activateItem( + id: string, + params: { origin: DocumentOrigin } + ): Promise { const connection = this.state.connections.find(c => c.id === id); const { rootClusterUri, activate } = this._trackedConnectionOperationsFactory.create(connection); @@ -89,7 +93,7 @@ export class ConnectionTrackerService extends ImmutableStore { + activate: params => { let srvDoc = documentsService .getDocuments() .find(getServerDocumentByConnection(connection)); if (!srvDoc) { - srvDoc = documentsService.createTshNodeDocument(connection.serverUri); + srvDoc = documentsService.createTshNodeDocument( + connection.serverUri, + params + ); srvDoc.status = 'connecting'; srvDoc.login = connection.login; srvDoc.title = connection.title; @@ -108,7 +114,7 @@ export class TrackedConnectionOperationsFactory { return { rootClusterUri, leafClusterUri, - activate: () => { + activate: params => { let gwDoc = documentsService .getDocuments() .find(getGatewayDocumentByConnection(connection)); @@ -122,6 +128,7 @@ export class TrackedConnectionOperationsFactory { title: connection.title, gatewayUri: connection.gatewayUri, port: connection.port, + origin: params.origin, }); documentsService.add(gwDoc); @@ -161,7 +168,7 @@ export class TrackedConnectionOperationsFactory { return { rootClusterUri, leafClusterUri, - activate: () => { + activate: params => { let kubeConn = documentsService .getDocuments() .find(getKubeDocumentByConnection(connection)); @@ -170,6 +177,7 @@ export class TrackedConnectionOperationsFactory { kubeConn = documentsService.createTshKubeDocument({ kubeUri: connection.kubeUri, kubeConfigRelativePath: connection.kubeConfigRelativePath, + origin: params.origin, }); documentsService.add(kubeConn); @@ -215,7 +223,7 @@ interface TrackedConnectionOperations { rootClusterUri: RootClusterUri; leafClusterUri: LeafClusterUri; - activate(): void; + activate(params: { origin: DocumentOrigin }): void; disconnect(): Promise; diff --git a/web/packages/teleterm/src/ui/services/usage/usageService.ts b/web/packages/teleterm/src/ui/services/usage/usageService.ts index 03dc0a863482d..121f02c4730e3 100644 --- a/web/packages/teleterm/src/ui/services/usage/usageService.ts +++ b/web/packages/teleterm/src/ui/services/usage/usageService.ts @@ -25,6 +25,7 @@ import { ConfigService } from 'teleterm/services/config'; import Logger from 'teleterm/logger'; import { staticConfig } from 'teleterm/staticConfig'; import { NotificationsService } from 'teleterm/ui/services/notifications'; +import { DocumentOrigin } from 'teleterm/ui/services/workspacesService'; type PrehogEventReq = Omit< ReportUsageEventRequest['prehogReq'], @@ -70,7 +71,8 @@ export class UsageService { captureProtocolUse( uri: ClusterOrResourceUri, - protocol: 'ssh' | 'kube' | 'db' + protocol: 'ssh' | 'kube' | 'db', + origin: DocumentOrigin ): void { const clusterProperties = this.getClusterProperties(uri); if (!clusterProperties) { @@ -84,6 +86,7 @@ export class UsageService { clusterName: clusterProperties.clusterName, userName: clusterProperties.userName, protocol, + origin, }, }); } diff --git a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.test.ts b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.test.ts index 8b9bd2c2a6ac9..f9d7a0f1030a7 100644 --- a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.test.ts +++ b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.test.ts @@ -77,6 +77,7 @@ describe('document should be added', () => { targetUri: '/clusters/bar/dbs/quux', targetName: 'quux', targetUser: 'foo', + origin: 'resource_table', }; test('at the specific position', () => { @@ -131,6 +132,7 @@ test('only TSH node documents should be returned', () => { status: 'connecting', rootClusterId: '', leafClusterId: undefined, + origin: 'resource_table', }; service.add(tshNodeDocument); @@ -150,6 +152,7 @@ test('only gateway documents should be returned', () => { targetUri: '/clusters/bar/dbs/quux', targetName: 'quux', targetUser: 'foo', + origin: 'resource_table', }; service.add(gatewayDocument); diff --git a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.ts b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.ts index 2831c33558327..ab809037df5f3 100644 --- a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.ts +++ b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/documentsService.ts @@ -33,6 +33,7 @@ import { DocumentAccessRequests, DocumentCluster, DocumentGateway, + DocumentOrigin, DocumentTshKube, DocumentTshNode, DocumentTshNodeWithLoginHost, @@ -104,23 +105,28 @@ export class DocumentsService { options.kubeConfigRelativePath || `${params.rootClusterId}/${params.kubeId}-${unique(5)}`, title: params.kubeId, + origin: options.origin, }; } - createTshNodeDocument(serverUri: ServerUri): DocumentTshNodeWithServerId { - const { params } = routing.parseServerUri(serverUri); + createTshNodeDocument( + serverUri: ServerUri, + params: { origin: DocumentOrigin } + ): DocumentTshNodeWithServerId { + const { params: routingParams } = routing.parseServerUri(serverUri); const uri = routing.getDocUri({ docId: unique() }); return { uri, kind: 'doc.terminal_tsh_node', status: 'connecting', - rootClusterId: params.rootClusterId, - leafClusterId: params.leafClusterId, - serverId: params.serverId, + rootClusterId: routingParams.rootClusterId, + leafClusterId: routingParams.leafClusterId, + serverId: routingParams.serverId, serverUri, title: '', login: '', + origin: params.origin, }; } @@ -132,12 +138,15 @@ export class DocumentsService { * the command will succeed only if the given cluster has only a single server with the hostname * matching `host`. * @param loginHost - the "user@host" pair. + * @param params - additional parameters. + * @param params.origin - where the document was opened from. */ createTshNodeDocumentFromLoginHost( clusterUri: ClusterUri, - loginHost: string + loginHost: string, + params: { origin: DocumentOrigin } ): DocumentTshNodeWithLoginHost { - const { params } = routing.parseClusterUri(clusterUri); + const { params: routingParams } = routing.parseClusterUri(clusterUri); const uri = routing.getDocUri({ docId: unique() }); return { @@ -145,9 +154,10 @@ export class DocumentsService { kind: 'doc.terminal_tsh_node', title: loginHost, status: 'connecting', - rootClusterId: params.rootClusterId, - leafClusterId: params.leafClusterId, + rootClusterId: routingParams.rootClusterId, + leafClusterId: routingParams.leafClusterId, loginHost, + origin: params.origin, }; } @@ -162,6 +172,7 @@ export class DocumentsService { targetSubresourceName, port, gatewayUri, + origin, } = opts; const uri = routing.getDocUri({ docId: unique() }); const title = `${targetUser}@${targetName}`; @@ -176,6 +187,7 @@ export class DocumentsService { gatewayUri, title, port, + origin, }; } diff --git a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.test.ts b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.test.ts index 82e61d7cf390d..971082a365777 100644 --- a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.test.ts +++ b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.test.ts @@ -31,6 +31,7 @@ const docWithServerId: DocumentTshNodeWithServerId = { rootClusterId: 'test', leafClusterId: undefined, login: 'user', + origin: 'resource_table', }; // eslint-disable-next-line @typescript-eslint/no-unused-vars const { serverId, serverUri, login, ...rest } = docWithServerId; diff --git a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.ts b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.ts index a7c7f625a1699..a28ed57ba62e3 100644 --- a/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.ts +++ b/web/packages/teleterm/src/ui/services/workspacesService/documentsService/types.ts @@ -25,6 +25,12 @@ export type Kind = | 'doc.terminal_tsh_node' | 'doc.terminal_tsh_kube'; +export type DocumentOrigin = + | 'resource_table' + | 'search_bar' + | 'connection_list' + | 'reopened_session'; + interface DocumentBase { uri: uri.DocumentUri; title: string; @@ -45,6 +51,7 @@ interface DocumentTshNodeBase extends DocumentBase { status: '' | 'connecting' | 'connected' | 'error'; rootClusterId: string; leafClusterId: string | undefined; + origin: DocumentOrigin; } export interface DocumentTshNodeWithServerId extends DocumentTshNodeBase { @@ -83,6 +90,7 @@ export interface DocumentTshKube extends DocumentBase { kubeConfigRelativePath: string; rootClusterId: string; leafClusterId?: string; + origin: DocumentOrigin; } export interface DocumentGateway extends DocumentBase { @@ -93,6 +101,7 @@ export interface DocumentGateway extends DocumentBase { targetName: string; targetSubresourceName?: string; port?: string; + origin: DocumentOrigin; } export interface DocumentCluster extends DocumentBase { @@ -151,6 +160,7 @@ export type CreateGatewayDocumentOpts = { targetSubresourceName?: string; title?: string; port?: string; + origin: DocumentOrigin; }; export type CreateClusterDocumentOpts = { @@ -160,6 +170,7 @@ export type CreateClusterDocumentOpts = { export type CreateTshKubeDocumentOptions = { kubeUri: uri.KubeUri; kubeConfigRelativePath?: string; + origin: DocumentOrigin; }; export type CreateAccessRequestDocumentOpts = { diff --git a/web/packages/teleterm/src/ui/services/workspacesService/workspacesService.ts b/web/packages/teleterm/src/ui/services/workspacesService/workspacesService.ts index 1d0262de35afa..e6d5b143aebad 100644 --- a/web/packages/teleterm/src/ui/services/workspacesService/workspacesService.ts +++ b/web/packages/teleterm/src/ui/services/workspacesService/workspacesService.ts @@ -316,6 +316,14 @@ export class WorkspacesService extends ImmutableStore { return { ...d, status: 'connecting', + origin: 'reopened_session', + }; + } + + if (d.kind === 'doc.gateway') { + return { + ...d, + origin: 'reopened_session', }; } return d;