Skip to content
Snippets Groups Projects
Unverified Commit d6c5e1a8 authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Open dashboard history on last edit info click (#22016)

parent b9f62be9
Branches
Tags
No related merge requests found
......@@ -38,6 +38,7 @@ const propTypes = {
setItemAttributeFn: PropTypes.func,
onHeaderModalDone: PropTypes.func,
onHeaderModalCancel: PropTypes.func,
onLastEditInfoClick: PropTypes.func,
};
const defaultProps = {
......@@ -116,7 +117,7 @@ class Header extends Component {
}
render() {
const { item, hasBadge } = this.props;
const { item, hasBadge, onLastEditInfoClick } = this.props;
const hasLastEditInfo = !!item["last-edit-info"];
let titleAndDescription;
......@@ -185,7 +186,12 @@ class Header extends Component {
{hasBadge && hasLastEditInfo && (
<HeaderBadgesDivider></HeaderBadgesDivider>
)}
{hasLastEditInfo && <StyledLastEditInfoLabel item={item} />}
{hasLastEditInfo && (
<StyledLastEditInfoLabel
item={item}
onClick={onLastEditInfoClick}
/>
)}
</HeaderBadges>
</HeaderContent>
......
/* eslint-disable react/prop-types */
import React, { Component } from "react";
import { connect } from "react-redux";
import { push } from "react-router-redux";
import PropTypes from "prop-types";
import { t } from "ttag";
import ActionButton from "metabase/components/ActionButton";
import Button from "metabase/core/components/Button";
import Header from "metabase/components/Header";
......@@ -31,6 +33,7 @@ const mapStateToProps = (state, props) => {
const mapDispatchToProps = {
createBookmark: id => Bookmark.actions.create({ id, type: "dashboard" }),
deleteBookmark: id => Bookmark.actions.delete({ id, type: "dashboard" }),
onChangeLocation: push,
};
@Bookmark.loadList()
......@@ -70,6 +73,8 @@ export default class DashboardHeader extends Component {
onFullscreenChange: PropTypes.func.isRequired,
onSharingClick: PropTypes.func.isRequired,
onChangeLocation: PropTypes.func.isRequired,
};
handleEdit(dashboard) {
......@@ -369,7 +374,7 @@ export default class DashboardHeader extends Component {
}
render() {
const { dashboard } = this.props;
const { dashboard, location, onChangeLocation } = this.props;
return (
<Header
......@@ -385,6 +390,9 @@ export default class DashboardHeader extends Component {
editingTitle={t`You're editing this dashboard.`}
editingButtons={this.getEditingButtons()}
setItemAttributeFn={this.props.setDashboardAttribute}
onLastEditInfoClick={() =>
onChangeLocation(`${location.pathname}/history`)
}
/>
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment