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

Migrate more options to singlestat2 #16039

Merged
merged 29 commits into from Mar 28, 2019
Merged

Conversation

ryantxu
Copy link
Member

@ryantxu ryantxu commented Mar 16, 2019

This takes the rest of the singlestat options and migrates them to react.

export interface SparklineOptions {
  show: boolean;
  full: boolean; // full height
  fillColor: string;
  lineColor: string;
}

// Structure copied from angular
export interface SingleStatOptions extends SingleStatBaseOptions {
  prefixFontSize?: string;
  valueFontSize?: string;
  postfixFontSize?: string;

  colorBackground?: boolean;
  colorValue?: boolean;
  colorPrefix?: boolean;
  colorPostfix?: boolean;

  sparkline: SparklineOptions;
}

It has a super ugly UI... but the values work. My goal is to have more real examples for #15938 and #15864. I don't intend to improve the UI, but it should be a good place to try some higher level way to define settings since the boilerplate gets pretty cumbersome

The styles were copied from angular version -- positions seem shifted though

@torkelo torkelo self-requested a review March 19, 2019 13:11
* grafana/master: (108 commits)
  Snapshot update
  fix: ts issue on SelectOption test
  chore: Bump react and react-dom to 16.8.4
  Update latest.json
  Update templating.md
  Update CHANGELOG.md
  Updated threshold editor test
  Re-render gauge / singlestat panels when changing options
  fix: refactored so members are loaded by TeamPages and use hideFromTabs instead of filtering out children in navModel
  teams: explains the external property of a team membership.
  fix: fixed snapshots and permission select not beeing able to click
  fix: new team link goes nowhere for viewers
  teams: refactor so that you can only delete teams if you are team admin
  permissions: removes global access to bus from MakeUserAdmin.
  teams: local access to bus, moving away from dep on global.
  teams: better names for api permissions.
  teams: refactor.
  permissions: refactor.
  teams: refactor.
  teams: hide tabs settings and groupsync for non team admins
  ...
* grafana/master:
  refactor: merged types and updated references
  Remove leftover from first iteration
  chore: cleaning up noimplicit anys in search_srv and tests progress: grafana#14714
  Fix threshold editor color picker not working for custom colors
@ryantxu
Copy link
Member Author

ryantxu commented Mar 20, 2019

@torkelo -- I updated this to have the properties we discussed in #15925

Current state looks like:

export type DisplayValueClicked = () => void;

export interface DisplayValue {
  text: string; // Show in the UI
  numeric: number; // Use isNaN to check if it is a real number
  color?: string; // color based on configs or Threshold
  fontSize?: string;
  title?: string; // An optional title for this value
  link?: string | DisplayValueClicked; // URL or callback
  linkNewWindow?: boolean; // target _blank
  tooltip?: ReactNode;
}

This adds a wrapper component that takes care of the 'link' and 'tooltip' value: <DisplayValueLink value={value}> I'm not sure where that should live, and what component should use it -- ie, should it be in the panel component? or in each vis?

Obviously the panels need to fill in what the link values are -- does not look like that is exposed yet

* grafana/master:
  update table data model
  fix(graphite): nonNegativeDerivative argument hidden if 0, fixes grafana#12488
  flot pairs
* grafana/master: (56 commits)
  another change that didn't come with earlier commit
  change that didn't come with in last commit
  reversed dashboard-padding
  Update CloudWatch metrics/dimension list (grafana#16102)
  brought back dashboard-padding and panel-padding variables, made dashboard-padding more specific
  fix(prometheus): Change aligment of range queries (grafana#16110)
  Minor refactoring of testdata query order PR grafana#16122
  cleaner version
  maintain query order
  Update PLUGIN_DEV.md
  Merge with master, and updated logo and name
  more fixes to snapshot
  more fixes to snapshot
  removed empty space in snapshot
  fixed snapshot for test
  removed dashboard variables, removed headings-font-family variable, created theme variables for links and z-index, removed unused class in _panel_editor and _dashboard
  Tooltip: show percent instead of value
  Right tooltip position
  Add "No data points" message
  Improve tooltip look
  ...
* grafana/master:
  rename stat to show in UI
  use display value in pie chart
  renamed float to flot
* grafana/master:
  clarify notifications API docs
  remove processTimeSeries
  merge master
  don't use process timeseries
* grafana/master:
  Pamels: Options are always there
  Panels: Support angular -> react migration via PanelMigrationHandler
  Panels: Added more tests for change panel plugin
  Panels: Refactoring how panel plugins sets hooks and components, grafana#16166
  keep plugin versions
  remove panel plugin setters
@torkelo
Copy link
Member

torkelo commented Mar 26, 2019

Sorry been buried in admin & release prep yesterday & today, hope find time for this and your other PRs later this week.

ryantxu and others added 2 commits March 26, 2019 08:18
* grafana/master: (36 commits)
  Fix: Elasticsearch fix template variables in the alias field (grafana#16629)
  Fix: TablePanel column color style now works even after removeing styles, fixes grafana#16162 (grafana#16227)
  Docs: Updated changelog for 6.1 release (grafana#16224)
  Alerting: Notification channel http api enhancements (grafana#16219)
  Upgrades: Patch updates to yarn lock (grafana#16215)
  Fix: DatasourceApi query response typing fix (grafana#16214)
  chore(influx): no point of reading response when bad status (grafana#16212)
  docs: loki provisioning
  docs(dev): Update docs about devenv dir (grafana#16208)
  fix(dashboard): time regions spanning across midnight (grafana#16201)
  fix(InfluxDB): Reads body and close request body even for error status codes (grafana#16207)
  chore: more TableData to SeriesData renaming (grafana#16206)
  fix(panels/graph): Default option name for spaceLength was accidentally changed (grafana#16205)
  fix(explore): only show split close button when split is active (grafana#16203)
  fix(react2angular): Fixed react to angular wrapper watching function expressions causing infinte digest loop, fixes grafana#16194 (grafana#16196)
  fix(Alerting): Fixed alert rules with eval in day units, fixes grafana#16174 (grafana#16182)
  fix(panel/table): Fix for white text on white background when value is null
  Use grafana's logger implementation
  Remove sleeps in test code by overriding time.Now()
  Abstract encrypt/encode and decode/decrypt into their own functions
  ...
@torkelo
Copy link
Member

torkelo commented Mar 27, 2019

Argh, this is just too hard. Especially with these font size options & prefix/suffix coloring options.

Challenges:

  • Eventually we want to migrate angular singlestat -> react singlestat with minimum breaking changs.
  • Eventually we want to migrate angular singlestat gauges -> react gauge with minimum breaking changs.

Interesting, Angular Singlestat Gauge actually does not support font size for prefix/suffix nor the coloring options for prefix/suffix.

I would like to get the bigger DisplayValue interface, so thinking about merging this even though there is a lot of things in POC state. We can then iterate on the options UI (want to put this to our UX designers), and think about how to add auto font size handling, is there any options we can remove without major breaking behavior etc.

@ryantxu
Copy link
Member Author

ryantxu commented Mar 27, 2019

Argh, this is just too hard.

no joke -- it gets pretty ugly, and I'm not sure how useful all the options are.

My goal with this PR is to find all the pieces that need effort and make sure our data model/interfaces can cleanly represent the range of options in a mostly common way. The UI and details obviously still need some serious love.

Auto font sizing could be interesting, but for repeated single stats, i think we want to make sure they all have a common font size. I suspect it would look pretty weird to have a bunch of them with different computed font sizes next to each other.

* grafana/master:
  Refactor: Rename TimeSeriesVM to GraphSeriesXY (grafana#16216)
  Chore: Implement revive (grafana#16200)
  InfluxDB: Fix tag names with periods in alerting (grafana#16255)
  Fix: Table Panel and string values & numeric formatting (grafana#16249)
  Tech: Patch lib updates, update yarn.lock (grafana#16250)
  Chore: docs whats new article for the 6.1 release (grafana#16251)
  Chore: Storybook improvements (grafana#16239)
  Feat: Introduce Button and LinkButton components to @grafana/ui (grafana#16228)
  Chore: changelog adds note for grafana#16234
  Fix: Prometheus regex ad-hoc filters w/ wildcards (grafana#16234)
  Chore: changelog notes for grafana#13825,grafana#15205,grafana#14877,grafana#16227
  Fix: Alert email variable name typo fixed (grafana#16232)
  Fix: scripts changelog cli per page set to 100
  Fix: Dashboard history diff & white theme fix (grafana#16231)
  Merge pull request grafana#16241 from grafana/hugoh/no-implicit-any
  Chore: Theme consistency, rems => pixels or variables (grafana#16235)
  Chore: Theme consistency, rems => pixels (grafana#16145)
  changelog: adds notes for grafana#16229 and grafana#16227
* grafana/master:
  Feature: Introduced CallToActionCard to @grafana/ui (grafana#16237)
@torkelo torkelo merged commit c8b2102 into grafana:master Mar 28, 2019
ryantxu added a commit to ryantxu/grafana that referenced this pull request Mar 28, 2019
* grafana/master:
  Feature: Case insensitive Loki search (grafana#15948)
  Feat: Singlestat panel react progress & refactorings (grafana#16039)
  Chore: Implement gosec (grafana#16261)
  Fix: Updated snapshot unit test that was failing
  Refactor: Theme & Removed the last rems (grafana#16245)
  Refactor: Theme input padding variables (grafana#16048)
  Feat: More robust csv support (grafana#16170)
  Docs: Fix rpm dependencies example (grafana#16272)
  Fix: HTML meta tags fix for iOS (grafana#16269)
ryantxu added a commit to ryantxu/grafana that referenced this pull request Mar 28, 2019
…-srv

* grafana/master: (95 commits)
  Feature: added actionable message in Explore when no datasource configured (grafana#16252)
  Feature: Case insensitive Loki search (grafana#15948)
  Feat: Singlestat panel react progress & refactorings (grafana#16039)
  Chore: Implement gosec (grafana#16261)
  Fix: Updated snapshot unit test that was failing
  Refactor: Theme & Removed the last rems (grafana#16245)
  Refactor: Theme input padding variables (grafana#16048)
  Feat: More robust csv support (grafana#16170)
  Docs: Fix rpm dependencies example (grafana#16272)
  Fix: HTML meta tags fix for iOS (grafana#16269)
  Feature: Introduced CallToActionCard to @grafana/ui (grafana#16237)
  Refactor: Rename TimeSeriesVM to GraphSeriesXY (grafana#16216)
  Chore: Implement revive (grafana#16200)
  InfluxDB: Fix tag names with periods in alerting (grafana#16255)
  Fix: Table Panel and string values & numeric formatting (grafana#16249)
  Tech: Patch lib updates, update yarn.lock (grafana#16250)
  Chore: docs whats new article for the 6.1 release (grafana#16251)
  Chore: Storybook improvements (grafana#16239)
  Feat: Introduce Button and LinkButton components to @grafana/ui (grafana#16228)
  Chore: changelog adds note for grafana#16234
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Mar 28, 2019
…-scroll-again

* grafana/master: (95 commits)
  Feature: added actionable message in Explore when no datasource configured (grafana#16252)
  Feature: Case insensitive Loki search (grafana#15948)
  Feat: Singlestat panel react progress & refactorings (grafana#16039)
  Chore: Implement gosec (grafana#16261)
  Fix: Updated snapshot unit test that was failing
  Refactor: Theme & Removed the last rems (grafana#16245)
  Refactor: Theme input padding variables (grafana#16048)
  Feat: More robust csv support (grafana#16170)
  Docs: Fix rpm dependencies example (grafana#16272)
  Fix: HTML meta tags fix for iOS (grafana#16269)
  Feature: Introduced CallToActionCard to @grafana/ui (grafana#16237)
  Refactor: Rename TimeSeriesVM to GraphSeriesXY (grafana#16216)
  Chore: Implement revive (grafana#16200)
  InfluxDB: Fix tag names with periods in alerting (grafana#16255)
  Fix: Table Panel and string values & numeric formatting (grafana#16249)
  Tech: Patch lib updates, update yarn.lock (grafana#16250)
  Chore: docs whats new article for the 6.1 release (grafana#16251)
  Chore: Storybook improvements (grafana#16239)
  Feat: Introduce Button and LinkButton components to @grafana/ui (grafana#16228)
  Chore: changelog adds note for grafana#16234
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Mar 28, 2019
* grafana/master: (88 commits)
  Feature: added actionable message in Explore when no datasource configured (grafana#16252)
  Feature: Case insensitive Loki search (grafana#15948)
  Feat: Singlestat panel react progress & refactorings (grafana#16039)
  Chore: Implement gosec (grafana#16261)
  Fix: Updated snapshot unit test that was failing
  Refactor: Theme & Removed the last rems (grafana#16245)
  Refactor: Theme input padding variables (grafana#16048)
  Feat: More robust csv support (grafana#16170)
  Docs: Fix rpm dependencies example (grafana#16272)
  Fix: HTML meta tags fix for iOS (grafana#16269)
  Feature: Introduced CallToActionCard to @grafana/ui (grafana#16237)
  Refactor: Rename TimeSeriesVM to GraphSeriesXY (grafana#16216)
  Chore: Implement revive (grafana#16200)
  InfluxDB: Fix tag names with periods in alerting (grafana#16255)
  Fix: Table Panel and string values & numeric formatting (grafana#16249)
  Tech: Patch lib updates, update yarn.lock (grafana#16250)
  Chore: docs whats new article for the 6.1 release (grafana#16251)
  Chore: Storybook improvements (grafana#16239)
  Feat: Introduce Button and LinkButton components to @grafana/ui (grafana#16228)
  Chore: changelog adds note for grafana#16234
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Mar 29, 2019
* grafana/master: (102 commits)
  Fix: Bring back styles on Switch components when checked
  Update CHANGELOG.md
  Chore: breaks build if certain FrontEnd limits are exceeded (grafana#16301)
  Fix: Graphite query ast to string fix (grafana#16297)
  Fix: Template query editor this bind exception fix (grafana#16299)
  Fix: Alerting Notification channel http api fixes (grafana#16288)
  Refactor: Move LogLevel and Labels utils to @grafana/ui (grafana#16285)
  Refactor: Rename Tags to Labels in SeriesData (simple) (grafana#16284)
  Elasticsearch: Fix view percentiles metric in table without date histogram (grafana#15686)
  Configuration: Improve session_lifetime comments (grafana#16238)
  Alerting: Makes timeouts and retries configurable (grafana#16259)
  Fix: Correct SnapshotData typing (grafana#16279)
  Feat: Angular panels & SeriesData to Table/TimeSeries (grafana#16266)
  Fix: React Graph & Show message on no data (grafana#16278)
  Feature: added actionable message in Explore when no datasource configured (grafana#16252)
  Feature: Case insensitive Loki search (grafana#15948)
  Feat: Singlestat panel react progress & refactorings (grafana#16039)
  Chore: Implement gosec (grafana#16261)
  Fix: Updated snapshot unit test that was failing
  Refactor: Theme & Removed the last rems (grafana#16245)
  ...
ryantxu added a commit to ryantxu/grafana that referenced this pull request Mar 29, 2019
* grafana/master: (608 commits)
  Fix: Bring back styles on Switch components when checked
  Update CHANGELOG.md
  Chore: breaks build if certain FrontEnd limits are exceeded (grafana#16301)
  Fix: Graphite query ast to string fix (grafana#16297)
  Fix: Template query editor this bind exception fix (grafana#16299)
  Fix: Alerting Notification channel http api fixes (grafana#16288)
  Refactor: Move LogLevel and Labels utils to @grafana/ui (grafana#16285)
  Refactor: Rename Tags to Labels in SeriesData (simple) (grafana#16284)
  Elasticsearch: Fix view percentiles metric in table without date histogram (grafana#15686)
  Configuration: Improve session_lifetime comments (grafana#16238)
  Alerting: Makes timeouts and retries configurable (grafana#16259)
  Fix: Correct SnapshotData typing (grafana#16279)
  Feat: Angular panels & SeriesData to Table/TimeSeries (grafana#16266)
  Fix: React Graph & Show message on no data (grafana#16278)
  Feature: added actionable message in Explore when no datasource configured (grafana#16252)
  Feature: Case insensitive Loki search (grafana#15948)
  Feat: Singlestat panel react progress & refactorings (grafana#16039)
  Chore: Implement gosec (grafana#16261)
  Fix: Updated snapshot unit test that was failing
  Refactor: Theme & Removed the last rems (grafana#16245)
  ...
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

2 participants