diff --git a/src/index.es6 b/src/index.es6
index 0b43cdc..0285600 100644
--- a/src/index.es6
+++ b/src/index.es6
@@ -18,18 +18,9 @@
* along with Cockpit; If not, see .
*/
-import 'cockpit';
import React from 'react';
-import { StarterKit } from './starter-kit-view.jsx';
+import { StarterKit } from './starter-kit.jsx';
-function render() {
- React.render(
- React.createElement(
- StarterKit,
- {title: "Sample Page"}
- ),
- document.getElementById('app')
- );
-}
-
-document.addEventListener("DOMContentLoaded", render);
+document.addEventListener("DOMContentLoaded", function () {
+ React.render(React.createElement(StarterKit, {}), document.getElementById('app'));
+});
diff --git a/src/starter-kit-view.jsx b/src/starter-kit.jsx
similarity index 76%
rename from src/starter-kit-view.jsx
rename to src/starter-kit.jsx
index 732744a..edbcf8d 100644
--- a/src/starter-kit-view.jsx
+++ b/src/starter-kit.jsx
@@ -17,21 +17,25 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Cockpit; If not, see .
*/
+
+import 'cockpit';
import React from 'react';
export class StarterKit extends React.Component {
constructor() {
super();
- // a good place to initialize this.state
+
+ cockpit.file('/etc/hostname').read().done((content) => {
+ this.setState({ 'hostname': content.trim() });
+ });
}
render() {
- let title = this.props.title?({this.props.title}):"Empty title";
return (
-
-
{title}
+
+
Starter Kit
- Some content
+ Running on {this.state.hostname}
);