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

View File

@ -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: 'wrn://dxos/type/application/web' } }
variables: { attributes: { type: 'wrn:app' } }
}));
// 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 { 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) => ({
tableContainer: {
@ -69,7 +70,7 @@ const IPFSStatus = () => {
const ipfsResponse = useQueryStatusReducer(useQuery(IPFS_STATUS));
const wnsResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, {
variables: { attributes: { type: RECORD_TYPE } }
variables: { attributes: { type: RECORD_TYPE, service: SERVICE_TYPE } }
}));
if (!wnsResponse || !ipfsResponse) {
@ -77,10 +78,10 @@ const IPFSStatus = () => {
}
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 addresses = get(service, 'attributes.addresses');
const addresses = get(service, 'attributes.ipfs.addresses');
let connected = false;
for (const address of addresses) {
const parts = address.split('/');
@ -93,6 +94,7 @@ const IPFSStatus = () => {
return {
...service.attributes,
...service.attributes.ipfs,
names: get(service, 'names'),
version: get(service, 'version'),
connected

View File

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

View File

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