From d1e47d994e1b0320363c86e6cf630d4419c32625 Mon Sep 17 00:00:00 2001
From: Pierre Ferreira
Date: Mon, 20 Nov 2023 08:17:32 +0100
Subject: [PATCH] ajout de la nouvelle ci :construction_worker:
---
.drone.yml | 32 +++++++++++++++++++
.../src/Components/GraphContainer.tsx | 23 +++++++++++++
2 files changed, 55 insertions(+)
create mode 100644 .drone.yml
diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..8779f51
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,32 @@
+kind: pipeline
+type: docker
+name: default
+
+steps:
+
+ - name: build
+ image: node:20 #voir pour changer la version ?
+ commands:
+ - cd cryptide_project
+ - npm install --legacy-peer-deps
+ - CI=false npm run build
+
+ - name: sonar-analyses
+ image: node:20
+ commands:
+ - cd ./cryptide_project
+ - npm install --legacy-peer-deps
+ - npm run test
+ - ls ./test/coverage
+ - sonar-scanner -Dsonar.projectKey=Learnihon -Dsonar.sources=. -Dsonar.host.url=$${PLUGIN_SONAR_HOST}
+ -Dsonar.login=$${PLUGIN_SONAR_TOKEN} -Dsonar.javascript.lcov.reportPaths=./test/coverage/lcov.info
+ -Dsonar.exclusions=**/lcov-report/**
+ secrets: [ SECRET_SONAR_LOGIN_CRYPTIDE ]
+ settings:
+ sonar_host: https://codefirst.iut.uca.fr/sonar/
+ sonar_token:
+ from_secret: SECRET_SONAR_LOGIN_CRYPTIDE
+ when:
+ event:
+ - push
+ - push_request
\ No newline at end of file
diff --git a/cryptide_project/src/Components/GraphContainer.tsx b/cryptide_project/src/Components/GraphContainer.tsx
index 797c788..22b33ea 100644
--- a/cryptide_project/src/Components/GraphContainer.tsx
+++ b/cryptide_project/src/Components/GraphContainer.tsx
@@ -65,6 +65,19 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS
}
}
}
+
+ //* fonction qui reinitialise le graphe
+ const resGraph = () => { //? comment accéder au nework ??
+ const savedGraphStateString = localStorage.getItem('graphState');
+ if (savedGraphStateString !== null) {
+ const savedGraphState = JSON.parse(savedGraphStateString);
+ //network.setData(savedGraphState);
+ } else {
+ // La clé 'graphState' n'existe pas dans le localStorage, prenez une action en conséquence.
+ console.log("ayoooooo");
+ }
+
+ };
useEffect(() => {
if (personNetwork == null){
@@ -72,6 +85,13 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS
}
const graph = GraphCreator.CreateGraph(personNetwork)
+ let n = graph.nodesPerson;
+ let e = graph.edges;
+ const graphState = { n, e };
+
+ // Sauvegarder l'état dans localStorage
+ localStorage.setItem('graphState', JSON.stringify(graphState));
+
const container = document.getElementById('graph-container');
if (!container) {
console.error("Container not found");
@@ -269,6 +289,9 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS
return (
<>
+
>
);