Skip to content

Commit

Permalink
feat: setup ff (#6532)
Browse files Browse the repository at this point in the history
Setup feature flag for the new refactoring of the project overview page

---------

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
  • Loading branch information
FredrikOseberg and sjaanus committed Mar 18, 2024
1 parent a86b8d3 commit 3621c72
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
14 changes: 14 additions & 0 deletions frontend/src/component/project/Project/Project.tsx
Expand Up @@ -43,6 +43,7 @@ import { UiFlags } from 'interfaces/uiConfig';
import { HiddenProjectIconWithTooltip } from './HiddenProjectIconWithTooltip/HiddenProjectIconWithTooltip';
import { ChangeRequestPlausibleProvider } from 'component/changeRequest/ChangeRequestContext';
import { ProjectApplications } from '../ProjectApplications/ProjectApplications';
import { useUiFlag } from 'hooks/useUiFlag';

const StyledBadge = styled(Badge)(({ theme }) => ({
position: 'absolute',
Expand Down Expand Up @@ -76,6 +77,8 @@ export const Project = () => {
const projectName = project?.name || projectId;
const { favorite, unfavorite } = useFavoriteProjectsApi();

const projectOverviewRefactor = useUiFlag('projectOverviewRefactor');

const [showDelDialog, setShowDelDialog] = useState(false);

const [
Expand Down Expand Up @@ -129,6 +132,14 @@ export const Project = () => {
},
];

if (projectOverviewRefactor) {
tabs.splice(1, 0, {
title: 'Insights',
path: `${basePath}/insights`,
name: 'insights',
});
}

const filteredTabs = tabs
.filter((tab) => {
if (tab.flag) {
Expand Down Expand Up @@ -299,6 +310,9 @@ export const Project = () => {
/>
<Route path='environments' element={<ProjectEnvironment />} />
<Route path='archive' element={<ProjectFeaturesArchive />} />
{Boolean(projectOverviewRefactor) && (
<Route path='insights' element={<div>Hello world</div>} />
)}
<Route path='logs' element={<ProjectLog />} />
<Route
path='change-requests'
Expand Down
1 change: 1 addition & 0 deletions frontend/src/interfaces/uiConfig.ts
Expand Up @@ -79,6 +79,7 @@ export type UiFlags = {
userAccessUIEnabled?: boolean;
sdkReporting?: boolean;
outdatedSdksBanner?: boolean;
projectOverviewRefactor?: string;
};

export interface IVersionInfo {
Expand Down
1 change: 1 addition & 0 deletions src/lib/__snapshots__/create-config.test.ts.snap
Expand Up @@ -132,6 +132,7 @@ exports[`should create default config 1`] = `
"newStrategyConfigurationFeedback": false,
"outdatedSdksBanner": false,
"personalAccessTokensKillSwitch": false,
"projectOverviewRefactor": false,
"queryMissingTokens": false,
"responseTimeMetricsFix": false,
"responseTimeWithAppNameKillSwitch": false,
Expand Down
7 changes: 6 additions & 1 deletion src/lib/types/experimental.ts
Expand Up @@ -55,7 +55,8 @@ export type IFlagKey =
| 'scimApi'
| 'displayEdgeBanner'
| 'globalFrontendApiCache'
| 'returnGlobalFrontendApiCache';
| 'returnGlobalFrontendApiCache'
| 'projectOverviewRefactor';

export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>;

Expand Down Expand Up @@ -272,6 +273,10 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_RETURN_GLOBAL_FRONTEND_API_CACHE,
false,
),
projectOverviewRefactor: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_PROJECT_OVERVIEW_REFACTOR,
false,
),
};

export const defaultExperimentalOptions: IExperimentalOptions = {
Expand Down
1 change: 1 addition & 0 deletions src/server-dev.ts
Expand Up @@ -53,6 +53,7 @@ process.nextTick(async () => {
outdatedSdksBanner: true,
globalFrontendApiCache: true,
returnGlobalFrontendApiCache: false,
projectOverviewRefactor: true,
},
},
authentication: {
Expand Down

0 comments on commit 3621c72

Please sign in to comment.