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

[Canvas] Added formatnumber and formatdate UIs to sidebar #43059

Merged
merged 11 commits into from
Aug 22, 2019

Conversation

cqliu1
Copy link
Contributor

@cqliu1 cqliu1 commented Aug 9, 2019

Summary

Closes #23111.
Closes #23112.

This introduces a dateformat argument form for the sidebar. It looks identical to the numberFormat argument type introduced in #42007 but handles MomentJS formats instead of NumeralJS formats.

Screen Shot 2019-08-09 at 1 36 31 PM

For expressions that include formatdate or rounddate as one of the functions, this form will appear in the sidebar.

Note: Currently the sidebar isn't populated with forms for functions used in sub-expressions, so if you have something like | mapColumn @timestamp fn={getCell @timestamp | formatdate "MM/DD/YYYY"}, you won't see this date format form in the sidebar and will still need to change it via the expression editor.

Changes:

  • adds a dateformat argument type
  • adds transform UIs for formatnumber, formatdate, and rounddate
  • adds stories for new components
  • adds argument type defs
  • adds transform type defs

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@cqliu1 cqliu1 requested a review from a team as a code owner August 9, 2019 20:50
@cqliu1 cqliu1 added enhancement New value added to drive a business result impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:enhancement v7.4.0 v8.0.0 labels Aug 9, 2019
@cqliu1 cqliu1 force-pushed the feat/format-transforms branch from 0aad09d to 9cc87d6 Compare August 9, 2019 20:51
@cqliu1 cqliu1 added the WIP Work in progress label Aug 9, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

LGTM, works great!!

For those testing, here is a little expression to get a date which can be formatted via this new sidebar UI:

date
| math "value - 1000*60*60*7"
| formatdate "dddd, MMMM Do YYYY, h:mm:ss a"
| markdown {context}
| render

@cqliu1 cqliu1 changed the title [Canvas] Added formatnumber and formatdate transform UIs [Canvas] Added formatnumber and formatdate UIs to sidebar Aug 14, 2019
@cqliu1 cqliu1 force-pushed the feat/format-transforms branch from 7182b64 to 2cbdb75 Compare August 14, 2019 20:37
@elasticmachine
Copy link
Contributor

💔 Build Failed

@cqliu1 cqliu1 force-pushed the feat/format-transforms branch from 2cbdb75 to 1286127 Compare August 15, 2019 22:13
@cqliu1 cqliu1 added review and removed WIP Work in progress labels Aug 15, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@cqliu1 cqliu1 added the Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas label Aug 16, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-canvas

@cqliu1 cqliu1 requested a review from clintandrewhall August 19, 2019 18:38
@cqliu1 cqliu1 requested review from poffdeluxe and removed request for clintandrewhall August 21, 2019 17:38
Copy link
Contributor

@poffdeluxe poffdeluxe left a comment

Choose a reason for hiding this comment

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

Just one minor thing regarding proptypes. Looks great overall!

})
).isRequired,
handleSelectChange: PropTypes.func,
handleTextChange: PropTypes.func,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these two props might be out of date

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@cqliu1 cqliu1 merged commit 90edcf2 into elastic:master Aug 22, 2019
@cqliu1 cqliu1 deleted the feat/format-transforms branch August 22, 2019 18:03
cqliu1 added a commit to cqliu1/kibana that referenced this pull request Aug 22, 2019
)

* Added formatnumber and formatdate transform UIs

* Added rounddate transform

* Changed default custom format

* Changed to UTC date

* Fixed ts error

* Fixed help text

* Added type def for arguments

* Added types for tranforms

* Added snapshots

* Fixed prop
cqliu1 added a commit that referenced this pull request Aug 22, 2019
* Added formatnumber and formatdate transform UIs

* Added rounddate transform

* Changed default custom format

* Changed to UTC date

* Fixed ts error

* Fixed help text

* Added type def for arguments

* Added types for tranforms

* Added snapshots

* Fixed prop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:enhancement review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create arg type for formatdate/rounddate Create arg type for formatnumber
4 participants