Skip to content

Commit

Permalink
feat(projectHistoryLogs): hide export button behind feature flag TASK…
Browse files Browse the repository at this point in the history
…-1359 (#5347)

### 🗒️ Checklist

1. [x] run linter locally
2. [x] update all related docs (API, README, inline, etc.), if any
3. [x] draft PR with a title `<type>(<scope>)<!>: <title> TASK-1234`
4. [x] tag PR: at least `frontend` or `backend` unless it's global
5. [x] fill in the template below and delete template comments
6. [x] review thyself: read the diff and repro the preview as written
7. [x] open PR & confirm that CI passes
8. [x] request reviewers, if needed
9. [ ] delete this section before merging

### 💭 Notes
This PR hides the `Export all data` button behind a feature flag, to be
viewed and tested conditionally.
The final implementation of the button will be worked on a future PR,
for another project.

### 👀 Preview steps
1. ℹ️ have account and a project
2. Have the activity logs feature flag on with:
?ff_activityLogsEnabled=true
3. Make some changes to the project, like editing the form and
redeploying
4. Navigate to Project > Settings > Activity
5. 🟢 `Export all data` should not be visible
6. Enable the button feature flag with:
?ff_exportActivityLogsEnabled=true
7. 🟢 `Export all data` should be visible
8. Button behavior is mocked so far and won't have any effect right now
  • Loading branch information
pauloamorimbr authored Dec 12, 2024
1 parent 9e143ff commit a2de673
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 11 additions & 4 deletions jsapp/js/components/activity/formActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import KoboModalHeader from '../modals/koboModalHeader';
import {ActivityMessage} from './activityMessage.component';
import ExportToEmailButton from '../exportToEmailButton/exportToEmailButton.component';
import {useParams} from 'react-router-dom';
import {FeatureFlag, useFeatureFlag} from 'jsapp/js/featureFlags';

/**
* A component used at Project > Settings > Activity route. Displays a table
Expand All @@ -26,6 +27,10 @@ import {useParams} from 'react-router-dom';
export default function FormActivity() {
const {data: filterOptions} = useActivityLogsFilterOptionsQuery();

const exportActivityLogsEnabled = useFeatureFlag(
FeatureFlag.exportActivityLogsEnabled
);

const [selectedFilterOption, setSelectedFilterOption] =
useState<KoboSelectOption | null>(null);

Expand Down Expand Up @@ -88,10 +93,12 @@ export default function FormActivity() {
placeholder={t('Filter by')}
options={filterOptions || []}
/>
<ExportToEmailButton
label={t('Export all data')}
exportFunction={exportData}
/>
{exportActivityLogsEnabled && (
<ExportToEmailButton
label={t('Export all data')}
exportFunction={exportData}
/>
)}
</div>
</div>
<div className={styles.tableContainer}>
Expand Down
3 changes: 2 additions & 1 deletion jsapp/js/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
export enum FeatureFlag {
activityLogsEnabled = 'activityLogsEnabled',
mmosEnabled = 'mmosEnabled',
oneTimeAddonsEnabled = 'oneTimeAddonsEnabled'
oneTimeAddonsEnabled = 'oneTimeAddonsEnabled',
exportActivityLogsEnabled = 'exportActivityLogsEnabled',
}

/**
Expand Down

0 comments on commit a2de673

Please sign in to comment.