Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: UI polishing #2985

Merged
merged 51 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
618e6a3
css polishing
taban03 Jul 14, 2023
d55fd47
fix warnings
taban03 Jul 14, 2023
f94115b
fix test
taban03 Jul 14, 2023
7d43215
fix some style
taban03 Jul 14, 2023
a77522f
improve handling in case of header set to white
taban03 Jul 14, 2023
6b9f8f1
fix buttons color
taban03 Jul 14, 2023
7aad1fc
Merge branch 'v2.x.x' into reboot/ui_polishing
taban03 Jul 14, 2023
eb98ef9
small fix for better responsiveness
taban03 Jul 14, 2023
3a52bf7
fix + test
taban03 Jul 16, 2023
f5e101d
fix complexity
taban03 Jul 16, 2023
3c73ee8
fixing
taban03 Jul 16, 2023
23bbb48
reduce complexity
taban03 Jul 16, 2023
01347a6
hide compare button in case of no doc
taban03 Jul 17, 2023
be034a4
fix wizard bar and add unit tests
taban03 Jul 17, 2023
850b282
fix login form
taban03 Jul 17, 2023
b85fd3d
fix spinner glitch on login
taban03 Jul 17, 2023
e1ee4eb
refactor tabs and fix css
taban03 Jul 20, 2023
4fc7f9f
get version for compare
taban03 Jul 20, 2023
427e9c2
fix compare versions
taban03 Jul 21, 2023
65799b1
add tests
taban03 Jul 22, 2023
8920533
add test
taban03 Jul 22, 2023
449ae1d
Merge branch 'v2.x.x' into reboot/ui_polishing
taban03 Jul 22, 2023
39a99ca
increase coverage
taban03 Jul 24, 2023
da7f2d3
fix small bug
taban03 Jul 24, 2023
e287f09
fix
taban03 Jul 24, 2023
0ffa31f
fix e2e test
taban03 Jul 24, 2023
8f5f076
Merge branch 'v2.x.x' into reboot/ui_polishing
taban03 Jul 24, 2023
aefb9a4
add border color when hover/select tab
taban03 Jul 24, 2023
5e6bdf4
fix anchors
taban03 Jul 24, 2023
a7794ee
fix media icons and search bar
taban03 Jul 25, 2023
094cb6e
add test
taban03 Jul 25, 2023
e0bc65e
small changes
taban03 Jul 25, 2023
cc62067
fix code smell
taban03 Jul 25, 2023
a1bcf62
increase coverage
taban03 Jul 25, 2023
ce45ae8
add check and hide right menu in case only swagger present
taban03 Jul 25, 2023
3e6e0cd
adjust internal doc img size
taban03 Jul 25, 2023
3dadb22
fix tests
taban03 Jul 25, 2023
4505dda
fix tests
taban03 Jul 25, 2023
83c636a
address PR comments
taban03 Jul 26, 2023
347782b
address comments
taban03 Jul 26, 2023
8d65d6f
Merge branch 'v2.x.x' into reboot/ui_polishing
taban03 Jul 26, 2023
a995200
small fix
taban03 Jul 26, 2023
1fe8595
fix operation swagger width
taban03 Jul 26, 2023
fce95db
address comments
taban03 Jul 27, 2023
5bc276c
fix search bar css
taban03 Jul 27, 2023
2059385
fix bug of no swagger being displayed when navigating to the detailpage
taban03 Jul 28, 2023
bfbbdb9
Merge branch 'v2.x.x' into reboot/ui_polishing
taban03 Jul 28, 2023
75afa0e
fix tests
taban03 Jul 28, 2023
3b8ce71
add test and adjust css
taban03 Jul 28, 2023
a157fe7
add unit tests
taban03 Jul 31, 2023
57501f2
small fix
taban03 Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ describe('>>> Service version compare Test', () => {
it('Should show compare tab', () => {
// Location of the compare has changed, it's no longer a specific tab
cy.get('.tabs-container').should('not.exist');
cy.get('.nav-tabs').should('exist');
cy.get('.nav-tabs').should('have.length', 12);
cy.get('div.MuiTabs-root.custom-tabs.MuiTabs-vertical > div.MuiTabs-scroller.MuiTabs-scrollable > div').should('exist');
cy.get('div.MuiTabs-flexContainer.MuiTabs-flexContainerVertical') // Select the parent div
.find('a.MuiTab-root') // Find all the anchor elements within the div
.should('have.length', 12); // Check if there are 12 anchor elements within the div
cy.get('.version-text').should('exist');
cy.get('.version-text').should('contain.text', 'Compare');
});
Expand Down
5 changes: 5 additions & 0 deletions api-catalog-ui/frontend/src/components/App/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
height: 100vh;
}

@media only screen and (max-width: 1120px) {
.content {
width: fit-content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ a {
display: contents;
}

@media only screen and (max-width: 600px) {
@media only screen and (max-width: 1120px) {
#dash-buttons {
margin: 0;
float: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
.header, .header > * {
align-items: center;
}
#search .MuiFormControl-root {
display: contents;
}
h1 {
margin: var( --spaceMedium ) 0;
padding-bottom: var( --spaceMedium );
Expand All @@ -28,9 +31,6 @@
margin-right: auto;
background: #FFFFFF;
border: 1px solid #C9C8C5;
.MuiFormControl-root {
display: flex;
}
}

#grid-container ,
Expand Down Expand Up @@ -90,4 +90,3 @@
width: 99%;
display: block;
}

18 changes: 10 additions & 8 deletions api-catalog-ui/frontend/src/components/DetailPage/DetailPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
}

.main-content2 detail-content {
display: flex;
height: 100vh;
text-align: left;
background-color: #EFEFEF;
}
Expand Down Expand Up @@ -44,14 +46,12 @@
}

.detailed-description-container {
margin-top: 2rem;
text-align: left;
overflow: hidden;
width: 100%;
}

.api-description-container {
margin-left: 397px;
margin-left: 375px;
padding: 2.2rem;
}

Expand Down Expand Up @@ -87,7 +87,6 @@
}

