Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

407 Add test workflow for leapfrogai_ui #439

Merged
merged 24 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d3fbc32
add ui-test workflow
jalling97 Apr 24, 2024
8939555
add npm prefix
jalling97 Apr 24, 2024
d311db7
add trufflehog scans to workflows
jalling97 Apr 25, 2024
8d0bb03
Merge remote-tracking branch 'origin/main' into 407-ci-create-test-wo…
jalling97 Apr 25, 2024
488b65f
add UI linter to github workflows
jalling97 Apr 25, 2024
a62b4a8
add eslint to pre-commit
jalling97 Apr 25, 2024
bbfa0d4
fix: prettier and eslint issues
andrewrisse Apr 25, 2024
0f0cab6
add prettier to pre-commit
jalling97 Apr 26, 2024
4fc87ea
fix wording mistake
jalling97 Apr 26, 2024
03cdee8
change to npm ci vs install
jalling97 Apr 26, 2024
7021fcf
convert prettier to eslint plugin
jalling97 Apr 26, 2024
0b21f9c
update package.json and package-lock.json
jalling97 Apr 26, 2024
48c284e
merge in main and sync eslint between pre-commit and npm script
jalling97 Apr 29, 2024
0a42e8d
pin setup node actions version
jalling97 Apr 29, 2024
60a8e3b
Merge remote-tracking branch 'origin/main' into 407-ci-create-test-wo…
jalling97 Apr 29, 2024
228efdb
linting fixes
jalling97 Apr 29, 2024
2a0ac2d
fix: frontend eslint issues
andrewrisse Apr 29, 2024
02c3087
pin node version in package.json
jalling97 Apr 29, 2024
233537f
remove pre-commit comments
jalling97 Apr 29, 2024
beb9362
fix: merge conflicts, minor test update
andrewrisse Apr 30, 2024
bdb21f5
exclude .pre-commit-config.yaml from e2e workflow
jalling97 Apr 30, 2024
443e57c
catch .pre-commit-config.yaml in e2e-shim workflow
jalling97 Apr 30, 2024
81e8041
add ui-test-shim
jalling97 Apr 30, 2024
0ef7cc3
remove redundancy in secret-scan github action
jalling97 Apr 30, 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
11 changes: 11 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,14 @@ jobs:
with:
version: 0.3.4
args: format --check

# Javascript & Typescript Linting
- uses: actions/setup-node@v4
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
with:
node-version: 18
jalling97 marked this conversation as resolved.
Show resolved Hide resolved

- name: Install UI Dependencies
run: npm --prefix src/leapfrogai_ui install
jalling97 marked this conversation as resolved.
Show resolved Hide resolved

- name: Run UI Linter
run: npm --prefix src/leapfrogai_ui run lint
20 changes: 20 additions & 0 deletions .github/workflows/secret-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: secret-scan
on:
pull_request:
paths:
# Catch-all
- "**"
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
jalling97 marked this conversation as resolved.
Show resolved Hide resolved


jobs:
secret-scan: # scan for any live secrets in the repository using trufflehog
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
with:
extra_args: --only-verified
35 changes: 35 additions & 0 deletions .github/workflows/ui-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ui-test
on:
pull_request:
paths:
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
# Ignore all workflows except this one
- ".github/workflows/ui-test.yaml"

# LFAI-UI things (no Python)
- "src/leapfrogai_ui/**"
- "packages/ui/**"

# Declare default permissions as read only.
permissions: read-all

concurrency:
group: uitest-${{ github.ref }}
cancel-in-progress: true

jobs:
ui-test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: actions/setup-node@v4
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
with:
node-version: 18
jalling97 marked this conversation as resolved.
Show resolved Hide resolved

- name: Install Dependencies
run: npm --prefix src/leapfrogai_ui install
jalling97 marked this conversation as resolved.
Show resolved Hide resolved

- name: Run Unit Tests
run: npm --prefix src/leapfrogai_ui run test:unit
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,18 @@ repos:
hooks:
- id: ruff # Run the linter.
- id: ruff-format # Run the formatter.

# ESlint
- repo: https://github.com/pre-commit/mirrors-eslint
andrewrisse marked this conversation as resolved.
Show resolved Hide resolved
rev: v8.56.0
hooks:
- id: eslint
files: \.(js|jsx|ts|tsx|svelte)$ # apply eslint to the provided filetypes
types: [file]

# Prettier Code formatter
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
files: \.(js|jsx|ts|tsx|svelte)$ # apply prettier to the provided filetypes
jalling97 marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 4 additions & 1 deletion src/leapfrogai_ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@ module.exports = {
parser: '@typescript-eslint/parser'
}
}
]
],
rules: {
'no-undef': 'off'
}
};
1 change: 1 addition & 0 deletions src/leapfrogai_ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"useTabs": true,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
Expand Down
6 changes: 3 additions & 3 deletions src/leapfrogai_ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ Under a realm in Keycloak that is not the master realm (if using UDS, its "uds")
1. Create a new client (the client ID you use will be used in the env variables below)
2. Turn on "Client Authentication"
3. For "Valid redirect URLs", you need to put:
1. `http://localhost:5173/auth/callback` (or the URL for the frontend app callback)
2. `http://127.0.0.1:54321/auth/v1/callback` (or the URL for the Supabase callback, for locally running Supabase, DO NOT USE LOCALHOST, use 127.0.0.1)
3. Put the same two URLs in for "Web Origins"
1. `http://localhost:5173/auth/callback` (or the URL for the frontend app callback)
2. `http://127.0.0.1:54321/auth/v1/callback` (or the URL for the Supabase callback, for locally running Supabase, DO NOT USE LOCALHOST, use 127.0.0.1)
3. Put the same two URLs in for "Web Origins"
4. Copy the Client Secret under the Clients -> Credentials tab and use in the env variables below
5. You can create users under the "Users" tab and either have them verify their email (if you setup SMTP), or manually mark them as verified.

Expand Down
2 changes: 1 addition & 1 deletion src/leapfrogai_ui/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 4173,
stderr: 'pipe',
stderr: 'pipe'
},
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
Expand Down
25 changes: 18 additions & 7 deletions src/leapfrogai_ui/src/lib/components/ChatSidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,19 @@
>
{#each organizedConversations as category}
{#if category.conversations.length > 0}
<SideNavMenu text={category.label} expanded data-testid="side-nav-menu">
<SideNavMenu
text={category.label}
expanded
data-testid="side-nav-menu"
>
{#each category.conversations as conversation (conversation.id)}
<SideNavMenuItem
data-testid="side-nav-menu-item-{conversation.label}"
id="side-nav-menu-item-{conversation.id}"
isSelected={activeConversation?.id === conversation.id}
on:click={() => handleActiveConversationChange(conversation.id)}
isSelected={activeConversation?.id ===
conversation.id}
on:click={() =>
handleActiveConversationChange(conversation.id)}
>
<div class="menu-content">
{#if editMode && activeConversation?.id === conversation.id}
Expand Down Expand Up @@ -194,20 +200,25 @@
on:click={(e) => {
e.stopPropagation();
overflowMenuOpen = true;
handleActiveConversationChange(conversation.id);
handleActiveConversationChange(
conversation.id
);
disableScroll = true;
}}
data-testid="overflow-menu-{conversation.label}"
style={overflowMenuOpen &&
activeConversation?.id === conversation.id
activeConversation?.id ===
conversation.id
? `position: fixed; top: 0; left: 0; transform: translate(224px, ${menuOffset - scrollOffset + 48}px)`
: ''}
>
<OverflowMenuItem
text="Edit"
on:click={() => {
editConversationId = conversation.id;
editLabelText = conversation.label;
editConversationId =
conversation.id;
editLabelText =
conversation.label;
}}
/>

Expand Down
Loading