Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#Django Config Variables
PYTHONUNBUFFERED=True
DJANGO_DEBUG=True

# Django DB_Engine Config
# Make sure settings correspond MYSQL or POSTGRES Config
SQL_ENGINE=django.db.backends.postgresql
SQL_PORT=5432
SQL_HOST=db

SQL_DATABASE=esimcloud_db
SQL_USER=user
SQL_PASSWORD=password


#POSTGRES Config ( Only if Postgres is being used as a backend )
# Make sure SQL_ENGINE is set to django.db.backends.postgresql
# SQL_PORT is set to 5432

POSTGRES_DB=esimcloud_db
POSTGRES_USER=user
POSTGRES_PASSWORD=password


# MYSQL Config
# Make sure SQL_ENGINE is set to django.db.backends.mysql
# SQL_PORT is set to 3306

MYSQL_DATABASE=esimcloud_db
MYSQL_USER=user
MYSQL_PASSWORD=password
MYSQL_ROOT_PASSWORD=password

#Docker Image Version Tags
TAG_MYSQL=8.0
TAG_REDIS=alpine3.11

#Production Config
GUNICORN_WORKERS=5
CELERY_WORKERS=5
EDA_PUBLIC_URL=http://localhost/eda
ARDUINO_BASE_HREF=/arduino/

# Authentication
POST_ACTIVATE_REDIRECT_URL=http://localhost/
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=yourkeyhere
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=yoursecrethere
GOOGLE_OAUTH_REDIRECT_URI=http://localhost/api/auth/google-callback

# Email Service
EMAIL_HOST=smtp.gmail.com
EMAIL_HOST_USER=youremail@gmail.com
EMAIL_HOST_PASSWORD=yourpassword
EMAIL_PORT=587
EMAIL_USE_TLS=True

# AI Chatbot Configuration
GEMINI_API_KEY=
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ redis_data/
mysql_data/
.vscode
venv
env

*.sqlite3
.env.prod
mongo_data/
Expand Down
6 changes: 3 additions & 3 deletions ArduinoFrontend/package-lock.json

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

57 changes: 29 additions & 28 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
version: '3'

services:

nginx:
image: nginx
ports:
- 80:80
volumes:
- tmp_vol:/tmp
- ./Nginx/dev.conf.d:/etc/nginx/conf.d
- ./Nginx/static_pages:/usr/share/nginx/static_pages
- ./esim-cloud-backend/static:/usr/share/nginx/django_static
- ./esim-cloud-backend/file_storage:/usr/share/nginx/django_file_storage
- ./esim-cloud-backend/kicad-symbols/:/usr/share/nginx/kicad-libs
- tmp_vol:/tmp:z
- ./Nginx/dev.conf.d:/etc/nginx/conf.d:z
- ./Nginx/static_pages:/usr/share/nginx/static_pages:z
- ./esim-cloud-backend/static:/usr/share/nginx/django_static:z
- ./esim-cloud-backend/file_storage:/usr/share/nginx/django_file_storage:z
- ./esim-cloud-backend/kicad-symbols/:/usr/share/nginx/kicad-libs:z
depends_on:
- django
- eda-frontend
Expand All @@ -26,7 +27,7 @@ services:
ports:
- "3000:3000"
volumes:
- ./eda-frontend:/code
- ./eda-frontend:/code:z
environment:
- NODE_ENV=development
- "PUBLIC_URL=${EDA_PUBLIC_URL}"
Expand All @@ -48,7 +49,7 @@ services:
- "4200:4200"

volumes:
- ./ArduinoFrontend:/code
- ./ArduinoFrontend:/code:z
environment:
- NODE_ENV=development
depends_on:
Expand All @@ -64,48 +65,48 @@ services:
ports:
- "8000:8000"
volumes:
- ./esim-cloud-backend:/code
- ./esim-cloud-backend:/code:z
- run_vol:/var/run
- cache_vol:/var/cache
- tmp_vol:/tmp
depends_on:
- redis
- db
- celery
- redis
- db
- celery

env_file:
- .env

links:
- "redis:redis_cache"
- "db:mysql"
- "redis:redis_cache"
- "db:mysql"

celery:
image: "docker.pkg.github.com/frg-fossee/esim-cloud/celery:dev"
build: ./esim-cloud-backend/
command: celery -A esimCloud.celery worker -l info --concurrency=1
links:
- "redis:redis_cache"
- "db:postgres"
- "redis:redis_cache"
- "db:postgres"
env_file:
- .env
- .env