#title {
padding: 2rem .3rem 1.3rem 0;
color: #58606e;
font-size: 28px;
font-weight: 700;
Expand Down Expand Up @@ -130,12 +129,13 @@ div.content-description-container > div > div:nth-child(2) > div {
}

.nav-bar {
min-height: 84vh;
max-width: 380px;
min-height: 40vh;
flex-direction: column;
align-items: center;
min-width: 368px;
box-shadow: 0 0 6px hsl(210 14% 90%);
padding: 10px 5px 10px 20px;
padding: 10px 5px 16px 20px;
flex: 1 0 0;
width: auto;
height: auto;
Expand All @@ -146,9 +146,7 @@ div.content-description-container > div > div:nth-child(2) > div {
}

.paragraph-description-container {
/*change width via templating mechanism to create space for the right menu (width 80%) */
width: auto;
/*width: 80%;*/
margin-left: 56px;
}

Expand All @@ -167,3 +165,7 @@ div.content-description-container > div > div:nth-child(2) > div {
width: 600px;
}
}

.MuiTabs-root.custom-tabs.MuiTabs-vertical {
margin-right: 12px;
}
64 changes: 44 additions & 20 deletions api-catalog-ui/frontend/src/components/DetailPage/DetailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import PageNotFound from '../PageNotFound/PageNotFound';
import BigShield from '../ErrorBoundary/BigShield/BigShield';
import ServicesNavigationBarContainer from '../ServicesNavigationBar/ServicesNavigationBarContainer';
import Shield from '../ErrorBoundary/Shield/Shield';
import { customUIStyle, isAPIPortal } from '../../utils/utilFunctions';
import countAdditionalContents, { customUIStyle, isAPIPortal } from '../../utils/utilFunctions';

