Skip to content
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4011a4b
add tailwind
ken-zlai Sep 24, 2024
f46c568
format code w/ prettier
ken-zlai Sep 24, 2024
6a05ff7
add shadcn
ken-zlai Sep 24, 2024
2a9aad1
add shadcn button
ken-zlai Sep 24, 2024
f96c4fe
use button on home page for simple counter
ken-zlai Sep 24, 2024
570ba5d
npm run format
ken-zlai Sep 24, 2024
2b2bddc
modify typescript rules to ignore specific errors in shadcn components
ken-zlai Sep 24, 2024
53e759e
configure tailwind typography
ken-zlai Sep 24, 2024
8dab5f7
Merge branch 'ken-websvc' into ken-frontend
ken-zlai Sep 25, 2024
71895c7
basic dark mode config
ken-zlai Sep 25, 2024
d0b55ea
ignore warnings from node_modules folder
ken-zlai Sep 25, 2024
1e11bc2
configure testing stuff
ken-zlai Sep 25, 2024
3205caa
readme
ken-zlai Sep 25, 2024
afb9aea
move tests
ken-zlai Sep 25, 2024
05bce39
dark mode should be applied in the app.html
ken-zlai Sep 25, 2024
1c31f4a
create a reusable echart component
ken-zlai Sep 26, 2024
8f5bd92
basic heatmap to start testing
ken-zlai Sep 26, 2024
201dc8e
install echarts
ken-zlai Sep 26, 2024
251a052
fix type issues
ken-zlai Sep 26, 2024
a77da82
add sheet component
ken-zlai Sep 26, 2024
6d3a1e9
use resizeobserver on my echart
ken-zlai Sep 27, 2024
7462ed4
refactor echart for clarity
ken-zlai Sep 27, 2024
b2270f6
use proper type
ken-zlai Sep 27, 2024
cf8c8e6
svelte 5 state
ken-zlai Sep 27, 2024
ea4ba7b
create SplitView.svelte
ken-zlai Sep 27, 2024
db32508
use SplitView to show heatmap/sidebar
ken-zlai Sep 27, 2024
f8060b1
Merge branch 'piyush--apis' into ken-frontend
ken-zlai Sep 30, 2024
fffd0ed
add table component
ken-zlai Sep 30, 2024
ea0cd3c
index to export table elements
ken-zlai Sep 30, 2024
fd3702b
add basic api
ken-zlai Sep 30, 2024
7eb1bea
type for model
ken-zlai Sep 30, 2024
00f3807
format code
ken-zlai Sep 30, 2024
dc76a03
add ModelsResponse
ken-zlai Sep 30, 2024
998956a
render a basic table with models data
ken-zlai Sep 30, 2024
7ab1d5d
change route structure
ken-zlai Sep 30, 2024
79268df
add preview of timeseries data
ken-zlai Sep 30, 2024
8e9327c
add avatar
ken-zlai Sep 30, 2024
1855d2e
zipline logo
ken-zlai Sep 30, 2024
3d76751
Wire up Play frontend + server in docker setup
piyush-zlai Sep 30, 2024
c3f728a
create a layout for the app w/ top and left bar
ken-zlai Sep 30, 2024
578ed5b
move model code to model route
ken-zlai Sep 30, 2024
a284edb
add loading indication on nav
ken-zlai Sep 30, 2024
114511f
Merge branch 'main' into ken-frontend
ken-zlai Sep 30, 2024
7e7d697
Fix based on coder rabbit suggestions
piyush-zlai Sep 30, 2024
557555b
Address feedback
piyush-zlai Oct 1, 2024
5691a3c
Merge remote-tracking branch 'origin/piyush/docker-play' into ken-fro…
ken-zlai Oct 1, 2024
34da3a4
configure frontend to build using nodejs
ken-zlai Oct 1, 2024
811cb65
create a custom build for docker to use that env file
ken-zlai Oct 1, 2024
6b27bd3
add a quick coming soon to the / route
ken-zlai Oct 1, 2024
115faa3
zipline logo routes to / route
ken-zlai Oct 1, 2024
9e63629
quick header for timeseries data
ken-zlai Oct 1, 2024
c7cb4a4
Merge branch 'main' into ken-frontend
ken-zlai Oct 1, 2024
cf2e418
remove old frontend stuff from build.sbt
ken-zlai Oct 1, 2024
463eefe
update docker readme
ken-zlai Oct 1, 2024
5ade424
format
ken-zlai Oct 1, 2024
b26c672
add link to the heatmap preview
ken-zlai Oct 1, 2024
6a75611
add instructions for how to start the backend server first for dev work
ken-zlai Oct 2, 2024
6c52f28
.env files were ignored in the .gitignore - remove this
ken-zlai Oct 2, 2024
4750136
cleaner way to run docker build
ken-zlai Oct 2, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ releases
# Frontend Vite
/frontend/vite.config.js.timestamp-*
/frontend/vite.config.ts.timestamp-*

# Frontend Test Results
/frontend/test-results
5 changes: 1 addition & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ lazy val frontend = (project in file("frontend"))
}

println("Building frontend...")
val buildResult = Process("npm run build", file("frontend")).!
val buildResult = Process("npm run build:docker", file("frontend")).!

