Skip to content

Commit 121f1c3

Browse files
jturelezr-ondrej
authored andcommitted
Fixes #30952 - Rename react-component to foreman-react-component
1 parent 04d12d3 commit 121f1c3

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

app/helpers/reactjs_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def mount_react_component(name, selector, data = [], opts = {})
1313
def react_component(name, props = {})
1414
props = props.to_json if props.is_a?(Hash)
1515

16-
content_tag('react-component', '', :name => name, :data => { props: props })
16+
content_tag('foreman-react-component', '', :name => name, :data => { props: props })
1717
end
1818

1919
def webpacked_plugins_js_for(*plugin_names)

webpack/assets/javascripts/react_app/common/MountingService.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ReactComponentElement extends HTMLElement {
5353
} catch (error) {
5454
// eslint-disable-next-line no-console
5555
console.error(
56-
`Unable to mount react-component: ${this.componentName}`,
56+
`Unable to mount foreman-react-component: ${this.componentName}`,
5757
error
5858
);
5959
}
@@ -65,13 +65,16 @@ class ReactComponentElement extends HTMLElement {
6565
} catch (error) {
6666
// eslint-disable-next-line no-console
6767
console.error(
68-
`Unable to unmount react-component: ${this.componentName}`,
68+
`Unable to unmount foreman-react-component: ${this.componentName}`,
6969
error
7070
);
7171
}
7272
}
7373
}
7474

75-
if (!window.customElements.get('react-component')) {
76-
window.customElements.define('react-component', ReactComponentElement);
75+
if (!window.customElements.get('foreman-react-component')) {
76+
window.customElements.define(
77+
'foreman-react-component',
78+
ReactComponentElement
79+
);
7780
}

webpack/stories/docs/adding-new-components.stories.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ react_component(component_name, props)
120120
will render the following HTML:
121121

122122
```html
123-
<react-component
123+
<foreman-react-component
124124
name="PowerStatus"
125125
data-props="<%= {
126126
id: host.id,
127127
url: power_host_path(host.id)
128128
}.to_json %>"
129-
></react-component>
129+
></foreman-react-component>
130130
```
131131

132132
(Note that the React component is rendered as a [web component](https://developer.mozilla.org/en-US/docs/Web/Web_Components).)

webpack/stories/docs/plugins.stories.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ react_component(component_name, props)
3131
will render the following HTML:
3232

3333
```html
34-
<react-component
34+
<foreman-react-component
3535
name="PowerStatus"
3636
data-props="<%= {
3737
id: host.id,
3838
url: power_host_path(host.id)
3939
}.to_json %>"
40-
></react-component>
40+
></foreman-react-component>
4141
```
4242

4343
(Note that the React component is rendered as a [web component](https://developer.mozilla.org/en-US/docs/Web/Web_Components).)

0 commit comments

Comments
 (0)