Skip to content

Commit

Permalink
refactor: rename sso-workflow-bridge -> user-tasks-bridge (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
hazimoarafa authored Jan 31, 2025
1 parent fd530a5 commit f7e5347
Show file tree
Hide file tree
Showing 90 changed files with 1,123 additions and 559 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/ui"
directory: "/console"
schedule:
interval: "monthly"
- package-ecosystem: npm
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Build and Test

on:
pull_request:
Expand Down Expand Up @@ -27,5 +27,10 @@ jobs:
- name: Lint
run: npm run lint -ws

- name: Test
run: npm run test -ws --if-present

- name: Build
run: npm run build -ws


2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- name: Trigger Build Standalone
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_USER_TASKS }}
run: gh workflow run main.yml -R littlehorse-enterprises/lh-sso-workflow-bridge-api
run: gh workflow run main.yml -R littlehorse-enterprises/lh-user-tasks-bridge-api
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Publish Image
uses: littlehorse-enterprises/publish-image@v1
with:
image-name: lh-sso-workflow-bridge-ui
image-name: lh-user-tasks-bridge-ui
dockerfile: Dockerfile
github-token: ${{ secrets.GITHUB_TOKEN }}
tags: |
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# LittleHorse SSO Workflow Bridge
# LittleHorse User Tasks Bridge

This repository contains the code for:

- `SSO Workflow Bridge UI` (Next.js)
- `@littlehorse-enterprises/sso-workflow-bridge-api-client` (Node Package That Interacts With The SSO Workflow Bridge API)
- `User Tasks Bridge Console` (Next.js)
- `@littlehorse-enterprises/user-tasks-bridge-api-client` (Node Package)

This repository will help you interact with LittleHorse's SSO Workflow Bridge API.
This repository will help you interact with LittleHorse's User Tasks Bridge Backend.

## Overview

The LH UserTask UI provides a complete solution for managing human tasks within LittleHorse workflows. It consists of:
The console provides a complete solution for managing human tasks within LittleHorse workflows. It consists of:

1. A modern web interface built with Next.js for managing and interacting with user tasks
2. A TypeScript API client that simplifies integration with the UserTasks API
Expand All @@ -35,22 +35,22 @@ This project is designed to work seamlessly with LittleHorse's workflow engine,
The fastest way to get started is using our standalone image that includes all necessary components:

```bash
docker run --name lh-sso-workflow-bridge-standalone --rm -d \
docker run --name lh-user-tasks-bridge-standalone --rm -d \
-p 2023:2023 \
-p 8080:8080 \
-p 8888:8888 \
-p 8089:8089 \
-p 3000:3000 \
ghcr.io/littlehorse-enterprises/sso-workflow-bridge/sso-workflow-bridge-standalone:main
ghcr.io/littlehorse-enterprises/lh-user-tasks-bridge/lh-user-tasks-bridge-standalone:latest
```

This will start:

