Giter Club home page Giter Club logo

Comments (2)

linear avatar linear commented on July 3, 2024

HIG-4664 dashboards / grafana should support grouping by multiple keys

from highlight.

greptile-apps avatar greptile-apps commented on July 3, 2024

To support grouping by multiple keys in the UI, follow these steps:

  1. Update State Management in GraphingEditor.tsx:

    • Modify the state to handle multiple keys for grouping.
    const [groupByKeys, setGroupByKeys] = useState<string[]>([]);
  2. Update LabeledRow Component for Group By:

    • Update the LabeledRow component to allow multiple selections for grouping keys.
    <LabeledRow
      label="Group by"
      name="groupBy"
      enabled={groupByEnabled}
      setEnabled={setGroupByEnabled}
      tooltip="Categorical fields for grouping results into separate series."
    >
      <Combobox
        options={allKeys}
        selection={groupByKeys}
        setSelection={setGroupByKeys}
        setQuery={setKeysQuery}
        label="groupBy"
        multiple
      />
    </LabeledRow>
  3. Update Graph Input in onSave Function:

    • Modify the onSave function to include the updated groupByKeys.
    const graphInput: GraphInput = {
      ...,
      groupByKeys: groupByEnabled ? groupByKeys : null,
      ...
    };
  4. Update Graph Component in Dashboard.tsx:

    • Ensure the Graph component can handle multiple grouping keys.
    <Graph
      ...
      groupByKeys={g.groupByKeys ?? undefined}
      ...
    />
  5. Update Graph Schema in model.go (if necessary):

    • Ensure the Graph struct in the backend model supports multiple grouping keys.
    type Graph struct {
      ...
      GroupByKeys []string `json:"groupByKeys"`
      ...
    }

References

/frontend/src/pages/Graphing/GraphingEditor.tsx
/frontend/src/pages/Graphing/Dashboard.tsx
/frontend/src/pages/Graphing
/backend/model/model.go

Ask Greptile

from highlight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.