Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .envs/.local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ IPYTHONDIR=/app/.ipython
DJANGO_DEBUG=True
DJANGO_UWSGI_WORKER_PROCESSES=4
DJANGO_UWSGI_WORKER_THREADS=2
DATABASE_URL=postgres://debug:debug@postgres:5432/target
DATABASE_MYDB_URL=postgres://user_dridev:278e41447c72@host.docker.internal:3307/prod_gavo
DATABASE_URL=postgres://debug:debug@postgres-14:5432/target
DATABASE_MYDB_URL=postgres://<user>:<password>@host.docker.internal:3308/catalogsdb
MYDB_SCHEMA_PREFIX=mydb_
# Redis
# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion .envs/.local/.postgres
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
# POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=target
POSTGRES_USER=debug
Expand Down
10 changes: 10 additions & 0 deletions backend/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,23 @@
"SCHEMA_PATH_PREFIX": "/api/",
}

# ------------------------------------------------------------------------------
# LINEA Settings
# ------------------------------------------------------------------------------
APPLICATION_NAME = env("APPLICATION_NAME", default="Target")
APPLICATION_TITLE = env("APPLICATION_TITLE", default="Target Viewer")
# LINEA MYDB
# ------------------------------------------------------------------------------
USER_SCHEMA_PREFIX = env("MYDB_SCHEMA_PREFIX", default="mydb_")
MYDB_QUOTA_MB = env.int("MYDB_QUOTA_MB", default=10240) # 10 GB

# LINEA Canvas
# ------------------------------------------------------------------------------
# Define se a funcionalidade de visualização de clusters está habilitada ou não.
# Diferencia entre target e canvas.
ENABLE_CLUSTER = env.bool("ENABLE_CLUSTER", default=False)


ENVIRONMENT_NAME = env("ENVIRONMENT_NAME", default="development").lower()

# Complete URL of the production server with protocol and port
Expand Down
5 changes: 5 additions & 0 deletions backend/target/common/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ def environment_settings(request):

login_url = settings.LOGIN_URL

enable_cluster = bool(settings.ENABLE_CLUSTER)

env_settings = {
"environment": enviroment,
"base_host": settings.BASE_HOST,
"login_url": login_url,
"is_dev": is_dev,
"enable_cluster": enable_cluster,
"application_name": settings.APPLICATION_NAME,
"application_title": settings.APPLICATION_TITLE,
"version": "1.0.0",
"build": "12345",
}
Expand Down
1 change: 1 addition & 0 deletions compose/local/postgresql_14/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM postgres:14.3-alpine
1 change: 1 addition & 0 deletions compose/local/postgresql_18/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM postgres:18.1-alpine
114 changes: 114 additions & 0 deletions docker-compose.canvas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
services:
backend: &django
build:
context: .
dockerfile: ./compose/local/django/Dockerfile
depends_on:
- postgres-14
volumes:
- ..:/workspaces
- ./backend/:/app:z
- ./logs/:/logs
- ./data/tmp:/data
env_file:
- .envs/.local/.django
- .envs/.local/.postgres
- .env
environment:
- APPLICATION_NAME=Canvas
- APPLICATION_TITLE=Canvas Title
- ENABLE_CLUSTER=True
command: /start
extra_hosts:
- "host.docker.internal:host-gateway"

postgres-14:
build:
context: .
dockerfile: ./compose/local/postgresql_14/Dockerfile
ports:
- "5432:5432"
volumes:
- ./pg_data:/var/lib/postgresql/data
- ./pg_data:/backups
env_file:
- .envs/.local/.postgres

# postgres-18:
# build:
# context: .
# dockerfile: ./compose/local/postgresql_18/Dockerfile
# ports:
# - "5432:5432"
# volumes:
# - ./pg_data_18:/var/lib/postgresql/data
# env_file:
# - .envs/.local/.postgres


# -------------- FOR FUTURE USE --------------
# mailpit:
# image: docker.io/axllent/mailpit:latest
# container_name: target_local_mailpit
# ports:
# - "8025:8025"

# redis:
# image: docker.io/redis:6
# container_name: target_local_redis

# volumes:
# - target_local_redis_data:/data


# celeryworker:
# <<: *django
# image: target_local_celeryworker
# container_name: target_local_celeryworker
# depends_on:
# - redis
# - postgres
# - mailpit
# ports: []
# command: /start-celeryworker

# celerybeat:
# <<: *django
# image: target_local_celerybeat
# container_name: target_local_celerybeat
# depends_on:
# - redis
# - postgres
# - mailpit
# ports: []
# command: /start-celerybeat

# flower:
# <<: *django
# image: target_local_flower
# container_name: target_local_flower
# ports:
# - '5555:5555'
# command: /start-flower

