0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00

Closes #645 fix adding dashboarditem with set dates (#646)

This commit is contained in:
Tim Glaser 2020-04-22 18:37:41 +01:00 committed by GitHub
parent 33ec0e8d12
commit 70ce87e02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,11 @@ import { toast } from 'react-toastify'
import { Link } from 'react-router-dom'
import { Button } from 'antd'
function momentToString(date) {
if (date._isAMomentObject) return val.format('YYYY-MM-DD')
return date
}
export class SaveToDashboard extends Component {
constructor(props) {
super(props)
@ -16,15 +21,20 @@ export class SaveToDashboard extends Component {
Toast({ closeToast }) {
return (
<div>
Panel added to dashboard.
Panel added to dashboard.&nbsp;
<Link to="/">Click here to see it.</Link>
</div>
)
}
save(event) {
let { filters } = this.props
event.preventDefault()
api.create('api/dashboard', {
filters: this.props.filters,
filters: {
...filters,
date_from: momentToString(filters.date_from),
date_to: momentToString(filters.date_to),
},
type: this.props.type,
name: event.target.name.value,
}).then(() => {