lint
This commit is contained in:
parent
432c061952
commit
b21da7b831
@ -35,7 +35,7 @@ const getAppUrl = (config, { name, version, text }) => {
|
||||
* @param {string} [version]
|
||||
*/
|
||||
const AppLink = ({ config, name, version, text }) => {
|
||||
const fullURL = getAppUrl(config, {name, version});
|
||||
const fullURL = getAppUrl(config, { name, version });
|
||||
return <Link href={fullURL} target={name}>{text || name}</Link>;
|
||||
};
|
||||
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
import React from 'react';
|
||||
import Link from '@material-ui/core/Link';
|
||||
import Menu from '@material-ui/core/Menu';
|
||||
import MenuItem from '@material-ui/core/MenuItem';
|
||||
|
||||
import { getServiceUrl } from '../util/config';
|
||||
|
||||
|
@ -22,15 +22,17 @@ const QUERY = `{
|
||||
* @param {string} name
|
||||
* @param {string} [text]
|
||||
*/
|
||||
const QueryLink = ({ config, name, text, icon = false}) => {
|
||||
const QueryLink = ({ config, name, text, icon = false }) => {
|
||||
const baseURL = getServiceUrl(config, 'wns.webui');
|
||||
const query = QUERY.replace('%NAME%', name);
|
||||
const fullURL= encodeURI(`${baseURL}?query=${query}`);
|
||||
const fullURL = encodeURI(`${baseURL}?query=${query}`);
|
||||
|
||||
if (icon) {
|
||||
return <Link href={fullURL} target='wns'>
|
||||
<ExitToApp />
|
||||
</Link>
|
||||
return (
|
||||
<Link href={fullURL} target='wns'>
|
||||
<ExitToApp />
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
return <Link href={fullURL} target='wns'>{text || name}</Link>;
|
||||
};
|
||||
|
@ -6,7 +6,6 @@ import React, { useContext } from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
import { useQuery } from '@apollo/react-hooks';
|
||||
import Link from '@material-ui/core/Link';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
@ -19,8 +18,7 @@ import { ConsoleContext, useQueryStatusReducer, useSorter } from '../../../hooks
|
||||
import { BooleanIcon } from '../../../components/BooleanIcon';
|
||||
import Table from '../../../components/Table';
|
||||
import TableCell from '../../../components/TableCell';
|
||||
import { getServiceUrl } from '../../../util/config';
|
||||
import AppLink from "../../../components/AppLink";
|
||||
import AppLink from '../../../components/AppLink';
|
||||
|
||||
const AppRecords = () => {
|
||||
const { config } = useContext(ConsoleContext);
|
||||
|
@ -11,7 +11,6 @@ import Button from '@material-ui/core/Button';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
import Tooltip from '@material-ui/core/Tooltip';
|
||||
|
||||
import WNS_RECORDS from '../../../gql/wns_records.graphql';
|
||||
|
||||
@ -21,8 +20,8 @@ import Table from '../../../components/Table';
|
||||
import TableCell from '../../../components/TableCell';
|
||||
|
||||
import PackageLink from '../../../components/PackageLink';
|
||||
import QueryLink from "../../../components/QueryLink";
|
||||
import AppLink from "../../../components/AppLink";
|
||||
import QueryLink from '../../../components/QueryLink';
|
||||
import AppLink from '../../../components/AppLink';
|
||||
|
||||
const types = [
|
||||
{ key: null, label: 'ALL' },
|
||||
@ -95,40 +94,41 @@ const WNSRecords = ({ type }) => {
|
||||
<TableBody>
|
||||
{records.sort(sorter)
|
||||
.map((record) => {
|
||||
const { id, type, name, version, createTime, attributes: { displayName, description, service, package: pkg } } = record;
|
||||
const { id, type, name, version, createTime, attributes: { displayName, description, service, package: pkg } } = record;
|
||||
|
||||
let pkgLink = undefined;
|
||||
let appLink = undefined;
|
||||
let verLink = undefined;
|
||||
let pkgLink;
|
||||
let appLink;
|
||||
let verLink;
|
||||
|
||||
if (pkg) {
|
||||
pkgLink = (<PackageLink config={config} type={type} pkg={pkg}/>);
|
||||
}
|
||||
|
||||
if (type === 'wrn:app') {
|
||||
appLink = (<AppLink config={config} name={name}/>);
|
||||
verLink = (<AppLink config={config} name={name} version={version} text={version}/>);
|
||||
}
|
||||
|
||||
return (<TableRow key={id} size='small'>
|
||||
<TableCell monospace>{type}</TableCell>
|
||||
<TableCell monospace>
|
||||
{appLink && appLink || name}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<QueryLink config={config} name={name} icon={true}/>
|
||||
</TableCell>
|
||||
<TableCell>{displayName || service || description}</TableCell>
|
||||
<TableCell monospace>
|
||||
{verLink && verLink || version}
|
||||
</TableCell>
|
||||
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
|
||||
<TableCell monospace>
|
||||
{pkgLink}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
if (pkg) {
|
||||
pkgLink = (<PackageLink config={config} type={type} pkg={pkg} />);
|
||||
}
|
||||
|
||||
if (type === 'wrn:app') {
|
||||
appLink = (<AppLink config={config} name={name} />);
|
||||
verLink = (<AppLink config={config} name={name} version={version} text={version} />);
|
||||
}
|
||||
|
||||
return (
|
||||
<TableRow key={id} size='small'>
|
||||
<TableCell monospace>{type}</TableCell>
|
||||
<TableCell monospace>
|
||||
{appLink || name}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<QueryLink config={config} name={name} icon />
|
||||
</TableCell>
|
||||
<TableCell>{displayName || service || description}</TableCell>
|
||||
<TableCell monospace>
|
||||
{verLink || version}
|
||||
</TableCell>
|
||||
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
|
||||
<TableCell monospace>
|
||||
{pkgLink}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
|
Loading…
Reference in New Issue
Block a user