This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
router.js
38 lines (36 loc) 路 1.61 KB
/
router.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {Route} from 'hyperapp-hash-router';
import {div, span, a, p} from '@hyperapp/html';
import ImagesRoute from './routes/images';
import ImageRoute from './routes/image';
import PushingRoute from './routes/instructions/pushing';
import PullingRoute from './routes/instructions/pulling';
import DeletingRoute from './routes/instructions/deleting';
import BigError from './components/tabler/big-error';
export default (state, actions) => {
if (state.isLoading) {
return span({class: 'loader'});
} else {
if (state.globalError !== null && state.globalError) {
return BigError(state.globalError.code || '500', state.globalError.message,
[
p('There may be a problem communicating with the Registry'),
a({
class: 'btn btn-link', onclick: function () {
actions.bootstrap();
}
}, 'Refresh')
],
true
);
} else {
return div(
Route({path: '/', render: ImagesRoute(state, actions)}),
Route({path: '/image/:imageId', render: ImageRoute(state, actions)}),
Route({path: '/image/:imageDomain/:imageId', render: ImageRoute(state, actions)}),
Route({path: '/instructions/pushing', render: PushingRoute(state, actions)}),
Route({path: '/instructions/pulling', render: PullingRoute(state, actions)}),
Route({path: '/instructions/deleting', render: DeletingRoute(state, actions)})
);
}
}
}