Skip to content

Commit

Permalink
Merge branch 'main' into sidebar-heading
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-mcgovern authored Jan 15, 2025
2 parents f3344fe + 8e732f6 commit 00f08fc
Show file tree
Hide file tree
Showing 29 changed files with 800 additions and 307 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_BASE_API_URL=http://localhost:8989
VITE_BASE_API_URL="http://localhost:8989"
18 changes: 18 additions & 0 deletions .github/workflows/_release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Please
permissions: write-all
on:
workflow_call:
secrets:
GH_PAT_RELEASE_PLEASE:
required: true
jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4
id: release
with:
token: ${{ secrets.GH_PAT_RELEASE_PLEASE }}
release-type: node
30 changes: 30 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# NOTE: This workflow deviates from the normal convention of using a single
# workflow as an entrypoint or trigger for other re-usable workflows. The reason
# for this is it needs to be triggered for a variety of PR events, including
# `edited`, when the title changes — where we do *not* want to trigger the
# entire suite of CI checks. We also cannot use `if` or `needs` triggers to
# filter which steps we need to run, as if we skip certain checks, we do not
# have visibility on the code quality or security of the PR.
name: Lint PR title
on:
pull_request:
types:
- edited
- opened
- reopened
- synchronize
jobs:
lint-pr-title:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- uses: ./.github/actions/setup

- name: Install commitlint
run: |
npm i -D commitlint @commitlint/config-conventional
- name: Validate PR title
run: echo "${{ github.event.pull_request.title }}" | npx commitlint -x '@commitlint/config-conventional'
9 changes: 7 additions & 2 deletions .github/workflows/on-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on:
push:
branches:
- main
permissions:
contents: write
permissions: write-all
jobs:
security:
name: Security Checks
Expand All @@ -19,3 +18,9 @@ jobs:
name: Unit Tests
uses: ./.github/workflows/_unit-tests.yml
secrets: inherit

release-please:
name: Release Please
uses: ./.github/workflows/_release-please.yml
secrets:
GH_PAT_RELEASE_PLEASE: ${{ secrets.GH_PAT_RELEASE_PLEASE }}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## [0.1.0](https://github.com/stacklok/codegate-ui/compare/v0.0.15...v0.1.0) (2025-01-15)


### Features

