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

Visualization Embed: Add option to hide timestamp #4491

Merged
merged 1 commit into from Dec 30, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -47,7 +47,7 @@ VisualizationEmbedHeader.propTypes = {

VisualizationEmbedHeader.defaultProps = { queryDescription: "" };

function VisualizationEmbedFooter({ query, queryResults, updatedAt, refreshStartedAt, queryUrl }) {
function VisualizationEmbedFooter({ query, queryResults, updatedAt, refreshStartedAt, queryUrl, hideTimestamp }) {
const downloadMenu = (
<Menu>
<Menu.Item>
@@ -76,15 +76,17 @@ function VisualizationEmbedFooter({ query, queryResults, updatedAt, refreshStart

return (
<div className="tile__bottom-control">
<span>
<a className="small hidden-print">
<i className="zmdi zmdi-time-restore" />{" "}
{refreshStartedAt ? <Timer from={refreshStartedAt} /> : <TimeAgo date={updatedAt} />}
</a>
<span className="small visible-print">
<i className="zmdi zmdi-time-restore" /> {formatDateTime(updatedAt)}
{!hideTimestamp && (
<span>

This comment has been minimized.

Copy link
@gabrieldutra

gabrieldutra Dec 25, 2019

Member

Just one note: currently this <span> is what moves the buttons to the right side, if you don't want them to be in the left side when there's no timestamp, just keep it empty 🙂

This comment has been minimized.

Copy link
@arikfr

arikfr Dec 30, 2019

Author Member

Thanks for noticing, but that's inline with the current implementation on SaaS, so safe to keep :)

<a className="small hidden-print">
<i className="zmdi zmdi-time-restore" />{" "}
{refreshStartedAt ? <Timer from={refreshStartedAt} /> : <TimeAgo date={updatedAt} />}
</a>
<span className="small visible-print">
<i className="zmdi zmdi-time-restore" /> {formatDateTime(updatedAt)}
</span>
</span>
</span>
)}
{queryUrl && (
<span className="hidden-print">
<Tooltip title="Open in Redash">
@@ -112,13 +114,15 @@ VisualizationEmbedFooter.propTypes = {
updatedAt: PropTypes.string,
refreshStartedAt: Moment,
queryUrl: PropTypes.string,
hideTimestamp: PropTypes.bool,
};

VisualizationEmbedFooter.defaultProps = {
queryResults: null,
updatedAt: null,
refreshStartedAt: null,
queryUrl: null,
hideTimestamp: false,
};

function VisualizationEmbed({ query }) {
@@ -128,6 +132,7 @@ function VisualizationEmbed({ query }) {
const hideHeader = has($location.search(), "hide_header");
const hideParametersUI = has($location.search(), "hide_parameters");
const hideQueryLink = has($location.search(), "hide_link");
const hideTimestamp = has($location.search(), "hide_timestamp");

const showQueryDescription = has($location.search(), "showDescription");
const visualizationId = parseInt($routeParams.visualizationId, 10);
@@ -185,6 +190,7 @@ function VisualizationEmbed({ query }) {
updatedAt={queryResults ? queryResults.getUpdatedAt() : undefined}
refreshStartedAt={refreshStartedAt}
queryUrl={!hideQueryLink ? query.getUrl() : null}
hideTimestamp={hideTimestamp}
/>
</div>
);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.