Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboards / grafana should support grouping by multiple keys #8581

Open
Vadman97 opened this issue May 15, 2024 — with Linear · 2 comments
Open

dashboards / grafana should support grouping by multiple keys #8581

Vadman97 opened this issue May 15, 2024 — with Linear · 2 comments
Labels

Comments

Copy link
Member

backend supports this already, so we just need to make the UI allow supporting multiple keys

@Vadman97 Vadman97 added the waterloo label May 15, 2024 — with Linear
Copy link

linear bot commented May 15, 2024

Copy link

greptile-apps bot commented May 15, 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant