Skip to content

Commit dd81f97

Browse files
committed
fix(pci-block-storage): add feature flipping
ref: #TAPC-5227 Signed-off-by: Adrien Turmo <[email protected]>
1 parent a9bc4fc commit dd81f97

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { usePCIFeatureAvailability } from '@ovh-ux/manager-pci-common';
2+
3+
export const FILE_STORAGE_ALPHA = 'pci-block-storage:file-storage-alpha-banner';
4+
5+
export const useIsFileStorageAlphaBannerAvailable = () => {
6+
const { data } = usePCIFeatureAvailability([FILE_STORAGE_ALPHA]);
7+
8+
return data?.get(FILE_STORAGE_ALPHA) ?? false;
9+
};

packages/manager/apps/pci-block-storage/src/components/banner/FileStorageAlphaBanner.component.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { useTranslation } from 'react-i18next';
33
import { useGeneralBannerContext } from '@/contexts/GeneralBanner.context';
44
import { Banner } from '@/components/banner/Banner.component';
55
import { ButtonLink } from '@/components/button-link/ButtonLink';
6+
import { useIsFileStorageAlphaBannerAvailable } from '@/api/feature';
67

78
export const FileStorageAlphaBanner = () => {
89
const { t } = useTranslation(['general-banners']);
910

1011
const { addBanner, getBanner } = useGeneralBannerContext();
12+
const isFileStorageAlphaBannerAvailable = useIsFileStorageAlphaBannerAvailable();
1113

1214
useEffect(() => {
15+
if (!isFileStorageAlphaBannerAvailable) return;
16+
1317
addBanner('alpha_file_storage', ({ onRemove }) => (
1418
<Banner
1519
iconName="circle-info"
@@ -34,7 +38,7 @@ export const FileStorageAlphaBanner = () => {
3438
</div>
3539
</Banner>
3640
));
37-
}, []);
41+
}, [isFileStorageAlphaBannerAvailable]);
3842

3943
return getBanner('alpha_file_storage');
4044
};

0 commit comments

Comments
 (0)