Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.

Commit decf504

Browse files
Swagger ui (#57)
* add swagger ui * upgrade dependencies
1 parent 271cd85 commit decf504

File tree

8 files changed

+85
-6
lines changed

8 files changed

+85
-6
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.IframeComponent_fullheight {
2+
height: 100%;
3+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from "react";
2+
import "./IframeComponent.scss";
3+
4+
interface Props {
5+
title: string;
6+
src: string;
7+
height: string;
8+
width: string;
9+
}
10+
11+
export const IframeComponent: React.FC<Props> = ({
12+
title,
13+
src,
14+
height,
15+
width
16+
}) => {
17+
return (
18+
<React.Fragment>
19+
<iframe
20+
title={title}
21+
src={src}
22+
height={height}
23+
width={width}
24+
className="IframeComponent_fullheight"
25+
/>
26+
</React.Fragment>
27+
);
28+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./IframeComponent";

src/PresentationalComponents/PageContextOrganization/PageContextOrganization.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Switch } from "react-router-dom";
33
import { XmlBuilderRouterProps } from "../../models/routerProps";
44
import { PageOrganizationEdit } from "../PageOrganizationEdit";
55
import { PageOrganizationKeys } from "../PageOrganizationKeys";
6-
import { PageOrganizationDocuments } from "../PageOrganizationDocuments";
6+
// import { PageOrganizationDocuments } from "../PageOrganizationDocuments";
77
import RouterOrganizationContextSelector from "../../SmartComponents/RouterOrganizationContextSelector";
88

99
interface Props extends XmlBuilderRouterProps {}
@@ -25,10 +25,10 @@ export class PageContextOrganization extends React.Component<Props, State> {
2525
path={`${match.path}/keys`}
2626
component={PageOrganizationKeys}
2727
/>
28-
<RouterOrganizationContextSelector
28+
{/* <RouterOrganizationContextSelector
2929
path={`${match.path}/documents`}
3030
component={PageOrganizationDocuments}
31-
/>
31+
/> */}
3232
</Switch>
3333
</React.Fragment>
3434
);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from "react";
2+
import {
3+
PageSection,
4+
PageSectionVariants,
5+
TextContent,
6+
Text
7+
} from "@patternfly/react-core";
8+
import { IframeComponent } from "../IframeComponent";
9+
10+
interface Props {}
11+
12+
export const PageSwaggerUI: React.FC<Props> = () => {
13+
// This will work only when it is deployed inside xml-builder Quarkus
14+
// const origin = `http://localhost:8080/swagger-ui/`;
15+
const origin = `${window.location.origin}/swagger-ui/`;
16+
return (
17+
<React.Fragment>
18+
<PageSection variant={PageSectionVariants.light}>
19+
<TextContent>
20+
<Text component="h1">OpenAPI v3</Text>
21+
<Text component="small">
22+
Interactúa con todos los endpoints utilizando las herramientas que
23+
te ofrecemos.
24+
</Text>
25+
</TextContent>
26+
</PageSection>
27+
<PageSection>
28+
<IframeComponent
29+
title="Swagger UI"
30+
src={origin}
31+
height="100%"
32+
width="100%"
33+
/>
34+
</PageSection>
35+
</React.Fragment>
36+
);
37+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./PageSwaggerUI";

src/Routes.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import RouterOrganizationContextLoader from "./SmartComponents/RouterOrganizatio
1010
import { PageOrganizationList } from "./PresentationalComponents/PageOrganizationList";
1111
import { PageOrganizationEdit } from "./PresentationalComponents/PageOrganizationEdit";
1212
import { PageContextOrganization } from "./PresentationalComponents/PageContextOrganization";
13+
import { PageSwaggerUI } from "./PresentationalComponents/PageSwaggerUI";
1314

1415
const XmlBuilderRoute = (params: any) => {
1516
const { component: Component, ...rest } = params;
@@ -49,6 +50,8 @@ export const AppRoutes = () => {
4950
component={PageContextOrganization}
5051
/>
5152

53+
<Route path="/swagger-ui" component={PageSwaggerUI} />
54+
5255
<Route path="/error403" component={PageForbidden403} />
5356
<Route path="/error404" component={PageNotFound404} />
5457
<Route path="/error503" component={PageServiceUnavailable503} />

src/SmartComponents/SidebarNav/SidebarNav.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { NavLink } from "react-router-dom";
33
import { Nav, NavItem, NavGroup } from "@patternfly/react-core";
4-
import { HomeIcon } from "@patternfly/react-icons";
4+
import { HomeIcon, BookOpenIcon } from "@patternfly/react-icons";
55
import { OrganizationRepresentation } from "../../models/xml-builder";
66

77
interface Props {
@@ -29,6 +29,12 @@ export class SidebarNav extends React.Component<Props, State> {
2929
&nbsp;Home
3030
</NavLink>
3131
</NavItem>
32+
<NavItem>
33+
<NavLink to="/swagger-ui" activeClassName="pf-m-current">
34+
<BookOpenIcon />
35+
&nbsp;API Docs
36+
</NavLink>
37+
</NavItem>
3238
</NavGroup>
3339
<NavGroup title="Consola administración">
3440
<NavItem key="organizations">
@@ -44,14 +50,14 @@ export class SidebarNav extends React.Component<Props, State> {
4450
Certificados digitales
4551
</NavLink>
4652
</NavItem>
47-
<NavItem key="documents">
53+
{/* <NavItem key="documents">
4854
<NavLink
4955
to={`/organizations/manage/${organizationId}/documents`}
5056
activeClassName="pf-m-current"
5157
>
5258
Comprobantes electrónicos
5359
</NavLink>
54-
</NavItem>
60+
</NavItem> */}
5561
</NavGroup>
5662
</Nav>
5763
);

0 commit comments

Comments
 (0)