Skip to content

Commit 6845b32

Browse files
Merge pull request #77 from neo4j-labs/UI-changes-for-cloud-provider-buckets
UI changes for cloud provider buckets
2 parents d0335b7 + 2e888a2 commit 6845b32

File tree

18 files changed

+309
-156
lines changed

18 files changed

+309
-156
lines changed

frontend/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Step 1: Build the React application
2+
FROM node:20 AS build
3+
ENV BACKEND_API_URL = "https://backendtest-dcavk67s4a-uc.a.run.app"
4+
WORKDIR /app
5+
COPY package.json yarn.lock ./
6+
RUN yarn install
7+
COPY . ./
8+
RUN yarn run build
9+
10+
# Step 2: Serve the application using Nginx
11+
FROM nginx:alpine
12+
COPY --from=build /app/dist /usr/share/nginx/html
13+
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
14+
15+
EXPOSE 8080
16+
CMD ["nginx", "-g", "daemon off;"]

frontend/nginx/nginx.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
server {
2+
3+
listen 8080;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
index index.html index.htm;
8+
try_files $uri $uri/ /index.html;
9+
}
10+
11+
error_page 401 403 404 index.html;
12+
13+
location /public {
14+
root /usr/local/var/www;
15+
}
16+
}

frontend/src/App.css

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,62 @@
11
.filetable {
2-
width: calc(-366px + 100dvw) !important;
2+
/* width: calc(-360px + 100dvw); */
33
height: calc(-322px + 100dvh);
4+
border: 1px solid #d1d5db;
5+
}
6+
.fileTableWithExpansion {
7+
width: calc(-400px + 100dvw) !important;
8+
height: calc(-322px + 100dvh);
9+
border: 1px solid #d1d5db;
10+
}
11+
12+
.fileTableWithExpansion .ndl-div-table {
13+
width: max-content !important;
14+
}
15+
.filetable .ndl-div-table {
16+
width: 100% !important;
17+
}
18+
.contentWithExpansion {
19+
width: calc(-360px + 100dvw);
20+
height: calc(100dvh - 60px);
21+
padding: 3;
22+
display: flex;
23+
flex-direction: column;
24+
align-items: center;
25+
gap: 5px;
26+
position: relative;
27+
}
28+
29+
.contentWithNoExpansion {
30+
width: calc(100% - 64px);
31+
height: calc(100dvh - 60px);
32+
padding: 3;
33+
display: flex;
34+
flex-direction: column;
35+
align-items: center;
36+
gap: 5px;
37+
position: relative;
438
}
539

640
.s3Container {
741
display: flex;
842
align-items: center;
943
justify-content: center;
10-
height: 200px;
11-
width: 245px;
44+
height: calc(-388px + 100dvh);
1245
border-radius: 8px;
46+
outline-color: #d1d5db;
1347
}
1448

15-
.s3Container> button > div {
49+
.s3Container > button > div {
1650
display: flex;
1751
flex-direction: column;
1852
align-items: center;
1953
}
2054

2155
.imageBg {
22-
background-image: url("./assets/images/bgImage.svg");
23-
border-radius: 8px;
24-
border-color: rgb(var(--theme-palette-neutral-border-strong));
25-
padding: 4px;
56+
outline-color: #d1d5db;
57+
border-radius: 8px;
58+
}
59+
60+
.ndl-data-grid-root .ndl-data-grid-navigation{
61+
padding-block: 5px !important;
2662
}
4.37 KB
Binary file not shown.

frontend/src/components/Content.tsx

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ import { useEffect, useState } from 'react';
22
import ConnectionModal from './ConnectionModal';
33
import LlmDropdown from './Dropdown';
44
import FileTable from './FileTable';
5-
import { Button, Label, Typography, Flex } from '@neo4j-ndl/react';
5+
import { Button, Typography, Flex, StatusIndicator } from '@neo4j-ndl/react';
66
import { setDriver, disconnect } from '../utils/Driver';
77
import { useCredentials } from '../context/UserCredentials';
88
import { useFileContext } from '../context/UsersFiles';
99
import CustomAlert from './Alert';
1010
import { extractAPI } from '../services/FileAPI';
11+
import { ContentProps } from '../types';
1112

12-
export default function Content() {
13+
const Content: React.FC<ContentProps> = ({ isExpanded }) => {
1314
const [init, setInit] = useState<boolean>(false);
1415
const [openConnection, setOpenConnection] = useState<boolean>(false);
1516
const [connectionStatus, setConnectionStatus] = useState<boolean>(false);
1617
const { setUserCredentials, userCredentials } = useCredentials();
1718
const { filesData, files, setFilesData, setModel, model } = useFileContext();
1819
const [errorMessage, setErrorMessage] = useState<string>('');
1920
const [showAlert, setShowAlert] = useState<boolean>(false);
20-
const [isLoading, setIsLoading] = useState<boolean>(false);
2121

2222
useEffect(() => {
2323
if (!init) {
@@ -135,16 +135,11 @@ export default function Content() {
135135
return curfile;
136136
})
137137
);
138-
setIsLoading(false);
139-
} finally {
140-
setIsLoading(false);
141138
}
142139
}
143140
};
144141

145142
const handleGenerateGraph = () => {
146-
setIsLoading(true);
147-
148143
if (files.length > 0) {
149144
for (let i = 0; i < files.length; i++) {
150145
if (filesData[i].status === 'New') {
@@ -157,37 +152,26 @@ export default function Content() {
157152
const handleClose = () => {
158153
setShowAlert(false);
159154
};
155+
156+
const classNameCheck = isExpanded ? 'contentWithExpansion' : 'contentWithNoExpansion';
160157
return (
161158
<>
162159
<CustomAlert open={showAlert} handleClose={handleClose} alertMessage={errorMessage} />
163-
<div
164-
className='n-bg-palette-neutral-bg-default'
165-
style={{
166-
width: 'calc(-342px + 100dvw)',
167-
height: 'calc(100dvh - 70px)',
168-
padding: 3,
169-
display: 'flex',
170-
flexDirection: 'column',
171-
alignItems: 'center',
172-
gap: '5px',
173-
position: 'relative',
174-
}}
175-
>
160+
<div className={`n-bg-palette-neutral-bg-default ${classNameCheck}`}>
176161
<Flex className='w-full' alignItems='center' justifyContent='space-between' style={{ flexFlow: 'row' }}>
177162
<ConnectionModal
178163
open={openConnection}
179164
setOpenConnection={setOpenConnection}
180165
setConnectionStatus={setConnectionStatus}
181166
/>
182-
<Typography variant='body-medium' style={{ display: 'flex', padding: '20px' }}>
183-
Neo4j connection Status:
184-
<Typography variant='body-medium' style={{ marginLeft: '10px' }}>
185-
{!connectionStatus ? (
186-
<Label color='danger'>Not connected</Label>
187-
) : (
188-
<Label color='success'>Connected</Label>
189-
)}
167+
<Typography
168+
variant='body-medium'
169+
style={{ display: 'flex', padding: '20px', alignItems: 'center', justifyContent: 'center' }}
170+
>
171+
<Typography variant='body-medium'>
172+
{!connectionStatus ? <StatusIndicator type='danger' /> : <StatusIndicator type='success' />}
190173
</Typography>
174+
Neo4j connection
191175
</Typography>
192176
{!connectionStatus ? (
193177
<Button className='mr-2.5' onClick={() => setOpenConnection(true)}>
@@ -199,18 +183,25 @@ export default function Content() {
199183
</Button>
200184
)}
201185
</Flex>
202-
<FileTable></FileTable>
186+
<FileTable isExpanded={isExpanded}></FileTable>
203187
<Flex
204188
className='w-full p-2.5 absolute bottom-4'
205189
justifyContent='space-between'
206190
style={{ flexFlow: 'row', marginTop: '5px' }}
207191
>
208192
<LlmDropdown onSelect={handleDropdownChange} isDisabled={disableCheck} />
209-
<Button loading={isLoading} disabled={disableCheck} onClick={handleGenerateGraph} className='mr-0.5'>
193+
<Button
194+
loading={filesData.some((f) => f.status === 'Processing')}
195+
disabled={disableCheck}
196+
onClick={handleGenerateGraph}
197+
className='mr-0.5'
198+
>
210199
Generate Graph
211200
</Button>
212201
</Flex>
213202
</div>
214203
</>
215204
);
216-
}
205+
};
206+
207+
export default Content;

frontend/src/components/DropZone.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ const DropZone: FunctionComponent = () => {
2323
setIsLoading(false);
2424
if (f.length) {
2525
const defaultValues: CustomFile = {
26-
processing: 'None',
26+
processing: 0,
2727
status: 'None',
2828
NodesCount: 0,
2929
id: uuidv4(),
3030
relationshipCount: 0,
3131
type: 'PDF',
3232
model: model,
33-
fileSource:"local file"
33+
fileSource: 'local file',
3434
};
3535

3636
const copiedFilesData: CustomFile[] = [...filesData];
@@ -56,7 +56,7 @@ const DropZone: FunctionComponent = () => {
5656
relationshipCount: defaultValues.relationshipCount,
5757
processing: defaultValues.processing,
5858
model: defaultValues.model,
59-
fileSource:defaultValues.fileSource
59+
fileSource: defaultValues.fileSource,
6060
});
6161
}
6262
if (fileIndex == -1) {
@@ -110,11 +110,11 @@ const DropZone: FunctionComponent = () => {
110110
})
111111
);
112112
setIsClicked(false);
113-
setIsLoading(false);
114113
}
115114
}
116115
});
117116
setIsClicked(false);
117+
setIsLoading(false);
118118
})
119119
.catch((err) => {
120120
setShowAlert(true);

0 commit comments

Comments
 (0)