Addresses Console Errors related to functions and test data

Also Adds speecificity to link URLs by add /details for urls that should
redireect to details pages instead of them ending in /:id
This commit is contained in:
Alex Corey 2020-01-10 09:17:00 -05:00
parent 919475a4c7
commit 33bc9e63c4
5 changed files with 3 additions and 18 deletions

View File

@ -14,16 +14,6 @@ import DeleteButton from '@components/DeleteButton';
import Switch from '@components/Switch';
import { HostsAPI } from '@api';
function HostDetail({ host, i18n }) {
const ActionButtonWrapper = styled.div`
display: flex;
justify-content: flex-end;
margin-top: 20px;
& > :not(:first-child) {
margin-left: 20px;
}
`;
function HostDetail({ host, history, match, i18n, onUpdateHost }) {
const { created, description, id, modified, name, summary_fields } = host;
@ -150,7 +140,6 @@ function HostDetail({ host, history, match, i18n, onUpdateHost }) {
{i18n._(t`Edit`)}
</Button>
)}
</CardActionsRow>
{summary_fields.user_capabilities &&
summary_fields.user_capabilities.delete && (
<DeleteButton
@ -159,6 +148,7 @@ function HostDetail({ host, history, match, i18n, onUpdateHost }) {
name={host.name}
/>
)}
</CardActionsRow>
</CardBody>
);
}
@ -167,4 +157,4 @@ HostDetail.propTypes = {
host: Host.isRequired,
};
export default withI18n()(HostDetail);
export default withI18n()(withRouter(HostDetail));

View File

@ -235,7 +235,7 @@ class HostsList extends Component {
<HostListItem
key={o.id}
host={o}
detailUrl={`${match.url}/${o.id}`}
detailUrl={`${match.url}/${o.id}/details`}
isSelected={selected.some(row => row.id === o.id)}
onSelect={() => this.handleSelect(o)}
onToggleHost={this.handleHostToggle}

View File

@ -49,7 +49,6 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
),
link: `/inventories/inventory/${inventory.id}/groups`,
id: 99,
isNestedTab: true,
},
{
name: i18n._(t`Details`),

View File

@ -14,8 +14,6 @@ GroupsAPI.readDetail.mockResolvedValue({
name: 'Foo',
description: 'Bar',
variables: 'bizz: buzz',
created: '1/12/2019',
modified: '1/13/2019',
summary_fields: {
inventory: { id: 1 },
created_by: { id: 1, username: 'Athena' },

View File

@ -17,8 +17,6 @@ describe('<JobTemplateDetail />', () => {
playbook: '',
id: 1,
verbosity: 1,
created: '1/12/2019',
modified: '1/13/2019',
summary_fields: {
user_capabilities: { edit: true },
created_by: { id: 1, username: 'Joe' },