├── server ├── .env ├── public │ └── .gitkeep ├── vercel.json ├── api │ └── index.ts ├── types │ └── types.ts ├── models │ └── model.ts ├── redis.ts ├── dashQL │ ├── queryHandler.ts │ └── dashCache.ts ├── server.ts └── Schemas │ └── schema.ts ├── client ├── index.css ├── vite-env.d.ts ├── assets │ ├── dan.png │ ├── drew.png │ ├── save.png │ ├── clock.png │ ├── hands.png │ ├── kevin.jpg │ ├── copyIcon.png │ ├── dashQL_Logo.png │ ├── fronheiser.jpeg │ ├── github-logo.png │ ├── linkedin-logo.png │ └── fonts │ │ ├── Khula-Bold.ttf │ │ ├── Khula-Light.ttf │ │ ├── Khula-Regular.ttf │ │ ├── Khula-ExtraBold.ttf │ │ ├── Khula-SemiBold.ttf │ │ └── OFL.txt ├── App.css ├── components │ ├── Docs.tsx │ ├── Contact.tsx │ ├── styles │ │ ├── Contact.css │ │ ├── Home.css │ │ └── Demo.css │ ├── Nav.tsx │ ├── Demo_Components │ │ ├── ResultCard.tsx │ │ ├── LineChart.tsx │ │ ├── PieChart.tsx │ │ ├── queryCode.tsx │ │ ├── BarChart.tsx │ │ └── QueryResult.tsx │ ├── Home.tsx │ └── Demo.tsx ├── main.tsx ├── api │ ├── clearCache.tsx │ └── apiFetch.tsx └── App.tsx ├── .DS_Store ├── vercel.json ├── __tests__ ├── setup.ts └── client │ ├── App.test.tsx │ ├── components │ ├── Demo.test.tsx │ ├── Nav.test.tsx │ └── QueryResult.test.tsx │ └── api │ └── apiFetch.test.tsx ├── tsconfig.node.json ├── .gitignore ├── .eslintrc.cjs ├── index.html ├── vite.config.ts ├── tsconfig.json ├── LICENSE ├── public └── vite.svg ├── package.json └── README.md /server/.env: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/public/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/index.css: -------------------------------------------------------------------------------- 1 | :root { 2 | margin-left: -8px; 3 | } 4 | -------------------------------------------------------------------------------- /client/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/.DS_Store -------------------------------------------------------------------------------- /server/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "routes": [{ "src": "/(.*)", "dest": "/api" }] 3 | } 4 | -------------------------------------------------------------------------------- /server/api/index.ts: -------------------------------------------------------------------------------- 1 | const app = require('../server'); 2 | 3 | export default app; 4 | -------------------------------------------------------------------------------- /client/assets/dan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/dan.png -------------------------------------------------------------------------------- /client/assets/drew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/drew.png -------------------------------------------------------------------------------- /client/assets/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/save.png -------------------------------------------------------------------------------- /client/assets/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/clock.png -------------------------------------------------------------------------------- /client/assets/hands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/hands.png -------------------------------------------------------------------------------- /client/assets/kevin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/kevin.jpg -------------------------------------------------------------------------------- /client/assets/copyIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/copyIcon.png -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | {"source": "/(.*)", "destination": "/"} 4 | ] 5 | } 6 | 7 | -------------------------------------------------------------------------------- /client/assets/dashQL_Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/dashQL_Logo.png -------------------------------------------------------------------------------- /client/assets/fronheiser.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/fronheiser.jpeg -------------------------------------------------------------------------------- /client/assets/github-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/github-logo.png -------------------------------------------------------------------------------- /client/assets/linkedin-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/linkedin-logo.png -------------------------------------------------------------------------------- /client/assets/fonts/Khula-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/fonts/Khula-Bold.ttf -------------------------------------------------------------------------------- /client/assets/fonts/Khula-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/fonts/Khula-Light.ttf -------------------------------------------------------------------------------- /client/assets/fonts/Khula-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/fonts/Khula-Regular.ttf -------------------------------------------------------------------------------- /server/types/types.ts: -------------------------------------------------------------------------------- 1 | export interface DashCache { 2 | query: Document; 3 | redisdb: any; 4 | response: any; 5 | } 6 | -------------------------------------------------------------------------------- /client/assets/fonts/Khula-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/fonts/Khula-ExtraBold.ttf -------------------------------------------------------------------------------- /client/assets/fonts/Khula-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oslabs-beta/dashQL/HEAD/client/assets/fonts/Khula-SemiBold.ttf -------------------------------------------------------------------------------- /client/App.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: Khula; 3 | background: radial-gradient( 4 | circle, 5 | rgba(238, 174, 202, 0.1558998599439776) 0%, 6 | rgba(148, 187, 233, 0.07746848739495793) 100% 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /__tests__/setup.ts: -------------------------------------------------------------------------------- 1 | import { afterEach } from 'vitest'; 2 | import { cleanup } from '@testing-library/react'; 3 | import '@testing-library/jest-dom/vitest'; 4 | 5 | // runs a cleanup after each test case (e.g. clearing jsdom) 6 | afterEach(() => { 7 | cleanup(); 8 | }); -------------------------------------------------------------------------------- /tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /client/components/Docs.tsx: -------------------------------------------------------------------------------- 1 | // import { useLayoutEffect } from "react"; 2 | // interface dataFormProps{ 3 | // changePage: ()=>void 4 | // } 5 | 6 | // export default function Docs({changePage}:dataFormProps) { 7 | // useLayoutEffect(()=> { 8 | // changePage("Docs") 9 | // }) 10 | 11 | // return
Docs page
12 | // } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /client/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App.tsx"; 4 | import "./index.css"; 5 | import { BrowserRouter } from "react-router-dom"; 6 | 7 | ReactDOM.createRoot(document.getElementById("root")!).render( 8 | 9 | 10 | 11 | 12 | 13 | ); 14 | -------------------------------------------------------------------------------- /__tests__/client/App.test.tsx: -------------------------------------------------------------------------------- 1 | import { render, screen } from "@testing-library/react"; 2 | import { MemoryRouter } from "react-router-dom"; 3 | 4 | import App from "../../client/App"; 5 | import "react-router-dom"; 6 | 7 | describe("App", () => { 8 | 9 | test("renders App", () => { 10 | render( 11 | 12 | 13 | 14 | ); 15 | 16 | screen.debug(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /client/api/clearCache.tsx: -------------------------------------------------------------------------------- 1 | export default async function clearCache() { 2 | const request: RequestInfo = new Request( 3 | "https://dash-ql-backend.vercel.app/clearCache", 4 | { 5 | method: "GET", 6 | headers: { "Content-Type": "application/json" }, 7 | } 8 | ); 9 | await fetch(request) 10 | .then(() => {}) 11 | .catch((error) => { 12 | console.log(error, "error in clearing cache"); 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /server/models/model.ts: -------------------------------------------------------------------------------- 1 | const { Pool } = require('pg'); 2 | const PG_URI = 3 | 'postgres://wqwwsdqz:NqDAPzuNW9J0o5eqZuIwyl2f5azOeicv@castor.db.elephantsql.com/wqwwsdqz'; 4 | 5 | const pool = new Pool({ 6 | connectionString: PG_URI, 7 | }); 8 | 9 | module.exports = { 10 | query: async (text: string, params: string, callback: any) => { 11 | console.log('executed query', text); 12 | 13 | const test = await pool.query(text, params, callback); 14 | return test 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { browser: true, es2020: true }, 4 | extends: [ 5 | 'eslint:recommended', 6 | 'plugin:@typescript-eslint/recommended', 7 | 'plugin:react-hooks/recommended', 8 | ], 9 | ignorePatterns: ['dist', '.eslintrc.cjs'], 10 | parser: '@typescript-eslint/parser', 11 | plugins: ['react-refresh'], 12 | rules: { 13 | 'react-refresh/only-export-components': [ 14 | 'warn', 15 | { allowConstantExport: true }, 16 | ], 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | dashQL 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /server/redis.ts: -------------------------------------------------------------------------------- 1 | // const redis = require('redis').createClient({ 2 | // password: 'tqVEk7pRA8dgdiwUjOGzCvTJjfK2YFMt', 3 | // // socket: { 4 | // // host: '127.0.0.1', 5 | // // port: 6379, 6 | // // }, 7 | // socket: { 8 | // host: 'redis-12168.c321.us-east-1-2.ec2.cloud.redislabs.com', 9 | // port: 12168, 10 | // }, 11 | // }); 12 | 13 | // (async () => { 14 | // //console.log('Connecting to Redis...'); 15 | // redis.on('error', (error: string) => console.error(`Ups : ${error}`)); 16 | // await redis.connect(); 17 | // })(); 18 | 19 | // export default redis; 20 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import react from '@vitejs/plugin-react'; 3 | 4 | export default defineConfig({ 5 | plugins: [react()], 6 | server: { 7 | proxy: { 8 | '/dashQL': { 9 | target: 'http://localhost:5001', 10 | changeOrigin: true, 11 | secure: false, 12 | }, 13 | '/api/query': { 14 | target: 'http://localhost:5001', 15 | changeOrigin: true, 16 | secure: false, 17 | }, 18 | }, 19 | port: 5173, 20 | }, 21 | test: { 22 | globals: true, 23 | environment: 'jsdom', 24 | setupFiles: './__tests__/setup.ts', 25 | } 26 | }) 27 | -------------------------------------------------------------------------------- /__tests__/client/components/Demo.test.tsx: -------------------------------------------------------------------------------- 1 | // import { render, screen } from "@testing-library/react"; 2 | // import Demo from "../../../client/components/Demo"; 3 | // import { MemoryRouter } from "react-router-dom"; 4 | // import { beforeEach } from "vitest"; 5 | // import { useState } from "react"; 6 | 7 | // let currentPage = "Demo"; 8 | // function changePage(page: string): void { 9 | // currentPage = page; 10 | // } 11 | 12 | // describe("Demo Test", () => { 13 | // beforeEach(async () => { 14 | // render(); 15 | // screen.debug() 16 | // }); 17 | 18 | // test("renders Demo component", () => { 19 | // expect(screen.getByText("dashQL Cache Demo")).toBeInTheDocument(); 20 | // }); 21 | // }); 22 | -------------------------------------------------------------------------------- /client/App.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import "./App.css"; 3 | import { Routes, Route } from "react-router-dom"; 4 | import Home from "./components/Home"; 5 | import Nav from "./components/Nav"; 6 | import Demo from "./components/Demo"; 7 | 8 | function App() { 9 | const [currentPage, setPage] = useState("Home"); 10 | 11 | function changePage(page: string): void { 12 | setPage(page); 13 | } 14 | 15 | return ( 16 | <> 17 |