webpack/index.js in foreman_ansible-3.0.0 vs webpack/index.js in foreman_ansible-3.0.1

- old
+ new

@@ -1,9 +1,10 @@ import componentRegistry from 'foremanReact/components/componentRegistry'; import injectReducer from 'foremanReact/redux/reducers/registerReducer'; import ReportJsonViewer from './components/ReportJsonViewer'; import AnsibleRolesSwitcher from './components/AnsibleRolesSwitcher'; +import $ from 'jquery'; import reducer from './reducer'; componentRegistry.register({ name: 'ReportJsonViewer', @@ -13,5 +14,15 @@ name: 'AnsibleRolesSwitcher', type: AnsibleRolesSwitcher, }); injectReducer('foremanAnsible', reducer); + +window.tfm.initAnsibleRoleSwitcher = () => { + $(document).on('ContentLoad', evt => { + tfm.reactMounter.mount( + 'AnsibleRolesSwitcher', + '#ansible_roles_switcher', + $('#ansible_roles_switcher').data('roles') + ); + }); +}