diff --git a/client/src/components/Footer/Footer.tsx b/client/src/components/Footer/Footer.tsx index d278b5dc9..f048a5e78 100644 --- a/client/src/components/Footer/Footer.tsx +++ b/client/src/components/Footer/Footer.tsx @@ -1,11 +1,11 @@ import React, { FC } from 'react'; -import useStyles from './styles'; import { Box, Link, Typography, Divider, IconButton, MenuItem, Menu } from '@mui/material'; +import { Help } from '@mui/icons-material'; import logo from '~/images/inferno_logo.png'; -import { getStaticPath } from '~/api/infernoApiService'; +import { basePath, getStaticPath } from '~/api/infernoApiService'; import { FooterLink } from '~/models/testSuiteModels'; import { useAppStore } from '~/store/app'; -import { Help } from '@mui/icons-material'; +import useStyles from './styles'; interface FooterProps { version: string; @@ -19,23 +19,32 @@ const Footer: FC = ({ version, linkList }) => { const [anchorEl, setAnchorEl] = React.useState(null); const [showMenu, setShowMenu] = React.useState(false); - const apiLink = ( - - - API - - - ); + const apiLink = () => { + // To test locally, set apiBase to 'http://127.0.0.1:4000/inferno-core/api-docs/' + const apiBase = 'https://inferno-framework.github.io/inferno-core/api-docs/'; + const hostname = window.location.host; + console.log(window.location); + const fullHost = `${hostname}/${basePath}`; + const scheme = window.location.protocol; + + return ( + + + API + + + ); + }; const renderLogoText = () => { - if (!version) return apiLink; + if (!version) return apiLink(); return ( {!windowIsSmall && ( @@ -53,7 +62,7 @@ const Footer: FC = ({ version, linkList }) => { - {apiLink} + {apiLink()} ); diff --git a/docs/api-docs/index.html b/docs/api-docs/index.html index c95fcd6ec..7bcc7dd58 100644 --- a/docs/api-docs/index.html +++ b/docs/api-docs/index.html @@ -36,25 +36,63 @@ + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + const scheme = urlParams.get('scheme').replaceAll(':', ''); + const host = urlParams.get('host'); + + window.onload = () => { + // Begin Swagger UI call region + const ui = SwaggerUIBundle({ + url: "/inferno-core/swagger.yml", + dom_id: '#swagger-ui', + deepLinking: true, + onComplete: () => { + if (host) window.ui.setHost(host); + if (scheme) window.ui.setScheme(scheme); + }, + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset + ], + plugins: [ + SwaggerUIBundle.plugins.DownloadUrl, + UrlMutatorPlugin, + ], + layout: "StandaloneLayout" + }); + // End Swagger UI call region + + window.ui = ui; + + + }; +