Skip to content

Commit

Permalink
Look good changes
Browse files Browse the repository at this point in the history
Signed-off-by: Shubh Sahu <shubhvs@amazon.com>
  • Loading branch information
Shubh Sahu committed Aug 17, 2024
1 parent 0095e6a commit 7bd5a5a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
10 changes: 8 additions & 2 deletions public/components/IndexMapping/IndexMapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export * from "./helper";
export * from "./interfaces";

const IndexMapping = (
{ value: propsValue, onChange: propsOnChange, isEdit, oldValue, readonly, docVersion }: IndexMappingProps,
{ value: propsValue, onChange: propsOnChange, isEdit, oldValue, readonly, docVersion, useNewUx }: IndexMappingProps,
ref: Ref<IIndexMappingsRef>
) => {
const value = propsValue?.properties || [];
Expand Down Expand Up @@ -194,10 +194,16 @@ const IndexMapping = (
{readonly ? null : (
<>
<EuiSpacer />
<EuiButton style={{ marginRight: 8 }} data-test-subj="createIndexAddFieldButton" onClick={() => addField("")}>
<EuiButton
size={useNewUx ? "s" : undefined}
style={{ marginRight: 8 }}
data-test-subj="createIndexAddFieldButton"
onClick={() => addField("")}
>
Add new field
</EuiButton>
<EuiButton
size={useNewUx ? "s" : undefined}
data-test-subj="createIndexAddObjectFieldButton"
onClick={() =>
addField("", {
Expand Down
1 change: 1 addition & 0 deletions public/components/IndexMapping/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface IndexMappingProps {
oldMappingsEditable?: boolean; // in template edit case, existing mappings is editable
readonly?: boolean;
docVersion: string;
useNewUx?: boolean;
}

export enum EDITOR_MODE {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ class ComposableTemplates extends MDSEnabledComponent<ComposableTemplatesProps,
this.props.history.push(ROUTES.CREATE_COMPOSABLE_TEMPLATE);
}}
data-test-subj="CreateComponentTemplateWhenNoTemplateFound"
size={useNewUX ? "s" : undefined}
>
Create component template
</EuiButton>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<IComponentTemplateD
isEdit,
field,
noPanel,
useNewUX,
};

const diffedNumber = isEdit
Expand Down Expand Up @@ -296,19 +297,25 @@ const TemplateDetail = (props: TemplateDetailProps, ref: Ref<IComponentTemplateD
<EuiSpacer />
<IndexSettings {...subCompontentProps} />
<EuiSpacer />
<TemplateMappings {...subCompontentProps} />
<TemplateMappings useNewUx={useNewUX} {...subCompontentProps} />
<EuiSpacer />
{isEdit || hideButton ? null : (
<>
<EuiSpacer />
<EuiFlexGroup alignItems="center" justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButtonEmpty onClick={onCancel} data-test-subj="CreateComposableTemplateCancelButton">
<EuiButtonEmpty onClick={onCancel} data-test-subj="CreateComposableTemplateCancelButton" size={useNewUX ? "s" : undefined}>
Cancel
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton fill onClick={onClickSubmit} isLoading={isSubmitting} data-test-subj="CreateComposableTemplateCreateButton">
<EuiButton
fill
onClick={onClickSubmit}
isLoading={isSubmitting}
data-test-subj="CreateComposableTemplateCreateButton"
size={useNewUX ? "s" : undefined}
>
Create component template
</EuiButton>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { AllBuiltInComponents } from "../../../../components/FormGenerator";
import { IndicesUpdateMode } from "../../../../utils/constants";

export default function TemplateMappings(props: SubDetailProps) {
const { field, noPanel } = props;
const { field, noPanel, useNewUx } = props;
const values = field.getValues();
const mappingsRef = useRef<IIndexMappingsRef>(null);
const coreServices = useContext(CoreServicesContext) as CoreStart;
Expand Down Expand Up @@ -76,6 +76,7 @@ export default function TemplateMappings(props: SubDetailProps) {
},
],
})}
useNewUx={useNewUx}
isEdit
ref={mappingsRef}
oldMappingsEditable
Expand Down
1 change: 1 addition & 0 deletions public/pages/CreateComposableTemplate/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface SubDetailProps extends TemplateDetailProps {
field: FieldInstance;
isEdit: boolean;
noPanel?: boolean;
useNewUx?: boolean;
}

export interface ComponentTemplateEdit extends IComposableTemplate {
Expand Down

0 comments on commit 7bd5a5a

Please sign in to comment.