FunctionsSection.tsx 694 B

123456789101112131415161718192021222324
  1. import React from 'react';
  2. import { SegmentSection } from '@grafana/ui';
  3. import { FuncDefs, FuncInstance } from '../gfunc';
  4. import { AddGraphiteFunction } from './AddGraphiteFunction';
  5. import { GraphiteFunctionEditor } from './GraphiteFunctionEditor';
  6. type Props = {
  7. functions: FuncInstance[];
  8. funcDefs: FuncDefs;
  9. };
  10. export function FunctionsSection({ functions = [], funcDefs }: Props) {
  11. return (
  12. <SegmentSection label="Functions" fill={true}>
  13. {functions.map((func: FuncInstance, index: number) => {
  14. return !func.hidden && <GraphiteFunctionEditor key={index} func={func} />;
  15. })}
  16. <AddGraphiteFunction funcDefs={funcDefs} />
  17. </SegmentSection>
  18. );
  19. }