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

Render property display name #137

Merged
merged 4 commits into from
Jan 19, 2023
Merged

Conversation

Digized
Copy link
Contributor

@Digized Digized commented Dec 2, 2022

Twinmaker is adding a property displayName field. This pr is to render the property display name in the grafana plugin.

Screen Shot 2023-01-12 at 6 43 50 PM

Screen Shot 2023-01-12 at 6 45 17 PM

@CLAassistant
Copy link

CLAassistant commented Dec 2, 2022

CLA assistant check
All committers have signed the CLA.

// TwinMakerQuery model
type TwinMakerQuery struct {
GrafanaLiveEnabled bool `json:"grafanaLiveEnabled,omitempty"`
IsStreaming bool `json:"isStreaming,omitempty"`
WorkspaceId string `json:"workspaceId,omitempty"`
EntityId string `json:"entityId,omitempty"`
Properties []*string `json:"properties,omitempty"`
Properties []*TwinmakerPropertyInfo `json:"properties,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

This change seems like it would break any existing saved dashboards 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch, any suggestion as to how I should handle it.

@@ -263,12 +263,20 @@ export class QueryEditor extends PureComponent<Props, State> {
onPropertiesSelected = (sel: Array<SelectableValue<string>>) => {
const { onChange, query, onRunQuery } = this.props;
let properties: string[] = [];
let propertyDisplayNames: { [key: string]: string } = {};
Copy link
Member

Choose a reason for hiding this comment

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

@Digized -- is this the part you expect to do the migration? I think this will only work when in edit mode, but not from a read only saved dashbaord

Copy link
Contributor Author

@Digized Digized Jan 18, 2023

Choose a reason for hiding this comment

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

if a customer has already created a dashboard before updating the plugin:
for all the dashboards created previously, they would still see the propertyName.

when a new dashboard is added, if it has propertyDisplayName, then we use the propertyDisplayName.

just fyi, propertyDisplayName is an optional field.

Copy link
Member

Choose a reason for hiding this comment

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

i get it now :) i added a suggestion for comment in the golang side

@Digized Digized requested review from ryantxu and removed request for toddtreece January 18, 2023 17:04
Copy link
Member

@ryantxu ryantxu 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

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
@mukeshsahay mukeshsahay merged commit 18a2172 into grafana:main Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants