Back to old types.

This commit is contained in:
Thomas E Lackey 2020-08-18 19:14:40 -05:00
parent 4779ffa804
commit 5079318d63
5 changed files with 18 additions and 20 deletions

View File

@ -10,19 +10,19 @@ import { getServiceUrl } from '../util/config';
/** /**
* Render IPFS links in package. * Render IPFS links in package.
* @param {Object} config * @param {Object} config
* @param {string} [type] * @param {string} type
* @param {string} pkg * @param {string} pkg
* @param {string} [text] * @param {string} [text]
*/ */
const PackageLink = ({ config, type, pkg, text }) => { const PackageLink = ({ config, type, pkg, text }) => {
// eslint-disable-next-line default-case // eslint-disable-next-line default-case
switch (type) { switch (type) {
case 'wrn://dxos/type/application/web': { case 'wrn:app': {
const cid = pkg['/']; const cid = pkg['/'];
const ipfsUrl = getServiceUrl(config, 'ipfs.gateway', { path: `${cid}` }); const ipfsUrl = getServiceUrl(config, 'ipfs.gateway', { path: `${cid}` });
return <Link href={ipfsUrl} key={cid} target={cid}>{text || cid}</Link>; return <Link href={ipfsUrl} key={cid} target={cid}>{text || cid}</Link>;
} }
case 'wrn://dxos/type/application/bot': { case 'wrn:bot': {
const packageLinks = []; const packageLinks = [];
Object.keys(pkg).forEach((platform, i) => { Object.keys(pkg).forEach((platform, i) => {
Object.keys(pkg[platform]).forEach(arch => { Object.keys(pkg[platform]).forEach(arch => {

View File

@ -25,7 +25,7 @@ const AppRecords = () => {
const [sorter, sortBy] = useSorter('createTime', false); const [sorter, sortBy] = useSorter('createTime', false);
const appResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, { const appResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: config.api.intervalQuery, pollInterval: config.api.intervalQuery,
variables: { attributes: { type: 'wrn://dxos/type/application/web' } } variables: { attributes: { type: 'wrn:app' } }
})); }));
// TODO(telackey): Does this also need an interval? // TODO(telackey): Does this also need an interval?

View File

@ -20,7 +20,8 @@ import Table from '../../../components/Table';
import TableCell from '../../../components/TableCell'; import TableCell from '../../../components/TableCell';
import { BooleanIcon } from '../../../components/BooleanIcon'; import { BooleanIcon } from '../../../components/BooleanIcon';
const RECORD_TYPE = 'wrn://dxos/type/service/ipfs'; const RECORD_TYPE = 'wrn:service';
const SERVICE_TYPE = 'ipfs';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
tableContainer: { tableContainer: {
@ -69,7 +70,7 @@ const IPFSStatus = () => {
const ipfsResponse = useQueryStatusReducer(useQuery(IPFS_STATUS)); const ipfsResponse = useQueryStatusReducer(useQuery(IPFS_STATUS));
const wnsResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, { const wnsResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, {
variables: { attributes: { type: RECORD_TYPE } } variables: { attributes: { type: RECORD_TYPE, service: SERVICE_TYPE } }
})); }));
if (!wnsResponse || !ipfsResponse) { if (!wnsResponse || !ipfsResponse) {
@ -77,10 +78,10 @@ const IPFSStatus = () => {
} }
const ipfsData = JSON.parse(ipfsResponse.ipfs_status.json); const ipfsData = JSON.parse(ipfsResponse.ipfs_status.json);
const registeredServers = JSON.parse(wnsResponse.wns_records.json).filter(record => get(record, 'attributes.active') !== false); const registeredServers = JSON.parse(wnsResponse.wns_records.json).filter(record => get(record, 'attributes.ipfs.active') !== false);
const displayServers = registeredServers.map((service) => { const displayServers = registeredServers.map((service) => {
const addresses = get(service, 'attributes.addresses'); const addresses = get(service, 'attributes.ipfs.addresses');
let connected = false; let connected = false;
for (const address of addresses) { for (const address of addresses) {
const parts = address.split('/'); const parts = address.split('/');
@ -93,6 +94,7 @@ const IPFSStatus = () => {
return { return {
...service.attributes, ...service.attributes,
...service.attributes.ipfs,
names: get(service, 'names'), names: get(service, 'names'),
version: get(service, 'version'), version: get(service, 'version'),
connected connected

View File

@ -25,16 +25,12 @@ import AppLink from '../../../components/AppLink';
const types = [ const types = [
{ key: null, label: 'ALL' }, { key: null, label: 'ALL' },
{ key: 'wrn://dxos/type/application/web', label: 'App' }, { key: 'wrn:kube', label: 'Kube' },
{ key: 'wrn://dxos/type/application/bot', label: 'Bot' }, { key: 'wrn:service', label: 'Service' },
{ key: 'wrn://dxos/type/device/kube', label: 'Kube' }, { key: 'wrn:app', label: 'App' },
{ key: 'wrn://dxos/type/service/bot-factory', label: 'Bot Factory' }, { key: 'wrn:bot', label: 'Bot' },
{ key: 'wrn://dxos/type/service/ipfs', label: 'IPFS' }, { key: 'wrn:bot-factory', label: 'Bot Factory' },
{ key: 'wrn://dxos/type/service/ipfs-gateway', label: 'IPFS Gateway' }, { key: 'wrn:type', label: 'Type' }
{ 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 => ({ const useStyles = makeStyles(theme => ({
@ -107,7 +103,7 @@ const WNSRecords = ({ type }) => {
pkgLink = (<PackageLink config={config} type={type} pkg={pkg} />); pkgLink = (<PackageLink config={config} type={type} pkg={pkg} />);
} }
if (type === 'wrn://dxos/type/application/web') { if (type === 'wrn:app') {
appLinks = ( appLinks = (
<> <>
{names.map(wrn => <> {names.map(wrn => <>

View File

@ -1,7 +1,7 @@
{ {
"build": { "build": {
"name": "@dxos/console-app", "name": "@dxos/console-app",
"buildDate": "2020-08-18T23:14:12.669Z", "buildDate": "2020-08-18T23:56:32.818Z",
"version": "1.0.0-beta.24" "version": "1.0.0-beta.24"
} }
} }