Skip to content

Commit

Permalink
Merge pull request #161 from COS301-SE-2024/develop
Browse files Browse the repository at this point in the history
Develop deployment
  • Loading branch information
Alec-Watson authored Sep 29, 2024
2 parents 6a4da6f + a348061 commit ec037f7
Show file tree
Hide file tree
Showing 36 changed files with 895 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Codebase
on:
pull_request:
branches: [ main ]
branches: [ main , develop]

permissions:
contents: read
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ jobs:
- name: Create Pem Files
run: |
echo ${{ secrets.PUBLIC }} > langchain/public.pem
echo ${{ secrets.PRIVATE }} > langchain/private.pem
echo ${{ secrets.PUBLIC }} > server/public.pem
echo ${{ secrets.PRIVATE }} > server/private.pem
echo ${{ secrets.REFRESH_PUBLIC }} > server/refreshPublic.pem
Expand All @@ -91,11 +89,9 @@ jobs:
docker build -t 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_api:latest ./server
docker build -t 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_client:latest ./CoVAR-app
docker build -t 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_nginx:latest ./nginx
docker build -t 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_langchain:latest ./langchain
docker push 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_api:latest
docker push 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_client:latest
docker push 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_nginx:latest
docker push 211125691345.dkr.ecr.eu-west-2.amazonaws.com/covar_langchain:latest
deploy-containers:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Cypress E2E Tests
on:
pull_request:
branches: [ main ]
branches: [ main , develop]

jobs:
e2e-tests:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Lint Codebase
on:
pull_request:
branches: [ main ]
branches: [ main , develop]

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test Codebase
on:
pull_request:
branches: [ main ]
branches: [ main , develop]

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion CoVAR-app/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
compiler: {
// Remove all console logs
removeConsole: true
}
};

export default nextConfig;
8 changes: 7 additions & 1 deletion CoVAR-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion CoVAR-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
"axios-mock-adapter": "^1.22.0",
"echarts": "^5.5.1",
"firebase": "^10.12.2",
"marked": "^14.1.2",
"i": "^0.3.7",
"marked": "^14.1.2",
"moment": "^2.30.1",
"mui": "^0.0.1",
"next": "14.2.13",
"react": "^18",
"react-dom": "^18",
Expand Down
7 changes: 6 additions & 1 deletion CoVAR-app/src/app/(pages)/adminTools/components/userList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ useEffect(() => {
throw new Error('Access token not found');
}
const users = await fetchUsers(accessToken);

setUsers(users);
setLoading(false);
} catch (error: any) {
Expand Down Expand Up @@ -311,8 +312,12 @@ const handleConfirmUnassignVA = async () => {
};

const filteredUsers = users.filter(user =>
user.username.toLowerCase().includes(searchTerm.toLowerCase()) && user.role !== 'va'
user.username.toLowerCase().includes(searchTerm.toLowerCase()) &&
user.role !== 'va' &&
user.organization == null ||
user.organization == ""
);


const filteredOrganizations = organizations.filter(org =>
org.name.toLowerCase().includes(searchTerm.toLowerCase())
Expand Down
43 changes: 39 additions & 4 deletions CoVAR-app/src/app/(pages)/adminTools/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
'use client'
import React from 'react';
import React, { useEffect, useState } from 'react';
import { Box } from '@mui/material';
import { mainContentStyles } from '../../../styles/sidebarStyle';
import UserList from './components/userList';
import { Loader } from '@/styles/conflictStyle';
import { boxStyles } from '@/styles/evaluateStyle';

const AdminTools: React.FC = () => {
return (
<Box sx={mainContentStyles}>
<UserList />

const [loading, setLoading] = useState(true);


useEffect(() => {
const timer = setTimeout(() => {
setLoading(false);
}, 1000);
return () => clearTimeout(timer);
}, []);


if (loading) {
return (
<Box
sx={{
...boxStyles,
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%',
}}
>
<Loader />
</Box>
);
}

return (
<Box sx={mainContentStyles}>
<UserList />
</Box>
);
};

Expand Down
74 changes: 74 additions & 0 deletions CoVAR-app/src/app/(pages)/dashboard/components/InviteList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
'use client';
import React, { useEffect, useState } from 'react';
import { Paper, Typography, Box, CircularProgress, List, ListItem, ListItemText } from '@mui/material';
import { fetchAllInvites } from '@/functions/requests';

type Invite = {
invite_id: string;
username: string;
organization_name: string;
invite_status: string;
};

const InviteList: React.FC = () => {
const [invites, setInvites] = useState<Invite[]>([]);
const [loading, setLoading] = useState(true);

useEffect(() => {
const loadInvites = async () => {
try {
const token = localStorage.getItem('accessToken');
const allInvites = await fetchAllInvites(token as string);
const pendingInvites = allInvites.filter((invite: Invite) => invite.invite_status === 'pending'); // Filter pending invites
setInvites(pendingInvites);
setLoading(false);
} catch (error) {
console.error('Error fetching invites:', error);
setLoading(false);
}
};

loadInvites();
}, []);

return (
<Box sx={{ padding: 2 }}>
<Typography variant="h6" color="text.primary">Pending Invites</Typography>
{loading ? (
<CircularProgress />
) : invites.length === 0 ? (
<Typography>No pending invites at the moment.</Typography>
) : (
<List
sx={{
maxHeight: '300px', // Adjust maxHeight as needed
overflowY: 'auto', // Enable vertical scroll when needed
'&::-webkit-scrollbar': {
width: '0.2vw',
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: 'gray',
borderRadius: '0.4vw',
},
'&::-webkit-scrollbar-track': {
backgroundColor: 'transparent',
},
scrollbarWidth: 'thin',
scrollbarColor: 'gray transparent',
}}
>
{invites.map((invite) => (
<ListItem key={invite.invite_id}>
<ListItemText
primary={`${invite.username} - ${invite.organization_name}`}
secondary={`Status: ${invite.invite_status}`}
/>
</ListItem>
))}
</List>
)}
</Box>
);
};

export default InviteList;
Loading

0 comments on commit ec037f7

Please sign in to comment.