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

Dashboard: Migration - Dashboard Settings Variables (List, Duplicate, Delete) #78917

Merged
merged 28 commits into from
Dec 14, 2023

Conversation

axelavargas
Copy link
Member

@axelavargas axelavargas commented Nov 30, 2023

Basic infrastructure

Edit tasklist title
Beta Give feedback Tasklist Basic infrastructure, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. One view dashboard variables list
    Options
  2. One can Delete, Duplicate a variable
    Options
  3. Deleting a variable shows a confirmation modal
    Options
  4. Variable(s) changes are reflected in a Dashboard Scene
    Options
  5. Add Unit Test
    Options

NOTE:

Not implemented anything regarding usage, renaming variables or creating variables

Part of: #78690

@axelavargas axelavargas added area/dashboard no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Nov 30, 2023
@axelavargas axelavargas self-assigned this Nov 30, 2023
@grafana-delivery-bot grafana-delivery-bot bot added this to the 10.3.x milestone Nov 30, 2023
@axelavargas axelavargas marked this pull request as ready for review December 8, 2023 15:03
@axelavargas axelavargas requested a review from a team as a code owner December 8, 2023 15:03
@axelavargas axelavargas requested review from dprokop, kaydelaney and ivanortegaalba and removed request for a team December 8, 2023 15:03
@dprokop
Copy link
Member

dprokop commented Dec 11, 2023

Did a quick testing @axelavargas, and found some issues:

  1. In a dashboard without variables, creating a variable ain't possible
  2. In a dashboard without variables, refreshing variables page results in the following error:
image
  1. If there are no variables in a dashboard, the variables table is still shown i think:
image
  1. Deleting a variable seems not to work.

@axelavargas
Copy link
Member Author

axelavargas commented Dec 11, 2023

@dprokop Thanks for the review 🙌🏾 , regarding not being able to create variables, indeed that is not being implemented in this PR. I am planning to tackle it in a different PR, my reasoning was to keep this PR small and also learn that we will need to create new forms per each variable type.

@axelavargas axelavargas changed the title Dashboard: Migration - Dashboard Settings Variables Basic Infra Dashboard: Migration - Dashboard Settings Variables (List, Duplicate, Delete) Dec 11, 2023
@dprokop dprokop requested a review from torkelo December 13, 2023 14:18
Comment on lines +97 to +108
infoBox={{
__html: ` <p>
Variables enable more interactive and dynamic dashboards. Instead of hard-coding things like server
or sensor names in your metric queries you can use variables in their place. Variables are shown as
list boxes at the top of the dashboard. These drop-down lists make it easy to change the data
being displayed in your dashboard. Check out the
<a class="external-link" href="https://grafana.com/docs/grafana/latest/variables/" target="_blank">
Templates and variables documentation
</a>
for more information.
</p>`,
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, we should add internationalization here. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is a good idea, but I would refrain from doing it in the scope of the migration 😄.

@@ -195,6 +195,11 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
variables = new SceneVariableSet({
variables: variableObjects,
});
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is mandatory to get always a valid value in variables, probably it is a good idea to add a test for it. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I have added the test :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, +1 to ivan's. Overall what we see is it's better to attach even empty objects rather than conditonally adding theme. It simplifies downstream code a lot.

Copy link
Member

@dprokop dprokop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now @axelavargas. I suggest merging this PR and moving forward with the following tasks :) They may reveal some gaps that we may not see here, but not necessarily.

Copy link
Contributor

@ivanortegaalba ivanortegaalba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for considering the feedback ✅

@axelavargas axelavargas merged commit 4c6bbab into main Dec 14, 2023
15 checks passed
@axelavargas axelavargas deleted the axelav/settings-variables branch December 14, 2023 11:54
@summerwollin summerwollin modified the milestones: 10.3.x, 10.3.0 Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard area/frontend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants