autoland-ui: The UI should display an error if no repo or series ID is provided (
Bug 1335481). r?imadueme
This also provides a generic error handler for URLs.
MozReview-Commit-ID: 7sUkIRKvFJ4
new file mode 100644
--- /dev/null
+++ b/autoland/ui/src/components/InvalidUrl.jsx
@@ -0,0 +1,19 @@
+import React from 'react';
+
+function InvalidUrl() {
+ document.title = 'Page Not Found';
+
+ return (
+ <div>
+ <header>
+ <h1>Mozilla Autoland</h1>
+ </header>
+
+ <div className="app">
+ <p>The page you requested could not be found.</p>
+ </div>
+ </div>
+ );
+}
+
+export default InvalidUrl;
--- a/autoland/ui/src/components/TestApp.jsx
+++ b/autoland/ui/src/components/TestApp.jsx
@@ -22,17 +22,17 @@ function TestApp() {
<header>
<h1>Mozilla Autoland</h1>
</header>
<div className="app">
{fixtures.map((fixture, i) => (
<div key={i} className="test-case" data-title={fixture.name}>
<AutolandController
- params={{ series_id: fixture.series_id, repo_id: fixture.repo }}/>
+ params={{ series_id: fixture.series_id, repo_id: fixture.repo_id }}/>
</div>
))}
</div>
</div>
);
}
export default TestApp;
--- a/autoland/ui/src/routes.jsx
+++ b/autoland/ui/src/routes.jsx
@@ -1,18 +1,20 @@
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, browserHistory } from 'react-router';
import App from './components/App';
import TestApp from './components/TestApp';
import AutolandController from './components/AutolandController';
+import InvalidUrl from './components/InvalidUrl';
export default function () {
render((
<Router history={browserHistory}>
<Route path="/" component={App}>
<Route path="repos/:repo_id/series/:series_id" component={AutolandController} />
</Route>
<Route path="/test" component={TestApp} />
+ <Route path="/*" component={InvalidUrl} />
</Router>
), document.getElementById('root'));
}