Skip to content

Commit

Permalink
fix: downgrade splunkui to 4.0.0
Browse files Browse the repository at this point in the history
doc: label/value mapping limitation for ComboBox
fix: dependabot alert for postcss vulnerability
  • Loading branch information
harshpatel-crest committed May 18, 2021
1 parent b5eb568 commit 80ef18f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 150 deletions.
5 changes: 3 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},
"dependencies": {
"@splunk/react-page": "^5.0.0",
"@splunk/react-toast-notifications": "^0.10.0",
"@splunk/react-ui": "4.1.0",
"@splunk/react-toast-notifications": "^0.9.0",
"@splunk/react-ui": "4.0.0",
"@splunk/splunk-utils": "^2.0.0",
"@splunk/themes": "^0.7.0",
"axios": "^0.21.1",
Expand All @@ -41,6 +41,7 @@
"@splunk/babel-preset": "^3.0.0",
"@splunk/eslint-config": "^4.0.0",
"@splunk/stylelint-config": "^4.0.0",
"postcss": "^8.2.10",
"@splunk/webpack-configs": "^5.0.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.4",
Expand Down
59 changes: 0 additions & 59 deletions ui/src/main/webapp/components/ComboBoxWrapper.jsx

This file was deleted.

39 changes: 21 additions & 18 deletions ui/src/main/webapp/components/SingleInputComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ import styled from 'styled-components';

import { axiosCallWrapper } from '../util/axiosCallWrapper';
import { filterResponse } from '../util/util';
import ComboBoxWrapper from './ComboBoxWrapper';

const SelectWrapper = styled(Select)`
width: 320px !important;
`;

const StyledDiv = styled.div`
div:first-child {
width: 320px !important;
}
`;

function SingleInputComponent(props) {
const {
field,
Expand All @@ -41,28 +46,24 @@ function SingleInputComponent(props) {
function handleChange(e, obj) {
restProps.handleChange(field, obj.value);
}
const [labelValueMapping, setLabelValueMapping] = useState(null);
const Option = createSearchChoice ? ComboBox.Option : Select.Option;
const Heading = createSearchChoice ? ComboBox.Heading : Select.Heading;

function generateOptions(items) {
const data = [];
const mapping = new Map();
items.forEach((item) => {
// Known issue(ADDON-37036): In case of ComboBox, label/value abstraction is not supported
// So prop label is just a dummy prop for ComboBox.Option or ComboBox.Heading
if (item.value && item.label) {
data.push(<Option label={item.label} value={item.value} key={item.value} />);
mapping.set(item.label, item.value);
}
if (item.children && item.label) {
mapping.set(item.label.toUpperCase(), new Map());
data.push(<Heading key={item.label}>{item.label}</Heading>);
item.children.forEach((child) => {
data.push(<Option label={child.label} value={child.value} key={child.value} />);
mapping.get(item.label.toUpperCase()).set(child.label, child.value);
});
}
});
setLabelValueMapping(mapping);
return data;
}

Expand Down Expand Up @@ -122,17 +123,19 @@ function SingleInputComponent(props) {
return (
<>
{createSearchChoice ? (
<ComboBoxWrapper
value={props.value === null ? '' : props.value}
name={field}
error={error}
placeholder={effectivePlaceholder}
disabled={effectiveDisabled}
labelValueMapping={labelValueMapping}
handleChange={handleChange}
>
{options && options.length > 0 && options}
</ComboBoxWrapper>
<StyledDiv>
<ComboBox
value={props.value === null ? '' : props.value}
name={field}
error={error}
placeholder={effectivePlaceholder}
disabled={effectiveDisabled}
onChange={handleChange}
inline
>
{options && options.length > 0 && options}
</ComboBox>
</StyledDiv>
) : (
<>
<SelectWrapper
Expand Down
94 changes: 23 additions & 71 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1395,19 +1395,6 @@
lodash "^4.17.14"
prop-types "^15.6.2"

"@splunk/react-icons@^3.1.0":
version "3.1.0"
resolved "https://registry.npmjs.org/@splunk/react-icons/-/react-icons-3.1.0.tgz#041ac5a69e779ff8daac328f1bb255449854e7f8"
integrity sha512-TZz/q4OOgb25fcI2FIv9V4GVmkmyzP2F1BBmuseAXhrAl4ouubBWMGJT0b5L3+Y97LQNTmwVwvcDAjD2H8Nz+g==
dependencies:
"@splunk/ui-utils" "^1.3.0"
"@types/lodash" "^4.14.156"
"@types/react" "^16.9.38"
"@types/react-dom" "^16.9.8"
"@types/styled-components" "^5.1.0"
lodash "^4.17.14"
prop-types "^15.6.2"

"@splunk/react-page@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@splunk/react-page/-/react-page-5.0.0.tgz"
Expand All @@ -1420,48 +1407,20 @@
prop-types "^15.6.2"
scriptjs "^2.5.8"

"@splunk/react-toast-notifications@^0.10.0":
version "0.10.0"
resolved "https://registry.npmjs.org/@splunk/react-toast-notifications/-/react-toast-notifications-0.10.0.tgz#85e4954a4d7065b6237cab29573ccffab357898b"
integrity sha512-XlUw2+SBTT59M4RX+giN62tftnr5CjX9NaBSPmDrznpudmnHZLRQWlhJ+q+CgQx08/O/CS2tW+0O0PzatmRZsg==
"@splunk/react-toast-notifications@^0.9.0":
version "0.9.0"
resolved "https://registry.yarnpkg.com/@splunk/react-toast-notifications/-/react-toast-notifications-0.9.0.tgz#0283ae0f981efebb0c804ac11a9e2718473d1986"
integrity sha512-r+7Zl+zjo+X1G9kPj0wyq8CLyw8FKUv4Rdlpzx+qVC8jwUELZFCnDJNs/lhtE7ColRsc8/jxlKx3J1f9I4mX8Q==
dependencies:
"@splunk/react-icons" "^3.1.0"
"@splunk/react-ui" "^4.1.0"
"@splunk/themes" "^0.8.0"
"@splunk/ui-utils" "^1.3.0"
"@splunk/react-icons" "^3.0.1"
"@splunk/react-ui" "^4.0.0"
"@splunk/themes" "^0.7.0"
"@splunk/ui-utils" "^1.2.1"
lodash "^4.17.14"
prop-types "^15.6.2"
react-flip-move "^3.0.1"

"@splunk/react-ui@4.1.0", "@splunk/react-ui@^4.1.0":
version "4.1.0"
resolved "https://registry.npmjs.org/@splunk/react-ui/-/react-ui-4.1.0.tgz#6fadad0b688ff4669aea41d53421e84d05595f4b"
integrity sha512-IIaBJvq+ZnYu9Bx6PVT0hgoFqxOzLkZYthpkQ/cppwK/5LJ085WIabfQIoDSUSGbioy9p0IbrELYoPTeOCDXEA==
dependencies:
"@splunk/react-icons" "^3.1.0"
"@splunk/themes" "^0.8.0"
"@splunk/ui-utils" "^1.3.0"
"@types/commonmark" "^0.27.0"
"@types/lodash" "^4.14.156"
"@types/react" "^16.9.38"
"@types/react-dom" "^16.9.8"
"@types/react-event-listener" "^0.4.10"
"@types/react-resize-detector" "^3.1.1"
"@types/styled-components" "^5.1.0"
"@types/tinycolor2" "^1.4.2"
commonmark "^0.27.0"
commonmark-react-renderer "^4.3.2"
decimal.js-light "^2.2.3"
lodash "^4.17.14"
moment "^2.22.2"
prop-types "^15.6.2"
react-event-listener "^0.6.2"
react-resize-detector "^3.2.1"
react-sortable-hoc "^1.11.0"
react-spring "^8.0.27"
tinycolor2 "^1.4.1"

"@splunk/react-ui@^4.0.0":
"@splunk/react-ui@4.0.0", "@splunk/react-ui@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@splunk/react-ui/-/react-ui-4.0.0.tgz"
integrity sha512-E3zwmLa49v5BIBoeoK6Q1A0GLkKr6UCWgyAwrKxyrF9afnHEwrYS84JRyKbvUWc46JvzApviLl7e5DvuMzum/A==
Expand Down Expand Up @@ -1519,19 +1478,6 @@
lodash "^4.17.14"
tinycolor2 "^1.4.1"

"@splunk/themes@^0.8.0":
version "0.8.0"
resolved "https://registry.npmjs.org/@splunk/themes/-/themes-0.8.0.tgz#2a037f5163c699f314e5822375c73f5fa1e63edd"
integrity sha512-XZ6vag5ZchHj/zglSBwMU9eadrpqWJK5Xyxa379RELfbtGmLoNqWajk4Rv0yHClpV6PSELonTYzOU6KO0GImBw==
dependencies:
"@types/lodash" "^4.14.156"
"@types/react" "^16.9.38"
"@types/styled-components" "^5.1.0"
"@types/tinycolor2" "^1.4.2"
color-blend "^2.0.9"
lodash "^4.17.14"
tinycolor2 "^1.4.1"

"@splunk/ui-utils@^1.2.0", "@splunk/ui-utils@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@splunk/ui-utils/-/ui-utils-1.2.1.tgz"
Expand All @@ -1540,14 +1486,6 @@
keycode "^2.1.9"
lodash "^4.17.14"

"@splunk/ui-utils@^1.3.0":
version "1.3.0"
resolved "https://registry.npmjs.org/@splunk/ui-utils/-/ui-utils-1.3.0.tgz#f08677bdf0b55247d7d66c226f59aa9b7007ab6a"
integrity sha512-YXAB49PrYlOUTNBdOT8Qr+TTJp23kd357H5kAwjmKp5LEeStyknbXcTuGMNwb+l/OVvuTZTmFlDvra6UM7cOvQ==
dependencies:
keycode "^2.1.9"
lodash "^4.17.14"

"@splunk/webpack-configs@^5.0.0":
version "5.0.0"
resolved "https://registry.yarnpkg.com/@splunk/webpack-configs/-/webpack-configs-5.0.0.tgz"
Expand Down Expand Up @@ -6695,6 +6633,11 @@ nanoid@^3.1.22:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.22.tgz"
integrity sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==

nanoid@^3.1.23:
version "3.1.23"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81"
integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==

nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz"
Expand Down Expand Up @@ -7662,6 +7605,15 @@ postcss@^7.0.14, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.26, postcss@^7.0.
source-map "^0.6.1"
supports-color "^6.1.0"

postcss@^8.2.10:
version "8.2.15"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.15.tgz#9e66ccf07292817d226fc315cbbf9bc148fbca65"
integrity sha512-2zO3b26eJD/8rb106Qu2o7Qgg52ND5HPjcyQiK2B98O388h43A448LCslC0dI2P97wCAQRJsFvwTRcXxTKds+Q==
dependencies:
colorette "^1.2.2"
nanoid "^3.1.23"
source-map "^0.6.1"

postcss@^8.2.8:
version "8.2.9"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.2.9.tgz"
Expand Down

0 comments on commit 80ef18f

Please sign in to comment.