mirror of https://github.com/grafana/grafana
Transformations: Add applicability function to group to nested table (#85501)
* Add applicability function to group to nested table * codeincarnate/group-to-nested-cond/ run linter --------- Co-authored-by: jev forsberg <jev.forsberg@grafana.com>testinfra-symlink-public
parent
ddf5fbe591
commit
075976bea6
@ -1,3 +1,22 @@ |
||||
import { DataFrame } from '../../types'; |
||||
|
||||
export const transformationsVariableSupport = () => { |
||||
return (window as any)?.grafanaBootData?.settings?.featureToggles?.transformationsVariableSupport; |
||||
}; |
||||
|
||||
/** |
||||
* Retrieve the maximum number of fields in a series of a dataframe. |
||||
*/ |
||||
export function findMaxFields(data: DataFrame[]) { |
||||
let maxFields = 0; |
||||
|
||||
// Group to nested table needs at least two fields
|
||||
// a field to group on and to show in the nested table
|
||||
for (const frame of data) { |
||||
if (frame.fields.length > maxFields) { |
||||
maxFields = frame.fields.length; |
||||
} |
||||
} |
||||
|
||||
return maxFields; |
||||
} |
||||
|
Loading…
Reference in new issue