Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test(UI): ADDON-58762 Jest setup for unit testing (#238) * test(UI): ADDON-58762 Jest setup * test(UI): ADDON-58762 Update eslintrc file * test(UI): ADDON-58762 Minor change * test(UI): ADDON-58762 Added test unit pipeline in the github workflow * test(UI): ADDON-58762 Added test cases for File Validator * test(UI): ADDON-58762 Handle file validation * test(UI): ADDON-58762 Fixed console error if input type file with encrypted false * test(UI): ADDON-58762 Added test:watch in the scripts * test(UI): ADDON-58762 Remove eslint ignore line * fix: ADDON-58705 Table action buttons are dynamic from the global config file (#239) * fix ADDON-58705 Table action buttons are dynamic from the global config file * fix ADDON-58705 Revert enable type in the schema file * fix ADDON-58705 Removed commented code * refactor: ADDON-59458 Refactored tabs feature and style changes (#240) * test(UI): ADDON-58762 Jest setup * test(UI): ADDON-58762 Update eslintrc file * test(UI): ADDON-58762 Added test:watch in the scripts * test(UI): ADDON-58762 Remove eslint ignore line * fix ADDON-58705 Table action buttons are dynamic from the global config file * fix ADDON-58705 Revert enable type in the schema file * refactor: ADDON-59458 Refactored tabs feature and style changes * feat: ADDON-59601 Added support for custom component in Configuration Tabs (#249) * test(UI): ADDON-58762 Jest setup * test(UI): ADDON-58762 Update eslintrc file * test(UI): ADDON-58762 Minor change * test(UI): ADDON-58762 Added test unit pipeline in the github workflow * test(UI): ADDON-58762 Added test cases for File Validator * test(UI): ADDON-58762 Handle file validation * test(UI): ADDON-58762 Fixed console error if input type file with encrypted false * test(UI): ADDON-58762 Added test:watch in the scripts * test(UI): ADDON-58762 Remove eslint ignore line * fix ADDON-58705 Table action buttons are dynamic from the global config file * fix ADDON-58705 Revert enable type in the schema file * fix ADDON-58705 Removed commented code * refactor: ADDON-59458 Refactored tabs feature and style changes * feat: ADDON-59601 Added support for custom component in Configuration Tabs * fix: ADDON-59559 Fixed ui for more info field with textarea component (#250) * fix: ADDON-59559 Fixed ui of more info field with textarea component * chore(code): updating wordBreak to break-word * fix: ADDON-59846 update the code for preventing unnecessary API call for "style=page" property (#251) * fix: ADDON-59846 update the code for preventing unnecessary API call for style=page property * fix: ADDON-59780 resolved the dependabot PRs (#252) * fix: ADDON-59780 resolved dependabot PRs * fix: ADDON-59780 resolved dependabot PRs * fix: ADDON-59459 revert code changes of ADDON-47627 (#258) --------- Co-authored-by: Hetang Modi <hemodi@splunk.com> --------- Co-authored-by: Hetang Modi <hemodi@splunk.com> Co-authored-by: Artem Rys <rysartem@gmail.com> --------- Co-authored-by: Tushar Balar <62089106+tbalar-splunk@users.noreply.github.com> Co-authored-by: Hetang Modi <hemodi@splunk.com>
- Loading branch information
1 parent
171d00d
commit 0e5df40
Showing
24 changed files
with
3,798 additions
and
2,116 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint no-undef: "error" */ | ||
/* eslint-env node */ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-react', | ||
{ | ||
runtime: 'automatic', | ||
}, | ||
], | ||
'@babel/preset-env', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
/* eslint no-undef: "error" */ | ||
/* eslint-env node */ | ||
module.exports = { | ||
testMatch: ['**/*.unit.[jt]s?(x)'], | ||
// Mock | ||
clearMocks: true, | ||
|
||
// env settings | ||
testEnvironment: 'jsdom', | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
modulePathIgnorePatterns: ['<rootDir>/src/main/resources'], | ||
|
||
// Coverage | ||
collectCoverage: true, | ||
collectCoverageFrom: ['src/main/webapp/**/*.{js,jsx}'], | ||
coverageDirectory: 'coverage', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import '@testing-library/jest-dom'; | ||
import { configure } from '@testing-library/react'; | ||
|
||
/** | ||
* Configure test attributes | ||
*/ | ||
configure({ testIdAttribute: 'data-test' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useEffect, useRef, useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { _ } from '@splunk/ui-utils/i18n'; | ||
import { getUnifiedConfigs } from '../util/util'; | ||
import { getBuildDirPath } from '../util/script'; | ||
|
||
function CustomTab({ tab }) { | ||
const [loading, setLoading] = useState(true); | ||
const divRef = useRef(null); | ||
|
||
const globalConfig = getUnifiedConfigs(); | ||
const appName = globalConfig.meta.name; | ||
|
||
const loadCustomTab = () => | ||
new Promise((resolve) => { | ||
if (tab.customTab.type === 'external') { | ||
import( | ||
/* webpackIgnore: true */ `${getBuildDirPath()}/custom/${tab.customTab.src}.js` | ||
).then((external) => { | ||
const Control = external.default; | ||
resolve(Control); | ||
}); | ||
} else { | ||
__non_webpack_require__( | ||
[`app/${appName}/js/build/custom/${tab.customTab.src}`], | ||
(Control) => resolve(Control) | ||
); | ||
} | ||
}); | ||
|
||
useEffect(() => { | ||
loadCustomTab().then((Control) => { | ||
const customControl = new Control(tab, divRef.current); | ||
customControl.render(); | ||
setLoading(false); | ||
}); | ||
}, []); // eslint-disable-line react-hooks/exhaustive-deps | ||
|
||
return ( | ||
<> | ||
{loading && _('Loading...')} | ||
<div ref={divRef} style={{ visibility: loading ? 'hidden' : 'visible' }} /> | ||
</> | ||
); | ||
} | ||
|
||
CustomTab.propTypes = { | ||
tab: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default CustomTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.