export default class DetailPage extends Component {
componentDidMount() {
Expand All @@ -27,6 +27,7 @@ export default class DetailPage extends Component {
if (currentTileId) {
fetchTilesStart(currentTileId);
}
localStorage.removeItem('selectedTab');
}

componentWillUnmount() {
Expand All @@ -40,6 +41,14 @@ export default class DetailPage extends Component {
history.push('/dashboard');
};

handleLinkClick = (e, id) => {
e.preventDefault();
const elementToView = document.querySelector(id);
if (elementToView) {
elementToView.scrollIntoView();
}
};

render() {
const {
tiles,
Expand Down Expand Up @@ -68,6 +77,8 @@ export default class DetailPage extends Component {
}
const apiPortalEnabled = isAPIPortal();
const hasTiles = !fetchTilesError && tiles && tiles.length > 0;
const { useCasesCounter, tutorialsCounter, videosCounter } = countAdditionalContents(services);
const onlySwaggerPresent = tutorialsCounter === 0 && videosCounter === 0 && useCasesCounter === 0;
if (hasTiles && 'customStyleConfig' in tiles[0] && tiles[0].customStyleConfig) {
customUIStyle(tiles[0].customStyleConfig);
}
Expand Down Expand Up @@ -101,16 +112,18 @@ export default class DetailPage extends Component {
</div>
{!isLoading && !fetchTilesError && (
<div className="api-description-container">
<IconButton
id="go-back-button"
data-testid="go-back-button"
color="primary"
onClick={this.handleGoBack}
size="medium"
>
{iconBack}
Back
</IconButton>
{!apiPortalEnabled && (
<IconButton
id="go-back-button"
data-testid="go-back-button"
color="primary"
onClick={this.handleGoBack}
size="medium"
>
{iconBack}
Back
</IconButton>
)}
<div className="detailed-description-container">
<div className="title-api-container">
{tiles !== undefined && tiles.length === 1 && (
Expand All @@ -127,23 +140,29 @@ export default class DetailPage extends Component {
)}
</div>
</div>
{apiPortalEnabled && (
{apiPortalEnabled && !onlySwaggerPresent && (
<div id="right-resources-menu">
<Typography id="resources-menu-title" variant="subtitle1">
On this page
</Typography>
<Container>
<Link className="links" href="#swagger-label">
<Link className="links" onClick={(e) => this.handleLinkClick(e, '#swagger-label')}>
Swagger
</Link>
<Link className="links" href="#use-cases-label">
Use cases
<Link
className="links"
onClick={(e) => this.handleLinkClick(e, '#use-cases-label')}
>
Use cases ({useCasesCounter})
</Link>
<Link className="links" href="#tutorials-label">
Tutorials
<Link
className="links"
onClick={(e) => this.handleLinkClick(e, '#tutorials-label')}
>
Tutorials ({tutorialsCounter})
</Link>
<Link className="links" href="#videos-label">
Videos
<Link className="links" onClick={(e) => this.handleLinkClick(e, '#videos-label')}>
Videos ({videosCounter})
</Link>
</Container>
</div>
Expand All @@ -167,7 +186,12 @@ export default class DetailPage extends Component {
path={`${match.path}/:serviceId`}
render={() => (
<div className="tabs-swagger">
<ServiceTabContainer tiles={tiles} />
<ServiceTabContainer
videosCounter={videosCounter}
tutorialsCounter={tutorialsCounter}
useCasesCounter={useCasesCounter}
tiles={tiles}
/>
</div>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,74 @@ describe('>>> Detailed Page component tests', () => {
expect(clearService).toHaveBeenCalled();
expect(fetchTilesStart).toHaveBeenCalled();
});

it('should display nav right menu', () => {
process.env.REACT_APP_API_PORTAL = true;
const fetchTilesStart = jest.fn();
const fetchNewTiles = jest.fn();
const history = {
push: jest.fn(),
pathname: jest.fn(),
};
const wrapper = shallow(
<DetailPage
tiles={[tile]}
services={tile.services}
currentTileId="apicatalog"
fetchTilesStart={fetchTilesStart}
fetchNewTiles={fetchNewTiles}
fetchTilesStop={jest.fn()}
match={match}
history={history}
/>
);
expect(wrapper.find('#right-resources-menu').exists()).toEqual(true);
});

it('should click', () => {
process.env.REACT_APP_API_PORTAL = true;
const fetchTilesStart = jest.fn();
const fetchNewTiles = jest.fn();
const history = {
push: jest.fn(),
pathname: jest.fn(),
};
const mockHandleLinkClick = jest.fn();
const mockEvent = { preventDefault: jest.fn() };
const mockElementToView = { scrollIntoView: jest.fn() };
document.querySelector = jest.fn().mockReturnValue(mockElementToView);
const wrapper = shallow(
<DetailPage
tiles={[tile]}
services={tile.services}
currentTileId="apicatalog"
handleLinkClick={mockHandleLinkClick}
fetchTilesStart={fetchTilesStart}
fetchNewTiles={fetchNewTiles}
fetchTilesStop={jest.fn()}
match={match}
history={history}
/>
);
// Simulate a click event on the Link component, providing the id as the second argument
wrapper.instance().handleLinkClick(mockEvent, '#swagger-label');
expect(mockEvent.preventDefault).toHaveBeenCalled();
expect(document.querySelector).toHaveBeenCalledWith('#swagger-label');
expect(mockElementToView.scrollIntoView).toHaveBeenCalled();

wrapper.instance().handleLinkClick(mockEvent, '#use-cases-label');
expect(mockEvent.preventDefault).toHaveBeenCalled();
expect(document.querySelector).toHaveBeenCalledWith('#use-cases-label');
expect(mockElementToView.scrollIntoView).toHaveBeenCalled();

wrapper.instance().handleLinkClick(mockEvent, '#videos-label');
expect(mockEvent.preventDefault).toHaveBeenCalled();
expect(document.querySelector).toHaveBeenCalledWith('#videos-label');
expect(mockElementToView.scrollIntoView).toHaveBeenCalled();

wrapper.instance().handleLinkClick(mockEvent, '#tutorials-label');
expect(mockEvent.preventDefault).toHaveBeenCalled();
expect(document.querySelector).toHaveBeenCalledWith('#tutorials-label');
expect(mockElementToView.scrollIntoView).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ body .detail-content {
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
padding: 14px;
margin-right: 30px;
margin-top: -119px;
margin-top: -60px;
}

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
/* Extra small devices (phones, 1361px and down) */
@media only screen and (max-width: 1361px) {
#right-resources-menu {
display: contents;
display: none;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ export default class BigShield extends Component {
<br />
{!disableButton && (
<div>
<Button primary onClick={this.handleGoToHome} size="medium" iconStart={iconBack}>
<Button
id="go-back-button"
primary
onClick={this.handleGoToHome}
size="medium"
iconStart={iconBack}
>
Go to Dashboard
</Button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions api-catalog-ui/frontend/src/components/Header/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ body {
#img-internal-link {
margin-right: 20px;
margin-left: 12px;
height: 16px;
width: 16px;
height: 15px;
width: 15px;
}
}//end header
}
7 changes: 3 additions & 4 deletions api-catalog-ui/frontend/src/components/Login/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
background-repeat: no-repeat;
display: flex;
flex: auto;
height: 100%;
height: 100vh;
padding-bottom: 0;
}

Expand Down Expand Up @@ -140,8 +140,7 @@ form#login-form {
}

.susp-card {
padding-top: 200px;
padding-left: 600px;
margin: auto;
}

.MuiFormControl-root {
Expand All @@ -160,4 +159,4 @@ form#login-form {
#warn-first-line {
display: flex;
padding-bottom: 10px;
}
}
Loading
Loading