From 6055b6fc99d3f614b3150121652fc6c254b38ba0 Mon Sep 17 00:00:00 2001 From: StubberG3 Date: Sat, 24 Feb 2024 21:23:38 -0500 Subject: [PATCH 01/23] feat: Make 'Contact us' a mailto link --- frontend/src/components/Footer/Footer.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Footer/Footer.tsx b/frontend/src/components/Footer/Footer.tsx index 08345c0e..6a60e3e9 100644 --- a/frontend/src/components/Footer/Footer.tsx +++ b/frontend/src/components/Footer/Footer.tsx @@ -24,7 +24,11 @@ function Footer() { Home { + window.location.href = 'mailto:balancerteam@codeforphilly.org'; + e.preventDefault(); + }} className="flex justify-center text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline" > Contact us From 744f5b7df85e12346e65143687c657bbaabb2f7b Mon Sep 17 00:00:00 2001 From: StubberG3 Date: Sun, 25 Feb 2024 12:38:14 -0500 Subject: [PATCH 02/23] style: Improve Chat Response Formatting in UI --- frontend/src/components/Header/Chat.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Header/Chat.tsx b/frontend/src/components/Header/Chat.tsx index 895e6075..b64db23f 100644 --- a/frontend/src/components/Header/Chat.tsx +++ b/frontend/src/components/Header/Chat.tsx @@ -113,8 +113,8 @@ const Chat: React.FC = ({ showChat, setShowChat }) => { ...prevChatLog, { type: "bot", - message: response.data.message.choices[0].message.content, - }, + message: response.data.message.choices[0].message.content + } ]); setIsLoading(false); }) @@ -193,15 +193,22 @@ const Chat: React.FC = ({ showChat, setShowChat }) => { message.type === "user" ? "justify-end" : "justify-start" }`} > -
- {message.message} -
+ )) )} From 5f0c6dcab20c49b309daa60dce4d8b3a69b7f032 Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 25 Feb 2024 12:49:43 -0500 Subject: [PATCH 03/23] Kristo changes --- frontend/src/pages/Help/Help.tsx | 39 +++++++++++++--------------- frontend/src/pages/Help/HelpCard.tsx | 30 +++++++++++++++------ frontend/src/pages/Help/HowTo.tsx | 12 ++++----- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/frontend/src/pages/Help/Help.tsx b/frontend/src/pages/Help/Help.tsx index b5c8fdf9..f8df95cb 100644 --- a/frontend/src/pages/Help/Help.tsx +++ b/frontend/src/pages/Help/Help.tsx @@ -4,18 +4,14 @@ import HelpCard from "./HelpCard"; import { Link } from "react-router-dom"; interface HelpData { - link: string[]; - icon: string[]; - title: string[]; - paragraph: string[]; + link: string[]; + icon: string[]; + title: string[]; + paragraph: string[]; } const HelpCardData: HelpData = { - link: [ - "/how-to", - "/feedback", - "/data-sources" - ], + link: ["/how-to", "/feedback", "/data-sources"], icon: ["UserDoctor", "FeedbackIcon", "MagnifyingGlassChart"], title: ["How To Use this Site", "Submit Feedback", "How We Get Our Data"], paragraph: [ @@ -48,27 +44,28 @@ function Help() {
-

+

Help & Support Page -

+
-
+

Let us help you in your Balancer experience!

{data.icon.map((icon, index) => ( - - -
- -
+ className="flex max-w-full flex-grow basis-1/3" + > + ))}
diff --git a/frontend/src/pages/Help/HelpCard.tsx b/frontend/src/pages/Help/HelpCard.tsx index cc61e42d..0f3cf344 100644 --- a/frontend/src/pages/Help/HelpCard.tsx +++ b/frontend/src/pages/Help/HelpCard.tsx @@ -23,17 +23,31 @@ function HelpCard(data: HelpProps) { } setTitle(data.title); setParagraph(data.paragraph); - if (data.icon == "UserDoctor") { - setIcon(); - } else if (data.icon == "FeedbackIcon") { - setIcon(); - } else if (data.icon == "MagnifyingGlassChart") { - setIcon(); + // if (data.icon == "UserDoctor") { + // setIcon(); + // } else if (data.icon == "FeedbackIcon") { + // setIcon(); + // } else if (data.icon == "MagnifyingGlassChart") { + // setIcon(); + switch (data.icon) { + case "UserDoctor": + setIcon(); + break; + case "FeedbackIcon": + setIcon(); + break; + case "MagnifyingGlassChart": + setIcon(); + break; + default: + setIcon(null); } - }, [paragraph, data, title]); + // }, [paragraph, data, title]); + }, [data.icon, data.title, data.paragraph]); return ( -
+ //
+
{icon &&
{icon}
}
diff --git a/frontend/src/pages/Help/HowTo.tsx b/frontend/src/pages/Help/HowTo.tsx index 7737538a..8ae0854c 100644 --- a/frontend/src/pages/Help/HowTo.tsx +++ b/frontend/src/pages/Help/HowTo.tsx @@ -20,8 +20,8 @@ const howToData: HowToProps = { "3. Answer 'yes' or 'no' to the questions related to patient characteristics.", "4. Check off any relevant reproductive status information.", "5. Type out a list of the patient's current medications. You can separate medications " + - "with commas. It doesn't matter if you use the generic or brand name of the medication; " + - "Balancer will understand.", + "with commas. It doesn't matter if you use the generic or brand name of the medication; " + + "Balancer will understand.", "6. Type out a list of any medications you want Balancer to exclude from the recommended " + "medications list. (For example, if a patient has already tried a particular medication " + "without success, enter the name of that medication and Balancer will be sure not to " + @@ -35,15 +35,15 @@ function HowTo() { return (
-

+

{howToData.title}

-

+

{howToData.paragraph[0]}

-

+

{howToData.paragraph[1]}

@@ -52,7 +52,7 @@ function HowTo() { {howToData.instructions.map((text, index) => { return (
  • {text} From acad1fc0a1e69595bb51f963f84aa52076a8e2c8 Mon Sep 17 00:00:00 2001 From: Tai Chan Date: Mon, 26 Feb 2024 19:52:42 -0500 Subject: [PATCH 04/23] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 54d673e5..3e0a3548 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ You can view the current [build of the website here](https://balancertestsite.co ![image](https://github.com/CodeForPhilly/balancer-main/assets/26842253/92c5d6e3-2aaf-4d28-9095-0ea22fa87791) -Likewise, you can view the very first iteration [build of the website here](https://64861cae18fa9449694ad5ef--deft-tapioca-dd7777.netlify.app/). +Likewise, you can view the first iteration [build of the website here](https://64861cae18fa9449694ad5ef--deft-tapioca-dd7777.netlify.app/). ## Project Updates @@ -26,6 +26,7 @@ Likewise, you can view the very first iteration [build of the website here](http ## Languages/Frameworks +Django, React, PostGres ## Contribution From 968fef94c8da1b2edcca07fcfb649e0def723f98 Mon Sep 17 00:00:00 2001 From: Tai Chan Date: Tue, 27 Feb 2024 17:22:16 -0500 Subject: [PATCH 05/23] Update README.md --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 3e0a3548..2bb4bfe2 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,21 @@ You can view the current [build of the website here](https://balancertestsite.co Likewise, you can view the first iteration [build of the website here](https://64861cae18fa9449694ad5ef--deft-tapioca-dd7777.netlify.app/). ## Project Updates +[Release V1.02272024] +Updated Help Page. Thank you @kristo_baricevic +Make 'Contact us' a mailto link. Thank you @greggaleg +Improve Chat Response Formatting in UI. Thank you @greggaleg ## Current Tasks +Official Deployment System: @joshgerstein +Prompt Creations: @erinc +Additional Business Logic for New Patient Form: @tomdoan +Backend for Feedback Form: @dattali +Redesign of AI Architecture +Add logging to the backend for debugging +Documentations of Forking and merging branches. ## Languages/Frameworks From 6a3348058a77d42f2f945de0b13ec1f7b2d032c7 Mon Sep 17 00:00:00 2001 From: Tai Chan Date: Tue, 27 Feb 2024 17:23:45 -0500 Subject: [PATCH 06/23] Update README.md --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2bb4bfe2..29aa7256 100644 --- a/README.md +++ b/README.md @@ -20,20 +20,21 @@ Likewise, you can view the first iteration [build of the website here](https://6 ## Project Updates [Release V1.02272024] -Updated Help Page. Thank you @kristo_baricevic -Make 'Contact us' a mailto link. Thank you @greggaleg -Improve Chat Response Formatting in UI. Thank you @greggaleg + +1) Updated Help Page. Thank you @kristo_baricevic +2) Make 'Contact us' a mailto link. Thank you @greggaleg +3) Improve Chat Response Formatting in UI. Thank you @greggaleg ## Current Tasks -Official Deployment System: @joshgerstein -Prompt Creations: @erinc -Additional Business Logic for New Patient Form: @tomdoan -Backend for Feedback Form: @dattali -Redesign of AI Architecture -Add logging to the backend for debugging -Documentations of Forking and merging branches. +1) Official Deployment System: @joshgerstein. +2) Prompt Creations: @erinc. +3) Additional Business Logic for New Patient Form: @tomdoan. +4) Backend for Feedback Form: @dattali. +5) Redesign of AI Architecture. +6) Add logging to the backend for debugging. +7) Documentations of Forking and merging branches. ## Languages/Frameworks From 8a8aea0992fc52017d509e0b37bd52577b5c568d Mon Sep 17 00:00:00 2001 From: StubberG3 Date: Fri, 1 Mar 2024 14:36:09 -0500 Subject: [PATCH 07/23] [Frontend] Make copy edits around the site --- frontend/src/pages/Help/DataSources.tsx | 9 +- frontend/src/pages/Help/Help.tsx | 12 +-- frontend/src/pages/Help/HowTo.tsx | 85 +++++++++++++------ .../pages/PatientManager/PatientManager.tsx | 4 +- 4 files changed, 73 insertions(+), 37 deletions(-) diff --git a/frontend/src/pages/Help/DataSources.tsx b/frontend/src/pages/Help/DataSources.tsx index 66dd7379..fe54f89b 100644 --- a/frontend/src/pages/Help/DataSources.tsx +++ b/frontend/src/pages/Help/DataSources.tsx @@ -9,10 +9,13 @@ interface DataProps { const data: DataProps = { title: "How Do We Get Our Data?", paragraph: [ - "Balancer gets it data from publicly available peer-reviewed research "+ - "as well as through extensive interviews with prescribers. ", - "Check back soon for more comprehensive information." + "Balancer is a free and open-source tool that utilizes data from " + + "publicly available peer-reviewed medical research, as well as " + + "through extensive interviews with physicians and medical professionals " + + "who treat patients with bipolar disorder.", + "Check back soon for more comprehensive information on our data sources." ], + }; function HowTo() { diff --git a/frontend/src/pages/Help/Help.tsx b/frontend/src/pages/Help/Help.tsx index b5c8fdf9..16bcd0dc 100644 --- a/frontend/src/pages/Help/Help.tsx +++ b/frontend/src/pages/Help/Help.tsx @@ -17,11 +17,11 @@ const HelpCardData: HelpData = { "/data-sources" ], icon: ["UserDoctor", "FeedbackIcon", "MagnifyingGlassChart"], - title: ["How To Use this Site", "Submit Feedback", "How We Get Our Data"], + title: ["How To Use This Site", "Submit Feedback", "How We Get Our Data"], paragraph: [ - "Visit this page to learn how to use the Balancer App!", + "Visit this page to learn how to use the Balancer App.", "Give the Balancer team feedback on your experience.", - "Learn where the Balancer team gets our data!", + "Learn about how the Balancer team gets our data.", ], }; @@ -49,17 +49,17 @@ function Help() {

    - Help & Support Page + Help & Support

    - Let us help you in your Balancer experience! + Get help and support for improving your Balancer experience.

    {data.icon.map((icon, index) => ( - +
    + {list.map((text, index) => { + if (index !== 5) { + return ( +
  • + {`${index + 1}. ${text}`} +
  • + ); + } else { // Custom sublist + return ( +
  • + {`${index + 1}. ${text}`} +
      +
    1. {"a. For example, if a patient has already tried a particular medication " + + "without success, enter the name of that medication and Balancer will " + + "be sure not to suggest it in the results page."} +
    2. +
    3. {"b. You can separate medications with commas. " + + "Again, it doesn't matter if you use the generic or " + + "brand name of the medication; Balancer will understand."} +
    4. +
    +
  • + ); + } + })} + + ) +} + function HowTo() { return ( @@ -48,18 +92,7 @@ function HowTo() {

    -
      - {howToData.instructions.map((text, index) => { - return ( -
    1. - {text} -
    2. - ); - })} -
    + {createList(howToData.instructions)}
    diff --git a/frontend/src/pages/PatientManager/PatientManager.tsx b/frontend/src/pages/PatientManager/PatientManager.tsx index 0dd36575..d56de333 100644 --- a/frontend/src/pages/PatientManager/PatientManager.tsx +++ b/frontend/src/pages/PatientManager/PatientManager.tsx @@ -73,8 +73,8 @@ const PatientManager = () => {
    Date: Mon, 4 Mar 2024 18:43:00 -0500 Subject: [PATCH 08/23] fixed bug with redux --- frontend/package-lock.json | 74 +++++++---------------- frontend/package.json | 2 +- frontend/src/components/Header/Header.tsx | 59 ++++++++++-------- frontend/src/services/store.tsx | 2 +- 4 files changed, 58 insertions(+), 79 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 79cafa89..9cbf6ac6 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,7 +8,7 @@ "name": "balancer", "version": "0.0.0", "dependencies": { - "@reduxjs/toolkit": "https://pkg.csb.dev/reduxjs/redux-toolkit/commit/933aa4a1/@reduxjs/toolkit", + "@redux-devtools/extension": "^3.3.0", "axios": "^1.4.0", "formik": "^2.4.2", "react": "^18.2.0", @@ -371,11 +371,11 @@ } }, "node_modules/@babel/runtime": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.5.tgz", - "integrity": "sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz", + "integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==", "dependencies": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" @@ -997,18 +997,16 @@ "node": ">= 8" } }, - "node_modules/@reduxjs/toolkit": { - "version": "1.2.3", - "resolved": "https://pkg.csb.dev/reduxjs/redux-toolkit/commit/933aa4a1/@reduxjs/toolkit", - "integrity": "sha512-9Eyplfq7iVInelDP1oUHug6qyMILsQcedhcYE39TAYgXxHFB8513h2fUl7upcmWEqIvu4CH+q4YQ04nU1oNF1A==", - "license": "MIT", + "node_modules/@redux-devtools/extension": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@redux-devtools/extension/-/extension-3.3.0.tgz", + "integrity": "sha512-X34S/rC8S/M1BIrkYD1mJ5f8vlH0BDqxXrs96cvxSBo4FhMdbhU+GUGsmNYov1xjSyLMHgo8NYrUG8bNX7525g==", "dependencies": { - "immer": "^4.0.1", - "redux": "^4.0.0", - "redux-devtools-extension": "^2.13.8", - "redux-immutable-state-invariant": "^2.1.0", - "redux-thunk": "^2.3.0", - "reselect": "^4.0.0" + "@babel/runtime": "^7.23.2", + "immutable": "^4.3.4" + }, + "peerDependencies": { + "redux": "^3.1.0 || ^4.0.0 || ^5.0.0" } }, "node_modules/@remix-run/router": { @@ -3007,10 +3005,10 @@ "node": ">= 4" } }, - "node_modules/immer": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/immer/-/immer-4.0.2.tgz", - "integrity": "sha512-Q/tm+yKqnKy4RIBmmtISBlhXuSDrB69e9EKTYiIenIKQkXBQir43w+kN/eGiax3wt1J0O1b2fYcNqLSbEcXA7w==" + "node_modules/immutable": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz", + "integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==" }, "node_modules/import-fresh": { "version": "3.3.0", @@ -3388,11 +3386,6 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" - }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -4354,32 +4347,16 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "peer": true, "dependencies": { "@babel/runtime": "^7.9.2" } }, - "node_modules/redux-devtools-extension": { - "version": "2.13.9", - "resolved": "https://registry.npmjs.org/redux-devtools-extension/-/redux-devtools-extension-2.13.9.tgz", - "integrity": "sha512-cNJ8Q/EtjhQaZ71c8I9+BPySIBVEKssbPpskBfsXqb8HJ002A3KRVHfeRzwRo6mGPqsm7XuHTqNSNeS1Khig0A==", - "deprecated": "Package moved to @redux-devtools/extension.", - "peerDependencies": { - "redux": "^3.1.0 || ^4.0.0" - } - }, - "node_modules/redux-immutable-state-invariant": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/redux-immutable-state-invariant/-/redux-immutable-state-invariant-2.1.0.tgz", - "integrity": "sha512-3czbDKs35FwiBRsx/3KabUk5zSOoTXC+cgVofGkpBNv3jQcqIe5JrHcF5AmVt7B/4hyJ8MijBIpCJ8cife6yJg==", - "dependencies": { - "invariant": "^2.1.0", - "json-stringify-safe": "^5.0.1" - } - }, "node_modules/redux-thunk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.2.tgz", "integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==", + "dev": true, "peerDependencies": { "redux": "^4" } @@ -4409,9 +4386,9 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" }, "node_modules/regexp.prototype.flags": { "version": "1.5.0", @@ -4435,11 +4412,6 @@ "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==" }, - "node_modules/reselect": { - "version": "4.1.8", - "resolved": "https://registry.npmjs.org/reselect/-/reselect-4.1.8.tgz", - "integrity": "sha512-ab9EmR80F/zQTMNeneUr4cv+jSwPJgIlvEmVwLerwrWVbpLlBuls9XHzIeTFy4cegU2NHBp3va0LKOzU5qFEYQ==" - }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index 74f04a4f..90759d42 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,7 @@ "preview": "vite preview" }, "dependencies": { - "@reduxjs/toolkit": "https://pkg.csb.dev/reduxjs/redux-toolkit/commit/933aa4a1/@reduxjs/toolkit", + "@redux-devtools/extension": "^3.3.0", "axios": "^1.4.0", "formik": "^2.4.2", "react": "^18.2.0", diff --git a/frontend/src/components/Header/Header.tsx b/frontend/src/components/Header/Header.tsx index 4f144894..788d1a1c 100644 --- a/frontend/src/components/Header/Header.tsx +++ b/frontend/src/components/Header/Header.tsx @@ -1,15 +1,16 @@ -import { useState, useRef, useEffect, Fragment } from "react"; +// import { useState, useRef, useEffect, Fragment } from "react"; +import { useState, Fragment } from "react"; import accountLogo from "../../assets/account.svg"; import { Link, useNavigate } from "react-router-dom"; import LoginMenuDropDown from "./LoginMenuDropDown"; import "../../components/Header/header.css"; import Chat from "./Chat"; -import { FeatureMenuDropDown } from "./FeatureMenuDropDown"; +// import { FeatureMenuDropDown } from "./FeatureMenuDropDown"; import MdNavBar from "./MdNavBar"; import { connect, useDispatch } from "react-redux"; import { RootState } from "../../services/actions/types"; import { logout, AppDispatch } from "../../services/actions/auth"; -import { HiChevronDown } from "react-icons/hi"; +// import { HiChevronDown } from "react-icons/hi"; interface LoginFormProps { isAuthenticated: boolean; @@ -18,9 +19,9 @@ interface LoginFormProps { const Header = (props: LoginFormProps) => { const { isAuthenticated } = props; const navigate = useNavigate(); - const [showFeaturesMenu, setShowFeaturesMenu] = useState(false); - const dropdownRef = useRef(null); - let delayTimeout: number | null = null; + // const [showFeaturesMenu, setShowFeaturesMenu] = useState(false); + // const dropdownRef = useRef(null); + // let delayTimeout: number | null = null; const [showChat, setShowChat] = useState(false); const [showLoginMenu, setShowLoginMenu] = useState(false); const [redirect, setRedirect] = useState(false); @@ -54,26 +55,26 @@ const Header = (props: LoginFormProps) => { setShowLoginMenu(!showLoginMenu); }; - const handleMouseEnter = () => { - if (delayTimeout !== null) { - clearTimeout(delayTimeout); - } - setShowFeaturesMenu(true); - }; + // const handleMouseEnter = () => { + // if (delayTimeout !== null) { + // clearTimeout(delayTimeout); + // } + // setShowFeaturesMenu(true); + // }; - const handleMouseLeave = () => { - delayTimeout = setTimeout(() => { - setShowFeaturesMenu(false); - }, 300) as unknown as number; // Adjust the delay time as needed - }; + // const handleMouseLeave = () => { + // delayTimeout = setTimeout(() => { + // setShowFeaturesMenu(false); + // }, 300) as unknown as number; // Adjust the delay time as needed + // }; - useEffect(() => { - return () => { - if (delayTimeout !== null) { - clearTimeout(delayTimeout); - } - }; - }, [delayTimeout]); + // useEffect(() => { + // return () => { + // if (delayTimeout !== null) { + // clearTimeout(delayTimeout); + // } + // }; + // }, [delayTimeout]); return (
    @@ -99,7 +100,7 @@ const Header = (props: LoginFormProps) => {
    */} + + Medication Suggester + <> Date: Tue, 5 Mar 2024 15:44:17 -0500 Subject: [PATCH 09/23] removed required attribute from last two input fields on newpatientform --- config/env/env.dev | 2 +- frontend/src/pages/PatientManager/NewPatientForm.tsx | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/config/env/env.dev b/config/env/env.dev index 47ff5783..262414bf 100644 --- a/config/env/env.dev +++ b/config/env/env.dev @@ -9,5 +9,5 @@ SQL_HOST=db SQL_PORT=5432 DATABASE=postgres LOGIN_REDIRECT_URL= -OPENAI_API_KEY= +OPENAI_API_KEY= PINECONE_API_KEY= \ No newline at end of file diff --git a/frontend/src/pages/PatientManager/NewPatientForm.tsx b/frontend/src/pages/PatientManager/NewPatientForm.tsx index a167492e..b56c6652 100644 --- a/frontend/src/pages/PatientManager/NewPatientForm.tsx +++ b/frontend/src/pages/PatientManager/NewPatientForm.tsx @@ -734,7 +734,6 @@ const NewPatientForm = ({ CurrentMedications: String(e.target.value), }) } - required placeholder="Separate medications with commas" className={ isLoading @@ -769,7 +768,6 @@ const NewPatientForm = ({ PriorMedications: String(e.target.value), }) } - required placeholder="Separate medications with commas" className={ isLoading @@ -792,14 +790,12 @@ const NewPatientForm = ({
    From b6c7bee6b7c9388f632b32e5619f0abf3b3bd5d3 Mon Sep 17 00:00:00 2001 From: StubberG3 Date: Tue, 5 Mar 2024 18:32:26 -0500 Subject: [PATCH 11/23] fix: Update labels of 'Feedback Type' radio buttons --- frontend/src/pages/Feedback/FeedbackForm.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/Feedback/FeedbackForm.tsx b/frontend/src/pages/Feedback/FeedbackForm.tsx index 769cf0c7..68a3b2a1 100644 --- a/frontend/src/pages/Feedback/FeedbackForm.tsx +++ b/frontend/src/pages/Feedback/FeedbackForm.tsx @@ -187,7 +187,7 @@ const FeedbackForm = () => { className="block text-sm font-medium leading-6 text-gray-900" htmlFor="psychotic-yes" > - Feature Request + Feature request { className="block text-sm font-medium leading-6 text-gray-900" htmlFor="psychotic-no" > - Bug + Issue { className="block text-sm font-medium leading-6 text-gray-900" htmlFor="psychotic-no" > - General Improvements + General feedback
    From 8ec99a2b13c6fe694b4f778faeaa98895985eb21 Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sat, 9 Mar 2024 07:53:56 -0500 Subject: [PATCH 12/23] hot reload --- docker-compose.prod.yml | 34 +++++++++++------ docker-compose.prodBackup.yml | 30 +++++++++++++++ docker-compose.yml | 3 ++ server/Dockerfile | 11 ++---- server/Dockerfile.prod | 64 ++++++------------------------- server/Dockerfile.prodBackup | 71 +++++++++++++++++++++++++++++++++++ 6 files changed, 142 insertions(+), 71 deletions(-) create mode 100644 docker-compose.prodBackup.yml create mode 100644 server/Dockerfile.prodBackup diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index a7f0ae12..d68a874c 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -4,25 +4,37 @@ services: image: postgres:15 volumes: - postgres_data:/var/lib/postgresql/data/ - env_file: - - ./config/env/.env.prod.db + environment: + - POSTGRES_USER=balancer + - POSTGRES_PASSWORD=balancer + - POSTGRES_DB=balancer_dev + ports: + - "5432:5432" backend: - build: - context: ./server - dockerfile: Dockerfile.prod - command: gunicorn balancer_backend.wsgi:application --bind 0.0.0.0:8000 + image: balancer-backend + dockerfile: Dockerfile.prod + build: ./server ports: - - 8000:8000 + - "8000:8000" env_file: - - ./config/env/.env.prod + - ./config/env/env.dev depends_on: - db frontend: + image: balancer-frontend build: - context: ./frontend - dockerfile: Dockerfile.prod + context: frontend + dockerfile: Dockerfile + args: + - IMAGE_NAME=balancer-frontend ports: - - "3000:80" + - "3000:3000" + environment: + - CHOKIDAR_USEPOLLING=true + # - VITE_API_BASE_URL=https://balancertestsite.com/ + volumes: + - "./frontend:/usr/src/app:delegated" + - "/usr/src/app/node_modules/" depends_on: - backend diff --git a/docker-compose.prodBackup.yml b/docker-compose.prodBackup.yml new file mode 100644 index 00000000..a7f0ae12 --- /dev/null +++ b/docker-compose.prodBackup.yml @@ -0,0 +1,30 @@ +version: '3.8' +services: + db: + image: postgres:15 + volumes: + - postgres_data:/var/lib/postgresql/data/ + env_file: + - ./config/env/.env.prod.db + backend: + build: + context: ./server + dockerfile: Dockerfile.prod + command: gunicorn balancer_backend.wsgi:application --bind 0.0.0.0:8000 + ports: + - 8000:8000 + env_file: + - ./config/env/.env.prod + depends_on: + - db + frontend: + build: + context: ./frontend + dockerfile: Dockerfile.prod + ports: + - "3000:80" + depends_on: + - backend + +volumes: + postgres_data: \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index df524dd4..be75d717 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,12 +13,15 @@ services: backend: image: balancer-backend build: ./server + command: python manage.py runserver 0.0.0.0:8000 ports: - "8000:8000" env_file: - ./config/env/env.dev depends_on: - db + volumes: + - ./server:/usr/src/server frontend: image: balancer-frontend build: diff --git a/server/Dockerfile b/server/Dockerfile index 252546c8..4f8b7c8a 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -2,7 +2,7 @@ FROM python:3.11.4-slim-buster # set work directory -WORKDIR /usr/src/app +WORKDIR /usr/src/server # set environment variables ENV PYTHONDONTWRITEBYTECODE 1 @@ -17,13 +17,10 @@ COPY ./requirements.txt . RUN pip install -r requirements.txt # copy project -COPY . . +COPY . /usr/src/app # Correct line endings in entrypoint.sh and make it executable -RUN sed -i 's/\r$//' entrypoint.sh && chmod +x entrypoint.sh +RUN sed -i 's/\r$//' /usr/src/app/entrypoint.sh && chmod +x /usr/src/app/entrypoint.sh # run entrypoint.sh -ENTRYPOINT ["./entrypoint.sh"] - -# Default command to run on container start -CMD ["python", "manage.py", "runserver", "0.0.0.0:8000", "--noreload"] +ENTRYPOINT ["/usr/src/app/entrypoint.sh"] diff --git a/server/Dockerfile.prod b/server/Dockerfile.prod index 9c5244c6..252546c8 100644 --- a/server/Dockerfile.prod +++ b/server/Dockerfile.prod @@ -1,9 +1,5 @@ -########### -# BUILDER # -########### - # pull official base image -FROM python:3.11.4-slim-buster as builder +FROM python:3.11.4-slim-buster # set work directory WORKDIR /usr/src/app @@ -13,59 +9,21 @@ ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 # install system dependencies -RUN apt-get update && \ - apt-get install -y --no-install-recommends gcc - -# lint -# RUN pip install --upgrade pip -# RUN pip install flake8==6.0.0 -# COPY . /usr/src/app/ -# RUN flake8 --ignore=E501,F401 . - -# install python dependencies -COPY ./requirements.txt . -RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt - - -######### -# FINAL # -######### - -# pull official base image -FROM python:3.11.4-slim-buster - -# create directory for the app user -RUN mkdir -p /home/app - -# create the app user -RUN addgroup --system app && adduser --system --group app - -# create the appropriate directories -ENV HOME=/home/app -ENV APP_HOME=/home/app/web -RUN mkdir $APP_HOME -WORKDIR $APP_HOME +RUN apt-get update && apt-get install -y netcat # install dependencies -RUN apt-get update && apt-get install -y --no-install-recommends netcat -COPY --from=builder /usr/src/app/wheels /wheels -COPY --from=builder /usr/src/app/requirements.txt . RUN pip install --upgrade pip -RUN pip install --no-cache /wheels/* - -# copy entrypoint.prod.sh -COPY ./entrypoint.prod.sh . -RUN sed -i 's/\r$//g' $APP_HOME/entrypoint.prod.sh -RUN chmod +x $APP_HOME/entrypoint.prod.sh +COPY ./requirements.txt . +RUN pip install -r requirements.txt # copy project -COPY . $APP_HOME +COPY . . -# chown all the files to the app user -RUN chown -R app:app $APP_HOME +# Correct line endings in entrypoint.sh and make it executable +RUN sed -i 's/\r$//' entrypoint.sh && chmod +x entrypoint.sh -# change to the app user -USER app +# run entrypoint.sh +ENTRYPOINT ["./entrypoint.sh"] -# run entrypoint.prod.sh -ENTRYPOINT ["/home/app/web/entrypoint.prod.sh"] \ No newline at end of file +# Default command to run on container start +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000", "--noreload"] diff --git a/server/Dockerfile.prodBackup b/server/Dockerfile.prodBackup new file mode 100644 index 00000000..9c5244c6 --- /dev/null +++ b/server/Dockerfile.prodBackup @@ -0,0 +1,71 @@ +########### +# BUILDER # +########### + +# pull official base image +FROM python:3.11.4-slim-buster as builder + +# set work directory +WORKDIR /usr/src/app + +# set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# install system dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends gcc + +# lint +# RUN pip install --upgrade pip +# RUN pip install flake8==6.0.0 +# COPY . /usr/src/app/ +# RUN flake8 --ignore=E501,F401 . + +# install python dependencies +COPY ./requirements.txt . +RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt + + +######### +# FINAL # +######### + +# pull official base image +FROM python:3.11.4-slim-buster + +# create directory for the app user +RUN mkdir -p /home/app + +# create the app user +RUN addgroup --system app && adduser --system --group app + +# create the appropriate directories +ENV HOME=/home/app +ENV APP_HOME=/home/app/web +RUN mkdir $APP_HOME +WORKDIR $APP_HOME + +# install dependencies +RUN apt-get update && apt-get install -y --no-install-recommends netcat +COPY --from=builder /usr/src/app/wheels /wheels +COPY --from=builder /usr/src/app/requirements.txt . +RUN pip install --upgrade pip +RUN pip install --no-cache /wheels/* + +# copy entrypoint.prod.sh +COPY ./entrypoint.prod.sh . +RUN sed -i 's/\r$//g' $APP_HOME/entrypoint.prod.sh +RUN chmod +x $APP_HOME/entrypoint.prod.sh + +# copy project +COPY . $APP_HOME + +# chown all the files to the app user +RUN chown -R app:app $APP_HOME + +# change to the app user +USER app + +# run entrypoint.prod.sh +ENTRYPOINT ["/home/app/web/entrypoint.prod.sh"] \ No newline at end of file From c3ba2f1a890d75d4ef13761300c13dd5c6f525dd Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sat, 9 Mar 2024 15:46:19 -0500 Subject: [PATCH 13/23] enable PG Admin --- docker-compose.yml | 34 +++++++++++++++++- .../migrations/0002_alter_uploadfile_file.py | 18 ++++++++++ server/pgadmin-data/pgadmin4.db | Bin 0 -> 172032 bytes .../2fd09268-e73a-4389-a491-645c57b88709 | Bin 0 -> 1059 bytes .../43801688-f52f-4365-a238-1926dc2ba942 | 0 .../7d3c8f51-2742-4b1f-a177-e21ef44f9b7b | 0 .../f7f81f4a-dc46-4751-bbb2-f4b9cace73f1 | 0 7 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 server/api/migrations/0002_alter_uploadfile_file.py create mode 100644 server/pgadmin-data/pgadmin4.db create mode 100644 server/pgadmin-data/sessions/2fd09268-e73a-4389-a491-645c57b88709 create mode 100644 server/pgadmin-data/sessions/43801688-f52f-4365-a238-1926dc2ba942 create mode 100644 server/pgadmin-data/sessions/7d3c8f51-2742-4b1f-a177-e21ef44f9b7b create mode 100644 server/pgadmin-data/sessions/f7f81f4a-dc46-4751-bbb2-f4b9cace73f1 diff --git a/docker-compose.yml b/docker-compose.yml index be75d717..53cb2856 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,25 @@ services: - POSTGRES_DB=balancer_dev ports: - "5432:5432" + networks: + app_net: + ipv4_address: 192.168.0.2 + pgadmin: + container_name: pgadmin4 + image: dpage/pgadmin4 + restart: always + environment: + PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org + PGADMIN_DEFAULT_PASSWORD: balancer + # PGADMIN_LISTEN_PORT = 80 + volumes: + - ./server/pgadmin-data:/var/lib/pgadmin + # PGADMIN_LISTEN_PORT = 80 + ports: + - "5050:80" + networks: + app_net: + ipv4_address: 192.168.0.3 backend: image: balancer-backend build: ./server @@ -22,6 +41,9 @@ services: - db volumes: - ./server:/usr/src/server + networks: + app_net: + ipv4_address: 192.168.0.4 frontend: image: balancer-frontend build: @@ -39,6 +61,16 @@ services: - "/usr/src/app/node_modules/" depends_on: - backend + networks: + app_net: + ipv4_address: 192.168.0.5 volumes: - postgres_data: \ No newline at end of file + postgres_data: +networks: + app_net: + ipam: + driver: default + config: + - subnet: "192.168.0.0/24" + gateway: 192.168.0.1 \ No newline at end of file diff --git a/server/api/migrations/0002_alter_uploadfile_file.py b/server/api/migrations/0002_alter_uploadfile_file.py new file mode 100644 index 00000000..4b678383 --- /dev/null +++ b/server/api/migrations/0002_alter_uploadfile_file.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.3 on 2024-03-09 20:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='uploadfile', + name='file', + field=models.BinaryField(null=True), + ), + ] diff --git a/server/pgadmin-data/pgadmin4.db b/server/pgadmin-data/pgadmin4.db new file mode 100644 index 0000000000000000000000000000000000000000..a2af4ead23c211f6af2d99bb197a8f6610a8ef01 GIT binary patch literal 172032 zcmeI532+?Qd6;J~IHu=n+=G)C4hR8QU#?iIB{glsgj~taa>Z#(P>## zN&eTzpnGs=SG$(E)IUXHy8r*3-+TS~z3zGczj=LC)JY<*s3l%cO#7OBe!uUDM8fCu z|EbUCdkp?NpItbpcTV8j?>au>5YjlU{!9aC>)3D7FoW!Otb-#Wpcn}t0VIF~kN^@u z0!RP}AOR$R1dsp{cs&VpO+sq%?kN2Avw!V_fA~QHNB{{S0VIF~kN^@u0!RP}AOR$R z1RfCrF@N0<$xY_d>HH!;L*_zIFI@jWB8`jHKmter2_OL^fCP{L5pu4Dk4_D-CP)AYAOR$R1dsp{Kmter2_OL^fCP|$&le8#GtL75`u@L;{jiVy zWB7v~B!C2v01`j~NB{{S0VIF~kN^@u0!ZMYBG6q|@9UVjp%JxQSQ1L2oS?^v4Miej z{(9f=k|`85UFCJ98pb0u1Jm_C82!f&5)ifC!(onN3<^Tg~)G5 zJ{b9jkwWCj$b95fBpm)`_%q>;hd&U$8-5{tF+37(34JT{nb5~WzYuyklnu zmzY0dewFzrOo_R|j5964uLnOH{Alo}g6{|_!DoW!gCjw<>03>oZ~FbFf7SHfroE;c zO;0q9HFY-m8vnBKla0U9_`b%wjn6e+Y8-218@|=>xrR?P{Bpww8jOY)8?HB;Z8+5s zssBd(7wSJ%|F7$Ryne5quV1d8tnaID4tzWC=YdZI{$1do1%5Q}QlJpn49o|50(Es? zuKV-4|5W#@bw5@2BXyNJu5PXF@w(BvcwL?UEB?>=KjHs1|Ihf}>wn;v0oO5~ZX;gr z^Ut>Gd{!cyN+ezv6`2!ASueI4ouC_T)ox4NuBaC|K~>68qXUHfEq4{A#3>a$Vzk3~ zuXQfU%|;uX4qB(W!sSK1#b^c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v=}|07;+S* p*UY%l4YIT&+bx27RqKw^ZFGTVwlxQKAw(E4s3&c>woRYY{~sMw6OsS` literal 0 HcmV?d00001 diff --git a/server/pgadmin-data/sessions/2fd09268-e73a-4389-a491-645c57b88709 b/server/pgadmin-data/sessions/2fd09268-e73a-4389-a491-645c57b88709 new file mode 100644 index 0000000000000000000000000000000000000000..fba8268b8565be91bfe85ae0b871a2f3aeb6afa3 GIT binary patch literal 1059 zcmY+D-*4SC6vsO{x~sKXg*FWy^MIhGy_Yz#odgMq(Ut<8wiTwbAtCGdR}w9CvN&mX zK}dU}mHdRvAHko*KZ1C~_qGhklYM-CeLv^q_08YjyScLb+&yZk3k+lJ z-R?Kf_FtlpAN{!VusHwXIUZgdKc7E)Q0|+9N7NiY)ydv*qYfJ`PYyoyKl?3rn{}!` z1*6R1FWef_y|Ps}ZL$t}Fl{Z_(7sT{yU#>QFefs>MT}|2xDirWM_U^W@z5XZPR)&z!8KNX9c$`xbE1ji)V@0GuMGgg|S}Dc7 zy9?t`G24#4P%JbHrRta6-@CTyzE(yyb7tUFc{i!epn3z1cN_l+wf+ZRZGgKY#=Z}N zuQLYQ=q7Bms%N$IF3NMoAqUN+&=?gdmj#u1f?@~{SZ3a>E*)Q|D%B{XD&raE2_+!X zBBvCxpq5KqU>qZXMM^Qy7(-FWEFmdPInp^vWX?q#V?iV@VqT=7R33OzngDWiDWiD^@t@zu06<8CC{ z)2?omjQBh%h4?o^GD~Lh6yfa%EswiVh~;&VII*F)ty|;2{`0H1R@~%`02gucID1SE zpY#W!>raZkz3;?0jA^a+hVS{8CtjbQ$0#ciB}-Mh-T1bZitZdtFcs|2R^!&Wg~8|de(Ye1-~ZDgQ# z={BM7VIF=4W{18urN12AX6S}P14ab=Qk^YYtUjn_)rW55fA(toXr=n-qT0Erb}y^x M Date: Sat, 9 Mar 2024 15:47:25 -0500 Subject: [PATCH 14/23] fixing docker compose for pgadmin --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 53cb2856..0c9c274a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: PGADMIN_DEFAULT_PASSWORD: balancer # PGADMIN_LISTEN_PORT = 80 volumes: - - ./server/pgadmin-data:/var/lib/pgadmin + - ./pgadmin-data:/var/lib/pgadmin # PGADMIN_LISTEN_PORT = 80 ports: - "5050:80" From 71c4b0e84c220db9698d3f2d0b3d1899fb41f646 Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sat, 9 Mar 2024 16:53:30 -0500 Subject: [PATCH 15/23] added the user account class to django admin --- docker-compose.yml | 6 +++--- server/api/admin.py | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0c9c274a..19051368 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,9 +21,9 @@ services: PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org PGADMIN_DEFAULT_PASSWORD: balancer # PGADMIN_LISTEN_PORT = 80 - volumes: - - ./pgadmin-data:/var/lib/pgadmin - # PGADMIN_LISTEN_PORT = 80 + # volumes: + # - ./pgadmin-data:/var/lib/pgadmin + # # PGADMIN_LISTEN_PORT = 80 ports: - "5050:80" networks: diff --git a/server/api/admin.py b/server/api/admin.py index 3c91cf73..b85f6ab9 100644 --- a/server/api/admin.py +++ b/server/api/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin from .views.uploadFile.models import UploadFile from .views.listMeds.models import StateMedication +from .models.authUser import UserAccount @admin.register(StateMedication) @@ -11,3 +12,8 @@ class StateMedicationAdmin(admin.ModelAdmin): @admin.register(UploadFile) class UploadFile(admin.ModelAdmin): list_display = ['guid', 'file_name', 'file'] + + +@admin.register(UserAccount) +class UserAccountAdmin(admin.ModelAdmin): + list_display = ['id', 'first_name', 'email', 'is_superuser'] From 8ef436cbbda077c7ef33e885860455e842badf59 Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sat, 9 Mar 2024 18:02:35 -0500 Subject: [PATCH 16/23] delete pgadmin folder --- server/pgadmin-data/pgadmin4.db | Bin 172032 -> 0 bytes .../2fd09268-e73a-4389-a491-645c57b88709 | Bin 1059 -> 0 bytes .../43801688-f52f-4365-a238-1926dc2ba942 | 0 .../7d3c8f51-2742-4b1f-a177-e21ef44f9b7b | 0 .../f7f81f4a-dc46-4751-bbb2-f4b9cace73f1 | 0 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 server/pgadmin-data/pgadmin4.db delete mode 100644 server/pgadmin-data/sessions/2fd09268-e73a-4389-a491-645c57b88709 delete mode 100644 server/pgadmin-data/sessions/43801688-f52f-4365-a238-1926dc2ba942 delete mode 100644 server/pgadmin-data/sessions/7d3c8f51-2742-4b1f-a177-e21ef44f9b7b delete mode 100644 server/pgadmin-data/sessions/f7f81f4a-dc46-4751-bbb2-f4b9cace73f1 diff --git a/server/pgadmin-data/pgadmin4.db b/server/pgadmin-data/pgadmin4.db deleted file mode 100644 index a2af4ead23c211f6af2d99bb197a8f6610a8ef01..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 172032 zcmeI532+?Qd6;J~IHu=n+=G)C4hR8QU#?iIB{glsgj~taa>Z#(P>## zN&eTzpnGs=SG$(E)IUXHy8r*3-+TS~z3zGczj=LC)JY<*s3l%cO#7OBe!uUDM8fCu z|EbUCdkp?NpItbpcTV8j?>au>5YjlU{!9aC>)3D7FoW!Otb-#Wpcn}t0VIF~kN^@u z0!RP}AOR$R1dsp{cs&VpO+sq%?kN2Avw!V_fA~QHNB{{S0VIF~kN^@u0!RP}AOR$R z1RfCrF@N0<$xY_d>HH!;L*_zIFI@jWB8`jHKmter2_OL^fCP{L5pu4Dk4_D-CP)AYAOR$R1dsp{Kmter2_OL^fCP|$&le8#GtL75`u@L;{jiVy zWB7v~B!C2v01`j~NB{{S0VIF~kN^@u0!ZMYBG6q|@9UVjp%JxQSQ1L2oS?^v4Miej z{(9f=k|`85UFC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HhSK?~KUCD1yIYgKuUde@cAhS=*e)lrOj9a)u^eW+q$h*j~iD(nl`229u~Y_JK;NxRnSbhHP+tVHseY)Ap!QWLl%%; ztML>_ht1&NA)WG3z?X~*7+8Bc(4pvNpc?P0CPc{`K^*9rv7kOUc3YcG8#!b*9Va2o?`S0osU2;H#H9$EBBbpD|}9;R$oQqCm6fz@1^YF$?Nh zZxU1u{v>;i8PF}pbJ`AM2n_+Qq2-DsX;3)5*kw$EcG}d|GAf4?LWiZL0 zLnjnfj)vGKx)w81pd0AiRrxY_HWpyi7ze>nCq0H{kpxJf(-;HUM5oogXx1I;37ZuJjut5a65>pxPTLY`H+R9%C5v z^Oj#u&aAiDz?zI^S5RX>H(CvX*yD{JioUP>Z;PbrII053} zYTz6=9EXJaJz>ElM^>T3eIE_mCKhCR&nm!Rt!te|F9;_bA>2>EpE|w8v=}|07;+S* p*UY%l4YIT&+bx27RqKw^ZFGTVwlxQKAw(E4s3&c>woRYY{~sMw6OsS` diff --git a/server/pgadmin-data/sessions/2fd09268-e73a-4389-a491-645c57b88709 b/server/pgadmin-data/sessions/2fd09268-e73a-4389-a491-645c57b88709 deleted file mode 100644 index fba8268b8565be91bfe85ae0b871a2f3aeb6afa3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1059 zcmY+D-*4SC6vsO{x~sKXg*FWy^MIhGy_Yz#odgMq(Ut<8wiTwbAtCGdR}w9CvN&mX zK}dU}mHdRvAHko*KZ1C~_qGhklYM-CeLv^q_08YjyScLb+&yZk3k+lJ z-R?Kf_FtlpAN{!VusHwXIUZgdKc7E)Q0|+9N7NiY)ydv*qYfJ`PYyoyKl?3rn{}!` z1*6R1FWef_y|Ps}ZL$t}Fl{Z_(7sT{yU#>QFefs>MT}|2xDirWM_U^W@z5XZPR)&z!8KNX9c$`xbE1ji)V@0GuMGgg|S}Dc7 zy9?t`G24#4P%JbHrRta6-@CTyzE(yyb7tUFc{i!epn3z1cN_l+wf+ZRZGgKY#=Z}N zuQLYQ=q7Bms%N$IF3NMoAqUN+&=?gdmj#u1f?@~{SZ3a>E*)Q|D%B{XD&raE2_+!X zBBvCxpq5KqU>qZXMM^Qy7(-FWEFmdPInp^vWX?q#V?iV@VqT=7R33OzngDWiDWiD^@t@zu06<8CC{ z)2?omjQBh%h4?o^GD~Lh6yfa%EswiVh~;&VII*F)ty|;2{`0H1R@~%`02gucID1SE zpY#W!>raZkz3;?0jA^a+hVS{8CtjbQ$0#ciB}-Mh-T1bZitZdtFcs|2R^!&Wg~8|de(Ye1-~ZDgQ# z={BM7VIF=4W{18urN12AX6S}P14ab=Qk^YYtUjn_)rW55fA(toXr=n-qT0Erb}y^x M Date: Sat, 9 Mar 2024 19:21:03 -0500 Subject: [PATCH 17/23] working on JWT to set superuser --- docker-compose.yml | 6 +++--- frontend/package-lock.json | 9 +++++++++ frontend/package.json | 1 + server/api/models/TokenObtainPairSerializer.py | 10 ++++++++++ server/balancer_backend/settings.py | 1 + 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 server/api/models/TokenObtainPairSerializer.py diff --git a/docker-compose.yml b/docker-compose.yml index 19051368..0c9c274a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,9 +21,9 @@ services: PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org PGADMIN_DEFAULT_PASSWORD: balancer # PGADMIN_LISTEN_PORT = 80 - # volumes: - # - ./pgadmin-data:/var/lib/pgadmin - # # PGADMIN_LISTEN_PORT = 80 + volumes: + - ./pgadmin-data:/var/lib/pgadmin + # PGADMIN_LISTEN_PORT = 80 ports: - "5050:80" networks: diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 9cbf6ac6..caac6f4d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,6 +11,7 @@ "@redux-devtools/extension": "^3.3.0", "axios": "^1.4.0", "formik": "^2.4.2", + "jwt-decode": "^4.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^5.0.1", @@ -3398,6 +3399,14 @@ "node": ">=6" } }, + "node_modules/jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "engines": { + "node": ">=18" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 90759d42..7d43a055 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,7 @@ "@redux-devtools/extension": "^3.3.0", "axios": "^1.4.0", "formik": "^2.4.2", + "jwt-decode": "^4.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^5.0.1", diff --git a/server/api/models/TokenObtainPairSerializer.py b/server/api/models/TokenObtainPairSerializer.py new file mode 100644 index 00000000..6b514202 --- /dev/null +++ b/server/api/models/TokenObtainPairSerializer.py @@ -0,0 +1,10 @@ +from rest_framework_simplejwt.serializers import TokenObtainPairSerializer + + +class MyTokenObtainPairSerializer(TokenObtainPairSerializer): + @classmethod + def get_token(cls, user): + token = super(MyTokenObtainPairSerializer, cls).get_token(user) + # Add custom claims + token['is_superuser'] = user.is_superuser + return token diff --git a/server/balancer_backend/settings.py b/server/balancer_backend/settings.py index 41b660e9..62884846 100644 --- a/server/balancer_backend/settings.py +++ b/server/balancer_backend/settings.py @@ -171,6 +171,7 @@ 'AUTH_HEADER_TYPES': ('JWT',), 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60), 'REFRESH_TOKEN_LIFETIME': timedelta(days=1), + 'TOKEN_OBTAIN_SERIALIZER': 'api.models.TokenObtainPairSerializer.MyTokenObtainPairSerializer', 'AUTH_TOKEN_CLASSES': ( 'rest_framework_simplejwt.tokens.AccessToken', ) From 012cba02656ab6cec6ba1947c46d4179ee93cd44 Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 10 Mar 2024 15:03:28 -0400 Subject: [PATCH 18/23] enable pgadmin agian --- config/env/env.dev | 2 +- docker-compose.yml | 7 +++---- server/api/views/uploadFile/urls.py | 2 +- server/api/views/uploadFile/views.py | 2 +- server/balancer_backend/urls.py | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/config/env/env.dev b/config/env/env.dev index 262414bf..c9122e82 100644 --- a/config/env/env.dev +++ b/config/env/env.dev @@ -1,4 +1,4 @@ -DEBUG=1 +DEBUG=True SECRET_KEY=foo DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1] SQL_ENGINE=django.db.backends.postgresql diff --git a/docker-compose.yml b/docker-compose.yml index 0c9c274a..548bff5b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,14 +16,13 @@ services: pgadmin: container_name: pgadmin4 image: dpage/pgadmin4 - restart: always environment: PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org PGADMIN_DEFAULT_PASSWORD: balancer # PGADMIN_LISTEN_PORT = 80 - volumes: - - ./pgadmin-data:/var/lib/pgadmin - # PGADMIN_LISTEN_PORT = 80 + # volumes: + # - ./pgadmin-data:/var/lib/pgadmin + # # PGADMIN_LISTEN_PORT = 80 ports: - "5050:80" networks: diff --git a/server/api/views/uploadFile/urls.py b/server/api/views/uploadFile/urls.py index 385e8cb1..e36dd8c6 100644 --- a/server/api/views/uploadFile/urls.py +++ b/server/api/views/uploadFile/urls.py @@ -2,5 +2,5 @@ from api.views.uploadFile import views urlpatterns = [ - path("chatgpt/uploadFile", views.uploadFiles, name="uploadFile") + path("chatgpt/uploadFile", views.uploadFiles, name="uploadFiles") ] diff --git a/server/api/views/uploadFile/views.py b/server/api/views/uploadFile/views.py index 1be42195..cf7424ba 100644 --- a/server/api/views/uploadFile/views.py +++ b/server/api/views/uploadFile/views.py @@ -20,7 +20,7 @@ def uploadFiles(request): file_name = file.name # Create an instance of the model - upload_file = UploadFile(file_name=file_name, file_data=file_contents) + upload_file = UploadFile(file_name=file_name, file=file_contents) # Save the instance to the database try: diff --git a/server/balancer_backend/urls.py b/server/balancer_backend/urls.py index aee2dae3..7bec66dc 100644 --- a/server/balancer_backend/urls.py +++ b/server/balancer_backend/urls.py @@ -18,7 +18,7 @@ ] # List of application names for which URL patterns will be dynamically added -urls = ['chatgpt', 'jira', 'listDrugs', 'listMeds', 'risk'] +urls = ['chatgpt', 'jira', 'listDrugs', 'listMeds', 'risk', 'uploadFile'] # Loop through each application name and dynamically import and add its URL patterns for url in urls: From 961a207eddde98ba518decf3c5ccc56a6d197ddf Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 10 Mar 2024 16:28:35 -0400 Subject: [PATCH 19/23] fixed email host info so that it is being pull from env file --- server/api/views/uploadFile/views.py | 2 +- server/balancer_backend/settings.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/api/views/uploadFile/views.py b/server/api/views/uploadFile/views.py index cf7424ba..17e00f25 100644 --- a/server/api/views/uploadFile/views.py +++ b/server/api/views/uploadFile/views.py @@ -15,7 +15,7 @@ def uploadFiles(request): # Read file contents in binary mode file_contents = file.read() - + print(file.read()) # Use the original file name file_name = file.name diff --git a/server/balancer_backend/settings.py b/server/balancer_backend/settings.py index 62884846..13988358 100644 --- a/server/balancer_backend/settings.py +++ b/server/balancer_backend/settings.py @@ -113,8 +113,8 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 -EMAIL_HOST_USER = 'tyc50ff@gmail.com' -EMAIL_HOST_PASSWORD = 'uvherhprtetbkzzn' +EMAIL_HOST_USER = os.environ.get("EMAIL_HOST_USER", "") +EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD", "") EMAIL_USE_TLS = True From a1e218595ddcecbae84d4f57d579bb5858cee8bd Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 10 Mar 2024 20:14:57 -0400 Subject: [PATCH 20/23] enable Admin portal --- frontend/package-lock.json | 149 ++++++++++++++++-- frontend/package.json | 3 + frontend/src/components/Header/Header.tsx | 11 ++ .../src/pages/AdminPortal/AdminPortal.tsx | 13 ++ frontend/src/routes/routes.tsx | 8 +- frontend/src/services/actions/types.tsx | 1 + frontend/src/services/reducers/auth.ts | 16 +- 7 files changed, 185 insertions(+), 16 deletions(-) create mode 100644 frontend/src/pages/AdminPortal/AdminPortal.tsx diff --git a/frontend/package-lock.json b/frontend/package-lock.json index caac6f4d..ae60363a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,6 +11,7 @@ "@redux-devtools/extension": "^3.3.0", "axios": "^1.4.0", "formik": "^2.4.2", + "jsonwebtoken": "^9.0.2", "jwt-decode": "^4.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -25,6 +26,8 @@ }, "devDependencies": { "@types/axios": "^0.14.0", + "@types/jsonwebtoken": "^9.0.6", + "@types/jwt-decode": "^3.1.0", "@types/node": "^20.10.6", "@types/react": "^18.2.14", "@types/react-dom": "^18.0.11", @@ -1049,6 +1052,25 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.6.tgz", + "integrity": "sha512-/5hndP5dCjloafCXns6SZyESp3Ldq7YjH3zwzwczYnjxIT0Fqzk5ROSYVGfFyczIue7IUEj8hkvLbPoLQ18vQw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/jwt-decode": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/jwt-decode/-/jwt-decode-3.1.0.tgz", + "integrity": "sha512-tthwik7TKkou3mVnBnvVuHnHElbjtdbM63pdBCbZTirCt3WAdM73Y79mOri7+ljsS99ZVwUFZHLMxJuJnv/z1w==", + "deprecated": "This is a stub types definition. jwt-decode provides its own type definitions, so you do not need this installed.", + "dev": true, + "dependencies": { + "jwt-decode": "*" + } + }, "node_modules/@types/node": { "version": "20.10.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz", @@ -1666,6 +1688,11 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -1943,6 +1970,14 @@ "node": ">=6.0.0" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.438", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.438.tgz", @@ -3399,6 +3434,51 @@ "node": ">=6" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/jwt-decode": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", @@ -3465,6 +3545,11 @@ "resolved": "https://registry.npmjs.org/lodash._basefor/-/lodash._basefor-3.0.3.tgz", "integrity": "sha512-6bc3b8grkpMgDcVJv9JYZAk/mHgcqMljzm7OsbmcE2FGUMmmLQTPHlh/dFqR8LA0GQ7z4K67JSotVKu5058v1A==" }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + }, "node_modules/lodash.isarguments": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", @@ -3475,6 +3560,21 @@ "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", "integrity": "sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ==" }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + }, "node_modules/lodash.isplainobject": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-3.2.0.tgz", @@ -3485,6 +3585,11 @@ "lodash.keysin": "^3.0.0" } }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + }, "node_modules/lodash.keysin": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/lodash.keysin/-/lodash.keysin-3.0.8.tgz", @@ -3500,6 +3605,11 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -3598,8 +3708,7 @@ "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/mz": { "version": "2.7.0", @@ -4528,6 +4637,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/safe-regex-test": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", @@ -4551,10 +4679,9 @@ } }, "node_modules/semver": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz", - "integrity": "sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==", - "dev": true, + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4569,7 +4696,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -4580,8 +4706,7 @@ "node_modules/semver/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/shebang-command": { "version": "2.0.0", @@ -5126,9 +5251,9 @@ } }, "node_modules/vite": { - "version": "4.4.9", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", - "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", + "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/frontend/package.json b/frontend/package.json index 7d43a055..09d561a9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,6 +13,7 @@ "@redux-devtools/extension": "^3.3.0", "axios": "^1.4.0", "formik": "^2.4.2", + "jsonwebtoken": "^9.0.2", "jwt-decode": "^4.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -27,6 +28,8 @@ }, "devDependencies": { "@types/axios": "^0.14.0", + "@types/jsonwebtoken": "^9.0.6", + "@types/jwt-decode": "^3.1.0", "@types/node": "^20.10.6", "@types/react": "^18.2.14", "@types/react-dom": "^18.0.11", diff --git a/frontend/src/components/Header/Header.tsx b/frontend/src/components/Header/Header.tsx index 788d1a1c..e5e0cb27 100644 --- a/frontend/src/components/Header/Header.tsx +++ b/frontend/src/components/Header/Header.tsx @@ -14,10 +14,12 @@ import { logout, AppDispatch } from "../../services/actions/auth"; interface LoginFormProps { isAuthenticated: boolean; + isSuperuser: boolean; } const Header = (props: LoginFormProps) => { const { isAuthenticated } = props; + const { isSuperuser } = props; const navigate = useNavigate(); // const [showFeaturesMenu, setShowFeaturesMenu] = useState(false); // const dropdownRef = useRef(null); @@ -151,6 +153,14 @@ const Header = (props: LoginFormProps) => { > Leave Feedback + {isSuperuser && ( + + Admin Portal + + )} {redirect ? navigate("/") : } @@ -171,6 +181,7 @@ const Header = (props: LoginFormProps) => { const mapStateToProps = (state: RootState) => ({ isAuthenticated: state.auth.isAuthenticated, + isSuperuser: state.auth.isSuperuser, }); const ConnectedLayout = connect(mapStateToProps)(Header); diff --git a/frontend/src/pages/AdminPortal/AdminPortal.tsx b/frontend/src/pages/AdminPortal/AdminPortal.tsx new file mode 100644 index 00000000..57f39527 --- /dev/null +++ b/frontend/src/pages/AdminPortal/AdminPortal.tsx @@ -0,0 +1,13 @@ +//import Welcome from "../../components/Welcome/Welcome.tsx"; +import Layout from "../Layout/Layout"; +// import image from "./OIP.jpeg"; + +function About() { + return ( + +
    +
    + ); +} + +export default About; diff --git a/frontend/src/routes/routes.tsx b/frontend/src/routes/routes.tsx index 691b11d8..938edf03 100644 --- a/frontend/src/routes/routes.tsx +++ b/frontend/src/routes/routes.tsx @@ -1,6 +1,7 @@ import App from "../App"; import RouteError from "../pages/404/404.tsx"; import LoginForm from "../pages/Login/Login.tsx"; +import AdminPortal from "../pages/AdminPortal/AdminPortal.tsx"; import ResetPassword from "../pages/Login/ResetPassword.tsx"; import ResetPasswordConfirm from "../pages/Login/ResetPasswordConfirm.tsx"; import DrugSummary from "../pages/DrugSummary/DrugSummary.tsx"; @@ -48,7 +49,8 @@ const routes = [ { path: "how-to", element: , - },{ + }, + { path: "data-sources", element: , }, @@ -56,6 +58,10 @@ const routes = [ path: "feedback", element: , }, + { + path: "adminportal", + element: , + }, ]; export default routes; diff --git a/frontend/src/services/actions/types.tsx b/frontend/src/services/actions/types.tsx index 5867c811..add0dad9 100644 --- a/frontend/src/services/actions/types.tsx +++ b/frontend/src/services/actions/types.tsx @@ -22,5 +22,6 @@ export interface RootState { auth: { error: any; isAuthenticated: boolean; + isSuperuser: boolean; }; } diff --git a/frontend/src/services/reducers/auth.ts b/frontend/src/services/reducers/auth.ts index 2566194f..5b4fbea9 100644 --- a/frontend/src/services/reducers/auth.ts +++ b/frontend/src/services/reducers/auth.ts @@ -1,3 +1,4 @@ +import { jwtDecode } from 'jwt-decode'; import { LOGIN_SUCCESS, LOGIN_FAIL, @@ -21,6 +22,10 @@ import { } from '../actions/types'; +type TokenClaims = { + is_superuser: boolean; +}; + type ActionType = | { type: typeof LOGIN_SUCCESS; payload: { access: string; refresh: string } } | { type: typeof LOGIN_FAIL; payload: string } @@ -49,6 +54,7 @@ export interface StateType { isAuthenticated: boolean | null; user: string; // error?: string | null; + isSuperuser: boolean | null; } // Initial state with correct types @@ -56,6 +62,7 @@ const initialState: StateType = { access: localStorage.getItem('access'), refresh: localStorage.getItem('refresh'), isAuthenticated: null, + isSuperuser: null, user: "" }; @@ -68,15 +75,18 @@ export default function authReducer(state = initialState, action: ActionType): S } case LOGIN_SUCCESS: case GOOGLE_AUTH_SUCCESS: - case FACEBOOK_AUTH_SUCCESS: + case FACEBOOK_AUTH_SUCCESS:{ localStorage.setItem('access', action.payload.access); localStorage.setItem('refresh', action.payload.refresh); + const decoded: TokenClaims = jwtDecode(action.payload.access); return { ...state, isAuthenticated: true, access: action.payload.access, - refresh: action.payload.refresh - } + refresh: action.payload.refresh, + isSuperuser: decoded.is_superuser + }; + } case SIGNUP_SUCCESS: return { ...state, From 26eb5aa3b1879c999f586f89fce8037e3ae56f6c Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 10 Mar 2024 21:22:52 -0400 Subject: [PATCH 21/23] added email host as a env var --- config/env/env.prod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/env/env.prod b/config/env/env.prod index a82573f0..12b3491a 100644 --- a/config/env/env.prod +++ b/config/env/env.prod @@ -9,4 +9,6 @@ SQL_PASSWORD=set_me SQL_HOST=db SQL_PORT=5432 DATABASE=postgres -LOGIN_REDIRECT_URL= \ No newline at end of file +LOGIN_REDIRECT_URL= +EMAIL_HOST_USER= +EMAIL_HOST_PASSWORD= \ No newline at end of file From ddb378c6bba825b8c33c1efb397ef6b3be87eed8 Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 10 Mar 2024 21:24:08 -0400 Subject: [PATCH 22/23] add EMAIL HOST as env var --- config/env/env.dev | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/env/env.dev b/config/env/env.dev index c9122e82..92f51aee 100644 --- a/config/env/env.dev +++ b/config/env/env.dev @@ -10,4 +10,6 @@ SQL_PORT=5432 DATABASE=postgres LOGIN_REDIRECT_URL= OPENAI_API_KEY= -PINECONE_API_KEY= \ No newline at end of file +PINECONE_API_KEY= +EMAIL_HOST_USER= +EMAIL_HOST_PASSWORD= \ No newline at end of file From 6d26826d6313051c55bdea1bed7a8d024f596a6c Mon Sep 17 00:00:00 2001 From: taichan03 Date: Sun, 10 Mar 2024 23:00:56 -0400 Subject: [PATCH 23/23] production docker compose --- docker-compose.prod.yml | 5 +++-- server/Dockerfile.prod | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index d68a874c..2113abeb 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -12,8 +12,9 @@ services: - "5432:5432" backend: image: balancer-backend - dockerfile: Dockerfile.prod - build: ./server + build: + context: server + dockerfile: Dockerfile.prod ports: - "8000:8000" env_file: diff --git a/server/Dockerfile.prod b/server/Dockerfile.prod index 252546c8..6b91236b 100644 --- a/server/Dockerfile.prod +++ b/server/Dockerfile.prod @@ -1,6 +1,7 @@ # pull official base image FROM python:3.11.4-slim-buster + # set work directory WORKDIR /usr/src/app @@ -17,7 +18,7 @@ COPY ./requirements.txt . RUN pip install -r requirements.txt # copy project -COPY . . +COPY . /usr/src/app # Correct line endings in entrypoint.sh and make it executable RUN sed -i 's/\r$//' entrypoint.sh && chmod +x entrypoint.sh