Skip to content
Snippets Groups Projects
Unverified Commit 2c3026fd authored by Anton Kulyk's avatar Anton Kulyk Committed by GitHub
Browse files

Add explanation text to the action editor (#28406)

* Add explanation text to the action editor

* Replace link
parent db3f2c8e
No related branches found
No related tags found
No related merge requests found
...@@ -4,12 +4,17 @@ import Icon from "metabase/components/Icon"; ...@@ -4,12 +4,17 @@ import Icon from "metabase/components/Icon";
import { color, lighten } from "metabase/lib/colors"; import { color, lighten } from "metabase/lib/colors";
import { space } from "metabase/styled-components/theme"; import { space } from "metabase/styled-components/theme";
export const FormCreatorWrapper = styled.div` export const FormContainer = styled.div`
flex: 1 1 0; flex: 1 1 0;
margin: 1rem 1.5rem;
transition: flex 500ms ease-in-out; transition: flex 500ms ease-in-out;
padding: ${space(3)};
background-color: ${color("white")}; background-color: ${color("white")};
overflow-y: auto; `;
export const InfoText = styled.span`
display: block;
color: ${color("text-medium")};
margin-bottom: 2rem;
`; `;
export const FieldSettingsButtonsContainer = styled.div` export const FieldSettingsButtonsContainer = styled.div`
......
import React, { useState, useEffect, useMemo } from "react"; import React, { useState, useEffect, useMemo } from "react";
import { jt, t } from "ttag";
import _ from "underscore"; import _ from "underscore";
import ExternalLink from "metabase/core/components/ExternalLink";
import { ActionForm } from "metabase/actions/components/ActionForm"; import { ActionForm } from "metabase/actions/components/ActionForm";
import SidebarContent from "metabase/query_builder/components/SidebarContent";
import MetabaseSettings from "metabase/lib/settings";
import type { ActionFormSettings, Parameter } from "metabase-types/api"; import type { ActionFormSettings, Parameter } from "metabase-types/api";
...@@ -10,7 +15,7 @@ import { addMissingSettings } from "../utils"; ...@@ -10,7 +15,7 @@ import { addMissingSettings } from "../utils";
import { hasNewParams } from "./utils"; import { hasNewParams } from "./utils";
import { EmptyFormPlaceholder } from "./EmptyFormPlaceholder"; import { EmptyFormPlaceholder } from "./EmptyFormPlaceholder";
import { FormCreatorWrapper } from "./FormCreator.styled"; import { FormContainer, InfoText } from "./FormCreator.styled";
function FormCreator({ function FormCreator({
params, params,
...@@ -47,23 +52,37 @@ function FormCreator({ ...@@ -47,23 +52,37 @@ function FormCreator({
if (!sortedParams.length) { if (!sortedParams.length) {
return ( return (
<FormCreatorWrapper> <SidebarContent title={t`Action parameters`}>
<EmptyFormPlaceholder onExampleClick={onExampleClick} /> <FormContainer>
</FormCreatorWrapper> <EmptyFormPlaceholder onExampleClick={onExampleClick} />
</FormContainer>
</SidebarContent>
); );
} }
const docsLink = (
<ExternalLink
key="learn-more"
href={MetabaseSettings.docsUrl("actions/custom")}
>{t`Learn more`}</ExternalLink>
);
return ( return (
<FormCreatorWrapper> <SidebarContent title={t`Action parameters`}>
<ActionForm <FormContainer>
parameters={sortedParams} <InfoText>
isEditable={isEditable} {jt`Configure your parameters' types and properties here. The values for these parameters can come from user input, or from a dashboard filter. ${docsLink}`}
onClose={_.noop} </InfoText>
onSubmit={_.noop} <ActionForm
formSettings={formSettings} parameters={sortedParams}
setFormSettings={setFormSettings} isEditable={isEditable}
/> onClose={_.noop}
</FormCreatorWrapper> onSubmit={_.noop}
formSettings={formSettings}
setFormSettings={setFormSettings}
/>
</FormContainer>
</SidebarContent>
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment