Skip to content

Commit 1ef827e

Browse files
authored
Merge pull request #47 from IQSS/deployment_fix
This change was required for the UI to be packed for production deployment.
2 parents 62d3641 + a72f26c commit 1ef827e

File tree

8 files changed

+42
-67
lines changed

8 files changed

+42
-67
lines changed

dv-marketplace/src/components/UI/AppMessageDialog.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

dv-marketplace/src/components/UI/MarketplaceCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface CardDeckProps {
1414
export const MarketplaceLinkCard = ({ header, imageId, text, link, children }: CardDeckProps) => {
1515
return (
1616
<div className="col-12 col-sm-6 col-md-6 col-lg-3 mb-2 px-0">
17-
<Link to={link} className="text-decoration-none">
17+
<Link to={link ?? ""} className="text-decoration-none">
1818
<BaseCard header={header} imageId={imageId} text={text} link={link}>
1919
{children}
2020
</BaseCard>
@@ -44,7 +44,7 @@ export const RowCard = ({ header, imageId, text, link, children }: CardDeckProps
4444
);
4545
}
4646

47-
export const BaseCard = ({ header, imageId, text, link, children }: CardDeckProps) => {
47+
export const BaseCard = ({ header, imageId, text, children }: CardDeckProps) => {
4848

4949
const { getImageUrl } = useMarketplaceApiRepo();
5050
return (
@@ -56,7 +56,8 @@ export const BaseCard = ({ header, imageId, text, link, children }: CardDeckProp
5656
</Card.Header>
5757
)}
5858
{imageId && (
59-
<Card.Img variant="top" src={getImageUrl(imageId)} className="rounded-5 p-1" />
59+
<Card.Img variant="top" src={getImageUrl(imageId)} className="rounded-5 p-1"
60+
style={{ maxHeight: '200px', minHeight: '100px', objectFit: 'scale-down' }}/>
6061
)}
6162
<Card.Body>
6263
{text && (

dv-marketplace/src/components/context/UserContextProvider.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ export const UserContext = createContext<UserContextType>({
66
user: null,
77
setUser: () => {},
88
showLogin: false,
9-
setShowLogin: () => {},
10-
showMessage: false,
11-
setShowMessage: () => {},
12-
modalMessage: '',
13-
setModalMessage: () => {},
14-
modalTitle: '',
15-
setModalTitle: () => {},
9+
setShowLogin: () => {},
1610
theme: Theme.AUTO,
1711
setTheme: () => {}
1812

@@ -23,7 +17,7 @@ const UserContextProvider = ({ children }: { children: React.ReactNode }) => {
2317
const [user, setUser] = useState<User | null>(null);
2418
const [showLogin, setShowLogin] = useState(false);
2519
//App message dialog
26-
const [theme, setTheme] = useState<Theme>();
20+
const [theme, setTheme] = useState<Theme>(Theme.AUTO);
2721

2822
useEffect((): void => {
2923
const user = localStorage.getItem('user');

dv-marketplace/src/components/forms/EditExternalToolForm/EditVersionForm/useEditManifestForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useState } from "react";
22
import type { Manifest } from "../../../../types/MarketplaceTypes";
33
import { createFormChangeHandler } from "../../../UI/FormInputFields";
4+
import useMarketplaceApiRepo from "../../../../repositories/useMarketplaceApiRepo";
45

56

67
export default function useEditManifestForm(initialManifest?: Manifest, show?: boolean) {
@@ -34,7 +35,7 @@ export default function useEditManifestForm(initialManifest?: Manifest, show?: b
3435
const handleManifestChange = createFormChangeHandler(setFormManifest);
3536

3637

37-
const BASE_URL = 'http://localhost:8081';
38+
const { BASE_URL } = useMarketplaceApiRepo();
3839

3940

4041
const [scopes, setScopes] = useState<string[]>([]);

dv-marketplace/src/components/pages/AppIndex.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import UserContextProvider from "../context/UserContextProvider";
33
import ErrorView from "../UI/ErrorView";
44
import { Outlet } from "react-router-dom";
55
import Navigation from '../UI/Navigation/NavigationBar';
6-
import AppMessageDialog from "../UI/AppMessageDialog";
76

87
function ErrorFallback({ error, resetErrorBoundary }: { error: Error; resetErrorBoundary: () => void }) {
98
return <ErrorView error={error} resetErrorBoundary={resetErrorBoundary} />;
@@ -21,7 +20,6 @@ const AppIndex = () => {
2120
<ErrorBoundary FallbackComponent={ErrorFallback}>
2221
<Outlet />
2322
</ErrorBoundary>
24-
<AppMessageDialog />
2523
</UserContextProvider>
2624
</ErrorBoundary>
2725
);

dv-marketplace/src/components/pages/ViewExternalTool.tsx

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import axios from "axios";
33
import type { ExternalTool, Manifest,Image } from "../../types/MarketplaceTypes";
44
import { Alert } from "react-bootstrap";
55
import { InnerCardDeck } from "../UI/CardDeck";
6-
import { RowCard, MarketplaceCard } from "../UI/MarketplaceCard";
6+
import { RowCard, MarketplaceCard, BaseCard } from "../UI/MarketplaceCard";
77
import InstallExToolFrame from "./InstallExToolFrame";
88
import useViewExternalTool from "./useViewExternalTool";
99
import { useEffect } from "react";
@@ -39,34 +39,42 @@ const ViewExternalTool = () => {
3939

4040
return (
4141
<div className="container" style={{ marginTop: "120px" }}>
42-
43-
44-
<Alert variant='light'>
45-
<div className='container '>
46-
<div className='row'>
47-
<h1 className='col-6'>{tool?.name}:</h1>
48-
<div className='col-6 d-flex justify-content-end align-items-center'>
49-
{userContext.user &&
42+
43+
{userContext.user &&
5044
( userContext.user.roles.includes("ADMIN") || tool?.ownerId == userContext.user.id) &&
51-
<Link to ={`/edit/${id}`} className="btn btn-secondary bi-pen" > Edit</Link>
52-
}
45+
<Alert variant='light' className="d-flex justify-content-end">
46+
<Link to ={`/edit/${id}`} className="btn btn-secondary bi-pen" > Edit</Link>
47+
</Alert>
48+
}
49+
50+
<div className="container-fluid" style={{display: 'flex', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'left'}}>
51+
<div className='row col-12'>
52+
<div className='col-3'>
53+
<BaseCard
54+
header={tool?.name}
55+
imageId={tool?.images[0]?.imageId}
56+
/>
57+
</div>
58+
<p className="col-9 mb-2 py-10" style={{padding: '10px'}}>
59+
{tool?.description}
60+
</p>
5361
</div>
5462
</div>
55-
</div>
56-
</Alert>
57-
63+
5864
<div>
5965
<p className='col-12 d-flex '>
60-
{tool?.description}
66+
6167
</p>
6268
</div>
63-
<Alert variant='light'>
64-
<div className='container '>
69+
{/* <Alert variant='light'> */}
70+
71+
<div className='container'>
72+
<hr />
6573
<div className='row'>
66-
<h3 className='col-6'>Releases:</h3>
74+
<h3 className='col-6'>Releases</h3>
6775
</div>
6876
</div>
69-
</Alert>
77+
{/* </Alert> */}
7078

7179
<InnerCardDeck>
7280
{tool?.versions.map((version) => (
@@ -114,15 +122,15 @@ const ViewExternalTool = () => {
114122

115123
<br />
116124

117-
<Alert variant='light'>
118125
<div className='container '>
126+
<hr />
119127
<div className='row'>
120-
<h3 className='col-6'>Images:</h3>
128+
<h3 className='col-6'>Images</h3>
121129
<div className='col-6 d-flex justify-content-end align-items-center'>
122130
</div>
123131
</div>
132+
124133
</div>
125-
</Alert>
126134
<InnerCardDeck>
127135

128136
{tool?.images.map((image: Image) => (

dv-marketplace/src/repositories/useMarketplaceApiRepo.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import axios from "axios";
44
import { toast } from "react-toastify";
55

66
const BASE_URL = 'http://localhost:8081';
7+
// Change this for deployment
8+
// const BASE_URL = '';
79

810
export default function useMarketplaceApiRepo() {
911

1012
const userContext = useContext(UserContext);
11-
// Change this for deployment
12-
// const BASE_URL = '';
13+
1314

1415
const jwtToken = userContext.user ? userContext.user.accessToken : '';
1516

dv-marketplace/src/types/MarketplaceTypes.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ export type UserContextType = {
6666
user: User | null;
6767
setUser: (user: User | null) => void;
6868
showLogin: boolean;
69-
setShowLogin: (show: boolean) => void;
70-
showMessage: boolean;
71-
setShowMessage: (show: boolean) => void;
72-
modalMessage: string;
73-
setModalMessage: (message: string) => void;
74-
modalTitle: string;
75-
setModalTitle: (title: string) => void;
69+
setShowLogin: (show: boolean) => void;
7670
theme: Theme;
7771
setTheme: (theme: Theme) => void;
7872
};

0 commit comments

Comments
 (0)