1import React, { useEffect, useCallback } from 'react';
2import { Grid, ErrorText } from 'indigo-react';
4import cn from 'classnames';
6import { useHosting } from 'store/hosting';
8import BridgeForm from 'form/BridgeForm';
10import { GenerateButton, ForwardButton } from './Buttons';
12import 'style/hosted-ship.scss';
13import useKeyfileGenerator from 'lib/useKeyfileGenerator';
15export default function HostedShip({
18 // additional from parent
21 const ship = useHosting();
22 const { syncStatus } = ship;
25 const { keyfile } = useKeyfileGenerator();
27 const createShip = useCallback(() => ship.create(keyfile), [ship, keyfile]);
29 const renderStatus = () => {
30 if (ship.missing || ship.booting) {
37 disabled={ship.booting}
38 loading={ship.booting}
43 } else if (ship.running || ship.connecting) {
50 disabled={ship.connecting}
51 loading={ship.connecting}
52 onClick={ship.getEvents}>
56 } else if (ship.connected) {
63 onClick={ship.getStatus}>
67 } else if (ship.unknown || ship.querying) {
72 accessory={ship.error ? '↺' : '->'}
75 disabled={ship.querying}
76 loading={ship.querying}
84 const renderEvents = (title, detail, events) => {
96 <ul className="hosting-events">
97 {events.length === 0 && <li><Waiting></li>}
98 {events.map(event => (
109 <Grid className={cn(className, 'mt1')}>
114 <Grid.Item full as={ErrorText} className="mv1">
126 detailClassName="mono">
137 {renderEvents('Run', 'Terminal events', ship.runEvents)}
140 'Pier creation and boot events',
145 'Hosting platform events',
146 ship.sysEvents.map(e => e.object.message)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list