Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions static/app/views/dashboards/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {IconResize} from 'sentry/icons';
import {t} from 'sentry/locale';
import GroupStore from 'sentry/stores/groupStore';
import {space} from 'sentry/styles/space';
import {defined} from 'sentry/utils';
import {trackAnalytics} from 'sentry/utils/analytics';
import {DatasetSource} from 'sentry/utils/discover/types';
import useApi from 'sentry/utils/useApi';
Expand Down Expand Up @@ -430,6 +431,7 @@ function Dashboard({
onSetTransactionsDataset={() => handleChangeSplitDataset(widget, index)}
isEmbedded={isEmbedded}
isPreview={isPreview}
isPrebuiltDashboard={defined(dashboard.prebuiltId)}
dashboardFilters={getDashboardFiltersFromURL(location) ?? dashboard.filters}
dashboardPermissions={dashboard.permissions}
dashboardCreator={dashboard.createdBy}
Expand Down
17 changes: 10 additions & 7 deletions static/app/views/dashboards/sortableWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Props = {
dashboardPermissions?: DashboardPermissions;
isEmbedded?: boolean;
isMobile?: boolean;
isPrebuiltDashboard?: boolean;
isPreview?: boolean;
newlyAddedWidget?: Widget;
onNewWidgetScrollComplete?: () => void;
Expand Down Expand Up @@ -73,18 +74,20 @@ function SortableWidget(props: Props) {
newlyAddedWidget,
onNewWidgetScrollComplete,
useTimeseriesVisualization,
isPrebuiltDashboard = false,
} = props;

const organization = useOrganization();
const currentUser = useUser();
const {teams: userTeams} = useUserTeams();
const hasEditAccess = checkUserHasEditAccess(
currentUser,
userTeams,
organization,
dashboardPermissions,
dashboardCreator
);
const hasEditAccess =
checkUserHasEditAccess(
currentUser,
userTeams,
organization,
dashboardPermissions,
dashboardCreator
) && !isPrebuiltDashboard;

Copy link
Contributor

Choose a reason for hiding this comment

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

Small nit, now the name hasEditAccess is a bit misleading imo because it now also checks against the prebuilt dashboard variable. Perhaps something like canEdit makes more sense

const disableTransactionWidget =
organization.features.includes('discover-saved-queries-deprecation') &&
Expand Down
Loading