Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #12

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open

Dev #12

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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ dmypy.json
.dccache

# image upload folder
uploads
uploads*

# .rest files
*.rest
Expand Down
15 changes: 12 additions & 3 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
"njpwerner.autodocstring",
"batisteo.vscode-django",
"ryanluker.vscode-coverage-gutters",
"octref.vetur",
"vuetifyjs.vuetify-vscode",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"mikestead.dotenv",
"oouo-diogo-perdigao.docthis",
"prograhammer.tslint-vue"
"prograhammer.tslint-vue",
"ms-python.python",
"donjayamanne.python-extension-pack",
"ms-azuretools.vscode-docker",
"hookyqr.beautify",
"ms-vscode.vscode-typescript-next",
"esbenp.prettier-vscode",
"rvest.vs-code-prettier-eslint",
"himanoa.python-autopep8",
"visualstudioexptteam.vscodeintellicode",
"jcbuisson.vue",
"peakchen90.vue-beautify"
]
}
1 change: 0 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ COPY . .
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
# VOLUME ["/app"]

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
# CMD ["gunicorn", "--bind", "0.0.0.0:8000", "config.wsgi"]
Expand Down
5 changes: 2 additions & 3 deletions backend/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ RUN apt-get update -y \


# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
COPY requirements-dev.txt .
RUN python -m pip install -r requirements-dev.txt

WORKDIR /app
COPY docker-entrypoint.sh docker-entrypoint.sh
COPY . .

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

2 changes: 2 additions & 0 deletions backend/cables/fixtures/cables.xml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions backend/commons/tests/tests_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ def createTestUser(username, password, *perm_codename):


def logTestUser(username, password):
"""Method to log user with given username and password.

Args:
username ([String]): user name
password ([String]): password

Returns:
[APIClient]: a client to be used for tests, authentified with given username, password
"""
client = APIClient()