* add ErrorBoundary ([#69](https://github.com/stacklok/codegate-ui/issues/69)) ([78bdfb9](https://github.com/stacklok/codegate-ui/commit/78bdfb9ef98ee9426c35c254fd4f670954c162b1))
* health check card ([#62](https://github.com/stacklok/codegate-ui/issues/62)) ([f2673bc](https://github.com/stacklok/codegate-ui/commit/f2673bcf71d2ce1850ac9ad8e861bf448ac84a91))

## [0.0.15](https://github.com/stacklok/codegate-ui/compare/v0.0.14...v0.0.15) (2025-01-15)


### Bug Fixes

* alerts line chart sorting ([#63](https://github.com/stacklok/codegate-ui/issues/63)) ([ce8146c](https://github.com/stacklok/codegate-ui/commit/ce8146c644b9a44884aba2a5b4fc0adba08a4518))
* formatting alert time in the table, add seconds ([#56](https://github.com/stacklok/codegate-ui/issues/56)) ([8d764aa](https://github.com/stacklok/codegate-ui/commit/8d764aac08329fceb2e3bc53b0ba01ef785ecf7e))
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
# React + TypeScript + Vite
# CodeGate Dashboard

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
[![Coverage Status](https://coveralls.io/repos/github/stacklok/codegate-ui/badge.svg?branch=main)](https://coveralls.io/github/stacklok/codegate-ui?branch=main)

Currently, two official plugins are available:
This repository contains the [CodeGate](https://github.com/stacklok/codegate)
dashboard user interface. The dashboard presents information about CodeGate's
security insights and activity, including:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
- Prompt and chat conversation history
- Security alert counts and daily trend
- Alert history with secrets and package risks detected by CodeGate
- CA certificate download and installation instructions

## Setting up local development environment

To install all dependencies for your local development environment, run
To run a local development environment, start by running a copy of the CodeGate
[application](https://github.com/stacklok/codegate/blob/main/docs/development.md)
or [container](https://docs.codegate.ai/how-to/install). The UI will connect to
the API endpoint at `http://localhost:8989` by default. To change this, set the
`VITE_BASE_API_URL` environment variable.

Install all dependencies and run a dev server:

```bash
npm install
Expand All @@ -23,6 +33,8 @@ Run the development server using:
npm run dev
```

Open <http://localhost:5173> on your browser to see the dashboard

## Build production

Run the build command:
Expand Down
47 changes: 45 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vite-project",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -26,6 +26,7 @@
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.6",
"@tanstack/react-query": "^5.64.1",
"@types/prismjs": "^1.26.5",
"@types/react-syntax-highlighter": "^15.5.13",
"class-variance-authority": "^0.7.1",
Expand Down Expand Up @@ -70,6 +71,7 @@
"lint-staged": "^15.3.0",
"msw": "^2.7.0",
"postcss": "^8.4.49",
"prettier": "3.4.2",
"tailwindcss": "^3.4.15",
"typescript": "~5.7.2",
"typescript-eslint": "^8.15.0",
Expand All @@ -81,4 +83,4 @@
"overrides": {
"vite": "^6.0.1"
}
}
}
4 changes: 2 additions & 2 deletions src/api/generated/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file is auto-generated by @hey-api/openapi-ts
export * from "./sdk.gen";
export * from "./types.gen";
export * from './sdk.gen';
export * from './types.gen';
71 changes: 18 additions & 53 deletions src/api/generated/sdk.gen.ts
Original file line number Diff line number Diff line change
@@ -1,74 +1,39 @@
// This file is auto-generated by @hey-api/openapi-ts

import {
createClient,
createConfig,
type OptionsLegacyParser,
} from "@hey-api/client-fetch";
import type {
GetMessagesDashboardMessagesGetError,
GetMessagesDashboardMessagesGetResponse,
GetAlertsDashboardAlertsGetError,
GetAlertsDashboardAlertsGetResponse,
StreamSseDashboardAlertsNotificationGetError,
StreamSseDashboardAlertsNotificationGetResponse,
} from "./types.gen";
import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch';
import type { GetMessagesDashboardMessagesGetError, GetMessagesDashboardMessagesGetResponse, GetAlertsDashboardAlertsGetError, GetAlertsDashboardAlertsGetResponse, StreamSseDashboardAlertsNotificationGetError, StreamSseDashboardAlertsNotificationGetResponse } from './types.gen';

export const client = createClient(createConfig());

/**
* Get Messages
* Get all the messages from the database and return them as a list of conversations.
*/
export const getMessagesDashboardMessagesGet = <
ThrowOnError extends boolean = false,
>(
options?: OptionsLegacyParser<unknown, ThrowOnError>,
) => {
return (options?.client ?? client).get<
GetMessagesDashboardMessagesGetResponse,
GetMessagesDashboardMessagesGetError,
ThrowOnError
>({
...options,
url: "/dashboard/messages",
});
export const getMessagesDashboardMessagesGet = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
return (options?.client ?? client).get<GetMessagesDashboardMessagesGetResponse, GetMessagesDashboardMessagesGetError, ThrowOnError>({
...options,
url: '/dashboard/messages'
});
};

/**
* Get Alerts
* Get all the messages from the database and return them as a list of conversations.
*/
export const getAlertsDashboardAlertsGet = <
ThrowOnError extends boolean = false,
>(
options?: OptionsLegacyParser<unknown, ThrowOnError>,
) => {
return (options?.client ?? client).get<
GetAlertsDashboardAlertsGetResponse,
GetAlertsDashboardAlertsGetError,
ThrowOnError
>({
...options,
url: "/dashboard/alerts",
});
export const getAlertsDashboardAlertsGet = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
return (options?.client ?? client).get<GetAlertsDashboardAlertsGetResponse, GetAlertsDashboardAlertsGetError, ThrowOnError>({
...options,
url: '/dashboard/alerts'
});
};

/**
* Stream Sse
* Send alerts event
*/
export const streamSseDashboardAlertsNotificationGet = <
ThrowOnError extends boolean = false,
>(
options?: OptionsLegacyParser<unknown, ThrowOnError>,
) => {
return (options?.client ?? client).get<
StreamSseDashboardAlertsNotificationGetResponse,
StreamSseDashboardAlertsNotificationGetError,
ThrowOnError
>({
...options,
url: "/dashboard/alerts_notification",
});
};
export const streamSseDashboardAlertsNotificationGet = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<unknown, ThrowOnError>) => {
return (options?.client ?? client).get<StreamSseDashboardAlertsNotificationGetResponse, StreamSseDashboardAlertsNotificationGetError, ThrowOnError>({
...options,
url: '/dashboard/alerts_notification'
});
};
Loading

0 comments on commit 00f08fc

Please sign in to comment.