mirror of
https://github.com/ansible/awx.git
synced 2026-03-27 05:45:02 -02:30
Style job output navigation control bar
This commit is contained in:
@@ -15,25 +15,21 @@ import ContentError from '@components/ContentError';
|
|||||||
import ContentLoading from '@components/ContentLoading';
|
import ContentLoading from '@components/ContentLoading';
|
||||||
import JobEvent from './JobEvent';
|
import JobEvent from './JobEvent';
|
||||||
import JobEventSkeleton from './JobEventSkeleton';
|
import JobEventSkeleton from './JobEventSkeleton';
|
||||||
import MenuControls from './MenuControls';
|
import PageControls from './PageControls';
|
||||||
import HostEventModal from './HostEventModal';
|
import HostEventModal from './HostEventModal';
|
||||||
|
|
||||||
const OutputHeader = styled.div`
|
const OutputHeader = styled.div`
|
||||||
font-weight: var(--pf-global--FontWeight--bold);
|
font-weight: var(--pf-global--FontWeight--bold);
|
||||||
`;
|
`;
|
||||||
const OutputToolbar = styled.div`
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
`;
|
|
||||||
const OutputWrapper = styled.div`
|
const OutputWrapper = styled.div`
|
||||||
height: calc(100vh - 350px);
|
|
||||||
background-color: #fafafa;
|
background-color: #fafafa;
|
||||||
margin-top: 24px;
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 15px;
|
|
||||||
outline: 1px solid #d7d7d7;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 15px;
|
||||||
|
height: calc(100vh - 350px);
|
||||||
|
outline: 1px solid #d7d7d7;
|
||||||
`;
|
`;
|
||||||
const OutputFooter = styled.div`
|
const OutputFooter = styled.div`
|
||||||
background-color: #ebebeb;
|
background-color: #ebebeb;
|
||||||
@@ -310,14 +306,12 @@ class JobOutput extends Component {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<OutputHeader>{job.name}</OutputHeader>
|
<OutputHeader>{job.name}</OutputHeader>
|
||||||
<OutputToolbar>
|
<PageControls
|
||||||
<MenuControls
|
onScrollFirst={this.handleScrollFirst}
|
||||||
onScrollFirst={this.handleScrollFirst}
|
onScrollLast={this.handleScrollLast}
|
||||||
onScrollLast={this.handleScrollLast}
|
onScrollNext={this.handleScrollNext}
|
||||||
onScrollNext={this.handleScrollNext}
|
onScrollPrevious={this.handleScrollPrevious}
|
||||||
onScrollPrevious={this.handleScrollPrevious}
|
/>
|
||||||
/>
|
|
||||||
</OutputToolbar>
|
|
||||||
<OutputWrapper>
|
<OutputWrapper>
|
||||||
<InfiniteLoader
|
<InfiniteLoader
|
||||||
isRowLoaded={this.isRowLoaded}
|
isRowLoaded={this.isRowLoaded}
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ async function checkOutput(wrapper, expectedLines) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function findScrollButtons(wrapper) {
|
async function findScrollButtons(wrapper) {
|
||||||
const menuControls = await waitForElement(wrapper, 'MenuControls');
|
const pageControls = await waitForElement(wrapper, 'PageControls');
|
||||||
const scrollFirstButton = menuControls.find(
|
const scrollFirstButton = pageControls.find(
|
||||||
'button[aria-label="scroll first"]'
|
'button[aria-label="scroll first"]'
|
||||||
);
|
);
|
||||||
const scrollLastButton = menuControls.find(
|
const scrollLastButton = pageControls.find(
|
||||||
'button[aria-label="scroll last"]'
|
'button[aria-label="scroll last"]'
|
||||||
);
|
);
|
||||||
const scrollPreviousButton = menuControls.find(
|
const scrollPreviousButton = pageControls.find(
|
||||||
'button[aria-label="scroll previous"]'
|
'button[aria-label="scroll previous"]'
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -10,26 +10,25 @@ import {
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-gap: 20px;
|
height: 35px;
|
||||||
grid-template-columns: repeat(5, 1fr);
|
outline: 1px solid #d7d7d7;
|
||||||
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Button = styled(PFButton)`
|
const Button = styled(PFButton)`
|
||||||
&:hover {
|
position: relative;
|
||||||
background-color: #0066cc;
|
z-index: 1;
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const MenuControls = ({
|
const PageControls = ({
|
||||||
onScrollFirst,
|
onScrollFirst,
|
||||||
onScrollLast,
|
onScrollLast,
|
||||||
onScrollNext,
|
onScrollNext,
|
||||||
onScrollPrevious,
|
onScrollPrevious,
|
||||||
}) => (
|
}) => (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Button variant="plain">
|
<Button variant="plain" css="margin-right: auto">
|
||||||
<PlusIcon />
|
<PlusIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@@ -51,4 +50,4 @@ const MenuControls = ({
|
|||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default MenuControls;
|
export default PageControls;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import MenuControls from './MenuControls';
|
import PageControls from './PageControls';
|
||||||
|
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let PlusIcon;
|
let PlusIcon;
|
||||||
@@ -17,14 +17,14 @@ const findChildren = () => {
|
|||||||
AngleDownIcon = wrapper.find('AngleDownIcon');
|
AngleDownIcon = wrapper.find('AngleDownIcon');
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('MenuControls', () => {
|
describe('PageControls', () => {
|
||||||
test('should render successfully', () => {
|
test('should render successfully', () => {
|
||||||
wrapper = mount(<MenuControls />);
|
wrapper = mount(<PageControls />);
|
||||||
expect(wrapper).toHaveLength(1);
|
expect(wrapper).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should render menu control icons', () => {
|
test('should render menu control icons', () => {
|
||||||
wrapper = mount(<MenuControls />);
|
wrapper = mount(<PageControls />);
|
||||||
findChildren();
|
findChildren();
|
||||||
expect(PlusIcon.length).toBe(1);
|
expect(PlusIcon.length).toBe(1);
|
||||||
expect(AngleDoubleUpIcon.length).toBe(1);
|
expect(AngleDoubleUpIcon.length).toBe(1);
|
||||||
Reference in New Issue
Block a user