if (buildResult == 0) {
println("Copying frontend assets to /hub/public...")
Expand Down Expand Up @@ -224,9 +224,6 @@ lazy val hub = (project in file("hub"))
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-parser" % circeVersion
),
// Ensure hub depends on frontend build
Compile / run := ((Compile / run) dependsOn (frontend / buildFrontend)).evaluated,
Compile / stage := ((Compile / stage) dependsOn (frontend / buildFrontend)).value
)

ThisBuild / assemblyMergeStrategy := {
Expand Down
6 changes: 4 additions & 2 deletions docker-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ app-1 | [info] 2024-09-30 20:47:56,448 [main] INFO play.api.Play - Ap
app-1 | [info] 2024-09-30 20:47:56,665 [main] INFO play.core.server.PekkoHttpServer - Listening for HTTP on /[0:0:0:0:0:0:0:0]:9000
```

You can now pull up the web-server on http://localhost:9000
The **backend** is served at: http://localhost:9000

The **frontend** is served at: http://localhost:3000

You can also access the parquet anomaly data table. To do so, from another terminal run:

```docker-compose exec app bash```
`docker-compose exec app bash`

The parquet is available in the /app/data directory.
24 changes: 20 additions & 4 deletions docker-init/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'hub-monitoring-demo'
name: "hub-monitoring-demo"
services:
dynamo:
command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"
Expand All @@ -21,8 +21,8 @@ services:
- SPARK_SSL_ENABLED=no
- SPARK_USER=spark
ports:
- '8080:8080'
- '7077:7077'
- "8080:8080"
- "7077:7077"

spark-worker:
image: bitnami/spark:3.5.2
Expand Down Expand Up @@ -57,10 +57,26 @@ services:
- PLAY_HTTP_SECRET_KEY=my_fake_chronon_monitoring_hub_http_secret_key # needs to be long to make Play happy
- JAVA_OPTS=-Xms1g -Xmx1g
ports:
- '9000:9000'
- "9000:9000"
healthcheck:
interval: 1s
retries: 5
start_period: 60s
test: curl -sS --fail http://app:${APP_PORT:-9000}/api/v1/ping
timeout: 5s

frontend:
build:
context: ..
dockerfile: docker-init/frontend/Dockerfile
depends_on:
- base
- app
ports:
- "3000:3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
24 changes: 24 additions & 0 deletions docker-init/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM base_image:latest AS build_env

# Copy the entire project directory into the container
COPY . /app

# Install Node.js and npm
RUN apk add --update nodejs npm

# Build the frontend using SBT
RUN sbt "project frontend" buildFrontend

FROM node:18-alpine

# Copy the built frontend from the previous stage to the new container
COPY --from=build_env app/frontend /app/frontend

# Set the working directory for subsequent commands
WORKDIR /app/frontend

# Expose port 3000 for the SvelteKit app
EXPOSE 3000

# Specify the command to run when the container starts
CMD ["node", "build/index.js"]
133 changes: 115 additions & 18 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,135 @@
# create-svelte
# Chronon Frontend

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
The frontend for Chronon.

## Creating a project
## Getting Started

If you're seeing this, you've probably already done this step. Congrats!
### Prerequisites

- [Node.js](https://nodejs.org/en/) (LTS version recommended)
- npm (comes with Node.js)

### Installation

1. Clone the repository:

```bash
git clone https://github.com/zipline-ai/chronon.git
cd chronon
```

2. Navigate to the frontend directory:

```bash
cd frontend
```

3. Install dependencies:
```bash
npm install
```

### Development

To start the development server:

```bash
# create a new project in the current directory
npm create svelte@latest
npm run dev
```

This will start a local server. The app will automatically reload if you make changes to the code.

# create a new project in my-app
npm create svelte@latest my-app
### Build

To create an optimized production build:

```bash
npm run build
```

## Developing
This will create an optimized version of your project in the `build` directory.

### Preview

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
To preview the production build locally:

```bash
npm run dev
npm run preview
```

# or start the server and open the app in a new browser tab
npm run dev -- --open
### Running Tests

#### All Tests

To run both unit and integration tests together:

```bash
npm run test
```

## Building
#### Unit Tests

To create a production version of your app:
To run unit tests using Vitest:

```bash
npm run build
npm run test:unit
```

To run unit tests once:

```bash
npm run test:unit:once
```

#### Integration Tests

To run integration tests using Playwright:

```bash
npm run test:integration
```

To run integration tests once:

```bash
npm run test:integration:once
```

For the Playwright UI to explore test results:

```bash
npm run test:integration:ui
```

### Linting and Formatting

To check code formatting and linting issues:

```bash
npm run lint
```

To format the codebase:

```bash
npm run format
```

### Type Checking

To check the TypeScript types:

```bash
npm run check
```

To continuously check types while developing:

```bash
npm run check:watch
```

You can preview the production build with `npm run preview`.
## Best Practices

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
1. **Code Style**: This project uses Prettier and ESLint for code formatting and linting. Please run `npm run lint` and `npm run format` before committing changes.
2. **Testing**: Ensure all changes are covered with unit and integration tests. Use Vitest for unit tests and Playwright for integration tests.
14 changes: 14 additions & 0 deletions frontend/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://shadcn-svelte.com/schema.json",
"style": "new-york",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app.css",
"baseColor": "neutral"
},
"aliases": {
"components": "$lib/components",
"utils": "$lib/utils"
},
"typescript": true
}
9 changes: 9 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ export default [
parserOptions: {
parser: ts.parser
}
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^\\$\\$(Props|Events|Slots|Generic)$'
}
]
}
},
{
Expand Down
Loading