From 77c1c7e87cc035dda897d20d626407e09f94c2f9 Mon Sep 17 00:00:00 2001 From: Lucas Prins Date: Thu, 1 Jun 2023 06:13:59 +0200 Subject: [PATCH 01/33] Fixed an issue with the magic cards --- ui/src/components/motion/MagicCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/motion/MagicCard.tsx b/ui/src/components/motion/MagicCard.tsx index bfb2464..6d77c14 100644 --- a/ui/src/components/motion/MagicCard.tsx +++ b/ui/src/components/motion/MagicCard.tsx @@ -43,7 +43,7 @@ export function MagicCardWrapper({ children, ...props }: MagicCardWrapper) { document.removeEventListener("mousemove", handleMouseMove); }; } - }, []); + }, [children]); return (
From 47a3e926643988e3929b43c817d2cb607a108894 Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Tue, 6 Jun 2023 13:15:19 +0200 Subject: [PATCH 02/33] page url --- backend/backend/urls.py | 4 +++- backend/functions/scan.py | 10 ++++++++-- backend/playground/views.py | 11 +++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/backend/backend/urls.py b/backend/backend/urls.py index b230544..14656a2 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -23,15 +23,17 @@ from playground.views import Login from playground.views import Logout from playground.views import User +from playground.views import IsSetup urlpatterns = [ #path('admin/', admin.site.urls), path ('api/scan/', Scan.as_view()), - path ('api/setup', Setup.as_view()), + path ('api/setup/', Setup.as_view()), path ('api/setup_registration/', SetupUserRegistration.as_view()), path ('api/registration/',UserRegistration.as_view()), path ('api/login/',Login.as_view()), path ('api/logout/',Logout.as_view()), path ('api/user/',User.as_view()), + path ('api/is_setup/',IsSetup.as_view()), ] diff --git a/backend/functions/scan.py b/backend/functions/scan.py index c6a3930..74fd480 100644 --- a/backend/functions/scan.py +++ b/backend/functions/scan.py @@ -28,7 +28,7 @@ def find_dependencies_in_sboms(name: str, version: [str], exactMatch: bool) -> o if type == 'CycloneDX': components = data['components'] df = pd.json_normalize(components) - cols = ['name', 'version'] + cols = ['name', 'version', 'purl'] df = df[cols] df = df.rename( columns={'name': 'label', 'id': 'license_id', 'url': 'reference_url'}) @@ -36,7 +36,13 @@ def find_dependencies_in_sboms(name: str, version: [str], exactMatch: bool) -> o packages = data['packages'] df = pd.json_normalize(packages) cols = ['name', 'versionInfo'] + externalRefs = pd.json_normalize(packages, record_path='externalRefs') + # get all where referenceType is 'PACKAGE-MANAGER' + purl = externalRefs[externalRefs['referenceType'] == 'purl'] + purl = purl.reset_index(drop=True) df = df[cols] + # add the reference url from purl to df + df['purl'] = purl['referenceLocator'] df = df.rename( columns={'name': 'label', 'versionInfo': 'version'}) else: @@ -57,7 +63,7 @@ def find_dependencies_in_sboms(name: str, version: [str], exactMatch: bool) -> o dockerVersion = v['dockerImage'].split(':')[1] temp = {'name': projectName, 'version': dockerVersion, 'dockerImage': v['dockerImage'], 'sbomFile': v['sbomFile'], - 'results': [{'label': v['label'], 'version': v['version']} for v in + 'results': [{'label': v['label'], 'version': v['version'], 'purl': v['purl']} for v in results.values()]} output.append(temp) diff --git a/backend/playground/views.py b/backend/playground/views.py index 2538fc7..4c8dca4 100644 --- a/backend/playground/views.py +++ b/backend/playground/views.py @@ -51,6 +51,17 @@ def post(self, request): return Response(response_data) +class IsSetup(APIView): + def get(self, request): + # get the key from data/setup_key file + key = RegistrationKey.objects.all().first() + + # if key is not None then setup is complete and return true + if key is not None: + return Response({'is_setup': True}) + else: + return Response({'is_setup': False}) + class SetupUserRegistration(APIView): def post(self, request): User = get_user_model() From b4508c889da72cf614b66a79f01387447df3c2c8 Mon Sep 17 00:00:00 2001 From: Lucas Prins Date: Tue, 6 Jun 2023 13:16:25 +0200 Subject: [PATCH 03/33] update --- .dockerignore | 4 +- .gitignore | 2 +- backend/backend/urls.py | 2 +- backend/data/db.sqlite3 | Bin 196608 -> 200704 bytes backend/data/setup_key | 1 + ui/src/components/_other/scan/ScanResults.tsx | 20 +- ui/src/pages/setup.tsx | 402 ++++++++++-------- ui/src/services/AuthService.ts | 53 +++ ui/src/types/api/api-setup.d.ts | 10 + ui/src/types/dependency.d.ts | 1 + 10 files changed, 306 insertions(+), 189 deletions(-) create mode 100644 backend/data/setup_key create mode 100644 ui/src/types/api/api-setup.d.ts diff --git a/.dockerignore b/.dockerignore index 83f9ce0..01d4456 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,4 +6,6 @@ .gitignore README.md .dockerignore -.git \ No newline at end of file +.git + +/backend/data/setup_key \ No newline at end of file diff --git a/.gitignore b/.gitignore index 03ebf46..216c35f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ *.pyc backend/.idea *.pyc -*.pyc +*.pyc \ No newline at end of file diff --git a/backend/backend/urls.py b/backend/backend/urls.py index b230544..b98d528 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -28,7 +28,7 @@ urlpatterns = [ #path('admin/', admin.site.urls), path ('api/scan/', Scan.as_view()), - path ('api/setup', Setup.as_view()), + path ('api/setup/', Setup.as_view()), path ('api/setup_registration/', SetupUserRegistration.as_view()), path ('api/registration/',UserRegistration.as_view()), path ('api/login/',Login.as_view()), diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index 441a2c28a023aba11068b449a3f1023c6612daf9..189a8217cc58c0a8ee47e83ca403c5b343ebc737 100644 GIT binary patch delta 1696 zcmai!OKjV89LJqUw>FFO*BIMigVC^{wwjvyQQL8#f+TI)Ce6EP+6t}pBTiz+b{=+K zLdqUOVq%A(9Ri#th6dVgDy#=MaA4xfOI(Hof&=0-%7M!co8sJ^xJDe!^)BSbBHfwjLXDfKQQQTbolKZ@O$?2kwU8;4b(F>})-A=@&2t z85@UX>NqT3mjl*u2aBLTxn$R8u2JU&^al9Z!EPP7;&!~^vBfMtQV?abgwqDq`!U8( zFl!%Rbks~PD zLu38Rv&K@sNHSW(aXKos`Ajqrp<;wba1ohUcw7|MrbRXiBV zq|9VZ4tJu383H57NsNYLAm$?}INL3o0#_fc)Jj_Y{w;xFIboVYYjJOSxF5&8IEgVd zwbT#qVQj?XV(S%wRe5$ddCX6+ew^@)}h!Ie?6S9q=3Y0elTU2iHIkyaU=mh98WB zF6yu$ZeGvJN?xuv3+M<$nUm_K$Qx1#9fnw{Roa{>G@2!JKg5b8wCjSwnIgImVoMc7 zrBYQS108}`D74M8T2}G})DAIUk#wnDmDL(*gQ%ztjc=72rixl2@-0&08f~*GHc$&> zv#Lv~q8I9w{yB931px~99ozyp!3EHPJ>h-uH~0jKCqUO_b6W=9jy?{&NBTJM9`577 zdw(AX-uwDE@E+>pz}w!(fw!%Xd`mj=z}t%2+#>_;o8MYbj`mLeYW<-5v__IAF+X0V zv#X*%qMK|$p+ z55>->0=0a@*WkGAS9h$pTn-clX>r{~T(|oz%GEvh@&sI!2|Uftn~$_syTAk5_@EzNW~8re!kOs+}tdT2GKt`qC)RY_XP zMd)nY2sYFNBd&KTI!6hVuS^z$Ez(EGF?MNMVnjUH!sjQ&_~L9Po#m1%vJp&ZMloUv zg>Z6g;bu2mQ0KqaPgY|=;6<5cWnmfTz-I;l-2v2u|PY?#J^ gB&oUlYBRi+N*U5vb|o+He7a;-1n#k6?zZfI0cm0SQ~&?~ delta 245 zcmZozz|+vcGeMg5F#`jG!9)dn#>X2I7RigOU|{EuVc>tse}#WHe;I!_|1AEP&4LMT z{45gO%;uXD^p_;?G4X!`YGN?p|IPo6Q)9Exg!}xehDKHEzwWe`mAA0!6Ng3)GwAR&9@4#kkCsS)JQsI{ODk|ILaDpSY%L{$}La z9`c)U0}C4?e+C182GHg>{^=R~OxYr)y2geIhL%=_W>%)=dZreZ=H>>|pYt=x0+qgJ s;C~NP`jmhBdwC|&37c6S{E?s3z_Oj?0+YPLW+MSk#_c*EnXd2w08ora@&Et; diff --git a/backend/data/setup_key b/backend/data/setup_key new file mode 100644 index 0000000..3dd43fb --- /dev/null +++ b/backend/data/setup_key @@ -0,0 +1 @@ +lucaslucaslucas \ No newline at end of file diff --git a/ui/src/components/_other/scan/ScanResults.tsx b/ui/src/components/_other/scan/ScanResults.tsx index 225c618..d02c358 100644 --- a/ui/src/components/_other/scan/ScanResults.tsx +++ b/ui/src/components/_other/scan/ScanResults.tsx @@ -53,7 +53,7 @@ function ScanResults({ results, open, setOpen }: ScanResultsProps) { animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.9 }} transition={{ duration: 0.3, ease: "easeInOut" }} - className={`no-scrollbar fixed left-[5%] lg:left-[25%] top-[10%] z-[60] flex max-h-[80%] flex-col gap-8 overflow-y-scroll rounded-lg border border-white-8 bg-gray-0 p-8 pt-0 drop-shadow-2xl w-[90%] lg:w-1/2`} + className={`no-scrollbar fixed left-[5%] top-[10%] z-[60] flex max-h-[80%] w-[90%] flex-col gap-8 overflow-y-scroll rounded-lg border border-white-8 bg-gray-0 p-8 pt-0 drop-shadow-2xl lg:left-[25%] lg:w-1/2`} >
Search Results @@ -91,7 +91,7 @@ function ScanResultProject({ project }: { project: Project }) { return ( <> -
+
- )} - - )} - -
- - ); -} - -export default VersionGuards; diff --git a/ui/src/components/input/TextField.tsx b/ui/src/components/input/TextField.tsx index b51a7ac..2f7cd5f 100644 --- a/ui/src/components/input/TextField.tsx +++ b/ui/src/components/input/TextField.tsx @@ -52,9 +52,8 @@ interface TextFieldErrorProps extends ErrorMessageProps {} export function TextFieldError({ ...props }: TextFieldErrorProps) { return ( -
{msg}
} - /> + + + ); } diff --git a/ui/src/components/navigation/cmdk/pages/Home.tsx b/ui/src/components/navigation/cmdk/pages/Home.tsx index 6121719..786ee5e 100644 --- a/ui/src/components/navigation/cmdk/pages/Home.tsx +++ b/ui/src/components/navigation/cmdk/pages/Home.tsx @@ -1,8 +1,15 @@ import { Command } from "cmdk"; import Item from "../CMDKItem"; -import { ProjectsIcon, PlusIcon, TeamsIcon, DocsIcon, FeedbackIcon } from "../Icons"; +import { + ProjectsIcon, + PlusIcon, + TeamsIcon, + DocsIcon, + FeedbackIcon, +} from "../Icons"; import { useUserContext } from "@/state/User"; import { IconLogout } from "@/components/_other/Icons"; +import { useRouter } from "next/router"; type HomeProps = { searchDataSources: Function; @@ -10,21 +17,26 @@ type HomeProps = { function Home({ searchDataSources }: HomeProps) { const { state: userState, dispatch: userDispatch } = useUserContext(); - + const router = useRouter(); + return ( <> - - searchDataSources()}> + + searchDataSources()}> Search Data Sources... - + { + router.push("/data-sources/new"); + }} + > Add Data Source - - + + Search Users... @@ -33,12 +45,20 @@ function Home({ searchDataSources }: HomeProps) { Create New User - - window.open("https://github.com/HR-Project-D/dependify")}> + + + window.open("https://github.com/HR-Project-D/dependify") + } + > View Documentation - window.open("https://github.com/HR-Project-D/dependify/issues")}> + + window.open("https://github.com/HR-Project-D/dependify/issues") + } + > Report an Issue diff --git a/ui/src/pages/data-sources/new.tsx b/ui/src/pages/data-sources/new.tsx index 6c86aa4..394ed12 100644 --- a/ui/src/pages/data-sources/new.tsx +++ b/ui/src/pages/data-sources/new.tsx @@ -1,9 +1,188 @@ +import { IconSpinner } from "@/components/_other/Icons"; import Layout from "@/components/_other/Layout"; +import { Button } from "@/components/input/Button"; +import { TextField, TextFieldError } from "@/components/input/TextField"; +import BodyBase from "@/components/text/BodyBase"; +import BodyLarge from "@/components/text/BodyLarge"; +import TitleLarge from "@/components/text/TitleLarge"; +import { Formik, Form } from "formik"; +import { AnimatePresence, MotionConfig, motion } from "framer-motion"; +import { useState } from "react"; +import { formAnimationProps } from "../setup"; export default function Page() { + const [step, setStep] = useState<"configure" | "add-key" | "clone">( + "configure" + ); + const [SSHKey, setSSHKey] = useState(""); + + async function handleAddDataSource(values: { label: string; url: string }) { + // TODO: Add data source + + setStep("add-key"); + } + return ( -

...

+
+
+
+ Add a new data source + + Add a new data source by filling in the form below and clicking + the "Add" button. After confirming the data source you will need + to add the SSH key that is shown to your GitHub repository as a + deploy key. + +
+
+ +
+ + + + + {step === "configure" && ( + { + await new Promise((r) => setTimeout(r, 3000)); + handleAddDataSource(values); + }} + validateOnBlur={false} + validateOnChange={false} + > + {({ values, isValidating, isSubmitting }) => ( +
+
+ { + if (value === "") { + return "Label is required"; + } + + if (!/^[a-zA-Z0-9 -]*$/.test(value)) { + return "Label can only contain letters, numbers, spaces and hyphens"; + } + + if (value.length < 3) { + return "Label must be at least 3 characters"; + } + + if (value.length > 32) { + return "Label must be less than 32 characters"; + } + }} + style="iconless" + type="text" + placeholder="Label" + /> + + +
+
+ +
+
+ )} +
+ )} + + {step === "add-key" && ( + +
+
+ + Add the following SSH key to your GitHub repository as a + deploy key. + + SHA256: +
+
+ + +
+ )} +
+
+
+
); } diff --git a/ui/src/pages/index.tsx b/ui/src/pages/index.tsx index 49a100b..1f7519f 100644 --- a/ui/src/pages/index.tsx +++ b/ui/src/pages/index.tsx @@ -10,9 +10,10 @@ import withAuth from "@/components/_other/auth/WithAuth"; import { MagicCardWrapper } from "@/components/motion/MagicCard"; import ComponentWrapper from "@/components/_other/auth/ComponentWrapper"; import { useSession } from "@/utils/session"; +import { useRouter } from "next/router"; function Page() { - //const session = useSession(); + const router = useRouter(); return ( @@ -38,19 +39,23 @@ function Page() { } + image="/images/dashboard-datasources.png" action={{ text: "Add source", - onClick: () => {}, + onClick: () => { + router.push("/data-sources"); + }, }} /> } + image="/images/dashboard-scan.png" action={{ text: "Scan", - onClick: () => {}, + onClick: () => { + router.push("/scans"); + }, }} /> {/* void; @@ -89,7 +94,7 @@ export function GridItem({
diff --git a/ui/src/pages/setup.tsx b/ui/src/pages/setup.tsx index 0101fe2..4fe7762 100644 --- a/ui/src/pages/setup.tsx +++ b/ui/src/pages/setup.tsx @@ -7,22 +7,22 @@ import { useState } from "react"; import { AuthService } from "@/services/AuthService"; import Link from "next/link"; +export const textAnimationProps = { + initial: { opacity: 0, y: 20 }, + animate: { opacity: 1, y: 0 }, + exit: { opacity: 0, y: -20 }, +} as const; + +export const formAnimationProps = { + initial: { opacity: 0, y: 20 }, + animate: { opacity: 1, y: 0 }, + exit: { opacity: 0, y: -20 }, +} as const; + export default function Page() { const [currentStep, setCurrentStep] = useState(0); const [registrationKey, setRegistrationKey] = useState(""); - const textAnimationProps = { - initial: { opacity: 0, y: 20 }, - animate: { opacity: 1, y: 0 }, - exit: { opacity: 0, y: -20 }, - } as const; - - const formAnimationProps = { - initial: { opacity: 0, y: 20 }, - animate: { opacity: 1, y: 0 }, - exit: { opacity: 0, y: -20 }, - } as const; - const steps = [ { text: "Welcome", From 7bb5ec0b9fd3b2fc9099343b7ce3599e44562b16 Mon Sep 17 00:00:00 2001 From: Lucas Prins Date: Mon, 12 Jun 2023 16:19:48 +0200 Subject: [PATCH 07/33] csv --- backend/data/db.sqlite3 | Bin 204800 -> 204800 bytes ui/package-lock.json | 30 +++++++++++ ui/package.json | 2 + ui/src/components/_other/scan/ScanResults.tsx | 50 +++++++++++++----- ui/src/components/navigation/Header.tsx | 4 +- ui/src/components/pdf/PDFDocument.tsx | 40 ++++++++++++++ ui/src/pages/index.tsx | 2 +- 7 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 ui/src/components/pdf/PDFDocument.tsx diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index 6ba187f34f4be8e14752f07399e2578f41eb6b15..11e2e51948b498faeff4d29186972329d16e8490 100644 GIT binary patch delta 387 zcmZoTz|(MmXM!{%*F+g-RxSp;Xp@a8o90iJSfIkhWx3gA0V9_}X|kb3fu*I9ag{-m zL3WC;2bL^_^v8x#G1n`+y8Jk)e8R{7snV1@wY}1uE__cZ1Ms+%g3suyda|@)YmP@&?`73 r(>T>K-@iP<%rrM8EHvE0C?Gy5$H>>s+d0Imyd2Y6upn9{z$^d&+8TFJ delta 563 zcmaixyKmEA0K}U>J5-hFfLLHiQ6*q-WPi@*7c92hCNZ%S+fAHUsvC8k0?v3 z_8;K!2hfS38+6Fpor!^|3~bEIEJQ-xkh> zQe}puFu<&;e+us(A{Yx876)Yl0|Y~_emy9D|GB&?(w_Rpg;+%D^QF?0an6qSx9EBR?haGZ%XG1H+3^QGtJe@ z-^H)U{hJNs=4!9>4OyN&eX;g6?k=vfE6zKCG;8JqPEkGdDA8&oxyLscqH<8x1!WRf zhl!8{8Ay*CkxDHV5iwW9)XWJh7P?Ys0K=GgUPBkjww&-;*rXg|2}vE=kRA~}KPPAq zNKB*RQ4Y?}@ha-b^#e_9o2^ce@XaXk#ngVI>LVVCb@^Bp)w&@Hn$p)fzc;A`+*pcD zrbUC945ix@&BNwvG(ub0$S1jen$$cm)ZK1=)Kiqid)Dr_wq>b=0.10.0" } }, + "node_modules/react-csv": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz", + "integrity": "sha512-RG5hOcZKZFigIGE8LxIEV/OgS1vigFQT4EkaHeKgyuCbUAu9Nbd/1RYq++bJcJJ9VOqO/n9TZRADsXNDR4VEpw==" + }, "node_modules/react-dom": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", @@ -8270,6 +8286,15 @@ "csstype": "^3.0.2" } }, + "@types/react-csv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@types/react-csv/-/react-csv-1.1.3.tgz", + "integrity": "sha512-dkEdyRvRpygSnNg4cyzYWSUjukIQ5lAtXJwc7BqyUfzww/Cv2dcAFGYd+sWTFpGiDNZMVPp6vVPLcAPvJID8Kg==", + "dev": true, + "requires": { + "@types/react": "*" + } + }, "@types/react-dom": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.0.tgz", @@ -10602,6 +10627,11 @@ "loose-envify": "^1.1.0" } }, + "react-csv": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz", + "integrity": "sha512-RG5hOcZKZFigIGE8LxIEV/OgS1vigFQT4EkaHeKgyuCbUAu9Nbd/1RYq++bJcJJ9VOqO/n9TZRADsXNDR4VEpw==" + }, "react-dom": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", diff --git a/ui/package.json b/ui/package.json index 13a6def..59e83b9 100644 --- a/ui/package.json +++ b/ui/package.json @@ -25,12 +25,14 @@ "next": "13.3.1", "next-themes": "^0.2.1", "react": "18.2.0", + "react-csv": "^2.2.2", "react-dom": "18.2.0", "react-use-measure": "^2.1.1", "sharp": "^0.32.1", "typescript": "5.0.4" }, "devDependencies": { + "@types/react-csv": "^1.1.3", "autoprefixer": "^10.4.14", "postcss": "^8.4.23", "prettier": "^2.8.8", diff --git a/ui/src/components/_other/scan/ScanResults.tsx b/ui/src/components/_other/scan/ScanResults.tsx index 9ee7368..1d39a7e 100644 --- a/ui/src/components/_other/scan/ScanResults.tsx +++ b/ui/src/components/_other/scan/ScanResults.tsx @@ -7,9 +7,26 @@ import * as Dialog from "@radix-ui/react-dialog"; import { Button } from "@/components/input/Button"; import { Project } from "@/types/scan"; import Body from "@/components/text/Body"; -import BodyBase from "@/components/text/BodyBase"; -import Tooltip from "@/components/status_info/Tooltip"; import Subtitle from "@/components/text/Subtitle"; +import { CSVLink } from "react-csv"; + +function convertResponseToTable(response: APIResponseScan) { + let table = []; + for (let project of response.data) { + for (let result of project.results) { + table.push({ + "Project Name": project.name, + "Project Version": project.version, + "Docker Image": project.dockerImage, + "SBOM File": project.sbomFile, + "Package Name": result.label, + "Package Version": result.version, + "Package URL": result.purl, + }); + } + } + return table; +} type ScanResultsProps = { results: APIResponseScan; @@ -20,9 +37,6 @@ type ScanResultsProps = { function ScanResults({ results, open, setOpen }: ScanResultsProps) { const [isExpanded, setIsExpanded] = useState(false); - // console.log(" RESULTS ") - // console.log( results); - return ( { @@ -57,14 +71,24 @@ function ScanResults({ results, open, setOpen }: ScanResultsProps) { >
Search Results - +
+ + + + +
diff --git a/ui/src/components/navigation/Header.tsx b/ui/src/components/navigation/Header.tsx index 0105bed..c0a1048 100644 --- a/ui/src/components/navigation/Header.tsx +++ b/ui/src/components/navigation/Header.tsx @@ -84,13 +84,13 @@ function NavDropdown() { - +{/* router.push("/settings")}> Settings - + */} diff --git a/ui/src/components/pdf/PDFDocument.tsx b/ui/src/components/pdf/PDFDocument.tsx new file mode 100644 index 0000000..7a2b033 --- /dev/null +++ b/ui/src/components/pdf/PDFDocument.tsx @@ -0,0 +1,40 @@ +import React from 'react'; +import { PDFDownloadLink, Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer'; + +const styles = StyleSheet.create({ + page: { + flexDirection: 'row', + backgroundColor: '#ffffff', + }, + table: { + flexGrow: 1, + margin: 10, + }, + tableRow: { + flexDirection: 'row', + }, + tableCell: { + flex: 1, + padding: 5, + }, +}); + +const PDFDocument = ({ data }: { data: any}) => ( + + + + {data.map((row: any, index: any) => ( + + {row.map((cell: any, cellIndex: any) => ( + + {cell} + + ))} + + ))} + + + +); + +export default PDFDocument; diff --git a/ui/src/pages/index.tsx b/ui/src/pages/index.tsx index 1f7519f..a7c600b 100644 --- a/ui/src/pages/index.tsx +++ b/ui/src/pages/index.tsx @@ -90,7 +90,7 @@ export function GridItem({ }; }) { return ( -
  • +
  • Date: Tue, 13 Jun 2023 15:21:02 +0200 Subject: [PATCH 08/33] updates --- backend/backend/settings.py | 2 +- backend/playground/apps.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/backend/backend/settings.py b/backend/backend/settings.py index 728c01a..243563e 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -39,7 +39,7 @@ 'django.contrib.staticfiles', 'corsheaders', 'rest_framework', - 'playground.apps.PlaygroundConfig' + 'playground' ] MIDDLEWARE = [ diff --git a/backend/playground/apps.py b/backend/playground/apps.py index c9c66d0..f7944e5 100644 --- a/backend/playground/apps.py +++ b/backend/playground/apps.py @@ -1,3 +1,5 @@ +import os + from django.apps import AppConfig @@ -7,7 +9,7 @@ class PlaygroundConfig(AppConfig): def ready(self): print('ready') - from git import Repo + from git import Repo, RemoteProgress import paramiko from playground.models import DataSource @@ -22,7 +24,15 @@ def clone_datasource(name): env={'GIT_SSH_COMMAND': f'ssh -i data/keys/{name}_private_key.pem'}) except: # TODO: fetch from remote if repo already exists - pass + bare_repo = Repo.init(repo_path) + origin = bare_repo.remote(name='origin') + if origin.exists(): + bare_repo.delete_remote('origin') + origin = bare_repo.create_remote('origin', repo_url) + with bare_repo.git.custom_environment(GIT_SSH_COMMAND=f'ssh -i data/keys/{name}_private_key.pem'): + origin.fetch() + origin.pull() + def fetch_datasource(): pass From 501416f238378af3f242696407fa4d8360b57dbd Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Tue, 13 Jun 2023 19:10:05 +0200 Subject: [PATCH 09/33] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e602e7c..cc1c384 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,7 @@ COPY ./backend/requirements.txt ./ # Copy the Django source code COPY ./backend . - +RUN apt-get update && apt-get install -y git RUN pip3 install -r requirements.txt From 61ebbc092a6b24a379c5e7efdeaccc5e3c2c453a Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:49:32 +0200 Subject: [PATCH 10/33] Update apps.py --- backend/playground/apps.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/backend/playground/apps.py b/backend/playground/apps.py index f7944e5..2f71063 100644 --- a/backend/playground/apps.py +++ b/backend/playground/apps.py @@ -1,5 +1,6 @@ import os +import git from django.apps import AppConfig @@ -24,14 +25,18 @@ def clone_datasource(name): env={'GIT_SSH_COMMAND': f'ssh -i data/keys/{name}_private_key.pem'}) except: # TODO: fetch from remote if repo already exists - bare_repo = Repo.init(repo_path) - origin = bare_repo.remote(name='origin') - if origin.exists(): - bare_repo.delete_remote('origin') - origin = bare_repo.create_remote('origin', repo_url) - with bare_repo.git.custom_environment(GIT_SSH_COMMAND=f'ssh -i data/keys/{name}_private_key.pem'): - origin.fetch() - origin.pull() + bare_repo = Repo(repo_path) + origin = bare_repo.remote('origin') + + assert origin.exists() + origin.fetch() + # origin = await bare_repo.remote(name='origin') + # if origin.exists(): + # bare_repo.delete_remote('origin') + # origin = bare_repo.create_remote('origin', repo_url) + # with bare_repo.git.custom_environment(GIT_SSH_COMMAND=f'ssh -i data/keys/{name}_private_key.pem'): + # origin.fetch() + # origin.pull() def fetch_datasource(): From 9bf7be1d1b6bc1d598d8888d720cf06ba3881496 Mon Sep 17 00:00:00 2001 From: Lucas Prins Date: Wed, 14 Jun 2023 13:49:47 +0200 Subject: [PATCH 11/33] asd --- ui/src/components/_other/scan/ScanForm.tsx | 15 ++++++--------- ui/src/utils/query.ts | 3 +-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ui/src/components/_other/scan/ScanForm.tsx b/ui/src/components/_other/scan/ScanForm.tsx index 89383e8..24a83f3 100644 --- a/ui/src/components/_other/scan/ScanForm.tsx +++ b/ui/src/components/_other/scan/ScanForm.tsx @@ -56,18 +56,15 @@ function ScanForm({ setSearchResults, handleSubmit }: Props) { } useEffect(() => { - window.addEventListener("importQuery", (event: CustomEventInit) => { + function handleImportQuery(event: CustomEventInit) { importQuery(event.detail as Query); - }); + } + + window.addEventListener("importQuery", handleImportQuery); return () => { - window.removeEventListener( - "importQuery", - (event: CustomEventInit) => { - importQuery(event.detail as Query); - } - ); - }; + window.removeEventListener("importQuery", handleImportQuery); + } }, []); return ( diff --git a/ui/src/utils/query.ts b/ui/src/utils/query.ts index 8ba7f2b..cf9ec0f 100644 --- a/ui/src/utils/query.ts +++ b/ui/src/utils/query.ts @@ -47,8 +47,6 @@ export function addRecentQuery(query: Query) { localStorage.getItem("dependify-recentQueries") || "[]" ); - // only keep the last 10 queries - if (recentQueries.length > 9) { recentQueries.pop(); } @@ -58,6 +56,7 @@ export function addRecentQuery(query: Query) { "dependify-recentQueries", JSON.stringify(recentQueries) ); + window.dispatchEvent(new Event("storage")); } From 89cfa0495c39a83ddd065811843c5ace3c3f1754 Mon Sep 17 00:00:00 2001 From: Lucas Prins Date: Wed, 14 Jun 2023 13:51:11 +0200 Subject: [PATCH 12/33] Delete PDFDocument.tsx --- ui/src/components/pdf/PDFDocument.tsx | 40 --------------------------- 1 file changed, 40 deletions(-) delete mode 100644 ui/src/components/pdf/PDFDocument.tsx diff --git a/ui/src/components/pdf/PDFDocument.tsx b/ui/src/components/pdf/PDFDocument.tsx deleted file mode 100644 index 7a2b033..0000000 --- a/ui/src/components/pdf/PDFDocument.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import { PDFDownloadLink, Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer'; - -const styles = StyleSheet.create({ - page: { - flexDirection: 'row', - backgroundColor: '#ffffff', - }, - table: { - flexGrow: 1, - margin: 10, - }, - tableRow: { - flexDirection: 'row', - }, - tableCell: { - flex: 1, - padding: 5, - }, -}); - -const PDFDocument = ({ data }: { data: any}) => ( - - - - {data.map((row: any, index: any) => ( - - {row.map((cell: any, cellIndex: any) => ( - - {cell} - - ))} - - ))} - - - -); - -export default PDFDocument; From 00fd8280994f41edeb3fdd7f1a834895fd78e173 Mon Sep 17 00:00:00 2001 From: Lucas Prins Date: Wed, 14 Jun 2023 14:05:09 +0200 Subject: [PATCH 13/33] Update apps.py --- backend/playground/apps.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/playground/apps.py b/backend/playground/apps.py index 2f71063..a4cd3cf 100644 --- a/backend/playground/apps.py +++ b/backend/playground/apps.py @@ -30,6 +30,7 @@ def clone_datasource(name): assert origin.exists() origin.fetch() + origin.pull() # origin = await bare_repo.remote(name='origin') # if origin.exists(): # bare_repo.delete_remote('origin') From a9a2bbd9c6b07ba92cadd9524821cdf03239a92b Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Wed, 14 Jun 2023 14:07:29 +0200 Subject: [PATCH 14/33] test --- backend/data/db.sqlite3 | Bin 204800 -> 204800 bytes backend/playground/apps.py | 24 ++++++++---------------- backend/playground/views.py | 3 +++ 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index 11e2e51948b498faeff4d29186972329d16e8490..85be81e4f53fd5412ff7d336422db39ec5ab05d3 100644 GIT binary patch delta 66 zcmZoTz|(MmXM!{%_e2?IR&EBpWX8sn))dCp6sD~y%yap<`CJ(oc^Vja8h9EuD=L)m WY;TZZKFY|#z`(eByQduUc18eTBN31Q delta 66 zcmZoTz|(MmXM!{%*F+g-RxSp;Xp_d2))dCp6sD~y%yap<85kItcp4b^TzMKcD=L)m WY;TZZKFY|_Y{AIB-BXTvJ0k#E2@y2_ diff --git a/backend/playground/apps.py b/backend/playground/apps.py index 2f71063..e34c730 100644 --- a/backend/playground/apps.py +++ b/backend/playground/apps.py @@ -16,9 +16,9 @@ def ready(self): def clone_datasource(name): repo_path = f'./data/sboms/{name}' - datasource = DataSource.objects.get(name=name) - repo_url = datasource.url - key = datasource.key + current_datasource = DataSource.objects.get(name=name) + repo_url = current_datasource.url + key = current_datasource.key private_key = paramiko.RSAKey.from_private_key_file(f"data/keys/{name}_private_key.pem") try: repo = Repo.clone_from(repo_url, repo_path, @@ -29,17 +29,9 @@ def clone_datasource(name): origin = bare_repo.remote('origin') assert origin.exists() - origin.fetch() - # origin = await bare_repo.remote(name='origin') - # if origin.exists(): - # bare_repo.delete_remote('origin') - # origin = bare_repo.create_remote('origin', repo_url) - # with bare_repo.git.custom_environment(GIT_SSH_COMMAND=f'ssh -i data/keys/{name}_private_key.pem'): - # origin.fetch() - # origin.pull() + ssh_cmd = f'ssh -i data/keys/{name}_private_key.pem' + with bare_repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd): + origin.fetch() - - def fetch_datasource(): - pass - - clone_datasource('pw-demo-sboms') + for datasource in DataSource.objects.all(): + clone_datasource(datasource.name) diff --git a/backend/playground/views.py b/backend/playground/views.py index 12d530e..984b3b9 100644 --- a/backend/playground/views.py +++ b/backend/playground/views.py @@ -198,6 +198,9 @@ def post(self, request): datasource = DataSource.objects.create(name=name, description=description, url=url, key=public_key) datasource.save() + repo_path = f'./data/sboms/{name}' + repo = Repo.clone_from(url, repo_path, + env={'GIT_SSH_COMMAND': f'ssh -i data/keys/{name}_private_key.pem'}) return Response({'message': 'Datasource created successfully.','public_key':public_key}) From 2e1c352a0602bf14349c0b76352f46280b6ed375 Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:09:42 +0200 Subject: [PATCH 15/33] Update Dockerfile --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index cc1c384..d0915f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,8 +52,12 @@ COPY ./backend/requirements.txt ./ # Copy the Django source code COPY ./backend . +RUN apt-get update && apt-get install -y openssh-client + RUN apt-get update && apt-get install -y git +RUN ssh-keygen -o -t rsa + RUN pip3 install -r requirements.txt VOLUME /app/data From 0d5553f722e7361b8e2d3d14179f2898beb2b0f3 Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:16:11 +0200 Subject: [PATCH 16/33] Update apps.py --- backend/playground/apps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/playground/apps.py b/backend/playground/apps.py index c5ebb98..e6822cb 100644 --- a/backend/playground/apps.py +++ b/backend/playground/apps.py @@ -39,5 +39,5 @@ def clone_datasource(name): # origin.fetch() # origin.pull() - for datasource in DataSource.objects.all(): - clone_datasource(datasource.name) + # for datasource in DataSource.objects.all(): + # clone_datasource(datasource.name) From 52392163a74bfc8b9b534a87d922b0e45d60bb9f Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Wed, 14 Jun 2023 23:24:33 +0200 Subject: [PATCH 17/33] eindelijk goed in de hemel heeft mij zien smeken om vrijheid en hij zei okay --- Dockerfile | 2 - backend/backend/urls.py | 3 + backend/data/db.sqlite3 | Bin 204800 -> 204800 bytes .../data/keys/pw-demo-sboms_private_key.pem | 27 --------- backend/data/keys/sboms_private_key | 49 +++++++++++++++++ backend/data/keys/sboms_private_key.pub | 1 + backend/functions/scan.py | 10 ++-- backend/playground/apps.py | 47 +++++++--------- backend/playground/views.py | 52 ++++++++++++++---- 9 files changed, 120 insertions(+), 71 deletions(-) delete mode 100644 backend/data/keys/pw-demo-sboms_private_key.pem create mode 100644 backend/data/keys/sboms_private_key create mode 100644 backend/data/keys/sboms_private_key.pub diff --git a/Dockerfile b/Dockerfile index d0915f3..3a3cbb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,8 +56,6 @@ RUN apt-get update && apt-get install -y openssh-client RUN apt-get update && apt-get install -y git -RUN ssh-keygen -o -t rsa - RUN pip3 install -r requirements.txt VOLUME /app/data diff --git a/backend/backend/urls.py b/backend/backend/urls.py index 1471591..de71218 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -25,6 +25,7 @@ from playground.views import User from playground.views import IsSetup from playground.views import Generate_datasource +from playground.views import Confirm_datasource urlpatterns = [ #path('admin/', admin.site.urls), @@ -37,4 +38,6 @@ path ('api/user/',User.as_view()), path ('api/is_setup/',IsSetup.as_view()), path ('api/generate_datasource/',Generate_datasource.as_view()), + path ('api/confirm_datasource/',Confirm_datasource.as_view()), + ] diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index 85be81e4f53fd5412ff7d336422db39ec5ab05d3..23a6f513aae42ae39e2272eb8019cf74592c94ad 100644 GIT binary patch delta 828 zcmWN|xsKyx007`*vl0l>Y_-LX#7wn9*6_zid`PUcPJG0P&m4A~3ZHQt|FPrSZZZ-G z3L2=UW8UOKa_~y^M`S8u(KfU}geEstS`0W7<|9t?j zK7ampFc=KSp9bSkfA_NH(GTFS-@pE9@b>K& z7j6oR=fCbo*w;l7J?4dT|NP(G=-qA38eBw~IA30N3V>&A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-BPr&%RN3Rq+%hSQVDaVGqoOz27%(55fH_5yC6kn zgbR2AIW3YU$vIcx6C7qz2AnGCOVg9}F-tli$$gN-{Yf|G<(X}GEtd3@ z#tUIw)tF)@ei*rgny28*_GxS7WE7!|D-|d^COW?3C~uaZWm(!4sptuIE%JlG@ZZ6= zKZL(FS6CI@dmm=``^wF;Dvaw7pNksz_0Pxq@BYV8GrHznBTnj)*?eEm&oCjae7rf1 zEpb;e?Gh9#Hcj^x5VkCYKulenA`F}Z0%Vs(y&;tyVmH{{yegtUJ1y_I0ZGur)K#5%NN;w?4syaUiXy19BBNA3 zTGFC~Q5%2->M}7Z)SRSDWa^CX~pWwmI*ax&aWK(pl)E)GL*vAQ40W2 zOi^O=Ipg6KL?G;m#RReApISnzJ`Xc5`T0Q&(PFx4{2kvJr;?Yk>1p1TP~#g)SY5{x pSwCh~({IU@Ywjr=itMCL+cRa9$7AanlxV4XGPeB+1dE19{{v6L4RHVf diff --git a/backend/data/keys/pw-demo-sboms_private_key.pem b/backend/data/keys/pw-demo-sboms_private_key.pem deleted file mode 100644 index ab99ec3..0000000 --- a/backend/data/keys/pw-demo-sboms_private_key.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAl2e8wnD4llxHRcrNyuiB3h+oe4lCWTMehw7lVCh00GnmZWD0 -8V7meYAZs0N3b1dejS7SIXa9M7iqnKhDsqE8HVov61TQvBW0Vd3ChTC2XW9hjfaL -Jtnh4tqC4c3hsa9C5NmhDt1F4QsepR8prmNU128M6YN4XyUhlaXheWTotV8U2Dkq -sKHCY6TKey5JTP2zJ/Avi1Oc4rRCs/CRj35c6odCtI3hkqN+XSTDLkjWO7vRmsh3 -eRv1/FHtjpbserVpo8BzDcX44sZE1OKpxbiUojE5QdKSvrLfzmY3YIW+UaJR5xcZ -b2KOoYcw2zKc5lo09DxvHN6JzTTD6ZS3CmbSyQIDAQABAoIBAAmpYekmEKT2tUkh -vpVr1iq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eeIkWDbreP5L7yEUB4bOtylcf7gbzEpE+JbjLL -QitzrQQNRb0K1BOvLhpUKJgVFlZ4IzZuzEsOhVxTwStUrS63U8G6Sz9GuFthmjRR -3tM+6ca/1evM4Vrhc1SP9FWg/VwC7ZsxCqnY8nMRzJNaVOib+DI= ------END RSA PRIVATE KEY----- diff --git a/backend/data/keys/sboms_private_key b/backend/data/keys/sboms_private_key new file mode 100644 index 0000000..85feb94 --- /dev/null +++ b/backend/data/keys/sboms_private_key @@ -0,0 +1,49 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn +NhAAAAAwEAAQAAAgEA4e1dxLZ1DP5pDl/dMTAX4aZpr6xsGgwPJqYE+vJvltGnnFm2DkqI +mrKJTjjgqwNQ4e9kevPyGNdTXV7hO7oeBthLl1ZvNzQiCOYmrcNmwqmQID5z9SxzYwN/TZ +eZLMY1YUCe+y3bP/T2G9AMjE034WRfi6xb7RsHn5yP3M1ichPjH3IiWrHRi/u0G3XriVmF +6YylQBWxdplfExQ/IQH+DFupXPpoS+97jFo3j21VJNHnTC+4VzRIQ4PeDkLN44+vYsXMn7 +fNysL8Jb3sNKKN8zImW5AoSL8SMppYPLw+oULXsfqrvNYz71rM7eH7pm7kkDFqtj7Ekf6l +C1v26FaxXP0+8dKd39fwfs/v+XjdyBrV/YImLVX9B4B2ivjDwUW9rfdTjIWiVejuDbR/7N +mXN1PH8Pf8spb08TWfeJg3VvI81tdK4aRDI62GBqfADavVtkYbVaJMx0u7pCPfcuZGHbQP +shZkGj82O3B7P2DMf3uIUDWc+P9a3Ub8VKjJdOEdqAFBKJW78kprZr9y95hJvv/G5T7zya +RZ3Hf8OlJ/hB8gaib7neoRUVSuIGiOhsfPDNmVmpGLMGbAs7Iyrmw/cl/UX5CgnfBqIX8/ +hrOrZxKG1eCZ/qAKRWgFa7nUzhPHJvY+Ea+wqpaNsFT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vcVH6XuF/rX90wkc3jxmnTQ9zATiA +Gz4JLI5I+WJROzAAABAQDo6k0FKNMalQ1Q7HThneyDGQOskzMqMAK5u9OHTaM+hgSCuNpK +J0KXFGQByDAzIy0OYlxSFCVSqKyNPl7lzGSRZsczvfuy8VGBqRBSumsYFUkWfGn8Br5Ax3 +9OlWvqkifJaIPaxDzjZ9soua0iiEz79zCrNVTVZJyphiYutyYxBpGOSbbWf7ZWdswNb7Zw +V38kmP3CyMm2nA7sYixvUf2CB5LNv1nP30/uL69q8QMjZ1e7sDV6l2i3fyyOf7v2P0AOFn +Fuu+fxhaMffvnlNBIqkikV7uiNImSwXtyxwolnqvd71azdwvk/bvqwUvNEU4rnrScUoMuA +xdtr3PT34sKvAAAAFWphbWllQERFU0tUT1AtTDJGVEROQgECAwQF +-----END OPENSSH PRIVATE KEY----- diff --git a/backend/data/keys/sboms_private_key.pub b/backend/data/keys/sboms_private_key.pub new file mode 100644 index 0000000..97762fb --- /dev/null +++ b/backend/data/keys/sboms_private_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDh7V3EtnUM/mkOX90xMBfhpmmvrGwaDA8mpgT68m+W0aecWbYOSoiasolOOOCrA1Dh72R68/IY11NdXuE7uh4G2EuXVm83NCII5iatw2bCqZAgPnP1LHNjA39Nl5ksxjVhQJ77Lds/9PYb0AyMTTfhZF+LrFvtGwefnI/czWJyE+MfciJasdGL+7QbdeuJWYXpjKVAFbF2mV8TFD8hAf4MW6lc+mhL73uMWjePbVUk0edML7hXNEhDg94OQs3jj69ixcyft83Kwvwlvew0oo3zMiZbkChIvxIymlg8vD6hQtex+qu81jPvWszt4fumbuSQMWq2PsSR/qULW/boVrFc/T7x0p3f1/B+z+/5eN3IGtX9giYtVf0HgHaK+MPBRb2t91OMhaJV6O4NtH/s2Zc3U8fw9/yylvTxNZ94mDdW8jzW10rhpEMjrYYGp8ANq9W2RhtVokzHS7ukI99y5kYdtA+yFmQaPzY7cHs/YMx/e4hQNZz4/1rdRvxUqMl04R2oAUEolbvySmtmv3L3mEm+/8blPvPJpFncd/w6Un+EHyBqJvud6hFRVK4gaI6Gx88M2ZWakYswZsCzsjKubD9yX9RfkKCd8Gohfz+Gs6tnEobV4Jn+oApFaAVrudTOE8cm9j4Rr7Cqlo2wVPLvZvaucfO+bDoI75w6PvtI1UwdXQ== jamie@DESKTOP-L2FTDNB diff --git a/backend/functions/scan.py b/backend/functions/scan.py index 74fd480..f3e03af 100644 --- a/backend/functions/scan.py +++ b/backend/functions/scan.py @@ -1,6 +1,6 @@ import os import json - +import glob import numpy as np import pandas as pd import functions.version as version_parser @@ -10,10 +10,12 @@ def find_dependencies_in_sboms(name: str, version: [str], exactMatch: bool) -> o # output = {'label': source, 'name': source.lower(), 'type': source.lower(), 'results': []} output = [] print("Searching for dependencies in SBOMs") - path = './functions/sboms' - for file in os.listdir(path): + path = './data/sboms' + # search for each file in the folder and subfolders + + for file in glob.glob(path + '/**/*.json', recursive=True): if file.endswith(".json"): - with open(path + '/' + file, encoding="utf-8") as json_file: + with open(file, encoding="utf-8") as json_file: data = json.load(json_file) try: type = data['bomFormat'] diff --git a/backend/playground/apps.py b/backend/playground/apps.py index e6822cb..2e7d973 100644 --- a/backend/playground/apps.py +++ b/backend/playground/apps.py @@ -9,35 +9,30 @@ class PlaygroundConfig(AppConfig): name = 'playground' def ready(self): - print('ready') - from git import Repo, RemoteProgress - import paramiko + import os + import subprocess from playground.models import DataSource def clone_datasource(name): + repo_path = f'./data/sboms/{name}' current_datasource = DataSource.objects.get(name=name) repo_url = current_datasource.url - key = current_datasource.key - private_key = paramiko.RSAKey.from_private_key_file(f"data/keys/{name}_private_key.pem") - try: - repo = Repo.clone_from(repo_url, repo_path, - env={'GIT_SSH_COMMAND': f'ssh -i data/keys/{name}_private_key.pem'}) - except: - # TODO: fetch from remote if repo already exists - bare_repo = Repo(repo_path) - origin = bare_repo.remote('origin') - - assert origin.exists() - origin.fetch() - origin.pull() - # origin = await bare_repo.remote(name='origin') - # if origin.exists(): - # bare_repo.delete_remote('origin') - # origin = bare_repo.create_remote('origin', repo_url) - # with bare_repo.git.custom_environment(GIT_SSH_COMMAND=f'ssh -i data/keys/{name}_private_key.pem'): - # origin.fetch() - # origin.pull() - - # for datasource in DataSource.objects.all(): - # clone_datasource(datasource.name) + absolute_key_path = os.path.abspath(f'./data/keys/{name}_private_key') + absolute_key_path = absolute_key_path.replace('\\', '/') + + + if not os.path.exists(repo_path): + subprocess.run(['git', 'config', '--global', 'core.sshCommand', + f'ssh -i {absolute_key_path} -F /dev/null']) + subprocess.run(['git', 'clone', repo_url, repo_path]) + else: + subprocess.run(['git', 'config', '--global', 'core.sshCommand', + f'ssh -i {absolute_key_path} -F /dev/null'], cwd=repo_path) + subprocess.run(['git', 'pull'], cwd=repo_path) + + + + + for datasource in DataSource.objects.all(): + clone_datasource(datasource.name) diff --git a/backend/playground/views.py b/backend/playground/views.py index 984b3b9..7572e06 100644 --- a/backend/playground/views.py +++ b/backend/playground/views.py @@ -1,5 +1,5 @@ -import paramiko import os +import subprocess from git import Repo from rest_framework.views import APIView from rest_framework.response import Response @@ -18,6 +18,15 @@ class Scan(APIView): def get(self, request): + datasources = DataSource.objects.all() + for datasource in datasources: + repo_path = f'./data/sboms/{datasource.name}' + absolute_key_path = os.path.abspath(f'./data/keys/{datasource.name}_private_key') + absolute_key_path = absolute_key_path.replace('\\', '/') + subprocess.run(['git', 'config', '--global', 'core.sshCommand', + f'ssh -i {absolute_key_path} -F /dev/null']) + subprocess.run(['git', 'pull'], cwd=repo_path) + name = request.GET.get('name', '') version = request.GET.get('version', "['']") exactMatch = request.GET.get('exactMatch', '') @@ -181,26 +190,45 @@ def post(self, request): description = request_data['description'] url = request_data['url'] - - key = paramiko.RSAKey.generate(bits=2048) - public_key = key.get_base64() + if DataSource.objects.filter(url=url).exists(): + return Response({'error': 'A datasource with this url already exists.'}, + status=status.HTTP_400_BAD_REQUEST) keys_dir = "data/keys" os.makedirs(keys_dir, exist_ok=True) - filename = f"{name}_private_key.pem" + subprocess.run( + ['ssh-keygen', '-t', 'rsa', '-b', '4096', '-f', f'{keys_dir}/{name}_private_key', '-q', '-N', '']) - private_key_file_path = os.path.join(keys_dir, filename) - - key.write_private_key_file(private_key_file_path) + with open(f'{keys_dir}/{name}_private_key.pub', 'r') as f: + public_key = f.read() datasource = DataSource.objects.create(name=name, description=description, url=url, key=public_key) datasource.save() - repo_path = f'./data/sboms/{name}' - repo = Repo.clone_from(url, repo_path, - env={'GIT_SSH_COMMAND': f'ssh -i data/keys/{name}_private_key.pem'}) - return Response({'message': 'Datasource created successfully.','public_key':public_key}) + return Response({'message': 'Datasource created successfully.', 'public_key': public_key}) + +class Confirm_datasource(APIView): + def post(self, request): + request_data = request.data + name = request_data['name'] + datasource = DataSource.objects.get(name=name) + absolute_key_path = os.path.abspath(f'./data/keys/{name}_private_key') + absolute_key_path = absolute_key_path.replace('\\', '/') + if datasource is not None: + repo_url = datasource.url + repo_path = f'./data/sboms/{name}' + if not os.path.exists(repo_path): + subprocess.run(['git', 'config', '--global', 'core.sshCommand', + f'ssh -i {absolute_key_path} -F /dev/null']) + subprocess.run(['git', 'clone', repo_url, repo_path]) + return Response({'message': 'Datasource confirmed successfully.'}) + else: + return Response({'message': 'Datasource already exists.'}) + + else: + return Response({'message': 'Datasource does not exist.'}) + From 8bde550aaf3d34ab4e36044e2501234955148f7f Mon Sep 17 00:00:00 2001 From: lucasprins Date: Thu, 15 Jun 2023 11:46:55 +0200 Subject: [PATCH 18/33] Added data source creation to the front-end --- backend/data/db.sqlite3 | Bin 204800 -> 204800 bytes backend/data/keys/Dependify_private_key | 49 +++++++ backend/data/keys/Dependify_private_key.pub | 1 + backend/data/keys/Portfolio-2023_private_key | 49 +++++++ .../data/keys/Portfolio-2023_private_key.pub | 1 + backend/data/keys/test2_private_key | 49 +++++++ backend/data/keys/test2_private_key.pub | 1 + ui/src/components/status_info/Tooltip.tsx | 2 +- ui/src/pages/data-sources/new.tsx | 121 ++++++++++++++---- ui/src/services/DataSourceService.ts | 78 +++++++++++ ui/src/types/api/api-data-source.d.ts | 9 ++ 11 files changed, 337 insertions(+), 23 deletions(-) create mode 100644 backend/data/keys/Dependify_private_key create mode 100644 backend/data/keys/Dependify_private_key.pub create mode 100644 backend/data/keys/Portfolio-2023_private_key create mode 100644 backend/data/keys/Portfolio-2023_private_key.pub create mode 100644 backend/data/keys/test2_private_key create mode 100644 backend/data/keys/test2_private_key.pub create mode 100644 ui/src/services/DataSourceService.ts diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index 23a6f513aae42ae39e2272eb8019cf74592c94ad..259629d8166031419e03dfc621de0574b3862d04 100644 GIT binary patch delta 2641 zcmah~In3k+72eHHvShRWCPWJ<$cl{wC>v+jw`aUkr1%7n2c4FVJ)z1O_=^y$;n_rCYuXSd$_?A9;7 zd;OJPzREoN%C(0-!afQ9^zizPC$E8jE$`gFdFR^YUv8(j|9Jb}t)E|h^5Pda?>za= zZ~pQ8559k)T%U#eGK{iu-rz0?C9Rhy2O@FzQHjq7^Z>u{KKap8@}uj2<}U8PaP#qv zFR!c5ym0f$YxjPC^YQ(^U%z~rya$nw5d0B_KEz23N6P8yMvK497do1 z?Zs#Ae)-L3EN*-`10H@yQW2u=%yo?PyX`x5&h^S@CqTA0#_X$G#O!7{02l2T1YCwMOgaFG^wl<3N?7v)r!8J5R-;L0{a zza!ci*aSY%q4;)P4NOGCHfRp2fGiA0h{1g4&nc(j$P#ur9@A`@ZEm&n98H3oaj?OJl;Y#-DXf~gX>k02f2nzg!R zdy7dz{Uow$g+ylsKW&c&)M8R%jNzVL$)vc^3@`!t{CJdrc+oWb;LIM939370EzxnG zgiaCjBZ5RTL}Mgv5dF9vhX^|D`wbhQt}b)~J?WD*ibX~=GP}dNiS3~EmX|_AqxK7Rl!e zz!sQxwg!|#G}~C^aoo6S3t-#W^#(v?YS&`LJmHn7rP7_fs!4-4O>?&@NGL86Wa^xq zxx;tIvx7T{as+&JyV&{*&R%t!)uyK-Ceqp90MM?P`6Q4sMaKYLs_WQP8PiHc{e#T6 zFgS}xnNSc3H#bs30J=_)i_shsZ@E`FoF&r$97se)q(kf#8aQP;JFzA_AS)M4Iy5^& zvvRO!aiIFE#)AJk+XP=l@Lz_% zjYEia^Fv$IV30J=`9&Q(Odr2=_u|d-W>%ntE{*63$s^{(?etb?$zu!+M zZe1$f7vR-n=wLrZS(cC*ohZVz6X>IiK*srK0ln|XnsPd+ts`O#bQHsR)e75FiW{{+EiHR720WO# z!l5LF6&@~$(MwQUGp_8*>cT3G5SkE2-0}>gsB&tRH9U}sG@@anS_8RVU`{B>f_2SvVN!8} zw&BhT1K~GfvQ+WFMs~2xx{1eCUWS0N{ delta 206 zcmZoTz|(MmXM!}N;6xc`RzU{6WX6ptd-NDtHY@5sE)de-vSi@B#+Svng-?N}lXoNk zoy`&p{%}rQpx$h`YP;ns#?!9M8r+)G**`D_ZdO#d$TgkoHzV(Mv)_#KMT88@6bwzQ zj7_bK4D}2wO-xLUwm;`*lKsHO$ajZ!zgU=Ia(G<>wZ|IMW}?FslkMFfiMI6m=&<#J69OVb);=05SzYG5`Po diff --git a/backend/data/keys/Dependify_private_key b/backend/data/keys/Dependify_private_key new file mode 100644 index 0000000..2cbf2fc --- /dev/null +++ b/backend/data/keys/Dependify_private_key @@ -0,0 +1,49 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn +NhAAAAAwEAAQAAAgEAsxuJEGiefuRf+MARhLTxmGquYhoJPLdiFvRIQMUahpYz3QbVtxqf +Qn7aGzSAhuxWZFYUI6WZLeS3VX7ROQciUhOdL4UNLZHM/aeeqYC4RlePOp0dNQVBgb+gfn +uXnpFy5ZsJG51xYA+cOLi8aRl2d/e/Au1o5awQrqPrbbUyftSw5PGdA9p/BflxwrezvjJI +Oz1qZsT2kLfuE4Wm8PkAq2lgyZ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PKkjXOIbOBHyETPPIhT6fWP +bpI2r7Ul+aYWJpAonfLRJPldnp74Ls7YNbLciyA3x4rhJb3WPmtUCq6eQR68ZCPZ4P+raz +isJo/NrnjJZBdmLdAAABAQDmcdaV0X6nnadyI1lB47i+T2ev6r2o/OFtLdUfEkFdqO/fvH +HcFM464xZhe3gna9raPeMpkESHIXejfZ+KqiJLTnSMalJklw5Gk0Z4onpb3bucWDw51BTN +y9pt5O6vwtOaDK+yUrPX06qLzEfBVbxj4dLJ3JpDRGreiEurlzbb6od8Xc36TvPDS9ol6l +dTIJb6lZpHJelI+/HdtSLF0qlsF1uSxoti8y4ZCMMnBi34RvtkRU8GfUNgycxnPl6C3jCT +VK2N+683qrGimCpa83+G784wXfG8mDOrjxdX+Q4j1PyY+RmrrVveNP40UaOHVvRTF6G74G +ARV+/8DRuJmMtpAAABAQDG+EXH7d4xKIxkEwnN9dP/NyWDibI4+CZzDQzcB0+zK/+AptJS +bBnOTaamLYiEfmRK5nTtGnTYr4XMCeSIW/bd2vQnhx/FsU56W9ayRzMJGN+nrR9whrBilb +JgYpwSDn64nB1//t2k/aTTthYOzTg6iTeq2L2ZUBOjPzmgh1GItAiT52IjdruvrHiBRlkH +3zjxTWvVoLFugSdPq+sqvgsb0SUzUnDyaQLwUie02hM1yOPHbG9aHdWlLtlXoDg7hlH5V0 +d6DdyFybATDyN6Tdi40lN2LvCxJusKIpPOQNUkmqxYDyPGWb1efO7Gacm8MUACZrFoh1Nv +hbpsvKTt4elnAAAAFWx1Y2FzQERFU0tUT1AtUVI0RUNEUAECAwQF +-----END OPENSSH PRIVATE KEY----- diff --git a/backend/data/keys/Dependify_private_key.pub b/backend/data/keys/Dependify_private_key.pub new file mode 100644 index 0000000..7f25571 --- /dev/null +++ b/backend/data/keys/Dependify_private_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzG4kQaJ5+5F/4wBGEtPGYaq5iGgk8t2IW9EhAxRqGljPdBtW3Gp9CftobNICG7FZkVhQjpZkt5LdVftE5ByJSE50vhQ0tkcz9p56pgLhGV486nR01BUGBv6B+e5eekXLlmwkbnXFgD5w4uLxpGXZ3978C7WjlrBCuo+tttTJ+1LDk8Z0D2n8F+XHCt7O+Mkg7PWpmxPaQt+4Thabw+QCraWDJniGMgtAjYXNr9UGVVVYNo90hoi2yuZYVY5YmZ5ZiMm+cQTFTcFEXNuPNPvBgCgSDdk+BaVlc9+jCouC+ujSS4yqUyNJ3ckLGt1/7hxL6M2K5VPKi6+SS69FxVwibIfQE5D9jd/w92L2KkhboR/ylYXiWy5d9qa/iu3l07pwX7hdQcNsb12D31eWJUdTYyv/G9M1DGyYzQybeq2prhnDfdRCXC3QVJEHOKoHHOzSV1o1ZfsAxogekFHQtrpJKLnd5ZzZzTXQpPyWDgetR4Std9T88gRV3+kSVHanSLaDM85r8CJlxjxiPioxFtro0NR5lcw/18wsvXDvj9EF+31+wKh90JP2+gC6oYwqyiUAFU3vHeJ5PMdWRWaUsxLZCB00m6IAEuFU79BtqsAoWSsCU9gh+IYVKNc3HtaOL9GBQCZzmbzlNGsUCQ7rMsoEbqvhyKM01K/VvfSUvaeVoPw== lucas@DESKTOP-QR4ECDP diff --git a/backend/data/keys/Portfolio-2023_private_key b/backend/data/keys/Portfolio-2023_private_key new file mode 100644 index 0000000..066baca --- /dev/null +++ b/backend/data/keys/Portfolio-2023_private_key @@ -0,0 +1,49 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn +NhAAAAAwEAAQAAAgEAzya8eYrsYoR+qbSreX4Ft7DxywFw1QdK3kEnoI9dVNlJcfw+HH3Y +i+6ijP0g6qRdasnmFQmCIorpqRKUSsQvkBY3CB67OodzPivBkluyLxbroi4aLxY3cjqDG5 +sAkQPz7b7vX00FqbphL2yFtBh0PAE6DENa8FzB2eesLI8Hr+x1PyN2gNCX2Ge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iCL9 +t4vPY1LXUYzwKOqPyHNH2FPaIx4ey7Wj+j7z+FPfF2s2KmhW1Q7mg5C1j1u1/JvZgZhvRh +A+7JU7e40pOwEYMr6mti0Xbts1uKwwDpADJ8dL/tBtZJe+xLWGA3xiBOCf4lMD1fN0bKep +JnD6Sz4gvfC+tBPbAAABAQD/D+ZS5MHXdKALEh+r9Q+YxvYCFJrihOO8vAMdwF3zgjW5Vg +cp6giB3Ta4i5edKagVlzn90btW0LzgDfOQbwyl5HFLfOepjXd8xZJGibuCrCTbATgKnhFH +gHc/g3GgQRwG/nyjfc2Up5hCYkJhDuvSvpc13zpglL0qv9ANUshO4z9azuYR/l67jiQW9u +Za1skJNdasfkrA5ge5wr6M84C7KYb7cS2kd1P1b9aFN+KYaLQ07rlaBPxNyioRvw83CcAL +kRyD7v4Aomv68vUMCxvjuwIps7b+cX7aqyvTBkIq52pIprVD8Fr1JuNFn60zg4OLXIiSiL +JIiSrF+o8z4sgnAAABAQDP6bx0osDYb+G2d5UjiMQT/GTmsloDKNNlRz/1Q6z1j7eVVVj2 +0jYKHXjLSi1j5aXPs55BCzmm4pkfzEEypQ8TRY0KdtysuzHDLESCyb/HrPZ2IexH4eK2LO +jRqx3E7VZvoBjjHC3mX7fPgucPeSNeIzQnXGQE+rW/gZUyN2sQC5Sw4OfBOs9o/1ZSZlpk +N7Q+x9RgmhX4i9e5oL45lPTJLrGae+9LG9mpB71MbIhmOjd8J4FpS+7EJ0X9ouDvcKyOdE +3QdpYpe255ig3oun2cJg1r5Jvd8LdmNgibVujqUQlZDp4zCqrxTQTW8GPZ5pr3y5y2Gywz +ilZ5QhXV3hkFAAAAFWx1Y2FzQERFU0tUT1AtUVI0RUNEUAECAwQF +-----END OPENSSH PRIVATE KEY----- diff --git a/backend/data/keys/Portfolio-2023_private_key.pub b/backend/data/keys/Portfolio-2023_private_key.pub new file mode 100644 index 0000000..7b70fb2 --- /dev/null +++ b/backend/data/keys/Portfolio-2023_private_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDPJrx5iuxihH6ptKt5fgW3sPHLAXDVB0reQSegj11U2Ulx/D4cfdiL7qKM/SDqpF1qyeYVCYIiiumpEpRKxC+QFjcIHrs6h3M+K8GSW7IvFuuiLhovFjdyOoMbmwCRA/Ptvu9fTQWpumEvbIW0GHQ8AToMQ1rwXMHZ56wsjwev7HU/I3aA0JfYZ714UZ1/nWVW2HcFWZnPORG0MqixU8rIV6e8RPYrXCu+feWYc73GvDGHculM+FQNUwXKhZ1lrnQxDbI1uSLxn1iPrHyjyCswEpB/piqL9AQVMS6Gbh+5JBJYAJaLabgnAulUWbDb/NXUecu6t7/sdc+u35TOqwCgB1X/VwQH2FUZHh/nYc8AZsE9zA5DGjyv1Ktp5Ys3ixmGswfwxZaWvzuKNsxJJKwNtvGLh5FUnz9iHxnI2yCZr41bITOKZhlfdrW24QKEfg0S5TVrQTDvWCieSzJDOM937oGyTmU0t4KiUxefDNL9JPRU/i/GnmmK+hFssfdDkiy0ruCOKBhvieZohGx22g72RCKRwJchtxwg0zfvPDd3aSHuwBySyWxJol6sLDY4uyDu0OxjHxUtAeRUQDRAzK24cr+xTECj0WbuiD8YSg4VB+Di1ZwHX2RQzL7pfLj+I7mji5gkyjXXcaXQL0O53DGzv1NjitvieZcHVAlCLcu3ww== lucas@DESKTOP-QR4ECDP diff --git a/backend/data/keys/test2_private_key b/backend/data/keys/test2_private_key new file mode 100644 index 0000000..34fd61f --- /dev/null +++ b/backend/data/keys/test2_private_key @@ -0,0 +1,49 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn +NhAAAAAwEAAQAAAgEAz+6N+kisd89p4AsxGErR7fZodMJh3o8FI53Wi7WgI36Pya8btXJb +cUCNPtvTcpbv1RCTRw1BmzMwBB5PBE+rWswIbngPyh9/cnsJ7hNKeOhe1ww+irEu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RKXlyLIrw52HqwA7H0pb9MA+fTV/BzES8zSMPS0v7sgPfGqE7ZAEND3AyGF8N/NIzGg7 +Y/lmxYy0J3NSQ2WKupogz/4CykhPBU4TZVPah6QoXza1HXZVjU8EUFtPDK5t+34pI+i4sk +ZIFca4qTnrkkfnyqqai+drtuEM7AkbvuICDsaQkP8vOAqMXDNtdT+YvpQ+o7pjh/tM0vsw +hGyhpGM5WjobPoF+2QAAAQEA6EEJ2HdYf7wkDFIz1mfe6iW2mWjK4tAM5ZZHxigrzcY7SA +jWcj5q4E9uB+R3lyCrx0yq/mdMQMARrY8I7e+yH+o9grpHFZsbh0oFweM3JcZJre8dWco6 +nxhmhbgIEaXgVavgKySFODU9OgpLgXJTvSu7wN3me5SokTSBSJlWBKncxNK4Ka0tEKCAWS +azO2znc1yEAlrKpEIFqQwX3Qt7gSek6nmqLjvacOd6PqxQLQf1hLAYYFkgI1Cyjq13XK9E +G8AJZr69EoU+3nanZ4aIeGrjTTS5B9oH3dW6OdJ/LBmOhhXsw8I/sn6Z9lVrvfJq1LX7Kr +q4/GuDojhJFBfnJQAAAQEA5TDppgFQwqiqPq22iDpqcRCwIGxb5HPB6pgCBSPfKzvFhxCt +dOm6or2BCsA7KnoqTgvkBU5Hei1s5qwCMzws2dzosioiD7Hselazr6ftN6xZkLuPY0qETM +xF6ygyI58RM/ynVztnRmtlh7o77Ja2r56CsUZK0Pr1U+Xgxj+96HSJXaN5OinF7VZSGmB3 +Hcd85dFR6aHdhxfguZsTdLUfD2m8G0HfZtmByGTOGdlwjihKL+WjmWk5QwvLFD2N3xR0KV +8lUVZNASM/GvPDqrOv+ibYR5tOkSOBJ86cVTU7AgfN+GIPbF1Y+Wp7XJ+YGXxyMFaqF/Af +cRwJjLqmhm1fGwAAABVsdWNhc0BERVNLVE9QLVFSNEVDRFABAgME +-----END OPENSSH PRIVATE KEY----- diff --git a/backend/data/keys/test2_private_key.pub b/backend/data/keys/test2_private_key.pub new file mode 100644 index 0000000..1fac97a --- /dev/null +++ b/backend/data/keys/test2_private_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDP7o36SKx3z2ngCzEYStHt9mh0wmHejwUjndaLtaAjfo/Jrxu1cltxQI0+29Nylu/VEJNHDUGbMzAEHk8ET6tazAhueA/KH39yewnuE0p46F7XDD6KsS6oejuHBmL20UmW+vcchRMzzQtZJ4C0mJe8qtHTzj5UrHAIWXFxdG/laHkp6wN5eI6xbi3XRU9JPWueqjg2B6Jx5WbUUoqnANlsG+lJB2R4xVo7EiAZr5Q4hzAKBb2yKN0QCEbEBR0joHM7DKy5c88o60EsqoXJ76dqmtxO3X0MPUZKQiflDmqJN6WnbAWWO+13vkc9ybnqV4Wkc7fq5+5SY/s/dmfwOmQylE8Iq0b5qIv41UlMl0A4hTrseh/X9NW5O+r8np6BQrHB8OIqaWCv9M/n2topRe/wwGxoH3qa1SMdXnuAKrOOq+hwWQbmTunshzQ06ChKzvEzSpJevmYVss/hNDZY1ylS3GaB4sVLRF5iSRR4kAoEwVy39D/rrGEeiqEwRPEFU2GPJgPeX8Thgz6nbTYHhhcE3GKxEse024kLID/cevwyAwbGgGOqnbBIlWgX4LWS+TG2l/CZZdDAJm/dQR3rBkhrR6cz5DORB6EMoTRaOKkIztWMH9gL3qOslLyVUw2PoSM1/lCXYDQ0c3PrEgWpz1KZLHPBhBa9g/NnTeNSxg0b5w== lucas@DESKTOP-QR4ECDP diff --git a/ui/src/components/status_info/Tooltip.tsx b/ui/src/components/status_info/Tooltip.tsx index 2027ebc..dba3ec5 100644 --- a/ui/src/components/status_info/Tooltip.tsx +++ b/ui/src/components/status_info/Tooltip.tsx @@ -23,7 +23,7 @@ function Tooltip({ {text} diff --git a/ui/src/pages/data-sources/new.tsx b/ui/src/pages/data-sources/new.tsx index 394ed12..681a00c 100644 --- a/ui/src/pages/data-sources/new.tsx +++ b/ui/src/pages/data-sources/new.tsx @@ -9,17 +9,65 @@ import { Formik, Form } from "formik"; import { AnimatePresence, MotionConfig, motion } from "framer-motion"; import { useState } from "react"; import { formAnimationProps } from "../setup"; +import Tooltip from "@/components/status_info/Tooltip"; +import { DataSourceService } from "@/services/DataSourceService"; +import { useRouter } from "next/router"; export default function Page() { const [step, setStep] = useState<"configure" | "add-key" | "clone">( "configure" ); const [SSHKey, setSSHKey] = useState(""); + const [name, setName] = useState(""); + + const router = useRouter(); async function handleAddDataSource(values: { label: string; url: string }) { - // TODO: Add data source + try { + const res = await DataSourceService.generateDataSource({ + name: values.label, + description: "", + url: values.url, + }); + + if (res.error) { + alert(res.error); + return; + } + + setSSHKey(res.public_key); + setName(values.label); + + setStep("add-key"); + } catch (e) { + console.log(e); + } + } + + async function handleConfirmDataSource() { + try { + const res = await DataSourceService.confirmDataSource({ + name, + }); + + if (res.message !== "Datasource confirmed successfully.") { + alert(res.message); + return; + } + + if(window.confirm("Data source added successfully!")) { + setStep("clone"); + } + + router.push("/data-sources"); + - setStep("add-key"); + // alert("Data source added successfully!"); + + setStep("clone"); + } catch (e) { + console.log(e); + } } return ( @@ -45,7 +93,11 @@ export default function Page() {
    @@ -55,12 +107,18 @@ export default function Page() {
    -
    + `} + >
  • Add deploy key
    @@ -128,13 +186,15 @@ export default function Page() { placeholder="Label" /> - + + +
    - +
    + + + +
    )} diff --git a/ui/src/services/DataSourceService.ts b/ui/src/services/DataSourceService.ts new file mode 100644 index 0000000..d765d25 --- /dev/null +++ b/ui/src/services/DataSourceService.ts @@ -0,0 +1,78 @@ +import { + APIResponseConfirmDataSource, + APIResponseGenerateDataSource, +} from "@/types/api/api-data-source"; +import { getApiUrl } from "@/utils/api"; +import { getCookie } from "@/utils/cookies"; + +const API_URL = getApiUrl(); + +/** + * http://127.0.0.1:8000/api/generate_datasource + */ +async function generateDataSource({ + name, + description, + url, +}: { + name: string; + description: string; + url: string; +}): Promise { + const URL = API_URL + "generate_datasource/"; + + console.log( + JSON.stringify({ + name, + description, + url, + }) + ); + + const response = await fetch(URL, { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") || "", + }, + credentials: "include", + body: JSON.stringify({ + name, + description, + url, + }), + }); + + console.log(response); + + const json = await response.json(); + return json; +} + +async function confirmDataSource({ + name, +}: { + name: string; +}): Promise { + const URL = API_URL + "confirm_datasource/"; + + const response = await fetch(URL, { + method: "POST", + headers: { + "Content-Type": "application/json", + "X-CSRFToken": getCookie("csrftoken") || "", + }, + credentials: "include", + body: JSON.stringify({ + name, + }), + }); + + const json = await response.json(); + return json; +} + +export const DataSourceService = { + generateDataSource, + confirmDataSource, +}; diff --git a/ui/src/types/api/api-data-source.d.ts b/ui/src/types/api/api-data-source.d.ts index e69de29..3c7c34c 100644 --- a/ui/src/types/api/api-data-source.d.ts +++ b/ui/src/types/api/api-data-source.d.ts @@ -0,0 +1,9 @@ +export type APIResponseGenerateDataSource = { + message?: string; + error?: string; + public_key: string; +}; + +export type APIResponseConfirmDataSource = { + message: string; +}; From b0a633ab64c970a1ed27031a024fb8dda9b8f6d9 Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Thu, 15 Jun 2023 13:07:52 +0200 Subject: [PATCH 19/33] Update new.tsx --- ui/src/pages/data-sources/new.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/pages/data-sources/new.tsx b/ui/src/pages/data-sources/new.tsx index 394ed12..b6e5eb2 100644 --- a/ui/src/pages/data-sources/new.tsx +++ b/ui/src/pages/data-sources/new.tsx @@ -30,7 +30,7 @@ export default function Page() { Add a new data source Add a new data source by filling in the form below and clicking - the "Add" button. After confirming the data source you will need + the "Add" button. After confirming the data source you will need to add the SSH key that is shown to your GitHub repository as a deploy key. From 1519a222cfa28a03cf3de513cbf57d24922481cb Mon Sep 17 00:00:00 2001 From: fabiothomas <95278302+fabiothomas@users.noreply.github.com> Date: Thu, 15 Jun 2023 13:47:12 +0200 Subject: [PATCH 20/33] new datasource name verification --- backend/playground/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/playground/views.py b/backend/playground/views.py index 7572e06..24b5dfd 100644 --- a/backend/playground/views.py +++ b/backend/playground/views.py @@ -190,6 +190,10 @@ def post(self, request): description = request_data['description'] url = request_data['url'] + if DataSource.objects.filter(name=name).exists(): + return Response({'error': 'A datasource with this name already exists.'}, + status=status.HTTP_400_BAD_REQUEST) + if DataSource.objects.filter(url=url).exists(): return Response({'error': 'A datasource with this url already exists.'}, status=status.HTTP_400_BAD_REQUEST) From 72380f5528db30c5f9ac39d2a3e01f08cf228a38 Mon Sep 17 00:00:00 2001 From: The0Danktor <94552546+The0Danktor@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:48:50 +0200 Subject: [PATCH 21/33] empty --- .dockerignore | 4 +- Dockerfile | 2 + backend/data/db.sqlite3 | Bin 204800 -> 204800 bytes backend/data/keys/Dependify_private_key | 49 ------------------ backend/data/keys/Dependify_private_key.pub | 1 - backend/data/keys/Portfolio-2023_private_key | 49 ------------------ .../data/keys/Portfolio-2023_private_key.pub | 1 - backend/data/keys/sboms_private_key | 49 ------------------ backend/data/keys/sboms_private_key.pub | 1 - backend/data/keys/test2_private_key | 49 ------------------ backend/data/keys/test2_private_key.pub | 1 - backend/playground/apps.py | 4 +- backend/playground/views.py | 13 +++-- 13 files changed, 18 insertions(+), 205 deletions(-) delete mode 100644 backend/data/keys/Dependify_private_key delete mode 100644 backend/data/keys/Dependify_private_key.pub delete mode 100644 backend/data/keys/Portfolio-2023_private_key delete mode 100644 backend/data/keys/Portfolio-2023_private_key.pub delete mode 100644 backend/data/keys/sboms_private_key delete mode 100644 backend/data/keys/sboms_private_key.pub delete mode 100644 backend/data/keys/test2_private_key delete mode 100644 backend/data/keys/test2_private_key.pub diff --git a/.dockerignore b/.dockerignore index 01d4456..74cd9aa 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,6 @@ README.md .dockerignore .git -/backend/data/setup_key \ No newline at end of file +/backend/data/setup_key +/backend/data/keys* +/backend/data/sboms* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3a3cbb9..a6a4a9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,6 +69,8 @@ COPY start_up.sh ./start_up.sh RUN chmod +x ./start_up.sh +RUN python manage.py flush --no-input + # Start the Django server #CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000" ,";","npm", "run", "start"] diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index 259629d8166031419e03dfc621de0574b3862d04..42f9a3a98ebbf3142e439961ccd562ba80055922 100644 GIT binary patch delta 2128 zcmZWqZERCj7{2G;)1KS)-urIr$GWv+?byaj+1jowa~iS%;m^MKr!d8>wl|}3TbK3@ zg8{c6CYoSmaH7R8LIe#H6|{jR;Kzu6NKm&##At%z9}^=+Vn_^$7|;C}myMpB_Bqda z&(r6<=e_65E=seD(p*pua~#*fdOPd*NNblP%(d@4_(}G7L*Qx71tNyu;Tnjr4-Ubb z&BM2!(FH0UmAmA3d#L};$$mfK5N!TjVt?@b*1E;xwsK@v`ScswY zw6=F-N-a#}ip5-hGDHu>!`^Cf6&;Y76ivtd^!s?+OJFw#Kf|AJ8IHnkD8h&EM!9M< z2^%k>sqyswu|j@&GMi0n=~^6#tf7ke=|V;&bhKw3a?+WeTED}K>w~DM8h>B3elh*H zCzKNu?5i;x>Y7u0HTFeZx-;9a%pOw6y^Vt(nT;8E93BC$a$8we-cvMXyW*Gc$Y0B+ zTQs)Bcn(o=mKFvmGM=~7=z2TuB5 zUo67*;Rh5=iRo;1M9<4iVtaZr8gg(b)=B8;z9tf6INnX@cYUp-&cb|uE2(8Tnj$pW z-$()sclJ2xaDO|gVYqv{lOFExAbty9Vc5rTYKxPiflb8AaIDioHxD!s55w_p2OSw` zCDj&wmEkIeqbUdde4sH_$#8QU-j`FK8?hcGvl-UMVQbt1dVCVoior-+F>z*ZdU8yC zaD~aNtO?63ZhZ{X;lUu07;ftl=z+l&;$}Gcm_X+TH+%=!`|_N;#cbtB_#b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kMnZpvd8%B%nxKHV$^z<622Democu5E@@!iyTe8g+Gdn#!avv=&HMte^Ot+ep5o(`pg;aC?4`8IJC77^t_2mRY!sVIRZcn8O(Ct)pIs8(JjeOmBdentZ!teA*kLB^F*` z*u(Iah-5tLt)gy*TRMqR)3=oZ!|l%zqq}b#)h#^Bu*PsCPK+yk^^GdSp)fu%mU?-R z@BO|+I%rx!Zq>P%zo7*ifA-Jw$<34*(N57g z-M>|Cc34J%8CxZ0gxf{qUVkuOPb9(F*v{u&JJ0{7W<-#ma1&-xk$5sSp30>L*T)s9 zpdBgl$l=jMdSqi{k+LJ}5Q`jXh_XZ3pvY`HNHI%G>k{B0>x^$%d0l{0FaZPbJZxuO z>eip?_x11fYx)QJ8~U_(8wd2~0T2~9lC8Dbd~K1pR$}utUV_3%Hq*ArKqWzO#0!yDR}-{@;r5=gd{q%!BAZ&YvVx!( zGOKcMlc$1b>fo8$ja$w$a#)$#yuZj>lh}NjH*couFek8CUkO1CNaEU7^LzP{Bum&L zON*qXYLO)#g0>*ZRJ0gR89^R~LDn_Sa12TPIp#HcyMZrD*f) z+sSrRG*xX>gdL~PHd+AMc$e9^9~Qi%wGDyuHmE|w}ngoZ7{ z_JL+O-c>9U4HLoVH}6J%NF^dOL#Ao(t_KmpAJ}l=+*n2=h{G;rkv>AJpc3tz0HgYM zdQ3aVI(=3nbM-`7nAgNhWX^+?g-%_ZCv!ETvT#cmFOWGOQWnNRJg*YCB)}5fhD-2} z?TZ0Ns&N+@pB_$RJKEY}Q<<@JcF)K}Vr;y1cyfYxa3e}&lQx6bhj(lW7u~qgnM-AJ zd(6QUxPFxc3*_Fj-8W8(qzx-@Y>{3S*$FFfe334RPrz$lrW$G%^gG&@>f5d Date: Thu, 15 Jun 2023 14:51:34 +0200 Subject: [PATCH 22/33] Update .gitignore --- .gitignore | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 01688a2..d576844 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ -*.pyc -*.pyc *.pyc backend/.idea -*.pyc -*.pyc -backend/data/sboms \ No newline at end of file +backend/data/sboms +backend/data/db.sqlite3 +backend/data/keys From d92d97a016aae2b67520f9de34cbc1f48178e688 Mon Sep 17 00:00:00 2001 From: lucasprins Date: Thu, 15 Jun 2023 15:11:31 +0200 Subject: [PATCH 23/33] Added validation to data source creation form --- ui/src/pages/data-sources/new.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ui/src/pages/data-sources/new.tsx b/ui/src/pages/data-sources/new.tsx index 5cc6887..68765d6 100644 --- a/ui/src/pages/data-sources/new.tsx +++ b/ui/src/pages/data-sources/new.tsx @@ -190,11 +190,27 @@ export default function Page() { { + if (value === "") { + return "URL is required"; + } + + // SSH github url regex (cant start wit hhhtps) + // Should be in the following format: git@github.com:Frojd/Wagtail-Pipit.git + if ( + !/^(git@github\.com:[a-zA-Z0-9-]+\/[a-zA-Z0-9-]+\.git)$/.test(value) + + ) { + return "URL must be a valid GitHub SSH URL"; + } + }} + style="iconless" type="text" - placeholder="URL" + placeholder="GitHub SSH URL" /> +
    From c0dbb647523cc805ca91c7e48a921358fa63ce1f Mon Sep 17 00:00:00 2001 From: lucasprins Date: Fri, 16 Jun 2023 11:12:27 +0200 Subject: [PATCH 28/33] Update views.py --- backend/playground/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/playground/views.py b/backend/playground/views.py index a443b13..53f50a4 100644 --- a/backend/playground/views.py +++ b/backend/playground/views.py @@ -252,6 +252,10 @@ def get(self, request): for item in json_data: fields = item['fields'] + # if the field is called status, rename it to error + if 'status' in fields: + fields['error'] = fields['status'] + del fields['status'] data_list.append(fields) response_data = {'data': data_list} From 21d461d0019226036acfea69829c86f0c5ec3eb6 Mon Sep 17 00:00:00 2001 From: lucasprins Date: Fri, 16 Jun 2023 11:46:37 +0200 Subject: [PATCH 29/33] delete and fetch data sources --- backend/data/db.sqlite3 | Bin 204800 -> 204800 bytes backend/playground/apps.py | 11 +- ui/src/pages/data-sources/index.tsx | 305 ++++++-------------------- ui/src/pages/data-sources/new.tsx | 7 +- ui/src/services/DataSourceService.ts | 43 ++++ ui/src/types/api/api-data-source.d.ts | 11 + ui/src/types/data-source.d.ts | 18 +- 7 files changed, 136 insertions(+), 259 deletions(-) diff --git a/backend/data/db.sqlite3 b/backend/data/db.sqlite3 index c3190ec054fbc75534c3165efb1b97d8003ee383..d2f6bd653889e14c7beb77c7b865eb6a25317f25 100644 GIT binary patch delta 812 zcmXxhxsKyx007{ftXA4c1A>NPStMFy319Is)7j(Oj;|!Xn#J+$--&<6P8_GnN=Q)9 zu+_W~7s8-??prQTR@BOFS_n&Tm|Muqo!`p|O`#*o`(VJI4Kcl}sqc)9N+fD7*UedZhF99Nm zTGpisO;WwKjy6jq_hqn%1Cqa+0K*_2rlHhrVpbUv+Ow%lMIY3Ht zw}#rWr7_@&n~F;T6M12_O^?QSsaS@cR~|t|byADm`Ly0` z+Ss#B<6!}(LEW}TlG-iD6HBVWvQETZc0xfJW*fzB)ljv1jt08x{#T-nJjNJ0`oOzm q;$fxi`#Ld2YV!Euo0o4M|Ndw8b1wk|gVZmF)Gq = [ - { - id: "1", - name: "Example Repository 1", - label: "Repository 1", - type: "github", - status: "connected", - uri: "https://github.com/example/repository1", - enabled: true, - labels: ["label1", "label2"], - lastSync: "2023-05-30", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "2", - name: "Example Repository 2", - label: "Repository 2", - type: "github", - status: "connected", - uri: "https://gitlab.com/example/repository2", - enabled: false, - labels: ["label3"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "Connection timeout", - }, - { - id: "3", - name: "Example Repository 3", - label: "Repository 3", - type: "github", - status: "error", - uri: "https://bitbucket.org/example/repository3", - enabled: true, - labels: ["label4", "label5"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "Unable to connect to data source", - }, - { - id: "4", - name: "Example Repository 4", - label: "Repository 4", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "5", - name: "Example Repository 5", - label: "Repository 5", - type: "github", - status: "connected", - uri: "https://github.com/example/repository5", - enabled: true, - labels: ["label1", "label2"], - lastSync: "2023-05-30", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "6", - name: "Example Repository 6", - label: "Repository 6", - type: "github", - status: "connected", - uri: "https://gitlab.com/example/repository2", - enabled: false, - labels: ["label3"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "Connection timeout", - }, - { - id: "7", - name: "Example Repository 7", - label: "Repository 7", - type: "github", - status: "error", - uri: "https://bitbucket.org/example/repository3", - enabled: true, - labels: ["label4", "label5"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "Unable to connect to data source", - }, - { - id: "8", - name: "Example Repository 8", - label: "Repository 8", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "9", - name: "Example Repository 9", - label: "Repository 9", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "10", - name: "Example Repository 10", - label: "Repository 10", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "11", - name: "Example Repository 11", - label: "Repository 11", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "12", - name: "Example Repository 12", - label: "Repository 12", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, - { - id: "13", - name: "Example Repository 13", - label: "Repository 13", - type: "github", - status: "connected", - uri: "https", - enabled: true, - labels: ["label6"], - lastSync: "2023-05-31T13:32:19+00:00", - lastSyncStatus: "synced", - lastSyncError: "", - }, -]; +import { DataSourceService } from "@/services/DataSourceService"; function Page() { - const [dataSources, setDataSources] = useState(fakeDataSources); + const [dataSources, setDataSources] = useState([]); const [filteredDataSources, setFilteredDataSources] = useState(); const [query, setQuery] = useState(""); @@ -214,14 +40,36 @@ function Page() { setFilteredDataSources(filteredDataSources); } + async function handleGetDataSources() { + try { + const res = await DataSourceService.getDataSources(); + setDataSources(res.data); + } catch (err) { + console.log(err); + } + } + + async function handleDeleteDataSource(name: string) { + try { + await DataSourceService.deleteDataSource({ name }); + handleGetDataSources(); + } catch (err) { + console.log(err); + } + } + useEffect(() => { handleFilterDataSources(query); }, [query]); useEffect(() => { - setFilteredDataSources(dataSources); + handleGetDataSources(); }, []); + useEffect(() => { + setFilteredDataSources(dataSources); + }, [dataSources]); + return (
    @@ -258,13 +106,13 @@ function Page() { {filteredDataSources.map((dataSource) => ( handleDeleteDataSource(dataSource.name)} /> ))} @@ -276,59 +124,50 @@ function Page() { } function DataSource({ - label, - status, - type, + name, + url, + key, lastSync, - lastSyncError, - enabled, -}: { - label: string; - status: DataSourceStatus; - type: DataSourceType; - lastSync: string | undefined; - lastSyncError?: string; - enabled: boolean; -}) { - const iconClassName = "w-6 ml-0.5 text-white"; - - const icon = { - github: , - gitlab: , - s3: , - local: , - } as const; - - const getIcon = icon[type]; - + error, + onDelete, +}: DataSource & { onDelete: () => void }) { return (
  • - +
    + + + {name} + - {status === "connected" ? ( - - ) : ( - - )} - {capitalize(status)} - -
    - - {label} + > + {!error ? ( + + ) : ( + + )} + {capitalize(status)} + + +
    + + +
    -
    +
    @@ -343,14 +182,6 @@ function DataSource({ )} - {/* - - - - - {enabled ? Enabled : Disabled} - - */}
  • ); diff --git a/ui/src/pages/data-sources/new.tsx b/ui/src/pages/data-sources/new.tsx index 3f4cd4f..14ab2ee 100644 --- a/ui/src/pages/data-sources/new.tsx +++ b/ui/src/pages/data-sources/new.tsx @@ -19,11 +19,13 @@ export default function Page() { ); const [SSHKey, setSSHKey] = useState(""); const [name, setName] = useState(""); + const [adding, setAdding] = useState(false); const [confirming, setConfirming] = useState(false); const router = useRouter(); async function handleAddDataSource(values: { label: string; url: string }) { + setAdding(true); try { const res = await DataSourceService.generateDataSource({ name: values.label, @@ -43,6 +45,7 @@ export default function Page() { } catch (e) { console.log(e); } + setAdding(false); } async function handleConfirmDataSource() { @@ -215,12 +218,12 @@ export default function Page() {