Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(3000): Reconnect submit buttons in PageHeader to forms #18602

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariusandra Do you think it'd make sense for kea-forms to add an ID automatically based on logic key + formKey? Or would that be annoying?

<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
Loading