Skip to content

Commit

Permalink
added feature flags to all release calls
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkikapadia committed Sep 20, 2024
1 parent c787071 commit e768e43
Show file tree
Hide file tree
Showing 2 changed files with 227 additions and 133 deletions.
267 changes: 169 additions & 98 deletions static/app/views/dashboards/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,39 +718,63 @@ class DashboardDetail extends Component<Props, State> {
legacyWhen={this.onLegacyRouteLeave}
when={this.onRouteLeave}
/>
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projects}
>
{({releaseSeries}) => {
// release series passed through to avoid multiple calls for line and area charts widgets
return isValidElement(children)
? cloneElement<any>(children, {
dashboard: modifiedDashboard ?? dashboard,
onSave: this.isEditingDashboard
? this.onUpdateWidget
: this.handleUpdateWidgetList,
updateDashboardSplitDecision: (
widgetId: string,
splitDecision: WidgetType
) => {
handleUpdateDashboardSplit({
widgetId,
splitDecision,
dashboard,
modifiedDashboard,
stateSetter: this.setState.bind(this),
onDashboardUpdate,
});
},
releaseSeries: releaseSeries,
})
: children;
}}
</ReleaseSeries>
{this.props.organization.features.includes('dashboards-releases-on-charts') ? (
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projects}
>
{({releaseSeries}) => {
// release series passed through to avoid multiple calls for line and area charts widgets
return isValidElement(children)
? cloneElement<any>(children, {
dashboard: modifiedDashboard ?? dashboard,
onSave: this.isEditingDashboard
? this.onUpdateWidget
: this.handleUpdateWidgetList,
updateDashboardSplitDecision: (
widgetId: string,
splitDecision: WidgetType
) => {
handleUpdateDashboardSplit({
widgetId,
splitDecision,
dashboard,
modifiedDashboard,
stateSetter: this.setState.bind(this),
onDashboardUpdate,
});
},
releaseSeries: releaseSeries,
})
: children;
}}
</ReleaseSeries>
) : isValidElement(children) ? (
cloneElement<any>(children, {
dashboard: modifiedDashboard ?? dashboard,
onSave: this.isEditingDashboard
? this.onUpdateWidget
: this.handleUpdateWidgetList,
updateDashboardSplitDecision: (
widgetId: string,
splitDecision: WidgetType
) => {
handleUpdateDashboardSplit({
widgetId,
splitDecision,
dashboard,
modifiedDashboard,
stateSetter: this.setState.bind(this),
onDashboardUpdate,
});
},
})
) : (
children
)}
</Fragment>
);
};
Expand Down Expand Up @@ -829,34 +853,53 @@ class DashboardDetail extends Component<Props, State> {
location={location}
forceTransactions={metricsDataSide.forceTransactionsOnly}
>
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projects}
>
{({releaseSeries}) => {
// release series passed through to avoid multiple calls for line and area charts widgets
return (
<Dashboard
paramDashboardId={dashboardId}
dashboard={modifiedDashboard ?? dashboard}
organization={organization}
isEditingDashboard={this.isEditingDashboard}
widgetLimitReached={widgetLimitReached}
onUpdate={this.onUpdateWidget}
handleUpdateWidgetList={this.handleUpdateWidgetList}
handleAddCustomWidget={this.handleAddCustomWidget}
handleAddMetricWidget={this.handleAddMetricWidget}
isPreview={this.isPreview}
router={router}
location={location}
releaseSeries={releaseSeries}
/>
);
}}
</ReleaseSeries>
{organization.features.includes(
'dashboards-releases-on-charts'
) ? (
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projects}
>
{({releaseSeries}) => {
// release series passed through to avoid multiple calls for line and area charts widgets
return (
<Dashboard
paramDashboardId={dashboardId}
dashboard={modifiedDashboard ?? dashboard}
organization={organization}
isEditingDashboard={this.isEditingDashboard}
widgetLimitReached={widgetLimitReached}
onUpdate={this.onUpdateWidget}
handleUpdateWidgetList={this.handleUpdateWidgetList}
handleAddCustomWidget={this.handleAddCustomWidget}
handleAddMetricWidget={this.handleAddMetricWidget}
isPreview={this.isPreview}
router={router}
location={location}
releaseSeries={releaseSeries}
/>
);
}}
</ReleaseSeries>
) : (
<Dashboard
paramDashboardId={dashboardId}
dashboard={modifiedDashboard ?? dashboard}
organization={organization}
isEditingDashboard={this.isEditingDashboard}
widgetLimitReached={widgetLimitReached}
onUpdate={this.onUpdateWidget}
handleUpdateWidgetList={this.handleUpdateWidgetList}
handleAddCustomWidget={this.handleAddCustomWidget}
handleAddMetricWidget={this.handleAddMetricWidget}
isPreview={this.isPreview}
router={router}
location={location}
/>
)}
</MEPSettingProvider>
)}
</MetricsDataSwitcher>
Expand Down Expand Up @@ -1075,43 +1118,71 @@ class DashboardDetail extends Component<Props, State> {
);
}}
/>

<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projectIds}
>
{({releaseSeries}) => {
// release series passed through to avoid multiple calls for line and area charts widgets
return (
<WidgetViewerContext.Provider
value={{seriesData, setData}}
>
<Dashboard
paramDashboardId={dashboardId}
dashboard={modifiedDashboard ?? dashboard}
organization={organization}
isEditingDashboard={this.isEditingDashboard}
widgetLimitReached={widgetLimitReached}
onUpdate={this.onUpdateWidget}
handleUpdateWidgetList={
this.handleUpdateWidgetList
}
handleAddCustomWidget={this.handleAddCustomWidget}
handleAddMetricWidget={this.handleAddMetricWidget}
router={router}
location={location}
newWidget={newWidget}
onSetNewWidget={onSetNewWidget}
isPreview={this.isPreview}
releaseSeries={releaseSeries}
/>
</WidgetViewerContext.Provider>
);
}}
</ReleaseSeries>
{organization.features.includes(
'dashboards-releases-on-charts'
) ? (
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projectIds}
>
{({releaseSeries}) => {
// release series passed through to avoid multiple calls for line and area charts widgets
return (
<WidgetViewerContext.Provider
value={{seriesData, setData}}
>
<Dashboard
paramDashboardId={dashboardId}
dashboard={modifiedDashboard ?? dashboard}
organization={organization}
isEditingDashboard={this.isEditingDashboard}
widgetLimitReached={widgetLimitReached}
onUpdate={this.onUpdateWidget}
handleUpdateWidgetList={
this.handleUpdateWidgetList
}
handleAddCustomWidget={
this.handleAddCustomWidget
}
handleAddMetricWidget={
this.handleAddMetricWidget
}
router={router}
location={location}
newWidget={newWidget}
onSetNewWidget={onSetNewWidget}
isPreview={this.isPreview}
releaseSeries={releaseSeries}
/>
</WidgetViewerContext.Provider>
);
}}
</ReleaseSeries>
) : (
<WidgetViewerContext.Provider
value={{seriesData, setData}}
>
<Dashboard
paramDashboardId={dashboardId}
dashboard={modifiedDashboard ?? dashboard}
organization={organization}
isEditingDashboard={this.isEditingDashboard}
widgetLimitReached={widgetLimitReached}
onUpdate={this.onUpdateWidget}
handleUpdateWidgetList={this.handleUpdateWidgetList}
handleAddCustomWidget={this.handleAddCustomWidget}
handleAddMetricWidget={this.handleAddMetricWidget}
router={router}
location={location}
newWidget={newWidget}
onSetNewWidget={onSetNewWidget}
isPreview={this.isPreview}
/>
</WidgetViewerContext.Provider>
)}
</MEPSettingProvider>
)}
</MetricsDataSwitcher>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,41 +118,64 @@ export function VisualizationStep({
/>
</FieldGroup>
<VisualizationWrapper displayType={displayType}>
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projects}
>
{({releaseSeries}) => {
return (
<WidgetCard
organization={organization}
selection={pageFilters}
widget={debouncedWidget}
dashboardFilters={
getDashboardFiltersFromURL(location) ?? dashboardFilters
}
isEditingDashboard={false}
widgetLimitReached={false}
renderErrorMessage={errorMessage =>
typeof errorMessage === 'string' && (
<PanelAlert type="error">{errorMessage}</PanelAlert>
)
}
noLazyLoad
showStoredAlert
noDashboardsMEPProvider={noDashboardsMEPProvider}
isWidgetInvalid={isWidgetInvalid}
onDataFetched={onDataFetched}
onWidgetSplitDecision={onWidgetSplitDecision}
shouldResize={false}
releaseSeries={releaseSeries}
/>
);
}}
</ReleaseSeries>
{organization.features.includes('dashboards-releases-on-charts') ? (
<ReleaseSeries
end={end}
start={start}
period={period}
environments={environments}
projects={projects}
>
{({releaseSeries}) => {
return (
<WidgetCard
organization={organization}
selection={pageFilters}
widget={debouncedWidget}
dashboardFilters={
getDashboardFiltersFromURL(location) ?? dashboardFilters
}
isEditingDashboard={false}
widgetLimitReached={false}
renderErrorMessage={errorMessage =>
typeof errorMessage === 'string' && (
<PanelAlert type="error">{errorMessage}</PanelAlert>
)
}
noLazyLoad
showStoredAlert
noDashboardsMEPProvider={noDashboardsMEPProvider}
isWidgetInvalid={isWidgetInvalid}
onDataFetched={onDataFetched}
onWidgetSplitDecision={onWidgetSplitDecision}
shouldResize={false}
releaseSeries={releaseSeries}
/>
);
}}
</ReleaseSeries>
) : (
<WidgetCard
organization={organization}
selection={pageFilters}
widget={debouncedWidget}
dashboardFilters={getDashboardFiltersFromURL(location) ?? dashboardFilters}
isEditingDashboard={false}
widgetLimitReached={false}
renderErrorMessage={errorMessage =>
typeof errorMessage === 'string' && (
<PanelAlert type="error">{errorMessage}</PanelAlert>
)
}
noLazyLoad
showStoredAlert
noDashboardsMEPProvider={noDashboardsMEPProvider}
isWidgetInvalid={isWidgetInvalid}
onDataFetched={onDataFetched}
onWidgetSplitDecision={onWidgetSplitDecision}
shouldResize={false}
/>
)}
</VisualizationWrapper>
</StyledBuildStep>
);
Expand Down

0 comments on commit e768e43

Please sign in to comment.