|
4 | 4 | "fmt" |
5 | 5 | "math" |
6 | 6 | "strconv" |
| 7 | + "time" |
7 | 8 | ) |
8 | 9 |
|
9 | 10 | // FieldConfig represents the display properties for a Field. |
@@ -158,11 +159,45 @@ func (fc *FieldConfig) SetFilterable(b bool) *FieldConfig { |
158 | 159 |
|
159 | 160 | // DataLink define what |
160 | 161 | type DataLink struct { //revive:disable-line |
161 | | - Title string `json:"title,omitempty"` |
162 | | - TargetBlank bool `json:"targetBlank,omitempty"` |
163 | | - URL string `json:"url,omitempty"` |
| 162 | + Title string `json:"title,omitempty"` |
| 163 | + TargetBlank bool `json:"targetBlank,omitempty"` |
| 164 | + URL string `json:"url,omitempty"` |
| 165 | + Internal *InternalDataLink `json:"internal,omitempty"` |
164 | 166 | } |
165 | 167 |
|
| 168 | +// InternalDataLink definition to allow Explore links to be constructed in the backend |
| 169 | +type InternalDataLink struct { |
| 170 | + Query any `json:"query,omitempty"` |
| 171 | + DatasourceUID string `json:"datasourceUid,omitempty"` |
| 172 | + DatasourceName string `json:"datasourceName,omitempty"` |
| 173 | + ExplorePanelsState *ExplorePanelsState `json:"panelsState,omitempty"` |
| 174 | + Transformations *[]LinkTransformationConfig `json:"transformations,omitempty"` |
| 175 | + Range *TimeRange `json:"timeRange,omitempty"` |
| 176 | +} |
| 177 | + |
| 178 | +// This is an object constructed with the keys as the values of the enum VisType and the value being a bag of properties |
| 179 | +type ExplorePanelsState any |
| 180 | + |
| 181 | +// Redefining this to avoid an import cycle |
| 182 | +type TimeRange struct { |
| 183 | + From time.Time `json:"from,omitempty"` |
| 184 | + To time.Time `json:"to,omitempty"` |
| 185 | +} |
| 186 | + |
| 187 | +type LinkTransformationConfig struct { |
| 188 | + Type SupportedTransformationTypes `json:"type,omitempty"` |
| 189 | + Field string `json:"field,omitempty"` |
| 190 | + Expression string `json:"expression,omitempty"` |
| 191 | + MapValue string `json:"mapValue,omitempty"` |
| 192 | +} |
| 193 | + |
| 194 | +type SupportedTransformationTypes string |
| 195 | + |
| 196 | +const ( |
| 197 | + Regex SupportedTransformationTypes = "regex" |
| 198 | + Logfmt SupportedTransformationTypes = "logfmt" |
| 199 | +) |
| 200 | + |
166 | 201 | // ThresholdsConfig setup thresholds |
167 | 202 | type ThresholdsConfig struct { |
168 | 203 | Mode ThresholdsMode `json:"mode"` |
|
0 commit comments