volumes:
- ./esim-cloud-backend:/code
- ./esim-cloud-backend:/code:z
- run_vol:/var/run
- cache_vol:/var/cache
- tmp_vol:/tmp
depends_on:
- redis
- db
- redis
- db

redis:
image: "redis:${TAG_REDIS}"
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
volumes:
- ./redis_data:/data
image: "redis:${TAG_REDIS}"
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
volumes:
- ./redis_data:/data:z

# Uncomment this and Change appropriate env variables to switch to mysql
# db:
Expand All @@ -117,9 +118,9 @@ services:
# - ./mysql_data:/var/lib/mysql

db:
image: postgres:15
image: postgres:13
volumes:
- ./postgres_data:/var/lib/postgresql/data/
- ./postgres_data:/var/lib/postgresql/data/:z
env_file:
- .env

Expand Down
95 changes: 69 additions & 26 deletions eda-frontend/src/components/Dashboard/CircuitCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import StarBorderIcon from '@material-ui/icons/StarBorder'
import OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser'
import { Link as RouterLink } from 'react-router-dom'
import { useDispatch, useSelector } from 'react-redux'
import { deleteSchematic, togglePinSave } from '../../redux/actions/index'
import { deleteSchematic, togglePinSave, removeFromProject } from '../../redux/actions/index'

// ── Styles ────────────────────────────────────────────────────────────────────
const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -124,7 +124,7 @@ function timeSince (jsonDate) {
}

// ── Component ─────────────────────────────────────────────────────────────────
export default function CircuitCard ({ sch, onRefresh }) {
export default function CircuitCard ({ sch, onRefresh, inProjectFolder = false }) {
const classes = useStyles()
const dispatch = useDispatch()
const auth = useSelector(state => state.authReducer)
Expand Down Expand Up @@ -164,6 +164,18 @@ export default function CircuitCard ({ sch, onRefresh }) {
}
}

const handleRemoveFromProject = () => {
if (!hasToken()) {
setSnackOpen(true)
return
}
if (window.confirm(`Remove "${sch.name || sch.save_id}" from project?`)) {
Promise.resolve(dispatch(removeFromProject(sch.save_id)))
.then(() => { if (onRefresh) onRefresh() })
.catch((err) => console.error(err))
}
}

// ── Render ────────────────────────────────────────────────────────────────
return (
<Card className={classes.card} variant='outlined'>
Expand Down Expand Up @@ -232,31 +244,62 @@ export default function CircuitCard ({ sch, onRefresh }) {
</Button>
</Tooltip>

{/* Pin / Unpin */}
<Tooltip title={isPinned ? 'Unpin from top' : 'Pin to top'} arrow>
<Button
size='small'
variant='outlined'
color={isPinned ? 'primary' : 'default'}
startIcon={isPinned ? <StarIcon /> : <StarBorderIcon />}
onClick={handlePin}
>
{isPinned ? 'Unpin' : 'Pin'}
</Button>
</Tooltip>
{inProjectFolder ? (
<>
{/* Remove from Project */}
<Tooltip title='Remove from project' arrow>
<Button
size='small'
variant='outlined'
color='default'
onClick={handleRemoveFromProject}
>
Remove
</Button>
</Tooltip>

{/* Delete */}
<Tooltip title='Delete circuit' arrow>
<Button
className={classes.deleteBtn}
size='small'
variant='outlined'
startIcon={<DeleteIcon />}
onClick={handleDelete}
>
Delete
</Button>
</Tooltip>
{/* Delete */}
<Tooltip title='Delete circuit' arrow>
<Button
className={classes.deleteBtn}
size='small'
variant='outlined'
startIcon={<DeleteIcon />}
onClick={handleDelete}
>
Delete
</Button>
</Tooltip>
</>
) : (
<>
{/* Pin / Unpin */}
<Tooltip title={isPinned ? 'Unpin from top' : 'Pin to top'} arrow>
<Button
size='small'
variant='outlined'
color={isPinned ? 'primary' : 'default'}
startIcon={isPinned ? <StarIcon /> : <StarBorderIcon />}
onClick={handlePin}
>
{isPinned ? 'Unpin' : 'Pin'}
</Button>
</Tooltip>

{/* Delete */}
<Tooltip title='Delete circuit' arrow>
<Button
className={classes.deleteBtn}
size='small'
variant='outlined'
startIcon={<DeleteIcon />}
onClick={handleDelete}
>
Delete
</Button>
</Tooltip>
</>
)}

</CardActions>

Expand Down
Loading