-
Notifications
You must be signed in to change notification settings - Fork 11
feat(tasks): action-center sample app #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amrit-agarwal-1
wants to merge
6
commits into
main
Choose a base branch
from
feat/samples-action-center-app
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b7a2c26
feat(tasks): action-center sample app
amrit-agarwal-1 3e99965
feat(samples/action-center-app): migrate UI to Apollo Vertex (apollo-…
amrit-agarwal-1 4c3ef4c
feat(samples/action-center-app): side-sheet task detail + UI fixes
amrit-agarwal-1 fcf1fc7
feat(samples/action-center-app): act on review feedback
amrit-agarwal-1 0d007f0
feat(samples/action-center-app): render validation station for Docume…
amrit-agarwal-1 fcb33f5
feat(samples/action-center-app): act on review feedback, use publishe…
amrit-agarwal-1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
|
|
||
| # Build outputs | ||
| node_modules | ||
| dist | ||
| dist-ssr | ||
|
|
||
| # Local UiPath OAuth config (tenant-specific) — copy uipath.json.example to | ||
| # uipath.json and fill in your values. Only the .example template is committed. | ||
| uipath.json | ||
|
|
||
| # Coded App publish artifacts | ||
| .uipath | ||
|
|
||
| # OS / editor | ||
| .DS_Store | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| *.sw? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # Action Center Manager — UiPath Coded Web App sample | ||
|
|
||
| A minimal React + TypeScript [UiPath Coded Web App](https://docs.uipath.com/) | ||
| demonstrating the `@uipath/uipath-typescript` SDK's **Tasks (Action Center)** | ||
| service. It's an operational dashboard for triaging human tasks: list and | ||
| filter them across your folders, view detail, assign / reassign / unassign, | ||
| complete (approve / reject), and create external tasks. **Document Validation | ||
| tasks** open the | ||
| [`@uipath/ui-widgets-validation-station`](https://github.com/UiPath/uipath-ui-widgets/pkgs/npm/ui-widgets-validation-station) | ||
| widget so a reviewer can validate the extracted document data inline. | ||
|
|
||
| Built on UiPath's [Apollo Vertex](https://apollo-vertex.vercel.app/) design | ||
| system via [`@uipath/apollo-wind`](https://www.npmjs.com/package/@uipath/apollo-wind). | ||
|
|
||
| ## What it demonstrates | ||
|
|
||
| Every method on [`TaskServiceModel`](https://uipath.github.io/uipath-typescript/api/interfaces/TaskServiceModel/): | ||
|
|
||
| | SDK call | Where | | ||
| |----------|-------| | ||
| | `Tasks.getAll({ folderId, pageSize, jumpToPage, filter, orderby, asTaskAdmin })` | `hooks/useTasks.ts` (`useTasks`) — paginated, filterable list | | ||
| | `Tasks.getById(id, {}, folderId)` | `hooks/useTasks.ts` (`useTask`) — full detail | | ||
| | `Tasks.getUsers(folderId)` | `hooks/useTasks.ts` (`useTaskUsers`) — assignee picker (cursor-looped) | | ||
| | `Tasks.create({ title, priority }, folderId)` | `components/TaskList.tsx` (create form) | | ||
| | `task.assign` / `task.reassign` / `task.unassign` | `components/TaskDetail.tsx` | | ||
| | `task.complete(options)` | `components/TaskDetail.tsx` (+ `taskUtils.ts` builds the discriminated-union options) | | ||
| | `Tasks.getById(id, { taskType: TaskType.DocumentValidation }, folderId)` + `task.complete({ type: TaskType.DocumentValidation, … })` | `components/DocumentValidationDialog.tsx` — loads the validation payload and submits it | | ||
|
|
||
| By default the app lists tasks across **all folders** you can view/edit. The | ||
| toolbar's **Folder** dropdown (populated from `/odata/Folders`) lets you scope | ||
| the list to one folder; the choice is persisted to `localStorage`. Per-task | ||
| actions (assign, complete) use each task's own folder, propagated from the | ||
| row; creating a task picks the target folder from the same dropdown. | ||
|
|
||
| ## Files | ||
|
|
||
| ``` | ||
| src/ | ||
| main.tsx App.tsx index.css | ||
| taskUtils.ts — badges, filter builder, complete-options builder, formatting | ||
| hooks/useAuth.tsx — OAuth/PKCE via the SDK (Coded Apps template) | ||
| hooks/useTasks.ts — useTasks + useTask + useTaskUsers | ||
| components/Theme.tsx, TaskList.tsx, TaskDetail.tsx | ||
| components/DocumentValidationDialog.tsx — validation-station host for Document Validation tasks | ||
| ``` | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Node.js 20+ | ||
| - A UiPath OAuth External Application (client ID) with **`OR.Tasks`**, | ||
| **`OR.Folders.Read`**, and **`OR.Buckets`** scopes. `OR.Folders.Read` powers | ||
| the folder dropdown (the SDK doesn't expose a Folders service yet, so the app | ||
| calls `/odata/Folders` directly with the SDK's access token); `OR.Buckets` | ||
| lets the validation-station widget fetch the document binary referenced by a | ||
| Document Validation task. | ||
| - An Orchestrator folder that contains Action Center tasks (only needed for | ||
| testing — leaving the filter on "All folders" still works) | ||
|
|
||
| ## Setup | ||
|
|
||
| ```bash | ||
| npm install | ||
| cp uipath.json.example uipath.json # then fill in your values | ||
| npm run dev # http://localhost:5173 | ||
| ``` | ||
|
|
||
| `uipath.json` (git-ignored) configures local dev — the `@uipath/coded-apps-dev` | ||
| Vite plugin reads it and injects the `<meta name="uipath:*">` tags the SDK | ||
| needs. A deployed Coded App gets these from the platform, so the same code works | ||
| in both places. | ||
|
|
||
| ## Build & deploy | ||
|
|
||
| ```bash | ||
| npm run build # tsc && vite build → dist/ | ||
|
|
||
| uip codedapp pack dist -n action-center-app --version 1.0.0 | ||
| uip codedapp publish | ||
| uip codedapp deploy -n action-center-app --folder-key <FOLDER_KEY> | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - **My Tasks vs Manage Tasks:** these map to `getAll`'s `asTaskAdmin` flag. | ||
| - **My Tasks** — clicking a row opens a quick-complete dialog (Approve / | ||
| Reject / custom action). An info icon in that dialog opens the full | ||
| detail sheet on demand. The streamlined flow is the daily worker view. | ||
| A **Document Validation** task instead opens the validation-station widget | ||
| (see below). | ||
| - **Manage Tasks** (`asTaskAdmin: true`) — clicking rows selects them | ||
| (multi-select), and bulk **Assign** / **Unassign** appear in the | ||
| toolbar. Surfaces `Tasks.assign(payload[])` and `Tasks.unassign(ids)` | ||
| in their array forms. When status is filtered to *Pending*, an | ||
| additional **Assigned to** filter (powered by `Tasks.getUsers`) lets | ||
| an admin see who's overloaded. | ||
| - **Pagination:** the list uses server-side page navigation (`jumpToPage` + | ||
| `totalCount`); the user picker loops the cursor. No list call assumes one | ||
| response holds every row. | ||
| - **Creation** through the API only supports **external** tasks — form and | ||
| app tasks are created by the system through workflows. | ||
| - **Document Validation:** selecting a task of type `DocumentValidationTask` | ||
| (from a My Tasks row, or via **Validate document** in the detail sheet) opens | ||
| a near-fullscreen dialog hosting `@uipath/ui-widgets-validation-station`. The | ||
| widget renders the source document next to the extracted fields; **Save** | ||
| validates and keeps the task open, **Submit** validates then completes it via | ||
| `task.complete({ type: TaskType.DocumentValidation, action: 'Completed' })`. | ||
| `vite.config.ts` copies the widget's `du-assets` (PDF renderer + translations) | ||
| into the production bundle so document rendering works after deploy. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" type="image/png" href="/src/assets/favicon.png" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Action Center Manager</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt the file src/context/AuthContext.tsx?