Skip to content

Commit

Permalink
Add unarchive button to dashboard (getredash#4697)
Browse files Browse the repository at this point in the history
Co-authored-by: Jesse Whitehouse <jesse@whitehouse.dev>
  • Loading branch information
2 people authored and tharzeez committed Jun 26, 2023
1 parent 35c5d0f commit 08c3915
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/app/pages/dashboards/components/DashboardHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { DashboardTagsControl } from "@/components/tags-control/TagsControl";
import getTags from "@/services/getTags";
import { clientConfig } from "@/services/auth";
import { policy } from "@/services/policy";
import recordEvent from "@/services/recordEvent";
import { durationHumanize } from "@/lib/utils";
import { DashboardStatusEnum } from "../hooks/useDashboard";

Expand Down Expand Up @@ -175,15 +176,22 @@ function DashboardControl({ dashboardConfiguration, headerExtra }) {
fullscreen,
toggleFullscreen,
showShareDashboardDialog,
updateDashboard,
} = dashboardConfiguration;
const showPublishButton = dashboard.is_draft;
const showRefreshButton = true;
const showFullscreenButton = !dashboard.is_draft;
const canShareDashboard = canEditDashboard && !dashboard.is_draft;
const showShareButton = !clientConfig.disablePublicUrls && (dashboard.publicAccessEnabled || canShareDashboard);
const showMoreOptionsButton = canEditDashboard;

const unarchiveDashboard = () => {
recordEvent("unarchive", "dashboard", dashboard.id);
updateDashboard({ is_archived: false }, false);
};
return (
<div className="dashboard-control">
{dashboard.can_edit && dashboard.is_archived && <Button onClick={unarchiveDashboard}>Unarchive</Button>}
{!dashboard.is_archived && (
<span className="hidden-print">
{showPublishButton && (
Expand Down

0 comments on commit 08c3915

Please sign in to comment.