Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: at670475 <[email protected]>
  • Loading branch information
taban03 committed Jul 11, 2023
1 parent d7898ce commit db97d4c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import WizardContainer from '../Wizard/WizardContainer';
import DialogDropdown from '../Wizard/DialogDropdown';
import { enablerData } from '../Wizard/configs/wizard_onboarding_methods';
import ConfirmDialogContainer from '../Wizard/ConfirmDialogContainer';
import { customUIStyle } from '../../utils/utilFunctions';
import { customUIStyle, isAPIPortal } from '../../utils/utilFunctions';

export default class Dashboard extends Component {
componentDidMount() {
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class Dashboard extends Component {
searchCriteria.length > 0;
const hasTiles = !fetchTilesError && tiles && tiles.length > 0;
let error = null;
const apiPortalEnabled = process.env.REACT_APP_API_PORTAL === 'true';
const apiPortalEnabled = isAPIPortal();
if (fetchTilesError !== undefined && fetchTilesError !== null) {
fetchTilesStop();
error = formatError(fetchTilesError);
Expand Down
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 } from '../../utils/utilFunctions';
import { customUIStyle, isAPIPortal } from '../../utils/utilFunctions';

export default class DetailPage extends Component {
componentDidMount() {
Expand Down Expand Up @@ -66,7 +66,7 @@ export default class DetailPage extends Component {
fetchNewTiles();
fetchTilesStart(currentTileId);
}
const apiPortalEnabled = process.env.REACT_APP_API_PORTAL === 'true';
const apiPortalEnabled = isAPIPortal();
const hasTiles = !fetchTilesError && tiles && tiles.length > 0;
if (hasTiles && 'customStyleConfig' in tiles[0] && tiles[0].customStyleConfig) {
customUIStyle(tiles[0].customStyleConfig);
Expand Down
3 changes: 2 additions & 1 deletion api-catalog-ui/frontend/src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/
import { Component } from 'react';
import { Container, Link, Typography } from '@material-ui/core';
import { isAPIPortal } from '../../utils/utilFunctions';

export default class Footer extends Component {
render() {
if (process.env.REACT_APP_API_PORTAL === 'true' || process.env.REACT_APP_CA_ENV === 'true') {
if (isAPIPortal() || process.env.REACT_APP_CA_ENV === 'true') {
return (
<footer id="pageFooter">
<div id="bottom-info-div">
Expand Down
7 changes: 4 additions & 3 deletions api-catalog-ui/frontend/src/components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import productImage from '../../assets/images/api-catalog-logo.png';
import zoweDocsImage from '../../assets/images/zowe-docs.png';
import zoweAuthImage from '../../assets/images/zowe-auth.png';
import customDoc from '../../assets/images/custom-doc.png';
import { isAPIPortal } from '../../utils/utilFunctions';

const useStyles = makeStyles({
root: {
Expand Down Expand Up @@ -96,7 +97,7 @@ function Header(props) {
</Link>
</div>
<div className="right-icons">
{docLink && (
{docLink && docLink.length === 2 && (
<Link
data-testid="internal-link"
id="internal-link"
Expand All @@ -108,7 +109,7 @@ function Header(props) {
<img id="img-internal-link" alt="Internal doc" src={customDoc} />
</Link>
)}
{process.env.REACT_APP_API_PORTAL === 'true' && (
{isAPIPortal() && (
<div id="zowe-links">
<Link rel="noopener noreferrer" target="_blank" href="https://docs.zowe.org">
<img id="doc" alt="Zowe docs" src={zoweDocsImage} />
Expand All @@ -122,7 +123,7 @@ function Header(props) {
</Link>
</div>
)}
{process.env.REACT_APP_API_PORTAL !== undefined && process.env.REACT_APP_API_PORTAL === 'false' && (
{!isAPIPortal() && (
<div className="logout-container">
<Button
className={classes.root}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Component } from 'react';
import Shield from '../ErrorBoundary/Shield/Shield';
import SwaggerContainer from '../Swagger/SwaggerContainer';
import ServiceVersionDiffContainer from '../ServiceVersionDiff/ServiceVersionDiffContainer';
import countAdditionalContents from '../../utils/utilFunctions';
import countAdditionalContents, { isAPIPortal } from '../../utils/utilFunctions';

export default class ServiceTab extends Component {
constructor(props) {
Expand Down Expand Up @@ -277,7 +277,7 @@ export default class ServiceTab extends Component {
isDialogOpen={isDialogOpen}
/>
)}
{process.env.REACT_APP_API_PORTAL === 'true' && (
{isAPIPortal() && (
<div id="detail-footer">
<Typography
className="footer-labels"
Expand Down
6 changes: 3 additions & 3 deletions api-catalog-ui/frontend/src/components/Tile/Tile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ReportProblemIcon from '@material-ui/icons/ReportProblem';
import HelpOutlineIcon from '@material-ui/icons/HelpOutline';
import videosImg from '../../assets/images/videos.png';
import tutorialsImg from '../../assets/images/tutorials.png';
import utilFunctions from '../../utils/utilFunctions';
import utilFunctions, { isAPIPortal } from '../../utils/utilFunctions';

export default class Tile extends Component {
getTileStatus = (tile) => {
Expand All @@ -37,7 +37,7 @@ export default class Tile extends Component {
if (tile === null || tile === undefined) {
return 'Status unknown';
}
const apiPortalEnabled = process.env.REACT_APP_API_PORTAL === 'true';
const apiPortalEnabled = isAPIPortal();
if (!apiPortalEnabled) {
const { status } = tile;
switch (status) {
Expand All @@ -60,7 +60,7 @@ export default class Tile extends Component {

render() {
const { tile, service } = this.props;
const apiPortalEnabled = process.env.REACT_APP_API_PORTAL === 'true';
const apiPortalEnabled = isAPIPortal();
const { useCasesCounter, tutorialsCounter, videosCounter } = utilFunctions(service);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Component } from 'react';
import { Button, Menu, MenuItem } from '@material-ui/core';
import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
import './wizard.css';
import { isAPIPortal } from '../../utils/utilFunctions';

export default class DialogDropdown extends Component {
constructor(props) {
Expand Down Expand Up @@ -53,7 +54,7 @@ export default class DialogDropdown extends Component {
}

renderDropdown() {
if (!this.props.visible || !Array.isArray(this.state.data) || process.env.REACT_APP_API_PORTAL === 'true') {
if (!this.props.visible || !Array.isArray(this.state.data) || isAPIPortal()) {
return null;
}
return (
Expand Down
3 changes: 2 additions & 1 deletion api-catalog-ui/frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import { rootEpic } from './epics';
import { sendError } from './actions/error-actions';
import Spinner from './components/Spinner/Spinner';
import { AsyncAppContainer } from './components/App/AsyncModules';
import { isAPIPortal } from './utils/utilFunctions';

if (process.env.REACT_APP_API_PORTAL !== undefined && process.env.REACT_APP_API_PORTAL === 'true') {
if (isAPIPortal()) {
import('./index.scss');
} else {
import('./index.css');
Expand Down
4 changes: 4 additions & 0 deletions api-catalog-ui/frontend/src/utils/utilFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,7 @@ export const customUIStyle = async (uiConfig) => {
}
}
};

export const isAPIPortal = () => {

Check warning on line 128 in api-catalog-ui/frontend/src/utils/utilFunctions.js

View workflow job for this annotation

GitHub Actions / BuildAndTest

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`

Check warning on line 128 in api-catalog-ui/frontend/src/utils/utilFunctions.js

View workflow job for this annotation

GitHub Actions / PublishJibContainers

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
return process.env.REACT_APP_API_PORTAL === 'true';
};

0 comments on commit db97d4c

Please sign in to comment.