frontend:
image: node:22.12.0-bookworm-slim
user: 1000:1000
working_dir: /app
volumes:
- ./frontend:/app
command: sh -c "yarn && yarn dev"

# Servidor Web NGINX
nginx:
image: nginx:latest
ports:
- 80:80
volumes:
# Arquivo de configuração do Ngnix para este ambiente.
- ./compose/local/nginx/nginx-proxy.conf:/etc/nginx/conf.d/default.conf:ro
# Diretório onde o backend manipula arquivos, e que deve ficar acessivel ao servidor web.
- ./data/tmp:/var/www/data
depends_on:
- backend
- frontend
1 change: 1 addition & 0 deletions env_template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_MYDB_URL=postgres://<user>:<password>@host.docker.internal:3308/catalogsdb
4 changes: 2 additions & 2 deletions frontend/src/app/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const roboto = Roboto({
});

export const metadata = {
title: "TARGET",
description: "TARGET by linea",
title: "LIneA Science Platform",
description: "LIneA Science Platform",
};

export default function RootLayout(props) {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export default function Header() {
>
<MenuIcon />
</IconButton>

<List sx={{ display: { xs: 'none', md: 'flex' } }}>
<ListItem sx={{ width: 'auto', marginRight: 4, fontWeight: 'bold' }} >
{settings?.application_name}
</ListItem>
{navItems.map(item => (
<ListItem key={item.href} sx={{ width: 'auto' }}>
<Link href={item.href} color="inherit" underline="none" target={item.target}>
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/components/TitleManager/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use client";

import { useEffect } from "react";
import { useAuth } from "@/contexts/AuthContext";

export default function TitleManager() {
const { settings } = useAuth();

useEffect(() => {
if (settings?.application_title) {
document.title = settings.application_title;
}
}, [settings]);

return null;
}
3 changes: 2 additions & 1 deletion frontend/src/containers/MainContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CircularProgress from '@mui/material/CircularProgress';
import Header from "@/components/Header";
import { useAuth } from "@/contexts/AuthContext";
import { CatalogProvider } from "@/contexts/CatalogContext";

import TitleManager from "@/components/TitleManager";
import CssBaseline from '@mui/material/CssBaseline';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

Expand All @@ -30,6 +30,7 @@ export default function MainContainer({ children }) {
<React.Fragment>
<CssBaseline />
<Header />
<TitleManager />
<QueryClientProvider client={queryClient}>
<CatalogProvider>
{user && (
Expand Down
19 changes: 10 additions & 9 deletions frontend/src/containers/RegisterCatalog/BasicInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,22 @@ export default function RegisterCatalogBasicInformation() {
<UserTableSelect onChange={onSelectTable} value={catalog.schema && catalog.table ? `${catalog.schema}.${catalog.table}` : ''} />
)}

{catalog.catalog_type === 'cluster' && (
<>
{catalog.related_table && (<TextField label="Table" variant="outlined" fullWidth value={`${catalog.related_table_name}`} disabled />)}
{!catalog.related_table && (<RelatedTableSelect onChange={onSelectRelatedTable} value={catalog.related_table_name ? `${catalog.related_table_name}` : ''} />)}
</>
)}

<TextField
label="Name"
variant="outlined"
fullWidth
name="title"
value={catalog.title}
onChange={handleChange} />
<TextField

{/* <TextField
label="Type"
variant="outlined"
fullWidth
Expand All @@ -99,14 +107,7 @@ export default function RegisterCatalogBasicInformation() {
>
<MenuItem key="target-option" value="target">Target</MenuItem>
<MenuItem key="cluster-option" value="cluster">Cluster</MenuItem>
</TextField>

{catalog.catalog_type === 'cluster' && (
<>
{catalog.related_table && (<TextField label="Table" variant="outlined" fullWidth value={`${catalog.related_table_name}`} disabled />)}
{!catalog.related_table && (<RelatedTableSelect onChange={onSelectRelatedTable} value={catalog.related_table_name ? `${catalog.related_table_name}` : ''} />)}
</>
)}
</TextField> */}

<TextField
label="Description"
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/contexts/RegisterCatalogContext.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { createContext, useEffect, useState, useContext } from 'react'

import { useAuth } from "./AuthContext";

export const RegisterCatalogContext = createContext({})

export const RegisterCatalogProvider = ({ children }) => {

const { settings } = useAuth();

const catalogType = settings?.enable_cluster ? "cluster" : "target";

const emptyCatalog = {
id: undefined,
title: '',
catalog_type: 'target',
catalog_type: catalogType,
schema: '',
table: '',
related_table: '',
Expand Down
Loading