From 74fa59a2e1ce316b760b7e06fa6cdb37e16ff83a Mon Sep 17 00:00:00 2001 From: Tykayn Date: Tue, 7 Oct 2025 14:45:16 +0200 Subject: [PATCH] up testing api page --- .../buttons/main-button/main-button.scss | 2 +- sae-csc/deployment/Dockerfile | 83 +++++++++++++++++++ .../app/pages/testing-api/testing-api.html | 38 +++++++-- .../app/pages/testing-api/testing-api.scss | 4 + .../src/app/pages/testing-api/testing-api.ts | 57 +++++++++++++ 5 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 sae-csc/deployment/Dockerfile diff --git a/my-workspace/projects/sae-lib/buttons/main-button/main-button.scss b/my-workspace/projects/sae-lib/buttons/main-button/main-button.scss index f89a83a..370e648 100644 --- a/my-workspace/projects/sae-lib/buttons/main-button/main-button.scss +++ b/my-workspace/projects/sae-lib/buttons/main-button/main-button.scss @@ -95,7 +95,7 @@ } &:focus { - border: 3px solid var(--Colors-Principal-100, #96BEE4); + outline: 3px solid var(--Colors-Principal-100, #96BEE4); background: var(--Gradient, linear-gradient(77deg, #073A7C -4.23%, #1767AD 51.8%, #255B8E 87.72%)); } diff --git a/sae-csc/deployment/Dockerfile b/sae-csc/deployment/Dockerfile new file mode 100644 index 0000000..123c401 --- /dev/null +++ b/sae-csc/deployment/Dockerfile @@ -0,0 +1,83 @@ +# servir une application angular buildée + +# qui utilise la lib sae Aero + +# - relier la lib my_workspace + +# - build de l'app angular + +# - servir le build + +# Use official Node.js LTS image + +FROM node:24-alpine AS build + +# Set working directory + +WORKDIR /usr/src/app + +# Create a non-root user + +RUN addgroup -S appgroup && adduser -S appuser -G appgroup + +# Copy package.json and package-lock.json as root and install dependencies + +COPY package*.json ./ + +# Copy app source and fix ownership + +COPY . . + +RUN chown -R appuser:appgroup /usr/src/app + +RUN pwd + +RUN cd /usr/src/app/my-workspace/projects/sae-lib + +RUN npm link + +# Switch to non-root user + +USER appuser + +RUN pwd + +RUN cd ../../../../../ + +RUN npm link sae-lib + +RUN npm install + +RUN npm run build + +RUN echo "building done" + +# Add healthcheck (tries every 30s, times out after 10s, fails after 3 retries) + +# HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ + +# CMD wget -qO- http://localhost:8080/ || exit 1 + +# ============================ + +# 🚀 Stage 2 — Serve with NGINX + +# ============================ + +FROM nginx:1.29-alpine AS serve + +# Remove default NGINX website + +RUN rm -rf /usr/share/nginx/html/* + +# Copy built Angular app from previous stage + +COPY --from=build /app/dist/implem /usr/share/nginx/html + +# Expose port 80 + +EXPOSE 80 + +# Start NGINX + +CMD ["nginx", "-g", "daemon off;"] diff --git a/sae-csc/src/app/pages/testing-api/testing-api.html b/sae-csc/src/app/pages/testing-api/testing-api.html index b720f98..dec0ea1 100644 --- a/sae-csc/src/app/pages/testing-api/testing-api.html +++ b/sae-csc/src/app/pages/testing-api/testing-api.html @@ -4,7 +4,7 @@
- /app/summarize_questions + + + backend: + + + + + + + + + + + + + + + + + + + + + + + +
@@ -35,14 +61,14 @@
-
+

Post /api/v1/messages

entrez votre message: -
+
-
+
@@ -78,7 +104,7 @@

Envoi de fichier

- + response.json()) + .then(data => { + console.log(data); + this.response = JSON.stringify(data); + } + ) + .catch(error => console.error('Error:', error)); + } + getKeywordFromEmail() { + console.log('getKeywordFromEmail TODO') + fetch(`http://${this.backend}/app/get_keyword_from_email`, { + method: "POST", + mode: "cors", + body: JSON.stringify({ + email: "test@test.com" + }), + headers: defaultHeaders + }) + .then(response => response.json()) + .then(data => { + console.log(data); + this.response = JSON.stringify(data); + } + ) + .catch(error => console.error('Error:', error)); + } + esmDetect() { + console.log('esmDetect TODO') + } + hardwareDetect() { + console.log('hardwareDetect TODO') + } + esmContentAnalyse() { + console.log('esmContentAnalyse TODO') + } + aiFilter() { + console.log('aiFilter TODO') + } + searchEngine() { + console.log('searchEngine TODO') + } + querySimple() { + console.log('querySimple TODO') + } + dicaDetect() { + console.log('dicaDetect TODO') + } }