Skip to content

Commit 7994e45

Browse files
committed
feat(addons): Move redirect service behind feature flag
1 parent a7658d3 commit 7994e45

File tree

6 files changed

+39
-11
lines changed

6 files changed

+39
-11
lines changed

src/app/features/project/project-addons/project-addons.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{{ 'settings.addons.description' | translate }}
2323
</p>
2424
<osf-addons-toolbar
25-
[categoryOptions]="categoryOptions"
25+
[categoryOptions]="categoryOptions()"
2626
[searchControl]="searchControl"
2727
[(selectedCategory)]="selectedCategory"
2828
/>
@@ -43,7 +43,7 @@
4343
{{ 'settings.addons.connectedDescription' | translate }}
4444
</p>
4545
<osf-addons-toolbar
46-
[categoryOptions]="categoryOptions"
46+
[categoryOptions]="categoryOptions()"
4747
[searchControl]="searchControl"
4848
[(selectedCategory)]="selectedCategory"
4949
/>

src/app/features/project/project-addons/project-addons.component.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export class ProjectAddonsComponent implements OnInit {
7777
private destroyRef = inject(DestroyRef);
7878
private queryParamsService = inject(AddonsQueryParamsService);
7979
readonly tabOptions = ADDON_TAB_OPTIONS;
80-
readonly categoryOptions = ADDON_CATEGORY_OPTIONS;
8180
readonly AddonTabValue = AddonTabValue;
8281
readonly defaultTabValue = AddonTabValue.ALL_ADDONS;
8382
searchControl = new FormControl<string>('');
@@ -107,6 +106,21 @@ export class ProjectAddonsComponent implements OnInit {
107106
isConfiguredStorageAddonsLoading = select(AddonsSelectors.getConfiguredStorageAddonsLoading);
108107
isConfiguredCitationAddonsLoading = select(AddonsSelectors.getConfiguredCitationAddonsLoading);
109108
isConfiguredLinkAddonsLoading = select(AddonsSelectors.getConfiguredLinkAddonsLoading);
109+
activeFlags = select(UserSelectors.getActiveFlags);
110+
111+
readonly categoryOptions = computed(() => {
112+
if (this.activeFlags().includes('gravy_redirect')) {
113+
return [
114+
...ADDON_CATEGORY_OPTIONS,
115+
{
116+
label: 'settings.addons.categories.otherServices',
117+
value: AddonCategory.EXTERNAL_REDIRECT_SERVICES,
118+
},
119+
];
120+
}
121+
return ADDON_CATEGORY_OPTIONS;
122+
});
123+
110124
isAddonsLoading = computed(() => {
111125
return (
112126
this.isStorageAddonsLoading() ||

src/app/features/settings/settings-addons/settings-addons.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</p>
2525

2626
<osf-addons-toolbar
27-
[categoryOptions]="categoryOptions"
27+
[categoryOptions]="categoryOptions()"
2828
[searchControl]="searchControl"
2929
[(selectedCategory)]="selectedCategory"
3030
/>
@@ -43,7 +43,7 @@
4343
{{ 'settings.addons.connectedDescription' | translate }}
4444
</p>
4545
<osf-addons-toolbar
46-
[categoryOptions]="categoryOptions"
46+
[categoryOptions]="categoryOptions()"
4747
[searchControl]="searchControl"
4848
[(selectedCategory)]="selectedCategory"
4949
/>

src/app/features/settings/settings-addons/settings-addons.component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class SettingsAddonsComponent implements OnInit {
7474
private readonly route = inject(ActivatedRoute);
7575
private readonly queryParamsService = inject(AddonsQueryParamsService);
7676
readonly tabOptions = ADDON_TAB_OPTIONS;
77-
readonly categoryOptions = ADDON_CATEGORY_OPTIONS;
7877
readonly AddonTabValue = AddonTabValue;
7978
readonly defaultTabValue = AddonTabValue.ALL_ADDONS;
8079
searchControl = new FormControl<string>('');
@@ -99,6 +98,20 @@ export class SettingsAddonsComponent implements OnInit {
9998
isAuthorizedStorageAddonsLoading = select(AddonsSelectors.getAuthorizedStorageAddonsLoading);
10099
isAuthorizedCitationAddonsLoading = select(AddonsSelectors.getAuthorizedCitationAddonsLoading);
101100
isAuthorizedLinkAddonsLoading = select(AddonsSelectors.getAuthorizedLinkAddonsLoading);
101+
activeFlags = select(UserSelectors.getActiveFlags);
102+
103+
readonly categoryOptions = computed(() => {
104+
if (this.activeFlags().includes('gravy_redirect')) {
105+
return [
106+
...ADDON_CATEGORY_OPTIONS,
107+
{
108+
label: 'settings.addons.categories.otherServices',
109+
value: AddonCategory.EXTERNAL_REDIRECT_SERVICES,
110+
},
111+
];
112+
}
113+
return ADDON_CATEGORY_OPTIONS;
114+
});
102115

103116
currentAddonsLoading = computed(() => {
104117
switch (this.selectedCategory()) {

src/app/shared/constants/addons-category-options.const.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ export const ADDON_CATEGORY_OPTIONS: SelectOption[] = [
1414
label: 'settings.addons.categories.linkedServices',
1515
value: AddonCategory.EXTERNAL_LINK_SERVICES,
1616
},
17-
{
18-
label: 'settings.addons.categories.otherServices',
19-
value: AddonCategory.EXTERNAL_REDIRECT_SERVICES,
20-
},
17+
// TODO: add this after feature flag gravy_redirect is either turned on for everyone or removed
18+
// {
19+
// label: 'settings.addons.categories.otherServices',
20+
// value: AddonCategory.EXTERNAL_REDIRECT_SERVICES,
21+
// },
2122
];

src/app/shared/stores/addons/addons.selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class AddonsSelectors {
5252
}
5353

5454
@Selector([AddonsState])
55-
static getRedirectAddons(state: AddonsStateModel): AddonModel[] {
55+
static getRedirectAddons(state: AddonsStateModel): AddonModel[] | null {
5656
return state.redirectAddons.data;
5757
}
5858

0 commit comments

Comments
 (0)