resp = client.post(
Expand Down
2 changes: 0 additions & 2 deletions backend/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ done

echo "PostgreSQL started"

# PGPASSWORD=djangoproject psql --host db --port 5432 --username=code.djangoproject --dbname=code.djangoproject < tracdb/trac.sql
python manage.py migrate
# python manage.py collectstatic --no-input --clear
python manage.py loaddata ./commons/fixtures/*.xml
python manage.py loaddata ./map_layers/fixtures/base_layers.xml

Expand Down
2 changes: 2 additions & 0 deletions backend/media/fixtures/media.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0"><object model="media.media" pk="1"><field name="timestamp_create" type="DateTimeField">2022-03-27T16:07:03.148831+00:00</field><field name="timestamp_update" type="DateTimeField">2022-03-27T16:07:03.148845+00:00</field><field name="created_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="updated_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="storage" type="FileField">uploads/P1110721_-_Copie.JPG</field><field name="date" type="DateField">2022-01-01</field><field name="author" type="CharField">Bob</field><field name="source" type="CharField">LPO</field><field name="remark" type="TextField">Nothing to report</field></object><object model="media.media" pk="2"><field name="timestamp_create" type="DateTimeField">2022-03-27T16:08:47.459603+00:00</field><field name="timestamp_update" type="DateTimeField">2022-03-27T16:08:47.459618+00:00</field><field name="created_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="updated_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="storage" type="FileField">uploads/DSC03009_-_Copie.JPG</field><field name="date" type="DateField">2022-01-01</field><field name="author" type="CharField">Bob</field><field name="source" type="CharField">LPO</field><field name="remark" type="TextField">Nothing to report</field></object><object model="media.media" pk="3"><field name="timestamp_create" type="DateTimeField">2022-03-27T16:13:29.801541+00:00</field><field name="timestamp_update" type="DateTimeField">2022-03-27T16:13:29.801555+00:00</field><field name="created_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="updated_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="storage" type="FileField">uploads/IMG_3644.JPG</field><field name="date" type="DateField">2022-01-01</field><field name="author" type="CharField">Bob</field><field name="source" type="CharField">LPO</field><field name="remark" type="TextField">Nothing to report</field></object><object model="media.media" pk="4"><field name="timestamp_create" type="DateTimeField">2022-03-27T16:15:55.992083+00:00</field><field name="timestamp_update" type="DateTimeField">2022-03-27T16:15:55.992172+00:00</field><field name="created_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="updated_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="storage" type="FileField">uploads/DSC03009_-_Copie_bj3IBMo.JPG</field><field name="date" type="DateField">2022-01-01</field><field name="author" type="CharField">Bob</field><field name="source" type="CharField">LPO</field><field name="remark" type="TextField">Nothing to report</field></object></django-objects>
2 changes: 2 additions & 0 deletions backend/sensitive_area/fixtures/sensitiveareas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0"><object model="sensitive_area.sensitivearea" pk="1"><field name="timestamp_create" type="DateTimeField">2022-03-22T10:57:48.401137+00:00</field><field name="timestamp_update" type="DateTimeField">2022-03-22T10:57:48.401153+00:00</field><field name="created_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="updated_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="uuid" type="UUIDField">6e14cc06-4dbe-4e1b-9e44-92aaf11f304b</field><field name="name" type="CharField">Zone Sensible 1</field><field name="code" type="CharField">ZS-1</field><field name="geom" type="PolygonField">SRID=4326;POLYGON ((4.702148437499999 45.09873027414908, 4.696655273437499 45.00947686967287, 4.987792968749998 44.97451370563982, 5.155334472656249 45.03083274759957, 4.916381835937498 45.09679146394737, 4.702148437499999 45.09873027414908))</field></object><object model="sensitive_area.sensitivearea" pk="2"><field name="timestamp_create" type="DateTimeField">2022-03-22T11:13:56.347805+00:00</field><field name="timestamp_update" type="DateTimeField">2022-03-22T11:13:56.347834+00:00</field><field name="created_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="updated_by" rel="ManyToOneRel" to="users.user"><None></None></field><field name="uuid" type="UUIDField">980470ea-d8a2-45fb-86ee-63519ee3f349</field><field name="name" type="CharField">Zone Sensible 2</field><field name="code" type="CharField">ZS-2</field><field name="geom" type="PolygonField">SRID=4326;POLYGON ((4.518127441406248 45.42737117898908, 4.545593261718748 45.37916094640916, 4.627990722656249 45.39555704145535, 4.590911865234374 45.41966030640987, 4.518127441406248 45.42737117898908))</field></object></django-objects>
15 changes: 2 additions & 13 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ services:
- 8000:8000
volumes:
- ./backend:/app
command:
[
"python",
"-m",
"manage",
"runserver",
"0.0.0.0:8000"
]
command: ["python", "-m", "manage", "runserver", "0.0.0.0:8000"]

frontend:
image: frontend
Expand All @@ -43,8 +36,4 @@ services:
- 3000:3000
volumes:
- ./frontend:/app
command: [ "npm", "run", "dev" ]

# Volumes used for persistent data
volumes:
ocb_db_data:
command: ["npm", "run", "dev"]
11 changes: 5 additions & 6 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ services:
networks:
- cablesv2_net


frontend:
ports:
- 10.0.3.1:9011:80
- 80:80
volumes:
- backend_static:/usr/share/nginx/html/static
networks:
- front
# - front
- cablesv2_net

volumes:
backend_static:

networks:
front:
external: true
# front:
# external: true
cablesv2_net:
driver: bridge

4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ services:
dockerfile: ./Dockerfile
env_file:
- .env
# ports:
# - 8000:8000


frontend:
Expand All @@ -21,5 +19,3 @@ services:
- .env
environment:
NODE_ENV: production
# ports:
# - 80:80
31 changes: 1 addition & 30 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
# FROM node:lts-alpine
# ENV NODE_ENV=production
# WORKDIR /usr/src/app
# COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
# RUN npm install --production --silent && mv node_modules ../
# COPY . .
# EXPOSE 3000
# RUN chown -R node /usr/src/app
# USER node
# RUN npm run build
# CMD ["npm", "start"]

## Build
FROM node:lts-alpine as builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install -g npm@latest & npm install
RUN npm install
COPY . ./
RUN npm run build

# ## Prod
# FROM node:alpine
# # RUN apk update && apk upgrade && \
# # apk add --no-cache git
# WORKDIR /app
# COPY package.json ./
# # ENV NODE_ENV=production
# RUN npm install --production
# COPY nuxt.config.js ./
# COPY --from=builder /app/.nuxt ./.nuxt/
# COPY --from=builder /app/static ./static/
# COPY --from=builder /app/content ./content/
# EXPOSE 3000
# ENV NUXT_HOST=0.0.0.0
# ENTRYPOINT [ "npm", "run" ]
# CMD [ "start" ]

FROM nginx:mainline-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY default.conf /etc/nginx/conf.d/default.conf
2 changes: 0 additions & 2 deletions frontend/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ COPY . ./
RUN npm run build

EXPOSE 3000

# VOLUME ["/app"]
38 changes: 20 additions & 18 deletions frontend/components/data/diagnosisCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
<v-spacer></v-spacer>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-btn icon @click="newDiag">
<v-btn icon v-bind="attrs" v-on="on" @click="newDiag">
<v-icon v-if="diagnosis.last" color="green"
>mdi-eye-plus-outline</v-icon
>
</v-btn>
</template>
<span>Ajouter un dignostic</span>
<span>Ajouter un diagnostic</span>
</v-tooltip>
<v-btn icon @click="updateDiag">
<v-icon color="orange">mdi-pencil</v-icon>
</v-btn>
</v-card-title>
<v-card-subtitle>
{{ $t('diagnosis.last-one') }}{{ diagnosis.date }}</v-card-subtitle
{{ $t('diagnosis.last-one') }}{{ diagnosis.date }}

<v-chip small :class="[diagnosis.neutralized ? 'success' : 'error']"
>{{ diagnosis.neutralized ? 'neutralisé' : 'à neutraliser' }}
</v-chip></v-card-subtitle
>

<v-card-text>
Expand Down Expand Up @@ -77,9 +81,7 @@
<!-- <v-col>date: {{ pictDate }}</v-col> -->
<v-col></v-col>
<v-col cols="1">
<v-icon small color="red" @click="notImplementedYet"
>mdi-trash-can</v-icon
>
<v-icon small color="red">mdi-trash-can</v-icon>
</v-col>
</v-row>
</v-list-item>
Expand All @@ -88,7 +90,7 @@
</v-card>
</template>

<script lang="ts">
<script >
import Vue from 'vue'

export default Vue.extend({
Expand All @@ -104,21 +106,21 @@ export default Vue.extend({
},
}
},
mounted() {
console.log('diagnosis', this.diagnosis)
},
// mounted() {
// // console.log('diagnosis', this.diagnosis)
// },
methods: {
newDiag() {
this.$router.push({
path: `/supports/${this.diagnosis.infrastructure}/diagnosis/${this.diagnosis.id}`,
query: { modifyDiag: 'false' },
})
this.$router.push(
// `/supports/${this.diagnosis.infrastructure}/new_diag/${this.diagnosis.id}`
{
path: `/diagnosis/new`,
query: { OriginDiagId: this.diagnosis.id },
}
)
},
updateDiag() {
this.$router.push({
path: `/supports/${this.diagnosis.infrastructure}/diagnosis/${this.diagnosis.id}`,
query: { modifyDiag: 'true' },
})
this.$router.push(`/diagnosis/${this.diagnosis.id}/update`)
},
notImplementedYet() {
return null
Expand Down
6 changes: 5 additions & 1 deletion frontend/components/data/supportDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
<v-card class="my-2">
<v-card-title
>Info Support <v-spacer></v-spacer>
<v-btn icon @click="$router.push('/view')">
<!-- <v-btn icon @click="$router.push('/view')"> -->
<v-btn
icon
@click="$router.push(`/supports/${data.properties.id}/update`)"
>
<v-icon color="orange">mdi-pencil</v-icon>
</v-btn></v-card-title
>
Expand Down
5 changes: 0 additions & 5 deletions frontend/components/displayComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ export default {
width: 100px;
background-color: 'indigo';
}

/*
.v-btn {
width: 80px;
} */
</style>
1 change: 0 additions & 1 deletion frontend/components/form/mortality.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
/>
</v-col>
<v-col cols="12" md="6">
{{ mortalityData.death_cause_id }}
<v-select
v-model="mortalityData.death_cause_id"
:items="deathCause"
Expand Down
Loading