- LittleHorse Server (gRPC: 2023)
- LittleHorse Dashboard (<http://localhost:8080>)
- Keycloak (<http://localhost:8888>)
- User Tasks API (<http://localhost:8089>)
- User Tasks UI (<http://localhost:3000>)
- User Tasks Bridge Backend (<http://localhost:8089>)
- User Tasks Bridge Console (<http://localhost:3000>)

## Available Users

Expand All @@ -61,9 +61,9 @@ To access the Keycloak admin console at <http://localhost:8888>, use:
- Username: **admin**
- Password: **admin**

### User Tasks UI
### User Tasks Bridge Console

You can log in to the User Tasks UI at <http://localhost:3000> with these pre-configured users:
You can log in to the User Tasks Bridge Console at <http://localhost:3000> with these pre-configured users:

| User | Password | Role |
| ------------- | -------- | ----- |
Expand All @@ -88,13 +88,13 @@ export KEYCLOAK_ADMIN_ACCESS_TOKEN=$(http --ignore-stdin --form "http://localhos

```bash
# Assign to specific user
lhctl run sso-workflow-bridge-demo user $(http --ignore-stdin -b -A bearer -a "${KEYCLOAK_ADMIN_ACCESS_TOKEN}" "http://localhost:8888/admin/realms/default/users/?username=my-user" | jq -r ".[0].id")
lhctl run user-tasks-bridge-demo user $(http --ignore-stdin -b -A bearer -a "${KEYCLOAK_ADMIN_ACCESS_TOKEN}" "http://localhost:8888/admin/realms/default/users/?username=my-user" | jq -r ".[0].id")

# Assign to users group
lhctl run sso-workflow-bridge-demo group $(http --ignore-stdin -b -A bearer -a "${KEYCLOAK_ADMIN_ACCESS_TOKEN}" "http://localhost:8888/admin/realms/default/groups/?exact=true&search=users" | jq -r ".[0].id")
lhctl run user-tasks-bridge-demo group $(http --ignore-stdin -b -A bearer -a "${KEYCLOAK_ADMIN_ACCESS_TOKEN}" "http://localhost:8888/admin/realms/default/groups/?exact=true&search=users" | jq -r ".[0].id")

# Assign to admins group
lhctl run sso-workflow-bridge-demo group $(http --ignore-stdin -b -A bearer -a "${KEYCLOAK_ADMIN_ACCESS_TOKEN}" "http://localhost:8888/admin/realms/default/groups/?exact=true&search=admins" | jq -r ".[0].id")
lhctl run user-tasks-bridge-demo group $(http --ignore-stdin -b -A bearer -a "${KEYCLOAK_ADMIN_ACCESS_TOKEN}" "http://localhost:8888/admin/realms/default/groups/?exact=true&search=admins" | jq -r ".[0].id")
```

## Development Setup
Expand All @@ -112,8 +112,8 @@ If you want to develop the UI locally:
1. Clone this repository:

```bash
git clone https://github.com/littlehorse-enterprises/lh-sso-workflow-bridge.git
cd lh-sso-workflow-bridge
git clone https://github.com/littlehorse-enterprises/lh-user-tasks-bridge.git
cd lh-user-tasks-bridge
```

2. Install git hooks:
Expand Down Expand Up @@ -162,7 +162,7 @@ The UI will start with watch mode on <http://localhost:3000>

### Useful Links

- SSO Workflow Bridge UI: <http://localhost:3000>
- User Tasks Bridge Console: <http://localhost:3000>
- LittleHorse Dashboard: <http://localhost:8080>
- Keycloak Admin Console: <http://localhost:8888>

Expand Down Expand Up @@ -196,9 +196,9 @@ docker run --rm \
-e AUTH_KEYCLOAK_SECRET=' ' \
-e AUTH_KEYCLOAK_ISSUER='http://localhost:8888/realms/default' \
-e LHUT_API_URL='http://localhost:8089' \
-e AUTHORITIES='$.realm_access.roles,$.resource_access.*.roles' \
-e LHUT_AUTHORITIES='$.realm_access.roles,$.resource_access.*.roles' \
-p 3000:3000 -p 3443:3443 \
ghcr.io/littlehorse-enterprises/lh-sso-workflow-bridge/lh-sso-workflow-bridge-ui:main
ghcr.io/littlehorse-enterprises/lh-user-tasks-bridge/lh-user-tasks-bridge-console:latest
```

When SSL is enabled, the UI will be available on:
Expand All @@ -213,11 +213,11 @@ When SSL is enabled, the UI will be available on:
| `SSL` | Set to `enabled` to enable SSL | Yes |
| `AUTH_URL` | Full URL where the app will be accessible (use HTTPS port) | Yes |
| `AUTH_SECRET` | Random string used to hash tokens | Yes |
| `AUTH_KEYCLOAK_CLIENT_ID` | Client ID from Keycloak | Yes |
| `AUTH_KEYCLOAK_ID` | Client ID from Keycloak | Yes |
| `AUTH_KEYCLOAK_SECRET` | Client secret from Keycloak | Yes |
| `AUTH_KEYCLOAK_ISSUER` | Keycloak server URL | Yes |
| `LHUT_API_URL` | URL of the User Tasks API | Yes |
| `AUTHORITIES` | Paths to extract roles from the token | Yes |
| `LHUT_AUTHORITIES` | Paths to extract roles from the token | Yes |

### Notes

Expand Down
2 changes: 1 addition & 1 deletion api-client/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within
third-party archives.

Copyright 2024 Little Horse Enterprises LLC.
Copyright 2025 LittleHorse Enterprises LLC.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions api-client/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# LittleHorse SSO Workflow Bridge API Client
# LittleHorse User Tasks Bridge API Client

A lightweight client for interacting with LittleHorse [SSO Workflow Bridge API](https://littlehorse.io/docs/sso-workflow-bridge/api).
A lightweight client for interacting with LittleHorse [User Tasks Bridge Backend](https://littlehorse.io/docs/user-tasks-bridge/backend).

## Installation

```bash
npm install @littlehorse-enterprises/sso-workflow-bridge-api-client
npm install @littlehorse-enterprises/user-tasks-bridge-api-client
```

## Documentation

Visit our [official documentation](https://littlehorse.io/docs/sso-workflow-bridge/api-client).
Visit our [official documentation](https://littlehorse.io/docs/user-tasks-bridge/api-client).

## License

Expand Down
15 changes: 7 additions & 8 deletions api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@littlehorse-enterprises/sso-workflow-bridge-api-client",
"homepage": "https://littlehorse.io/docs/sso-workflow-bridge",
"bugs": "https://github.com/littlehorse-enterprises/sso-workflow-bridge/issues",
"version": "0.12.2",
"description": "Client for interacting with the LittleHorse SSO Workflow Bridge API",
"name": "@littlehorse-enterprises/user-tasks-bridge-api-client",
"homepage": "https://littlehorse.io/docs/user-tasks-bridge",
"bugs": "https://github.com/littlehorse-enterprises/lh-user-tasks-bridge/issues",
"version": "0.12.5",
"description": "Client for interacting with the LittleHorse User Tasks Bridge Backend",
"license": "Apache-2.0",
"author": "LittleHorse Enterprises",
"repository": {
"type": "git",
"url": "git+https://github.com/littlehorse-enterprises/sso-workflow-bridge.git"
"url": "git+https://github.com/littlehorse-enterprises/lh-user-tasks-bridge.git"
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -21,8 +21,7 @@
},
"keywords": [
"littlehorse",
"sso",
"workflow",
"user tasks",
"bridge",
"api",
"client"
Expand Down
10 changes: 5 additions & 5 deletions api-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from "./errors";

/**
* Configuration options for the LittleHorse SSO Workflow Bridge API client
* Configuration options for the LittleHorse User Tasks Bridge API client
* @interface
*/
export interface ClientConfig {
Expand All @@ -36,7 +36,7 @@ export interface ClientConfig {
}

/**
* Client for interacting with the LittleHorse SSO Workflow Bridge API.
* Client for interacting with the LittleHorse User Tasks Bridge API.
*
* This client provides methods for managing user tasks in LittleHorse, including:
* - Task operations (claim, complete, cancel)
Expand All @@ -46,20 +46,20 @@ export interface ClientConfig {
*
* @example
* ```typescript
* const client = new LHSWBApiClient({
* const client = new LHUTBApiClient({
* baseUrl: 'http://localhost:8089', // UserTasks API endpoint
* tenantId: 'default', // Your LittleHorse tenant
* accessToken: 'your-oidc-token' // Valid OIDC access token
* });
* ```
*/
export class LHSWBApiClient {
export class LHUTBApiClient {
private baseUrl: string;
private tenantId: string;
private accessToken: string;

/**
* Creates a new instance of the LittleHorse SSO Workflow Bridge API client
* Creates a new instance of the LittleHorse User Tasks Bridge API client
* @param config - Configuration object containing connection details
* @throws {ValidationError} If required configuration parameters are missing or invalid
* @throws {UnauthorizedError} If initial connection test fails
Expand Down
7 changes: 3 additions & 4 deletions ui/.env.sample → console/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ AUTH_URL='http://localhost:3000'
NEXTAUTH_URL='http://localhost:3000'
AUTH_SECRET='<any secret here>'

AUTH_KEYCLOAK_CLIENT_ID='user-tasks-client'
AUTH_KEYCLOAK_SECRET=' '
AUTH_KEYCLOAK_ID='user-tasks-bridge-client'
AUTH_KEYCLOAK_SECRET=''
AUTH_KEYCLOAK_ISSUER='http://localhost:8888/realms/default'

LHUT_API_URL='http://localhost:8089'

AUTHORITIES=$.realm_access.roles,$.resource_access.*.roles
LHUT_AUTHORITIES='$.realm_access.roles,$.resource_access.*.roles'
2 changes: 2 additions & 0 deletions console/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.next/
node_modules/
6 changes: 3 additions & 3 deletions Dockerfile → console/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ghcr.io/littlehorse-enterprises/alpine-nginx-nodejs/nginx-nodejs:main
WORKDIR /app

COPY ./ui/.next/standalone/ui ./
COPY ./ui/.next/standalone/node_modules ./node_modules
COPY ./ui/.next/static ./.next/static
COPY ./.next/standalone/console ./
COPY ./.next/standalone/node_modules ./node_modules
COPY ./.next/static ./.next/static

COPY ./entrypoint.sh ./

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions entrypoint.sh → console/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ ! "${AUTH_SECRET+x}" ]; then
exit 1
fi

if [ ! "${AUTH_KEYCLOAK_CLIENT_ID+x}" ]; then
echo "Provide the AUTH_KEYCLOAK_CLIENT_ID env variable"
if [ ! "${AUTH_KEYCLOAK_ID+x}" ]; then
echo "Provide the AUTH_KEYCLOAK_ID env variable"
exit 1
fi

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ui/package.json → console/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@littlehorse-enterprises/sso-workflow-bridge-ui",
"name": "@littlehorse-enterprises/user-tasks-bridge-console",
"scripts": {
"dev": "next dev --turbo",
"build": "next build",
Expand All @@ -10,7 +10,7 @@
},
"dependencies": {
"@hookform/resolvers": "^3.10.0",
"@littlehorse-enterprises/sso-workflow-bridge-api-client": "*",
"@littlehorse-enterprises/user-tasks-bridge-api-client": "*",
"@radix-ui/react-alert-dialog": "^1.1.4",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-checkbox": "^1.1.3",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ListUserTasksRequest,
UserTask,
UserTaskResult,
} from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
} from "@littlehorse-enterprises/user-tasks-bridge-api-client";

export async function adminCancelUserTask(
tenantId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ListUserTasksRequest,
UserTask,
UserTaskResult,
} from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
} from "@littlehorse-enterprises/user-tasks-bridge-api-client";

export async function claimUserTask(tenantId: string, userTask: UserTask) {
return clientWithErrorHandling(tenantId, (client) =>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
User,
UserGroup,
UserTask,
} from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
} from "@littlehorse-enterprises/user-tasks-bridge-api-client";
import { useEffect, useState } from "react";
import { toast } from "sonner";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button, buttonVariants } from "@/components/ui/button";
import { UserTask } from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
import { UserTask } from "@littlehorse-enterprises/user-tasks-bridge-api-client";
import { toast } from "sonner";

export default function CancelUserTaskButton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { Button, buttonVariants } from "@/components/ui/button";
import { UserTask } from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
import { UserTask } from "@littlehorse-enterprises/user-tasks-bridge-api-client";
import { toast } from "sonner";

export default function ClaimUserTaskButton({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
GetUserTaskResponse,
UserTask,
UserTaskResult,
} from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
} from "@littlehorse-enterprises/user-tasks-bridge-api-client";
import { useEffect, useState } from "react";
import { toast } from "sonner";
import Loading from "../../loading";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import type { UserTask } from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
import type { UserTask } from "@littlehorse-enterprises/user-tasks-bridge-api-client";
import { useSession } from "next-auth/react";
import { ReactNode, useEffect, useRef, useState } from "react";
import AssignUserTaskButton from "./action-buttons/assign";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
ListUserTasksResponse,
Status,
UserGroup,
} from "@littlehorse-enterprises/sso-workflow-bridge-api-client";
} from "@littlehorse-enterprises/user-tasks-bridge-api-client";
import { useInfiniteQuery } from "@tanstack/react-query";
import { FilterIcon } from "lucide-react";
import { useRouter, useSearchParams } from "next/navigation";
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f7e5347

Please sign in to comment.