Skip to content

Commit 8dbfa65

Browse files
authored
Merge pull request #4029 from dlabrecq/remove-feature-flags
Remove unused Unleash flags
2 parents 247769b + 91e8cab commit 8dbfa65

File tree

24 files changed

+103
-217
lines changed

24 files changed

+103
-217
lines changed

src/components/featureToggle/featureToggle.tsx

-24
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ export const enum FeatureToggle {
1212
finsights = 'cost-management.ui.finsights', // RHEL support for FINsights https://issues.redhat.com/browse/COST-3306
1313
ibm = 'cost-management.ui.ibm', // IBM https://issues.redhat.com/browse/COST-935
1414
ocpCloudGroupBys = 'cost-management.ui.ocp-cloud-group-bys', // https://issues.redhat.com/browse/COST-5514
15-
ocpCloudNetworking = 'cost-management.ui.ocp-cloud-networking', // https://issues.redhat.com/browse/COST-4781
16-
ocpProjectStorage = 'cost-management.ui.ocp-project-storage', // https://issues.redhat.com/browse/COST-4856
17-
ros = 'cost-management.ui.ros', // ROS support https://issues.redhat.com/browse/COST-3477
1815
}
1916

2017
const useIsToggleEnabled = (toggle: FeatureToggle) => {
@@ -50,18 +47,6 @@ export const useIsOcpCloudGroupBysToggleEnabled = () => {
5047
return useIsToggleEnabled(FeatureToggle.ocpCloudGroupBys);
5148
};
5249

53-
export const useIsOcpCloudNetworkingToggleEnabled = () => {
54-
return useIsToggleEnabled(FeatureToggle.ocpCloudNetworking);
55-
};
56-
57-
export const useIsOcpProjectStorageToggleEnabled = () => {
58-
return useIsToggleEnabled(FeatureToggle.ocpProjectStorage);
59-
};
60-
61-
export const useIsRosToggleEnabled = () => {
62-
return useIsToggleEnabled(FeatureToggle.ros);
63-
};
64-
6550
// The FeatureToggle component saves feature toggles in store for places where Unleash hooks not available
6651
export const useFeatureToggle = () => {
6752
const dispatch = useDispatch();
@@ -74,9 +59,6 @@ export const useFeatureToggle = () => {
7459
const isFinsightsToggleEnabled = useIsFinsightsToggleEnabled();
7560
const isIbmToggleEnabled = useIsIbmToggleEnabled();
7661
const isOcpCloudGroupBysToggleEnabled = useIsOcpCloudGroupBysToggleEnabled();
77-
const isOcpCloudNetworkingToggleEnabled = useIsOcpCloudNetworkingToggleEnabled();
78-
const isOcpProjectStorageToggleEnabled = useIsOcpProjectStorageToggleEnabled();
79-
const isRosToggleEnabled = useIsRosToggleEnabled();
8062

8163
const fetchUser = callback => {
8264
auth.getUser().then(user => {
@@ -95,9 +77,6 @@ export const useFeatureToggle = () => {
9577
isFinsightsToggleEnabled,
9678
isIbmToggleEnabled,
9779
isOcpCloudGroupBysToggleEnabled,
98-
isOcpCloudNetworkingToggleEnabled,
99-
isOcpProjectStorageToggleEnabled,
100-
isRosToggleEnabled,
10180
})
10281
);
10382
if (isDebugToggleEnabled) {
@@ -112,9 +91,6 @@ export const useFeatureToggle = () => {
11291
isFinsightsToggleEnabled,
11392
isIbmToggleEnabled,
11493
isOcpCloudGroupBysToggleEnabled,
115-
isOcpCloudNetworkingToggleEnabled,
116-
isOcpProjectStorageToggleEnabled,
117-
isRosToggleEnabled,
11894
]);
11995
};
12096

src/components/permissions/permissions.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ interface PermissionsOwnProps extends ChromeComponentProps {
3434
interface PermissionsStateProps {
3535
isFinsightsToggleEnabled?: boolean;
3636
isIbmToggleEnabled?: boolean;
37-
isRosToggleEnabled?: boolean;
3837
userAccess: UserAccess;
3938
userAccessError: AxiosError;
4039
userAccessFetchStatus: FetchStatus;
@@ -48,7 +47,6 @@ const PermissionsBase: React.FC<PermissionsProps> = ({
4847
// chrome,
4948
isFinsightsToggleEnabled,
5049
isIbmToggleEnabled,
51-
isRosToggleEnabled,
5250
userAccess,
5351
userAccessError,
5452
userAccessFetchStatus,
@@ -66,7 +64,7 @@ const PermissionsBase: React.FC<PermissionsProps> = ({
6664
const oci = hasOciAccess(userAccess);
6765
const ocp = hasOcpAccess(userAccess);
6866
const rhel = isFinsightsToggleEnabled && hasRhelAccess(userAccess);
69-
const ros = isRosToggleEnabled && hasRosAccess(userAccess);
67+
const ros = hasRosAccess(userAccess);
7068
const settings = costModel || hasSettingsAccess(userAccess);
7169

7270
switch (pathname) {
@@ -135,7 +133,6 @@ const mapStateToProps = createMapStateToProps<PermissionsOwnProps, PermissionsSt
135133
return {
136134
isFinsightsToggleEnabled: FeatureToggleSelectors.selectIsFinsightsToggleEnabled(state),
137135
isIbmToggleEnabled: FeatureToggleSelectors.selectIsIbmToggleEnabled(state),
138-
isRosToggleEnabled: FeatureToggleSelectors.selectIsRosToggleEnabled(state),
139136
userAccess,
140137
userAccessError,
141138
userAccessFetchStatus,

src/routes/components/charts/historicalCostChart/__snapshots__/historicalCostChart.test.tsx.snap

+10-10
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@ exports[`null previous and current reports are handled 1`] = `
336336
vector-effect="non-scaling-stroke"
337337
width="79.2"
338338
x="0"
339-
y="57"
339+
y="67"
340340
/>
341341
<path
342-
d="M 7.84, 73.156
342+
d="M 7.84, 83.156
343343
h12.32
344344
v-4.312
345345
h-12.32
@@ -349,7 +349,7 @@ exports[`null previous and current reports are handled 1`] = `
349349
style="fill: #8bc1f7;"
350350
/>
351351
<path
352-
d="M 47.44, 73.156
352+
d="M 47.44, 83.156
353353
h12.320000000000007
354354
v-4.312
355355
h-12.320000000000007
@@ -363,7 +363,7 @@ exports[`null previous and current reports are handled 1`] = `
363363
dx="0"
364364
id="exampleCostChart-legend-ChartLabel-0"
365365
x="30.8"
366-
y="75.97"
366+
y="85.97"
367367
>
368368
<tspan
369369
dx="0"
@@ -380,7 +380,7 @@ exports[`null previous and current reports are handled 1`] = `
380380
dx="0"
381381
id="exampleCostChart-legend-ChartLabel-1"
382382
x="70.39999999999999"
383-
y="75.97"
383+
y="85.97"
384384
>
385385
<tspan
386386
dx="0"
@@ -705,10 +705,10 @@ exports[`reports are formatted to datums 1`] = `
705705
vector-effect="non-scaling-stroke"
706706
width="79.2"
707707
x="0"
708-
y="57"
708+
y="67"
709709
/>
710710
<path
711-
d="M 7.84, 73.156
711+
d="M 7.84, 83.156
712712
h12.32
713713
v-4.312
714714
h-12.32
@@ -718,7 +718,7 @@ exports[`reports are formatted to datums 1`] = `
718718
style="fill: #8bc1f7;"
719719
/>
720720
<path
721-
d="M 47.44, 73.156
721+
d="M 47.44, 83.156
722722
h12.320000000000007
723723
v-4.312
724724
h-12.320000000000007
@@ -732,7 +732,7 @@ exports[`reports are formatted to datums 1`] = `
732732
dx="0"
733733
id="exampleCostChart-legend-ChartLabel-0"
734734
x="30.8"
735-
y="75.97"
735+
y="85.97"
736736
>
737737
<tspan
738738
dx="0"
@@ -749,7 +749,7 @@ exports[`reports are formatted to datums 1`] = `
749749
dx="0"
750750
id="exampleCostChart-legend-ChartLabel-1"
751751
x="70.39999999999999"
752-
y="75.97"
752+
y="85.97"
753753
>
754754
<tspan
755755
dx="0"

src/routes/components/charts/historicalCostChart/historicalCostChart.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,12 @@ class HistoricalCostChartBase extends React.Component<HistoricalCostChartProps,
301301
series.map((s, index) => {
302302
return this.getChart(s, index);
303303
})}
304-
<ChartAxis label={xAxisLabel} style={chartStyles.xAxis} tickValues={[1, midDate, endDate]} />
304+
<ChartAxis
305+
label={xAxisLabel}
306+
style={chartStyles.xAxis}
307+
tickValues={[1, midDate, endDate]}
308+
fixAxisLabelHeight
309+
/>
305310
<ChartAxis dependentAxis label={yAxisLabel} style={chartStyles.yAxis} />
306311
</Chart>
307312
</div>

src/routes/components/charts/historicalUsageChart/historicalUsageChart.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,12 @@ class HistoricalUsageChartBase extends React.Component<HistoricalUsageChartProps
405405
series.map((s, index) => {
406406
return this.getChart(s, index);
407407
})}
408-
<ChartAxis label={xAxisLabel} style={chartStyles.xAxis} tickValues={[1, midDate, endDate]} />
408+
<ChartAxis
409+
label={xAxisLabel}
410+
style={chartStyles.xAxis}
411+
tickValues={[1, midDate, endDate]}
412+
fixAxisLabelHeight
413+
/>
409414
<ChartAxis dependentAxis label={yAxisLabel} style={chartStyles.yAxis} />
410415
</Chart>
411416
</div>

src/routes/details/components/breakdown/breakdownBase.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export interface BreakdownStateProps {
7171
instancesComponent?: React.ReactNode;
7272
isAwsEc2InstancesToggleEnabled?: boolean;
7373
isOptimizationsTab?: boolean;
74-
isRosToggleEnabled?: boolean;
7574
optimizationsBadgeComponent?: React.ReactNode;
7675
optimizationsComponent?: React.ReactNode;
7776
providers?: Providers;
@@ -136,7 +135,6 @@ class BreakdownBase extends React.Component<BreakdownProps, BreakdownState> {
136135
historicalDataComponent,
137136
instancesComponent,
138137
isAwsEc2InstancesToggleEnabled,
139-
isRosToggleEnabled,
140138
optimizationsComponent,
141139
} = this.props;
142140

@@ -159,7 +157,7 @@ class BreakdownBase extends React.Component<BreakdownProps, BreakdownState> {
159157
tab: BreakdownTab.instances,
160158
});
161159
}
162-
if (optimizationsComponent && isRosToggleEnabled) {
160+
if (optimizationsComponent) {
163161
availableTabs.push({
164162
contentRef: React.createRef(),
165163
showBadge: true,

src/routes/details/components/costOverview/costOverviewBase.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ interface CostOverviewOwnProps {
4343
}
4444

4545
export interface CostOverviewStateProps {
46-
isOcpProjectStorageToggleEnabled?: boolean;
4746
selectWidgets?: Record<number, any>;
4847
title?: string;
4948
widgets: number[];
@@ -358,8 +357,6 @@ class CostOverviewsBase extends React.Component<CostOverviewProps, any> {
358357

359358
// Returns rendered widget based on type
360359
private renderWidget(widget: CostOverviewWidget) {
361-
const { isOcpProjectStorageToggleEnabled } = this.props;
362-
363360
switch (widget.type) {
364361
case CostOverviewWidgetType.cluster:
365362
return this.getClusterCard(widget);
@@ -374,9 +371,6 @@ class CostOverviewsBase extends React.Component<CostOverviewProps, any> {
374371
case CostOverviewWidgetType.pvc:
375372
return this.getPvcChart(widget);
376373
case CostOverviewWidgetType.reportSummary:
377-
if (widget.reportType === ReportType.volume && !isOcpProjectStorageToggleEnabled) {
378-
return null;
379-
}
380374
return this.getReportSummaryCard(widget);
381375
case CostOverviewWidgetType.volumeUsage:
382376
return this.getVolumeUsageChart(widget);

src/routes/details/components/historicalData/historicalDataBase.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ interface HistoricalDataOwnProps {
2121
}
2222

2323
export interface HistoricalDataStateProps {
24-
isOcpCloudNetworkingToggleEnabled?: boolean;
25-
isOcpProjectStorageToggleEnabled?: boolean;
2624
selectWidgets?: Record<number, any>;
2725
widgets: number[];
2826
}
@@ -190,7 +188,7 @@ class HistoricalDatasBase extends React.Component<HistoricalDataProps, any> {
190188

191189
// Returns rendered widget based on type
192190
private renderWidget(widgetId: number) {
193-
const { isOcpCloudNetworkingToggleEnabled, isOcpProjectStorageToggleEnabled, selectWidgets } = this.props;
191+
const { selectWidgets } = this.props;
194192

195193
const widget = selectWidgets[widgetId];
196194
let result = null;
@@ -200,7 +198,7 @@ class HistoricalDatasBase extends React.Component<HistoricalDataProps, any> {
200198
result = this.getCostChart(widget);
201199
break;
202200
case HistoricalDataWidgetType.network:
203-
result = isOcpCloudNetworkingToggleEnabled ? this.getNetworkChart(widget) : null;
201+
result = this.getNetworkChart(widget);
204202
break;
205203
case HistoricalDataWidgetType.trend:
206204
result = this.getTrendChart(widget);
@@ -209,7 +207,7 @@ class HistoricalDatasBase extends React.Component<HistoricalDataProps, any> {
209207
result = this.getUsageChart(widget);
210208
break;
211209
case HistoricalDataWidgetType.volume:
212-
result = isOcpProjectStorageToggleEnabled ? this.getVolumeChart(widget) : null;
210+
result = this.getVolumeChart(widget);
213211
break;
214212
}
215213
return result !== null ? <GridItem key={`widget-${widgetId}`}>{result}</GridItem> : null;

src/routes/details/ocpBreakdown/costOverview.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import type { CostOverviewStateProps } from 'routes/details/components/costOverv
33
import { CostOverviewBase } from 'routes/details/components/costOverview';
44
import { ocpCostOverviewSelectors } from 'store/breakdown/costOverview/ocpCostOverview';
55
import { createMapStateToProps } from 'store/common';
6-
import { FeatureToggleSelectors } from 'store/featureToggle';
76

87
interface OcpCostOverviewOwnProps {
98
title?: string;
109
}
1110

1211
const mapStateToProps = createMapStateToProps<OcpCostOverviewOwnProps, CostOverviewStateProps>((state, { title }) => {
1312
return {
14-
isOcpProjectStorageToggleEnabled: FeatureToggleSelectors.selectIsOcpProjectStorageToggleEnabled(state),
1513
selectWidgets: ocpCostOverviewSelectors.selectWidgets(state),
1614
widgets: ocpCostOverviewSelectors.selectCurrentWidgets(state),
1715
title,

src/routes/details/ocpBreakdown/historicalData.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { HistoricalDataStateProps } from 'routes/details/components/histori
33
import { HistoricalDataBase } from 'routes/details/components/historicalData';
44
import { ocpHistoricalDataSelectors } from 'store/breakdown/historicalData/ocpHistoricalData';
55
import { createMapStateToProps } from 'store/common';
6-
import { FeatureToggleSelectors } from 'store/featureToggle';
76

87
interface OcpHistoricalDataOwnProps {
98
// TBD...
@@ -12,8 +11,6 @@ interface OcpHistoricalDataOwnProps {
1211
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1312
const mapStateToProps = createMapStateToProps<OcpHistoricalDataOwnProps, HistoricalDataStateProps>((state, props) => {
1413
return {
15-
isOcpCloudNetworkingToggleEnabled: FeatureToggleSelectors.selectIsOcpCloudNetworkingToggleEnabled(state),
16-
isOcpProjectStorageToggleEnabled: FeatureToggleSelectors.selectIsOcpProjectStorageToggleEnabled(state),
1714
selectWidgets: ocpHistoricalDataSelectors.selectWidgets(state),
1815
widgets: ocpHistoricalDataSelectors.selectCurrentWidgets(state),
1916
};

src/routes/details/ocpBreakdown/ocpBreakdown.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { getGroupById, getGroupByValue } from 'routes/utils/groupBy';
1818
import { filterProviders } from 'routes/utils/providers';
1919
import { getQueryState } from 'routes/utils/queryState';
2020
import { createMapStateToProps } from 'store/common';
21-
import { FeatureToggleSelectors } from 'store/featureToggle';
2221
import { providersQuery, providersSelectors } from 'store/providers';
2322
import { reportActions, reportSelectors } from 'store/reports';
2423
import { uiActions } from 'store/ui';
@@ -125,7 +124,6 @@ const mapStateToProps = createMapStateToProps<OcpBreakdownOwnProps, BreakdownSta
125124
<HistoricalData costDistribution={costDistribution} currency={currency} groupBy={groupBy} />
126125
),
127126
isOptimizationsTab: queryFromRoute.optimizationsTab !== undefined,
128-
isRosToggleEnabled: FeatureToggleSelectors.selectIsRosToggleEnabled(state),
129127
optimizationsComponent: groupBy === 'project' && groupByValue !== '*' ? <Optimizations /> : undefined,
130128
providers: filterProviders(providers, ProviderType.ocp),
131129
providersFetchStatus,

src/routes/details/ocpDetails/detailsTable.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentPro
4040
hiddenColumns?: Set<string>;
4141
isAllSelected?: boolean;
4242
isLoading?: boolean;
43-
isRosToggleEnabled?: boolean;
4443
onSelect(items: ComputedReportItem[], isSelected: boolean);
4544
onSort(sortType: string, isSortAscending: boolean);
4645
orderBy?: any;
@@ -100,7 +99,6 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
10099
hiddenColumns,
101100
intl,
102101
isAllSelected,
103-
isRosToggleEnabled,
104102
query,
105103
report,
106104
router,
@@ -133,7 +131,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
133131
name: '', // Default & Overhead column
134132
},
135133
{
136-
hidden: !(isGroupByProject && isRosToggleEnabled),
134+
hidden: !isGroupByProject,
137135
name: intl.formatMessage(messages.optimizations),
138136
},
139137
{
@@ -174,7 +172,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
174172
name: '', // Default & Overhead column
175173
},
176174
{
177-
hidden: !(isGroupByProject && isRosToggleEnabled),
175+
hidden: !isGroupByProject,
178176
name: intl.formatMessage(messages.optimizations),
179177
},
180178
{
@@ -304,7 +302,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
304302
),
305303
},
306304
{
307-
hidden: !(isGroupByProject && isRosToggleEnabled),
305+
hidden: !isGroupByProject,
308306
value: !isPlatformProject && !isDisabled && (
309307
<AsyncComponent
310308
scope="costManagementMfe"

0 commit comments

Comments
 (0)