diff --git a/packages/console-app/src/components/AppLink.js b/packages/console-app/src/components/AppLink.js index 386cbaa..0b4eecc 100644 --- a/packages/console-app/src/components/AppLink.js +++ b/packages/console-app/src/components/AppLink.js @@ -8,7 +8,7 @@ import Link from '@material-ui/core/Link'; import { getServiceUrl } from '../util/config'; -const getAppUrl = (config, { name, version }) => { +const getAppUrl = (config, { wrn }) => { const base = getServiceUrl(config, 'app.server'); const pathComponents = [base]; @@ -21,11 +21,7 @@ const getAppUrl = (config, { name, version }) => { pathComponents.push(prefix.substring(1)); } - if (version) { - pathComponents.push(`${name}@${version}`); - } else { - pathComponents.push(name); - } + pathComponents.push(encodeURIComponent(wrn)); return `${pathComponents.join('/')}/`; }; @@ -34,11 +30,10 @@ const getAppUrl = (config, { name, version }) => { * @param {Object} config * @param {string} name * @param {string} [text] - * @param {string} [version] */ -const AppLink = ({ config, name, version, text }) => { - const fullURL = getAppUrl(config, { name, version }); - return {text || name}; +const AppLink = ({ config, wrn, text }) => { + const fullURL = getAppUrl(config, { wrn }); + return {text || wrn}; }; export default AppLink; diff --git a/packages/console-app/src/components/PackageLink.js b/packages/console-app/src/components/PackageLink.js index 93aee9f..94571ef 100644 --- a/packages/console-app/src/components/PackageLink.js +++ b/packages/console-app/src/components/PackageLink.js @@ -15,19 +15,18 @@ import { getServiceUrl } from '../util/config'; * @param {string} [text] */ const PackageLink = ({ config, type, pkg, text }) => { - // TODO(burdon): Pass in expected arg types. - if (typeof pkg === 'string') { - const ipfsUrl = getServiceUrl(config, 'ipfs.gateway', { path: `${pkg}` }); - return {text || pkg}; - } - // eslint-disable-next-line default-case switch (type) { - case 'bot': { + case 'wrn://dxos/type/application/web': { + const cid = pkg['/']; + const ipfsUrl = getServiceUrl(config, 'ipfs.gateway', { path: `${cid}` }); + return {text || cid}; + } + case 'wrn://dxos/type/application/bot': { const packageLinks = []; Object.keys(pkg).forEach((platform, i) => { Object.keys(pkg[platform]).forEach(arch => { - const cid = pkg[platform][arch]; + const cid = pkg[platform][arch]['/']; const ipfsUrl = getServiceUrl(config, 'ipfs.gateway', { path: `${cid}` }); packageLinks.push(
diff --git a/packages/console-app/src/containers/panels/apps/AppRecords.js b/packages/console-app/src/containers/panels/apps/AppRecords.js index 68a467d..f1d4cb7 100644 --- a/packages/console-app/src/containers/panels/apps/AppRecords.js +++ b/packages/console-app/src/containers/panels/apps/AppRecords.js @@ -25,7 +25,7 @@ const AppRecords = () => { const [sorter, sortBy] = useSorter('createTime', false); const appResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, { pollInterval: config.api.intervalQuery, - variables: { attributes: { type: 'app' } } + variables: { attributes: { type: 'wrn://dxos/type/application/web' } } })); // TODO(telackey): Does this also need an interval? @@ -42,7 +42,7 @@ const AppRecords = () => { - Identifier + Registered Names Version Name Created @@ -54,8 +54,8 @@ const AppRecords = () => { return ( - {names.map(name => <> - + {names.map(wrn => <> +
)} diff --git a/packages/console-app/src/containers/panels/ipfs/IPFSNetwork.js b/packages/console-app/src/containers/panels/ipfs/IPFSNetwork.js index a457c59..b6c474e 100644 --- a/packages/console-app/src/containers/panels/ipfs/IPFSNetwork.js +++ b/packages/console-app/src/containers/panels/ipfs/IPFSNetwork.js @@ -20,8 +20,7 @@ import Table from '../../../components/Table'; import TableCell from '../../../components/TableCell'; import { BooleanIcon } from '../../../components/BooleanIcon'; -const RECORD_TYPE = 'wrn:service'; -const SERVICE_TYPE = 'ipfs'; +const RECORD_TYPE = 'wrn://dxos/type/service/ipfs'; const useStyles = makeStyles((theme) => ({ tableContainer: { @@ -70,7 +69,7 @@ const IPFSStatus = () => { const ipfsResponse = useQueryStatusReducer(useQuery(IPFS_STATUS)); const wnsResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, { - variables: { attributes: { type: RECORD_TYPE, service: SERVICE_TYPE } } + variables: { attributes: { type: RECORD_TYPE } } })); if (!wnsResponse || !ipfsResponse) { @@ -78,10 +77,10 @@ const IPFSStatus = () => { } const ipfsData = JSON.parse(ipfsResponse.ipfs_status.json); - const registeredServers = JSON.parse(wnsResponse.wns_records.json); + const registeredServers = JSON.parse(wnsResponse.wns_records.json).filter(record => get(record, 'attributes.active') !== false); const displayServers = registeredServers.map((service) => { - const addresses = get(service, 'attributes.ipfs.addresses'); + const addresses = get(service, 'attributes.addresses'); let connected = false; for (const address of addresses) { const parts = address.split('/'); @@ -93,10 +92,9 @@ const IPFSStatus = () => { } return { - name: get(service, 'name'), + ...service.attributes, + names: get(service, 'names'), version: get(service, 'version'), - description: get(service, 'attributes.description'), - ipfs: get(service, 'attributes.ipfs'), connected }; }); @@ -115,19 +113,19 @@ const IPFSStatus = () => {
- Identifier + Registered Names Description Address Connected - {displayServers.map(({ name, description, ipfs, connected }) => ( - - {name} + {displayServers.map(({ names, description, addresses, connected }) => ( + + {names.map(name => <>{name}
)}
{description} - {ipfs.addresses} + {addresses} diff --git a/packages/console-app/src/containers/panels/wns/WNSRecords.js b/packages/console-app/src/containers/panels/wns/WNSRecords.js index dd3715d..c807f80 100644 --- a/packages/console-app/src/containers/panels/wns/WNSRecords.js +++ b/packages/console-app/src/containers/panels/wns/WNSRecords.js @@ -25,13 +25,16 @@ import AppLink from '../../../components/AppLink'; const types = [ { key: null, label: 'ALL' }, - { key: 'kube', label: 'Kube' }, - { key: 'resource', label: 'Resource' }, - { key: 'service', label: 'Service' }, - { key: 'app', label: 'App' }, - { key: 'bot', label: 'Bot' }, - { key: 'bot-factory', label: 'Bot Factory' }, - { key: 'type', label: 'Type' } + { key: 'wrn://dxos/type/application/web', label: 'App' }, + { key: 'wrn://dxos/type/application/bot', label: 'Bot' }, + { key: 'wrn://dxos/type/device/kube', label: 'Kube' }, + { key: 'wrn://dxos/type/service/bot-factory', label: 'Bot Factory' }, + { key: 'wrn://dxos/type/service/ipfs', label: 'IPFS' }, + { key: 'wrn://dxos/type/service/ipfs-gateway', label: 'IPFS Gateway' }, + { key: 'wrn://dxos/type/service/signal', label: 'Signal' }, + { key: 'wrn://dxos/type/service/stun', label: 'STUN' }, + { key: 'wrn://dxos/type/service/turn', label: 'TURN' }, + { key: 'type', label: 'Type' }, ]; const useStyles = makeStyles(theme => ({ @@ -84,7 +87,7 @@ const WNSRecords = ({ type }) => { Type - Identifier + Registered Names Version Name Created @@ -104,11 +107,11 @@ const WNSRecords = ({ type }) => { pkgLink = (); } - if (type === 'app') { + if (type === 'wrn://dxos/type/application/web') { appLinks = ( <> - {names.map(name => <> - + {names.map(wrn => <> +
)} diff --git a/packages/console-app/src/version.json b/packages/console-app/src/version.json index bb55c95..3996772 100644 --- a/packages/console-app/src/version.json +++ b/packages/console-app/src/version.json @@ -1,7 +1,7 @@ { "build": { "name": "@dxos/console-app", - "buildDate": "2020-07-21T20:40:54.153Z", - "version": "1.0.0-beta.22" + "buildDate": "2020-08-18T23:14:12.669Z", + "version": "1.0.0-beta.24" } }