Fix vesion check.

This commit is contained in:
Thomas E Lackey 2020-06-13 00:35:52 -05:00
parent 9db86c2570
commit bc38d95213
5 changed files with 15 additions and 45 deletions

View File

@ -1,37 +0,0 @@
#
# NODE_ENV === production
# NOTE: Set CONFIG_FILE to swap out this config file.
#
app:
title: 'Console'
org': 'DxOS'
theme: 'dark'
website: 'https://dxos.org'
publicUrl: '/console'
api:
path: '/api'
intervalLog: 5000
pollInterval: 10000
system:
debug: 'dxos:console:*'
routes:
app:
server: '/app'
wns:
server: '/dxos/wns/api'
webui: '/dxos/wns/console'
signal:
api: '/dxos/signal'
ipfs:
server: '/dxos/ipfs/api'
gateway: '/dxos/ipfs/gateway'
wellknown:
endpoint: '/.well-known/dxos'

View File

@ -8,7 +8,7 @@ import { InMemoryCache } from 'apollo-cache-inmemory';
import { createResolvers } from './resolvers'; import { createResolvers } from './resolvers';
const defaultServer = `${window.location.origin}`; const defaultServer = `${window.location.host}`;
export const graphqlApi = config => { export const graphqlApi = config => {
const { api: { server = defaultServer, port = '', path = '/api' } } = config; const { api: { server = defaultServer, port = '', path = '/api' } } = config;

View File

@ -111,6 +111,9 @@ const StatusBar = () => {
<div className={classes.center}> <div className={classes.center}>
<div>{name} ({version})</div> <div>{name} ({version})</div>
<div>{moment(buildDate).format('L')}</div> <div>{moment(buildDate).format('L')}</div>
</div>
<div className={classes.center}>
<VersionCheck /> <VersionCheck />
</div> </div>

View File

@ -27,7 +27,7 @@ const useStyles = makeStyles(theme => ({
const VersionCheck = () => { const VersionCheck = () => {
const classes = useStyles(); const classes = useStyles();
const [{ current, latest }, setUpgrade] = useState({}); const [{ current, latest }, setUpgrade] = useState({});
const statusRespone = useQueryStatusReducer(useQuery(SYSTEM_STATUS)); const statusResponse = useQueryStatusReducer(useQuery(SYSTEM_STATUS));
const wnsResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, { const wnsResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: CHECK_INTERVAL, pollInterval: CHECK_INTERVAL,
variables: { attributes: { type: 'wrn:resource' } } variables: { attributes: { type: 'wrn:resource' } }
@ -35,8 +35,8 @@ const VersionCheck = () => {
// Check version. // Check version.
useEffect(() => { useEffect(() => {
if (statusRespone && wnsResponse) { if (statusResponse && wnsResponse) {
const statusData = JSON.parse(statusRespone.system_status.json); const statusData = JSON.parse(statusResponse.system_status.json);
const wnsData = JSON.parse(wnsResponse.wns_records.json); const wnsData = JSON.parse(wnsResponse.wns_records.json);
const current = get(statusData, 'dxos.xbox.version', '0.0.0'); const current = get(statusData, 'dxos.xbox.version', '0.0.0');
@ -51,9 +51,13 @@ const VersionCheck = () => {
} }
}); });
console.error('ZZZZZ', current, latest);
setUpgrade({ current, latest: latest !== current ? latest : undefined }); setUpgrade({ current, latest: latest !== current ? latest : undefined });
} else {
console.error('YYY', current, latest);
} }
}, [status, wnsResponse]); }, [statusResponse, wnsResponse]);
// TODO(burdon): Link to Github page with upgrade info. // TODO(burdon): Link to Github page with upgrade info.
return ( return (
@ -62,7 +66,7 @@ const VersionCheck = () => {
<div>SYS: {current}</div> <div>SYS: {current}</div>
)} )}
{latest && ( {latest && (
<div className={classes.update}>LATEST: {latest}</div> <div className={classes.update}>(LATEST: {latest})</div>
)} )}
</> </>
); );

View File

@ -1,7 +1,7 @@
{ {
"build": { "build": {
"name": "@dxos/console-app", "name": "@dxos/console-app",
"buildDate": "2020-06-13T04:50:21.878Z", "buildDate": "2020-06-13T05:18:32.994Z",
"version": "1.0.0-beta.4" "version": "1.0.0-beta.5"
} }
} }