Skip to content

Commit cf7d21d

Browse files
authored
[BUG] Fix config diff view for the scenarios where experiment engine configuration has been updated (#95)
* - fix diff of experiment engine client configuration * - fix a scenario, when router is updated from nop experiment to any other exp engine * - strip util keys from exp engine config * - improve readability of stripKeys * - run prettifier on the entire UI repo
1 parent 9b63b92 commit cf7d21d

File tree

126 files changed

+784
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+784
-717
lines changed

ui/src/PrivateLayout.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import {
44
ApplicationsContextProvider,
55
CurrentProjectContextProvider,
66
Header,
7-
ProjectsContextProvider
7+
ProjectsContextProvider,
88
} from "@gojek/mlp-ui";
99
import { appConfig } from "./config";
1010
import { EnvironmentsContextProvider } from "./providers/environments/context";
1111
import "./PrivateLayout.scss";
1212

13-
export const PrivateLayout = Component => {
14-
return props => (
13+
export const PrivateLayout = (Component) => {
14+
return (props) => (
1515
<ApplicationsContextProvider>
1616
<ProjectsContextProvider>
1717
<CurrentProjectContextProvider {...props}>
1818
<Header
1919
homeUrl={appConfig.homepage}
2020
appIcon={appConfig.appIcon}
21-
onProjectSelect={projectId =>
21+
onProjectSelect={(projectId) =>
2222
navigate(`${appConfig.homepage}/projects/${projectId}/routers`)
2323
}
2424
docLinks={appConfig.docsUrl}

ui/src/components/accordion_form/AccordionForm.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from "@elastic/eui";
33
import { StepActions } from "../multi_steps_form/StepActions";
44
import { Sticky, StickyContainer } from "react-sticky";
55
import FormValidationContext, {
6-
MultiSectionFormValidationContextProvider
6+
MultiSectionFormValidationContextProvider,
77
} from "../form/validation";
88
import {
99
AccordionFormScrollController,
1010
AccordionFormSection,
11-
AccordionFormSideNav
11+
AccordionFormSideNav,
1212
} from ".";
1313

1414
import "./AccordionForm.scss";
1515
import useDimension from "../../hooks/useDimension";
1616
import { isEmpty } from "../../utils/object";
1717

18-
export const isSectionInvalid = errors => !isEmpty(errors);
18+
export const isSectionInvalid = (errors) => !isEmpty(errors);
1919

2020
export const AccordionForm = ({
2121
name,
2222
sections,
2323
onCancel,
2424
onSubmit,
2525
submitLabel,
26-
renderTitle
26+
renderTitle,
2727
}) => {
2828
const lastSectionRef = useRef(null);
2929
const { height: lastSectionHeight } = useDimension(lastSectionRef);
@@ -44,8 +44,8 @@ export const AccordionForm = ({
4444
<EuiFlexItem grow={true} className="accordionForm--content">
4545
<MultiSectionFormValidationContextProvider
4646
onSubmit={onSubmit}
47-
schemas={sections.map(s => s.validationSchema)}
48-
contexts={sections.map(s => s.validationContext)}>
47+
schemas={sections.map((s) => s.validationSchema)}
48+
contexts={sections.map((s) => s.validationContext)}>
4949
<FormValidationContext.Consumer>
5050
{({ errors, onSubmit, isSubmitting }) => (
5151
<EuiFlexGroup
@@ -76,9 +76,9 @@ export const AccordionForm = ({
7676
<EuiFlexItem
7777
// set the minHeight dynamically, based on the height of the last section
7878
style={{
79-
minHeight: `calc(100vh - ${lastSectionHeight +
80-
24 +
81-
16}px)`
79+
minHeight: `calc(100vh - ${
80+
lastSectionHeight + 24 + 16
81+
}px)`,
8282
}}>
8383
<StepActions
8484
submitLabel={submitLabel}

ui/src/components/accordion_form/AccordionFormScrollController.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import { animatedScrollConfig } from "./scroll";
66
import { isSectionInvalid } from "./AccordionForm";
77

88
export const AccordionFormScrollController = ({ sections }) => {
9-
const [isFormSubmissionInProgress, setFormSubmissionInProgress] = useState(
10-
false
11-
);
9+
const [isFormSubmissionInProgress, setFormSubmissionInProgress] =
10+
useState(false);
1211
const { isSubmitting, errors } = useContext(FormValidationContext);
1312

1413
useEffect(() => {

ui/src/components/accordion_form/AccordionFormSideNav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export const AccordionFormSideNav = ({ name, sections }) => {
1212
items: sections.map((section, idx) => ({
1313
id: idx,
1414
name: section.title,
15-
renderItem: () => <AccordionFormSideNavItem section={section} />
16-
}))
17-
}
15+
renderItem: () => <AccordionFormSideNavItem section={section} />,
16+
})),
17+
},
1818
];
1919

2020
return <EuiSideNav items={sideNav} />;

ui/src/components/accordion_form/scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ export const animatedScrollConfig = {
22
smooth: true,
33
offset: 0,
44
delay: 50,
5-
duration: 300
5+
duration: 300,
66
};

ui/src/components/form/combo_box/ComboboxSuggestItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const ComboboxSuggestItem = ({
88
searchValue,
99
optionContentClassname,
1010
prepend,
11-
append
11+
append,
1212
}) => {
1313
return (
1414
<EuiFlexGroup direction="row" justifyContent="spaceBetween">

ui/src/components/form/combo_box/EuiComboBoxSelect.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React, { useEffect, useState } from "react";
22
import { EuiComboBox } from "@elastic/eui";
33
import {
44
ComboboxSuggestItem,
5-
EuiComboboxSuggestItemRowHeight
5+
EuiComboboxSuggestItemRowHeight,
66
} from "./ComboboxSuggestItem";
77

88
export const EuiComboBoxSelect = ({ value, onChange, options, ...props }) => {
99
const [selected, setSelected] = useState([]);
1010

1111
useEffect(() => {
12-
let selected = options.filter(suggestion => suggestion.label === value);
12+
let selected = options.filter((suggestion) => suggestion.label === value);
1313

1414
if (value && selected.length === 0) {
1515
selected = [{ label: value }];
@@ -28,7 +28,7 @@ export const EuiComboBoxSelect = ({ value, onChange, options, ...props }) => {
2828
singleSelection={{ asPlainText: true }}
2929
noSuggestions={props.noSuggestions || !options}
3030
options={options}
31-
onChange={selected => {
31+
onChange={(selected) => {
3232
onChange(selected.length ? selected[0].label : undefined);
3333
}}
3434
isClearable={props.isClearable || true}

ui/src/components/form/context.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ export const FormContextProvider = ({ data: initData, ...props }) => {
1010

1111
const handleChanges = useCallback(
1212
(paths, value) => {
13-
const path = paths.filter(part => !!part).join(".");
14-
setData(data => {
13+
const path = paths.filter((part) => !!part).join(".");
14+
setData((data) => {
1515
set(data, path, value);
1616
return Object.assign(Object.create(data), data);
1717
});
1818
},
1919
[setData]
2020
);
2121

22-
const rootHandler = useMemo(() => new StackableFunction([], handleChanges), [handleChanges])
22+
const rootHandler = useMemo(
23+
() => new StackableFunction([], handleChanges),
24+
[handleChanges]
25+
);
2326
const { onChangeHandler, onChange } = useOnChangeHandler(rootHandler);
2427

2528
return (

ui/src/components/form/docker_image_combo_box/DockerRegistryPopover.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export const DockerRegistryPopover = ({ value, registryOptions, onChange }) => {
77

88
const panels = flattenPanelTree({
99
id: 0,
10-
items: registryOptions.map(registry => ({
10+
items: registryOptions.map((registry) => ({
1111
name: registry.inputDisplay,
1212
value: registry.value,
1313
icon: "logoDocker",
1414
onClick: () => {
1515
togglePopover();
1616
onChange(registry.value);
17-
}
18-
}))
17+
},
18+
})),
1919
});
2020

2121
const togglePopover = () => setOpen(!isOpen);
@@ -28,7 +28,7 @@ export const DockerRegistryPopover = ({ value, registryOptions, onChange }) => {
2828
iconType="arrowDown"
2929
iconSide="right"
3030
onClick={togglePopover}>
31-
{registryOptions.find(o => o.value === value).inputDisplay}
31+
{registryOptions.find((o) => o.value === value).inputDisplay}
3232
</EuiButtonEmpty>
3333
}
3434
isOpen={isOpen}

ui/src/components/form/docker_image_combo_box/SelectDockerImageComboBox.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { EuiComboBoxSelect } from "../combo_box/EuiComboBoxSelect";
55

66
const extractRegistry = (image, registries) => {
77
if (image) {
8-
const registry = registries.find(o => image.startsWith(o.value));
8+
const registry = registries.find((o) => image.startsWith(o.value));
99
if (registry && registry.value) {
1010
image = image.substr(registry.value.length);
1111
image && image.startsWith("/") && (image = image.substr(1));
@@ -25,11 +25,11 @@ export const SelectDockerImageComboBox = ({
2525
}) => {
2626
const [registry, image] = extractRegistry(value, registryOptions);
2727

28-
const onRegistryChange = value => {
28+
const onRegistryChange = (value) => {
2929
onChange(value ? `${value}/${image}` : image);
3030
};
3131

32-
const onImageChange = value => {
32+
const onImageChange = (value) => {
3333
onChange(registry ? `${registry}/${value}` : value);
3434
};
3535

@@ -42,7 +42,7 @@ export const SelectDockerImageComboBox = ({
4242
isInvalid={props.isInvalid}
4343
options={imageOptions}
4444
value={image}
45-
onChange={value => onImageChange(value || "")}
45+
onChange={(value) => onImageChange(value || "")}
4646
onCreateOption={onImageChange}
4747
prepend={
4848
<DockerRegistryPopover

0 commit comments

Comments
 (0)