Skip to content

Commit

Permalink
fix: revert "feat: ADDON-61556 Introduced checkbox group component (#394
Browse files Browse the repository at this point in the history
)" (#428)

This reverts commit 9ffed80.
  • Loading branch information
artemrys authored Sep 13, 2023
1 parent 10d1031 commit 358b1be
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 587 deletions.
356 changes: 76 additions & 280 deletions ui/src/main/webapp/components/BaseFormView.jsx

Large diffs are not rendered by default.

71 changes: 0 additions & 71 deletions ui/src/main/webapp/components/CheckboxGroupsComponent.jsx

This file was deleted.

38 changes: 28 additions & 10 deletions ui/src/main/webapp/components/ControlWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import React from 'react';
import PropTypes from 'prop-types';
import ControlGroup from '@splunk/react-ui/ControlGroup';
import styled from 'styled-components';

import MarkdownMessage from './MarkdownMessage';
import CONTROL_TYPE_MAP from '../constants/ControlTypeMap';
import { CustomElement, CheckboxElement, ControlGroupWrapper } from './StyledComponent';

const CHECKBOX_GROUPS = 'checkboxGroups';
const CustomElement = styled.div`
margin-left: 30px;
`;

const ControlGroupWrapper = styled(ControlGroup).attrs((props) => ({
'data-name': props.dataName,
}))`
width: 100%;
max-width: 100%;
> * {
&:first-child {
width: 240px !important;
}
&:nth-child(3) {
margin-left: 270px !important;
width: 320px;
}
}
span[class*='ControlGroupStyles__StyledAsterisk-'] {
color: red;
}
`;

class ControlWrapper extends React.PureComponent {
static isString = (str) => !!(typeof str === 'string' || str instanceof String);
Expand Down Expand Up @@ -54,9 +78,7 @@ class ControlWrapper extends React.PureComponent {
rowView = this.controlType
? React.createElement(this.controlType, {
handleChange,
label: this.props.entity.label,
value: this.props.value,
checkboxTextFieldValue: this.props.checkboxTextFieldValue,
field,
controlOptions: this.props.entity.options,
error: this.props.error,
Expand All @@ -83,10 +105,7 @@ class ControlWrapper extends React.PureComponent {
);

return (
this.props.display &&
(this.props.entity.type === CHECKBOX_GROUPS ? (
<CheckboxElement>{rowView}</CheckboxElement>
) : (
this.props.display && (
<ControlGroupWrapper
label={label}
help={helpText}
Expand All @@ -97,7 +116,7 @@ class ControlWrapper extends React.PureComponent {
>
<CustomElement>{rowView}</CustomElement>
</ControlGroupWrapper>
))
)
);
}
}
Expand All @@ -106,7 +125,6 @@ ControlWrapper.propTypes = {
mode: PropTypes.string,
utilityFuncts: PropTypes.object,
value: PropTypes.any,
checkboxTextFieldValue: PropTypes.any,
display: PropTypes.bool,
error: PropTypes.bool,
entity: PropTypes.object,
Expand Down
143 changes: 0 additions & 143 deletions ui/src/main/webapp/components/StyledComponent.jsx

This file was deleted.

2 changes: 0 additions & 2 deletions ui/src/main/webapp/constants/ControlTypeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import RadioComponent from '../components/RadioComponent';
import PlaceholderComponent from '../components/PlaceholderComponent';
import CustomControl from '../components/CustomControl';
import FileInputComponent from '../components/FileInputComponent';
import CheckboxGroupsComponent from '../components/CheckboxGroupsComponent';

export default {
text: TextComponent,
Expand All @@ -20,6 +19,5 @@ export default {
radio: RadioComponent,
file: FileInputComponent,
placeholder: PlaceholderComponent,
checkboxGroups: CheckboxGroupsComponent,
custom: CustomControl,
};
Loading

0 comments on commit 358b1be

Please sign in to comment.