Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Add interactive search #177

Draft
wants to merge 72 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
85705ad
Add experimental fetch method
katjuell Aug 11, 2021
9de6815
Try more things
katjuell Aug 11, 2021
46e8ef6
Add basic fetch for query match
katjuell Aug 12, 2021
e715b26
Fix merge conflicts
katjuell Aug 13, 2021
7a35bf7
Add interactive search component and continue defining shape of retur…
katjuell Aug 13, 2021
c5510fb
Merge branch 'main' into kjuell/hooks-experiment
katjuell Aug 17, 2021
a7f12c4
Save progress
katjuell Aug 17, 2021
5425a03
Add working hook with ngrok and cors config on local docker instance
katjuell Aug 18, 2021
49847d1
Update set state
katjuell Aug 18, 2021
2e62a52
Merge branch 'main' into kjuell/hooks-experiment
katjuell Aug 18, 2021
d199172
Add code blocks to results and use env vars for credentials
katjuell Aug 18, 2021
6c2bf42
Handle results as arrays
katjuell Aug 18, 2021
5831cd4
Fix key error
katjuell Aug 19, 2021
6525221
Update interactive search
katjuell Aug 19, 2021
b957abe
Adjust table styles
katjuell Aug 19, 2021
7bf5837
Update hook to be fully interactive
katjuell Aug 19, 2021
1328c5c
Add surrounding lines for matches and adjust styles
katjuell Aug 20, 2021
904e25c
Highlight matches
katjuell Aug 22, 2021
9b3d27b
Handle first line search matches
katjuell Aug 22, 2021
4137de5
Modify highlighting logic and quick select results
katjuell Aug 23, 2021
2d99365
Merge branch 'main' into kjuell/hooks-experiment
katjuell Aug 23, 2021
33301a6
Add placeholders for env vars to install script
katjuell Aug 23, 2021
ab06b26
Move token and url and update component
katjuell Aug 23, 2021
262e0a1
Add vars to install script and update logic in highlighter for repo s…
katjuell Aug 23, 2021
20eb91f
Merge branch 'main' into kjuell/hooks-experiment
katjuell Aug 23, 2021
363e2f6
Remove unused vars in slug template
katjuell Aug 23, 2021
bf25bff
Merge branch 'main' into kjuell/hooks-experiment
katjuell Sep 1, 2021
05218c4
Add error component for fetch fail
katjuell Sep 2, 2021
770b4c1
Repo reorg and start of backend
katjuell Sep 3, 2021
7243980
Fix gitignore for node_modules
katjuell Sep 3, 2021
d6d5013
Finalize routing and handler logic using node-fetch
katjuell Sep 8, 2021
e49cb56
Add interfaces, get file logic, fix body parser, handle try/catch in …
katjuell Sep 8, 2021
956e21d
More cleanup
katjuell Sep 8, 2021
18848cf
Reorg project again to take the simplest approach to front/backend fo…
katjuell Sep 8, 2021
8c3bcf1
Update install script
katjuell Sep 8, 2021
d660fb6
Update client to use backend; add everything back to main dir
katjuell Sep 8, 2021
61c751d
Update install script
katjuell Sep 8, 2021
f986f10
Merging main
katjuell Sep 8, 2021
a9bb9c7
Add compose file and Caddy config
katjuell Sep 9, 2021
42c46f2
Update netlify toml for new repo org
katjuell Sep 9, 2021
d42bdd4
Reorg project, update toml
katjuell Sep 9, 2021
777528b
Finalize local Docker testing and update search url to be part of hook
katjuell Sep 9, 2021
6ae89af
Update gitignore
katjuell Sep 9, 2021
45cb113
Merge branch 'main' into kjuell/hooks-experiment
katjuell Sep 10, 2021
7a3e9af
Add dockerignore and infra install script
katjuell Sep 10, 2021
5262beb
Remove unused code from backend/tsconfig
katjuell Sep 10, 2021
f758239
Fix merge conflicts
katjuell Sep 10, 2021
ff4779a
Modify infra install script
katjuell Sep 10, 2021
bad67d9
Add data & config vars to install script, adjust infra install script…
katjuell Sep 10, 2021
7c9aa10
Update toml to proceed with build if there are changes in the top-lev…
katjuell Sep 10, 2021
5be477c
Update results display logic and matches messaging
katjuell Sep 10, 2021
c60d022
Add no console linting rule and eslintrc.json for backend
katjuell Sep 10, 2021
0083536
Address warning on hook with initial object interface
katjuell Sep 10, 2021
1756c0c
Remove all remaining warnings on backend
katjuell Sep 10, 2021
737cb7e
Fix merge conflicts with main
katjuell Sep 20, 2021
f37547f
Update query matching logic for repos in highlighter and add check fo…
katjuell Sep 20, 2021
6cb04e2
Update checks on interactive search result
katjuell Sep 20, 2021
1b67d77
More checks
katjuell Sep 20, 2021
91d3a07
Move checks to upper level
katjuell Sep 20, 2021
c691dc5
Add search on cloud input field
katjuell Sep 20, 2021
a238681
Update fragment in search component and add encoding for query
katjuell Sep 21, 2021
8745ec7
Use V2 interface for search
katjuell Sep 22, 2021
09d10c5
Fix merge conflicts with main
katjuell Sep 22, 2021
e66b542
Update pattern type logic for structural search; update line numbers …
katjuell Sep 22, 2021
4047f0f
Move search results to atom
katjuell Sep 22, 2021
c0432d5
Add results table component to display search results, and ensure str…
katjuell Sep 23, 2021
db768cd
Fix highlighting for structural search
katjuell Sep 23, 2021
e05c741
Highlighting for AND queries
katjuell Sep 23, 2021
9d0e836
Add search results header, commit results interface to front and back…
katjuell Sep 24, 2021
e805415
Add interactive to regexp tutorial, update and refactor highlighter
katjuell Sep 24, 2021
21122ec
Remove unneeded search results component and make sure commit search …
katjuell Sep 24, 2021
7fbab7a
Update highlighting logic for regexp matching groups
katjuell Sep 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
**/node_modules/
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/
**/.next/
**/out/

