Skip to content

Commit

Permalink
[Gitar] Cleaning up stale flag: improveCreateFlagFlow with value true (
Browse files Browse the repository at this point in the history
…#7895)

[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

---------

Co-authored-by: Gitar <[email protected]>
Co-authored-by: sjaanus <[email protected]>
  • Loading branch information
3 people authored Aug 15, 2024
1 parent 30cbde5 commit 977f969
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 71 deletions.
8 changes: 4 additions & 4 deletions frontend/cypress/support/UI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ export const createFeature_UI = (

cy.wait(300);

cy.get("[data-testid='CF_NAME_ID'] input").type(name, uiOpts);
cy.get("[data-testid='CF_DESC_ID'] textarea")
cy.get("[data-testid='FORM_NAME_INPUT'] input").type(name, uiOpts);
cy.get("[data-testid='FORM_DESCRIPTION_INPUT'] textarea")
.first()
.type('hello-world', uiOpts);
if (!shouldWait)
return cy.get("[data-testid='CF_CREATE_BTN_ID']").click(uiOpts);
else cy.get("[data-testid='CF_CREATE_BTN_ID']").click(uiOpts);
return cy.get("[data-testid='FORM_CREATE_BUTTON']").click(uiOpts);
else cy.get("[data-testid='FORM_CREATE_BUTTON']").click(uiOpts);
return cy.wait('@createFeature');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from 'component/providers/AccessProvider/permissions';
import { useContext } from 'react';
import AccessContext from 'contexts/AccessContext';
import { useUiFlag } from 'hooks/useUiFlag';

const WarningContainer = styled(Box)(({ theme }) => ({
display: 'flex',
Expand Down Expand Up @@ -109,7 +108,6 @@ type ApplicationIssues =

const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
const { hasAccess } = useContext(AccessContext);
const improveCreateFlagFlow = useUiFlag('improveCreateFlagFlow');
const length = features.length;

if (length === 0) {
Expand All @@ -130,25 +128,12 @@ const FeaturesMissing = ({ features }: IFeaturesMissingProps) => {
<ConditionallyRender
condition={hasAccess(CREATE_FEATURE)}
show={
<ConditionallyRender
condition={improveCreateFlagFlow}
show={
<StyledLink
key={feature}
to={`/projects/default?create=true&name=${feature}`}
>
Create feature flag
</StyledLink>
}
elseShow={
<StyledLink
key={feature}
to={`/projects/default/create-toggle?name=${feature}`}
>
Create feature flag
</StyledLink>
}
/>
<StyledLink
key={feature}
to={`/projects/default?create=true&name=${feature}`}
>
Create feature flag
</StyledLink>
}
/>
</IssueRowContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import Add from '@mui/icons-material/Add';
import FileDownload from '@mui/icons-material/FileDownload';
import { styled } from '@mui/material';
import ResponsiveButton from 'component/common/ResponsiveButton/ResponsiveButton';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useSearchParams } from 'react-router-dom';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import { getCreateTogglePath } from 'utils/routePathHelpers';
import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions';
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
import type { FeatureSchema } from 'openapi';
Expand Down Expand Up @@ -48,44 +47,25 @@ const FlagCreationButton: FC = () => {
const showCreateDialog = Boolean(searchParams.get('create'));
const [openCreateDialog, setOpenCreateDialog] = useState(showCreateDialog);
const { loading } = useUiConfig();
const navigate = useNavigate();
const improveCreateFlagFlow = useUiFlag('improveCreateFlagFlow');

return (
<ConditionallyRender
condition={improveCreateFlagFlow}
show={
<>
<StyledResponsiveButton
onClick={() => setOpenCreateDialog(true)}
maxWidth='960px'
Icon={Add}
projectId={projectId}
disabled={loading}
permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE'
>
New feature flag
</StyledResponsiveButton>
<CreateFeatureDialog
open={openCreateDialog}
onClose={() => setOpenCreateDialog(false)}
/>
</>
}
elseShow={
<StyledResponsiveButton
onClick={() => navigate(getCreateTogglePath(projectId))}
maxWidth='960px'
Icon={Add}
projectId={projectId}
permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE'
>
New feature flag
</StyledResponsiveButton>
}
/>
<>
<StyledResponsiveButton
onClick={() => setOpenCreateDialog(true)}
maxWidth='960px'
Icon={Add}
projectId={projectId}
disabled={loading}
permission={CREATE_FEATURE}
data-testid='NAVIGATE_TO_CREATE_FEATURE'
>
New feature flag
</StyledResponsiveButton>
<CreateFeatureDialog
open={openCreateDialog}
onClose={() => setOpenCreateDialog(false)}
/>
</>
);
};

Expand Down
1 change: 0 additions & 1 deletion frontend/src/interfaces/uiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export type UiFlags = {
resourceLimits?: boolean;
insightsV2?: boolean;
integrationEvents?: boolean;
improveCreateFlagFlow?: boolean;
newEventSearch?: boolean;
changeRequestPlayground?: boolean;
archiveProjects?: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/lib/__snapshots__/create-config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ exports[`should create default config 1`] = `
},
"filterInvalidClientMetrics": false,
"googleAuthEnabled": false,
"improveCreateFlagFlow": false,
"insightsV2": false,
"integrationEvents": false,
"killInsightsUI": false,
Expand Down
5 changes: 0 additions & 5 deletions src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export type IFlagKey =
| 'removeUnsafeInlineStyleSrc'
| 'insightsV2'
| 'integrationEvents'
| 'improveCreateFlagFlow'
| 'originMiddleware'
| 'newEventSearch'
| 'changeRequestPlayground'
Expand Down Expand Up @@ -298,10 +297,6 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_INTEGRATION_EVENTS,
false,
),
improveCreateFlagFlow: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_IMPROVE_CREATE_FLAG_FLOW,
false,
),
originMiddleware: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_ORIGIN_MIDDLEWARE,
false,
Expand Down
1 change: 0 additions & 1 deletion src/server-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ process.nextTick(async () => {
extendedMetrics: true,
insightsV2: true,
integrationEvents: true,
improveCreateFlagFlow: true,
originMiddleware: true,
newEventSearch: true,
changeRequestPlayground: true,
Expand Down

0 comments on commit 977f969

Please sign in to comment.