This commit is contained in:
Keith Grant
2019-07-11 16:13:13 -07:00
parent e3d67117e7
commit 761ed6dec0
6 changed files with 24 additions and 19 deletions

View File

@@ -15,7 +15,7 @@ class Jobs extends Base {
this.baseUrl = '/api/v2/jobs/'; this.baseUrl = '/api/v2/jobs/';
} }
readDetail (id, type) { readDetail(id, type) {
return this.http.get(`/api/v2${BASE_URLS[type]}${id}/`); return this.http.get(`/api/v2${BASE_URLS[type]}${id}/`);
} }
} }

View File

@@ -6,7 +6,7 @@ import { t } from '@lingui/macro';
import Chip from './Chip'; import Chip from './Chip';
import { Credential } from '../../types'; import { Credential } from '../../types';
function CredentialChip ({ credential, i18n, ...props }) { function CredentialChip({ credential, i18n, ...props }) {
let type; let type;
if (credential.cloud) { if (credential.cloud) {
type = i18n._(t`Cloud`); type = i18n._(t`Cloud`);
@@ -21,7 +21,7 @@ function CredentialChip ({ credential, i18n, ...props }) {
<strong>{type}: </strong> <strong>{type}: </strong>
{credential.name} {credential.name}
</Chip> </Chip>
) );
} }
CredentialChip.propTypes = { CredentialChip.propTypes = {
credential: Credential.isRequired, credential: Credential.isRequired,

View File

@@ -26,7 +26,9 @@ const DetailValue = styled(({ fullWidth, ...props }) => (
`; `;
const Detail = ({ label, value, fullWidth }) => { const Detail = ({ label, value, fullWidth }) => {
if (!value && typeof value !== 'number') { return null; } if (!value && typeof value !== 'number') {
return null;
}
return ( return (
<Fragment> <Fragment>
<DetailName component={TextListItemVariants.dt} fullWidth={fullWidth}> <DetailName component={TextListItemVariants.dt} fullWidth={fullWidth}>

View File

@@ -27,18 +27,19 @@ class JobListItem extends Component {
onChange={onSelect} onChange={onSelect}
aria-labelledby={`check-action-${job.id}`} aria-labelledby={`check-action-${job.id}`}
/> />
<DataListItemCells dataListCells={[ <DataListItemCells
<DataListCell key="divider"> dataListCells={[
<VerticalSeparator /> <DataListCell key="divider">
<span> <VerticalSeparator />
<Link to={`/jobs/${JOB_TYPE_URLS[job.type]}/${job.id}`}> <span>
<b>{job.name}</b> <Link to={`/jobs/${JOB_TYPE_URLS[job.type]}/${job.id}`}>
</Link> <b>{job.name}</b>
</span> </Link>
</DataListCell>, </span>
<DataListCell key="type">{toTitleCase(job.type)}</DataListCell>, </DataListCell>,
<DataListCell key="finished">{job.finished}</DataListCell>, <DataListCell key="type">{toTitleCase(job.type)}</DataListCell>,
]} <DataListCell key="finished">{job.finished}</DataListCell>,
]}
/> />
</DataListItemRow> </DataListItemRow>
</DataListItem> </DataListItem>

View File

@@ -27,7 +27,7 @@ class Jobs extends Component {
return; return;
} }
const type =JOB_TYPE_URLS[job.type]; const type = JOB_TYPE_URLS[job.type];
const breadcrumbConfig = { const breadcrumbConfig = {
'/jobs': i18n._(t`Jobs`), '/jobs': i18n._(t`Jobs`),
[`/jobs/${type}/${job.id}`]: `${job.name}`, [`/jobs/${type}/${job.id}`]: `${job.name}`,

View File

@@ -22,8 +22,10 @@ export function jsonToYaml(jsonString) {
return yaml.safeDump(value); return yaml.safeDump(value);
} }
export function isJson (jsonString) { export function isJson(jsonString) {
if (typeof jsonString !== 'string') { return false; } if (typeof jsonString !== 'string') {
return false;
}
let value; let value;
try { try {
value = JSON.parse(jsonString); value = JSON.parse(jsonString);