Skip to content

Commit

Permalink
fix(3000): Reconnect submit buttons in PageHeader to forms (#18602)
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes authored Nov 14, 2023
1 parent 12a7872 commit b471e02
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions frontend/src/scenes/cohorts/CohortEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function CohortEdit({ id }: CohortLogicProps): JSX.Element {
}
return (
<div className="cohort">
<Form logic={cohortEditLogic} props={logicProps} formKey="cohort" enableFormOnSubmit>
<Form id="cohort" logic={cohortEditLogic} props={logicProps} formKey="cohort" enableFormOnSubmit>
<PageHeader
title={isNewCohort ? 'New cohort' : cohort.name || 'Untitled'}
buttons={
Expand Down Expand Up @@ -119,7 +119,7 @@ export function CohortEdit({ id }: CohortLogicProps): JSX.Element {
data-attr="save-cohort"
htmlType="submit"
loading={cohortLoading || cohort.is_calculating}
disabled={cohortLoading || cohort.is_calculating}
form="cohort"
>
Save
</LemonButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
}

return (
<Form formKey="earlyAccessFeature" logic={earlyAccessFeatureLogic}>
<Form id="early-access-feature" formKey="earlyAccessFeature" logic={earlyAccessFeatureLogic}>
<PageHeader
title={isNewEarlyAccessFeature ? 'New Feature Release' : earlyAccessFeature.name}
buttons={
Expand Down Expand Up @@ -95,6 +95,7 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
submitEarlyAccessFeatureRequest(earlyAccessFeature)
}}
loading={isEarlyAccessFeatureSubmitting}
form="early-access-feature"
>
{isNewEarlyAccessFeature ? 'Save as draft' : 'Save'}
</LemonButton>
Expand Down Expand Up @@ -146,7 +147,7 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
type="secondary"
onClick={() => updateStage(EarlyAccessFeatureStage.Beta)}
>
Reactivate Beta
Reactivate beta
</LemonButton>
)}
{earlyAccessFeature.stage == EarlyAccessFeatureStage.Draft && (
Expand All @@ -155,7 +156,7 @@ export function EarlyAccessFeature({ id }: { id?: string } = {}): JSX.Element {
tooltip={'Make beta feature available'}
type="primary"
>
Release Beta
Release beta
</LemonButton>
)}
<LemonDivider vertical />
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/scenes/experiments/Experiment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ export function Experiment(): JSX.Element {
{experimentId === 'new' || editingExistingExperiment ? (
<>
<Form
id="experiment"
logic={experimentLogic}
formKey="experiment"
props={props}
id="experiment-form"
enableFormOnSubmit
className="space-y-4 experiment-form"
>
Expand Down Expand Up @@ -196,7 +196,7 @@ export function Experiment(): JSX.Element {
data-attr="save-experiment"
htmlType="submit"
loading={experimentLoading}
disabled={experimentLoading}
form="experiment"
>
{editingExistingExperiment ? 'Save' : 'Save as draft'}
</LemonButton>
Expand Down Expand Up @@ -512,7 +512,7 @@ export function Experiment(): JSX.Element {
data-attr="save-experiment"
htmlType="submit"
loading={experimentLoading}
disabled={experimentLoading}
form="experiment"
>
{editingExistingExperiment ? 'Save' : 'Save as draft'}
</LemonButton>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/scenes/feature-flags/FeatureFlag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element {
<div className="feature-flag">
{isNewFeatureFlag || isEditingFlag ? (
<Form
id="feature-flag"
logic={featureFlagLogic}
props={props}
formKey="featureFlag"
Expand Down Expand Up @@ -248,8 +249,8 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element {
type="primary"
data-attr="save-feature-flag"
htmlType="submit"
form="feature-flag"
loading={featureFlagLoading}
disabled={featureFlagLoading}
>
Save
</LemonButton>
Expand Down Expand Up @@ -449,8 +450,8 @@ export function FeatureFlag({ id }: { id?: string } = {}): JSX.Element {
type="primary"
data-attr="save-feature-flag"
htmlType="submit"
form="feature-flag"
loading={featureFlagLoading}
disabled={featureFlagLoading}
>
Save
</LemonButton>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/scenes/surveys/Survey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function SurveyForm({ id }: { id: string }): JSX.Element {
const { loadSurvey, editingSurvey } = useActions(surveyLogic)

return (
<Form formKey="survey" logic={surveyLogic} className="space-y-4" enableFormOnSubmit>
<Form id="survey" formKey="survey" logic={surveyLogic} className="space-y-4" enableFormOnSubmit>
<PageHeader
title={id === 'new' ? 'New survey' : survey.name}
buttons={
Expand All @@ -75,6 +75,7 @@ export function SurveyForm({ id }: { id: string }): JSX.Element {
data-attr="save-feature-flag"
htmlType="submit"
loading={surveyLoading}
form="survey"
>
{id === 'new' ? 'Save as draft' : 'Save'}
</LemonButton>
Expand Down

0 comments on commit b471e02

Please sign in to comment.