# production
/build
Expand Down
3 changes: 3 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.env*
npm-debug.log
15 changes: 15 additions & 0 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "@sourcegraph/eslint-config",
"rules": {
"import/no-default-export": "off",
"react/forbid-dom-props": "warn",
"@typescript-eslint/require-await": "warn",
"multiline-ternary": "error",
"no-console": ["error",
{ "allow": ["error"] }
]
},
"parserOptions": {
"project": "tsconfig.json"
}
}
File renamed without changes.
12 changes: 12 additions & 0 deletions backend/Dockerfile-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:16-alpine
MAINTAINER [email protected]

WORKDIR .

COPY package*.json ./
RUN npm ci
COPY . ./

EXPOSE 3001

CMD ["npm", "run", "start"]
7 changes: 7 additions & 0 deletions backend/caddy/http.Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Routes all plain http requests to backend service - suitable for local testing.
#
# Caddyfile documentation: https://caddyserver.com/docs/caddyfile

:80

reverse_proxy {$BACKEND}
21 changes: 21 additions & 0 deletions backend/caddy/https.lets-encrypt-prod.Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Serves Sourcegraph over HTTPS, using Caddy's automatic HTTPS certificate feature:
# https://caddyserver.com/docs/automatic-https
#
# 🚨 Warning: If your DNS and Caddy configuration aren't properly configured (as
# specified in https://caddyserver.com/docs/automatic-https), you can
# run into Let's Encrypt rate limits which can block your certificates
# for up to a week.
# It's strongly recommened that you use the staging Caddyfile
# (https.lets-encrypt-staging.Caddyfile) to test your
# configuration before switching to this production one.
#
# Caddyfile documentation: https://caddyserver.com/docs/caddyfile
#

{
email {$ACME_EMAIL}
}

{$SITE_ADDRESS}

reverse_proxy {$BACKEND}
27 changes: 27 additions & 0 deletions backend/caddy/https.lets-encrypt-staging.Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Serves Sourcegraph over HTTPS, using Caddy's automatic HTTPS certificate feature:
# https://caddyserver.com/docs/automatic-https
#
# Note: This configuration uses Let's Encrypt's staging environment. This will
# allow you to ensure that everything is correctly configured (with a reduced
# chance of running into rate limit issues). Note that using this configuration
# issues a fake certificate (for testing purposes) instead of a trusted one.
#
# 🚨 Warning: If your DNS and Caddy configuration aren't properly configured (as
# specified in https://caddyserver.com/docs/automatic-https), you can
# run into Let's Encrypt rate limits which can block your certificates
# for up to a week.
# It's strongly recommened that you use this Caddyfile to test your
# configuration before switching to the production one.
#
# Caddyfile documentation: https://caddyserver.com/docs/caddyfile
#

{
# Use Let's Encrypt's staging environment
acme_ca "https://acme-staging-v02.api.letsencrypt.org/directory"
email {$ACME_EMAIL}
}

{$SITE_ADDRESS}

reverse_proxy {$BACKEND}
41 changes: 41 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.7'

services:
caddy:
image: caddy:2.4.5-alpine
env_file: .env
volumes:
- caddy:/caddy-storage
- ./caddy/http.Caddyfile:/etc/caddy/Caddyfile
# Uncomment the following line when using HTTPS with Let's Encrypt's staging environment
# - './caddy/https.lets-encrypt-staging.Caddyfile:/etc/caddy/Caddyfile'
#
# Uncomment the following line when using HTTPS with Let's Encrypt's production environment
# IMPORTANT: Strongly recommended to test with the staging configuration above first, see that file for details.
# - './caddy/https.lets-encrypt-prod.Caddyfile:/etc/caddy/Caddyfile'
ports:
- '127.0.0.1:80:80'
# Uncomment when working in staging/prod
# - '0.0.0.0:80:80'
# Uncomment when using HTTPS
# - '0.0.0.0:443:443'
networks:
- sg-learn
restart: unless-stopped

backend:
build:
context: .
dockerfile: Dockerfile-backend
env_file: .env
ports:
- '3001:3001'
networks:
- sg-learn
restart: unless-stopped

networks:
sg-learn:

volumes:
caddy:
Loading