Commit e53eccd9 authored by Joaquim Rocha's avatar Joaquim Rocha
Browse files

frontend: Override reflectInURL in all views that need it

These are views that have more than one table, and as such will need
a prefix for their page data.
parent 23f309ae
Showing with 18 additions and 427 deletions
+18 -427
......@@ -138,6 +138,7 @@ export default function CustomResourceDefinitionDetails() {
datum: 'listKind',
},
]}
reflectInURL="acceptedNames"
/>
</SectionBox>
<SectionBox title={t('frequent|Versions')}>
......@@ -157,6 +158,7 @@ export default function CustomResourceDefinitionDetails() {
getter: version => version.storage.toString(),
},
]}
reflectInURL="versions"
/>
</SectionBox>
<SectionBox title={t('Conditions')}>
......@@ -177,6 +179,7 @@ export default function CustomResourceDefinitionDetails() {
},
'age',
]}
reflectInURL="objects"
/>
</SectionBox>
<DetailsViewSection resource={item} />
......
......@@ -60,6 +60,7 @@ function TolerationsSection(props: TolerationsSection) {
sort: true,
},
]}
reflectInURL="tolerations"
/>
</SectionBox>
);
......
......@@ -70,6 +70,7 @@ export default function EndpointDetails() {
},
},
]}
reflectInURL="addresses"
/>
<SectionHeader noPadding title={t('Ports')} headerStyle="label" />
<SimpleTable
......@@ -92,6 +93,7 @@ export default function EndpointDetails() {
},
]}
defaultSortingColumn={1}
reflectInURL="ports"
/>
</SectionBox>
))
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Storyshots endpoints/EndpointsDetailsView Default 1`] = `
<div>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-spacing-xs-1"
>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
>
<div
class="MuiBox-root MuiBox-root"
>
<a
aria-disabled="false"
class="MuiButtonBase-root MuiButton-root MuiButton-text MuiButton-textSizeSmall MuiButton-sizeSmall"
href="/"
role="button"
tabindex="0"
>
<span
class="MuiButton-label"
>
<span
class="MuiButton-startIcon MuiButton-iconSizeSmall"
>
<span />
</span>
<p
class="MuiTypography-root MuiTypography-body1"
style="padding-top: 3px;"
>
Back
</p>
</span>
<span
class="MuiTouchRipple-root"
/>
</a>
<div
class="MuiBox-root MuiBox-root"
>
<div
class="MuiGrid-root makeStyles-sectionHeader makeStyles-sectionHeader MuiGrid-container MuiGrid-spacing-xs-2 MuiGrid-align-items-xs-center MuiGrid-justify-content-xs-space-between"
>
<div
class="MuiGrid-root MuiGrid-item"
>
<h1
class="MuiTypography-root makeStyles-sectionTitle makeStyles-sectionTitle MuiTypography-h1 MuiTypography-noWrap"
>
Endpoint
</h1>
</div>
<div
class="MuiGrid-root MuiGrid-item"
>
<div
class="MuiGrid-root MuiGrid-container MuiGrid-item MuiGrid-align-items-xs-center MuiGrid-justify-content-xs-flex-end"
>
<div
class="MuiGrid-root MuiGrid-item"
/>
<div
class="MuiGrid-root MuiGrid-item"
>
<button
aria-label="View YAML"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-edgeEnd"
tabindex="0"
title="View YAML"
type="button"
>
<span
class="MuiIconButton-label"
>
<span />
</span>
<span
class="MuiTouchRipple-root"
/>
</button>
</div>
<div
class="MuiGrid-root MuiGrid-item"
/>
</div>
</div>
</div>
<div
class="MuiPaper-root MuiPaper-elevation1 MuiPaper-rounded"
>
<div
aria-busy="false"
aria-live="polite"
class="MuiBox-root MuiBox-root"
>
<table
class="MuiTable-root makeStyles-table"
>
<tbody
class="MuiTableBody-root"
>
<tr
class="MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-body makeStyles-metadataNameCell"
role="cell"
scope="row"
>
Name
</th>
<td
class="MuiTableCell-root MuiTableCell-body makeStyles-metadataCell"
>
<span
class="MuiTypography-root makeStyles-valueLabel MuiTypography-body1"
>
my-endpoint
</span>
</td>
</tr>
<tr
class="MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-body makeStyles-metadataNameCell"
role="cell"
scope="row"
>
Namespace
</th>
<td
class="MuiTableCell-root MuiTableCell-body makeStyles-metadataCell"
>
<span
class="MuiTypography-root makeStyles-valueLabel MuiTypography-body1"
>
my-namespace
</span>
</td>
</tr>
<tr
class="MuiTableRow-root"
>
<th
class="MuiTableCell-root MuiTableCell-body makeStyles-metadataNameCell"
role="cell"
scope="row"
>
Creation
</th>
<td
class="MuiTableCell-root MuiTableCell-body makeStyles-metadataCell"
>
<span
class="MuiTypography-root makeStyles-valueLabel MuiTypography-body1"
>
4/25/2020, 12:00:00 AM UTC
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
>
<div
class="MuiBox-root MuiBox-root"
>
<div
class="MuiBox-root MuiBox-root"
>
<div
class="MuiGrid-root makeStyles-sectionHeader makeStyles-sectionHeader MuiGrid-container MuiGrid-spacing-xs-2 MuiGrid-align-items-xs-center MuiGrid-justify-content-xs-space-between"
>
<div
class="MuiGrid-root MuiGrid-item"
>
<h2
class="MuiTypography-root makeStyles-sectionTitle makeStyles-sectionTitle MuiTypography-h2 MuiTypography-noWrap"
>
Subsets
</h2>
</div>
</div>
<div
class="MuiPaper-root MuiPaper-elevation1 MuiPaper-rounded"
>
<div
class="MuiBox-root MuiBox-root"
/>
</div>
</div>
<div
class="MuiBox-root MuiBox-root"
>
<div
class="MuiPaper-root MuiPaper-elevation1 MuiPaper-rounded"
>
<div
class="MuiBox-root MuiBox-root"
>
<div
class="MuiGrid-root makeStyles-sectionHeader makeStyles-sectionHeader MuiGrid-container MuiGrid-spacing-xs-2 MuiGrid-align-items-xs-center MuiGrid-justify-content-xs-space-between"
>
<div
class="MuiGrid-root MuiGrid-item"
>
<h4
class="MuiTypography-root makeStyles-sectionTitle makeStyles-sectionTitle MuiTypography-h4 MuiTypography-noWrap"
>
Addresses
</h4>
</div>
</div>
<table
class="MuiTable-root makeStyles-table"
>
<thead
class="MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head"
>
<th
class="MuiTableCell-root MuiTableCell-head makeStyles-headerCell "
scope="col"
>
IP
</th>
<th
class="MuiTableCell-root MuiTableCell-head makeStyles-headerCell "
scope="col"
>
Hostname
</th>
<th
class="MuiTableCell-root MuiTableCell-head makeStyles-headerCell "
scope="col"
>
Target
</th>
</tr>
</thead>
<tbody
class="MuiTableBody-root"
>
<tr
class="MuiTableRow-root"
>
<td
class="MuiTableCell-root MuiTableCell-body"
>
127.0.0.1
</td>
<td
class="MuiTableCell-root MuiTableCell-body"
/>
<td
class="MuiTableCell-root MuiTableCell-body"
>
<a
class="MuiTypography-root MuiLink-root MuiLink-underlineHover MuiTypography-colorPrimary"
href="/"
>
mypod
</a>
</td>
</tr>
<tr
class="MuiTableRow-root"
>
<td
class="MuiTableCell-root MuiTableCell-body"
>
127.0.0.2
</td>
<td
class="MuiTableCell-root MuiTableCell-body"
/>
<td
class="MuiTableCell-root MuiTableCell-body"
>
<a
class="MuiTypography-root MuiLink-root MuiLink-underlineHover MuiTypography-colorPrimary"
href="/"
>
mypod-1
</a>
</td>
</tr>
</tbody>
</table>
<div
class="MuiGrid-root makeStyles-sectionHeader makeStyles-sectionHeader MuiGrid-container MuiGrid-spacing-xs-2 MuiGrid-align-items-xs-center MuiGrid-justify-content-xs-space-between"
>
<div
class="MuiGrid-root MuiGrid-item"
>
<h4
class="MuiTypography-root makeStyles-sectionTitle makeStyles-sectionTitle MuiTypography-h4 MuiTypography-noWrap"
>
Ports
</h4>
</div>
</div>
<table
class="MuiTable-root makeStyles-table"
>
<thead
class="MuiTableHead-root"
>
<tr
class="MuiTableRow-root MuiTableRow-head"
>
<th
class="MuiTableCell-root MuiTableCell-head makeStyles-headerCell "
scope="col"
>
Name
<button
aria-label="sort up"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall"
tabindex="0"
type="button"
>
<span
class="MuiIconButton-label"
>
<span />
</span>
<span
class="MuiTouchRipple-root"
/>
</button>
</th>
<th
class="MuiTableCell-root MuiTableCell-head makeStyles-headerCell "
scope="col"
>
Port
<button
aria-label="sort swap"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall"
tabindex="0"
type="button"
>
<span
class="MuiIconButton-label"
>
<span />
</span>
<span
class="MuiTouchRipple-root"
/>
</button>
</th>
<th
class="MuiTableCell-root MuiTableCell-head makeStyles-headerCell "
scope="col"
>
Protocol
<button
aria-label="sort swap"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeSmall"
tabindex="0"
type="button"
>
<span
class="MuiIconButton-label"
>
<span />
</span>
<span
class="MuiTouchRipple-root"
/>
</button>
</th>
</tr>
</thead>
<tbody
class="MuiTableBody-root"
>
<tr
class="MuiTableRow-root"
>
<td
class="MuiTableCell-root MuiTableCell-body"
>
myport
</td>
<td
class="MuiTableCell-root MuiTableCell-body"
>
8080
</td>
<td
class="MuiTableCell-root MuiTableCell-body"
>
TCP
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12"
>
<div
class="MuiBox-root MuiBox-root"
/>
</div>
</div>
</div>
`;
exports[`Storyshots endpoints/EndpointsDetailsView Default 1`] = `<div />`;
exports[`Storyshots endpoints/EndpointsDetailsView Error 1`] = `
<div>
......
......@@ -57,6 +57,7 @@ export default function IngressDetails() {
},
]}
data={getHostsData(item)}
reflectInURL="rules"
/>
</SectionBox>
)}
......
......@@ -211,6 +211,7 @@ export function VolumeDetails(props: VolumeDetailsProps) {
},
]}
data={volumes}
reflectInURL="volumes"
/>
</SectionBox>
);
......
......@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { ApiError } from '../../lib/k8s/apiProxy';
import Pod from '../../lib/k8s/pod';
import { timeAgo } from '../../lib/util';
import { LightTooltip, SectionFilterHeader } from '../common';
import { LightTooltip, SectionFilterHeader, SimpleTableProps } from '../common';
import { StatusLabel, StatusLabelProps } from '../common/Label';
import ResourceTable, { ResourceTableProps } from '../common/Resource/ResourceTable';
import { SectionBox } from '../common/SectionBox';
......@@ -52,10 +52,11 @@ export interface PodListProps {
pods: Pod[] | null;
error: ApiError | null;
hideColumns?: ('namespace' | 'restarts')[];
reflectTableInURL?: SimpleTableProps['reflectInURL'];
}
export function PodListRenderer(props: PodListProps) {
const { pods, error, hideColumns = [] } = props;
const { pods, error, hideColumns = [], reflectTableInURL = 'pods' } = props;
const { t } = useTranslation('glossary');
function getDataCols() {
......@@ -110,6 +111,7 @@ export function PodListRenderer(props: PodListProps) {
errorMessage={Pod.getErrorMessage(error)}
columns={getDataCols()}
data={pods}
reflectInURL={reflectTableInURL}
/>
</SectionBox>
);
......@@ -118,5 +120,5 @@ export function PodListRenderer(props: PodListProps) {
export default function PodList() {
const [pods, error] = Pod.useList();
return <PodListRenderer pods={pods} error={error} />;
return <PodListRenderer pods={pods} error={error} reflectTableInURL />;
}
......@@ -67,6 +67,7 @@ export default function RoleBindingDetails() {
getter: item => item.namespace,
},
]}
reflectInURL="bindingInfo"
/>
</SectionBox>
)
......
......@@ -42,6 +42,7 @@ export default function RoleDetails() {
},
]}
data={item.rules}
reflectInURL="rules"
/>
</SectionBox>
)
......
......@@ -74,6 +74,7 @@ export default function ServiceDetails() {
),
},
]}
reflectInURL="ports"
/>
</SectionBox>
<SectionBox title={t('Endpoints')}>
......@@ -93,6 +94,7 @@ export default function ServiceDetails() {
cellProps: { style: { width: '40%', maxWidth: '40%' } },
},
]}
reflectInURL="endpoints"
/>
)}
</SectionBox>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment