Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/workflows/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ jobs:
# where the file is, the duplicate findings, the worklist suggestions
- name: Test the rules of new items from local files
run: node scripts/desktop-new-files.test.mjs
# *Local changes* over the whole working folder (#416): grouping by
# item and the actions per file and per selection
- name: Test the rules of the Local changes list
run: node scripts/desktop-local-changes.test.mjs
# Update the BOM from the CAD file at check-in (#407): when the box is
# offered, the result line
- name: Test the check-in BOM rules
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ see the notices in the README.

### Added

- **Desktop: one *Local changes* list for the whole working folder** (#416):
a worklist section next to *New on this computer* lists every file of the
working folder that is modified, outdated, in conflict, new (a companion
such as a STEP export) or missing, grouped by item – also a file changed
after clearing its read-only flag without a check-out, and files outdated
because somebody checked in a newer version, without opening their item.
Each row and each selection offers *Check out (keep my file)*, *Get latest*,
*Check in selected* (the *Check in all* flow), *Merge…* for a conflict and
*Folder*. The count joins the worklist badge on the rail. The scan
(`local_changes_scan`, `desktop/src/localchanges.rs`) compares
`state.json` with the disk first (no network; unchanged files are never
read, at most 512 MiB hashed per scan) and then the Workspace status of at
most 100 revisions (local changes first, then own check-outs, then a window
over the rest that moves on with every scan, so outdated files anywhere in
the folder are found over successive scans). The scan only compares: it
sets no read-only flags and writes no state. A check-in from the list takes
every changed file of the revision along (the check-in releases the
check-out; the dialog names the unticked ones and offers *Park* instead).
It runs when the worklist opens or is refreshed and when the window gets
the focus back (at most every 15 s), and at once after a check-out,
check-in, park, cancelled check-out or Get. The list rules are in
`desktop/ui/js/local-changes.js`, tested by
`scripts/desktop-local-changes.test.mjs`.
- **Check-in: *Update the BOM from the CAD file*** (#407): a box in the web
check-in form and the desktop app's *Check in…*, ticked by default every
time, shown when the revision has an assembly whose references are read (an
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ desktop/ TeamCraft Desktop (Tauri 2, own Cargo project – never part
list-thumbs.js = row pictures of Home and the search (lazy, IntersectionObserver, #420),
crash.js = crash reports; desktop/src/workspace.rs + layout.rs = working folder, park, local changes;
new-files.js + desktop/src/newfiles.rs = new items from local files, worklist *New on this computer* (#359);
local-changes.js + desktop/src/localchanges.rs = worklist *Local changes* over the whole working folder (#416);
drop.js + drop-rules.js = files dropped from the file manager → *New* / *Add files…* (#418, dragDropEnabled);
desktop/src/localserver.rs = *Try TeamCraft on this computer* (starts the bundled teamcraft-server local);
desktop/src/policy.rs = managed deployment policies (registry / macOS profile / /etc/teamcraft, #378);
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ end-to-end tests against a real PostgreSQL.
or *Add files…*, new items straight from the files
saved in the working folder (group and folder taken from where they are,
duplicates refused, the worklist suggesting the parts and assemblies that
belong to no item yet), an Agent view, crash reports the user
belong to no item yet), a *Local changes* list of the whole working folder
(modified, outdated, conflicting and missing files with *Check out (keep my
file)*, *Get latest* and *Check in selected*), an Agent view, crash reports the user
decides about, *Report…* on every error (a reviewed, redacted report with
the action and its key inputs; nothing is sent without a click) and an update notice (never installs anything itself). The
download *with local server* also runs a private test server with its own
Expand Down
5 changes: 3 additions & 2 deletions desktop/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A failed export never stops the check-in: the file goes without its STEP and the result says why. With exports the ticked files are uploaded first (parked), then exported, then checked in with the STEP files; *Cancel* during an export skips it and ends the CAD program the script started (`teamcraft-started-pid:` line, `taskkill`); rejected COM calls (`RPC_E_CALL_REJECTED`, `RPC_E_SERVERCALL_RETRYLATER`) are retried for a minute; the whole error output goes to `<config>/export-logs/` (newest 20, 64 KiB each, local only) – #342 |# TeamCraft Desktop
# TeamCraft Desktop

The rich client of TeamCraft for **Linux, macOS and Windows**: a navigation
rail, a navigator tree of the project groups, object tabs with sub-tabs, a
Expand Down Expand Up @@ -37,7 +37,7 @@ TeamCraft server – it is a client, not an offline copy.
| Old workspaces | Folders of the older layout `<group>/<item>/<revision>/` (and `<item>/<revision>/`) are found after the sign-in; the app offers to move the files into the new layout – never overwriting a file, keeping files whose place is taken and listing them, writing every step to `.teamcraft/migration.log` |
| Check in all | *Check in all* in the worklist (navigator and home page): the check-outs with local changes (modified, new, conflicting files) are listed first, with the offer to check them in with their files; then every check-out without local changes is checked in on the server (lock released, one revision at a time); check-outs with a conflict stay checked out. *Sign out* asks the same: *Check in and sign out*, *Park and sign out*, *Sign out anyway*. The list is the pure `layout::local_changes` |
| Park | *Park…* (Workspace tab, *More ▾*, the check-in dialog): the ticked files go up as new versions through the upload endpoint (`POST …/files`) and the check-out **stays** – work in progress survives a lost laptop. After somebody else released your check-out, the Workspace tab shows *Released by X; your local changes are kept and need a new check-out* (`released` of the server's file status) |
| Native CAD previews | The preview image stored in Inventor and Solid Edge files in the Files tab, a picture of the 3D preview for NX and SOLIDWORKS files; on Windows *STEP* in the Workspace tab and *Create STEP exports … first* at check-in export with the installed Inventor or Solid Edge (COM automation through Windows PowerShell; uses your own licence); on every system SolidCraft designs (`.sc`) export through SolidCraft's `solidcraft-cli run --in … --out ….stp` (found through `SOLIDCRAFT_CLI`, `PATH` or the default install folders). A failed export never stops the check-in: the file goes without its STEP and the result says why |
| Native CAD previews | The preview image stored in Inventor and Solid Edge files in the Files tab, a picture of the 3D preview for NX and SOLIDWORKS files; on Windows *STEP* in the Workspace tab and *Create STEP exports … first* at check-in export with the installed Inventor or Solid Edge (COM automation through Windows PowerShell; uses your own licence); on every system SolidCraft designs (`.sc`) export through SolidCraft's `solidcraft-cli run --in … --out ….stp` (found through `SOLIDCRAFT_CLI`, `PATH` or the default install folders). A failed export never stops the check-in: the file goes without its STEP and the result says why. With exports the ticked files are uploaded first (parked), then exported, then checked in with the STEP files; *Cancel* during an export skips it and ends the CAD program the script started (`teamcraft-started-pid:` line, `taskkill`); rejected COM calls (`RPC_E_CALL_REJECTED`, `RPC_E_SERVERCALL_RETRYLATER`) are retried for a minute; the whole error output goes to `<config>/export-logs/` (newest 20, 64 KiB each, local only) – #342 |
| SolidCraft item data | *Item data* in the Workspace tab (SolidCraft designs of your check-out, not open in SolidCraft): `solidcraft-cli run <script> --in <design> --save <design>` with one `document.metadata.set` – `part_number`, `revision`, `description` and `teamcraft.pdm` (item and revision ids, server); `src/scprops.rs` |
| SolidCraft design properties | The Files tab shows the `properties_line` the server sends with a design's file record under its name and the server's `property_mismatches` as the notice *Design properties differ from this revision* (`ui/js/revision.js` `propertyMismatchNotice`); *New item* from local files (`ui/js/dialogs.js` `createItemFromFiles`) and *Import a CAD folder* fill an empty description from the uploaded design's `properties.description` while the item is still checked out (`ui/js/folder-import.js` `describeFromDesign`, best effort) – #367 |
| SolidCraft plugin bridge | The TeamCraft plugin inside SolidCraft has no network, so the app shares `<workspace>/.teamcraft/solidcraft` with it (`src/scbridge.rs`, `ui/js/solidcraft-bridge.js`): every 30 s a heartbeat (`desktop.json`: the app runs, the server answers), on every Workspace refresh the state of the revision (`state-<key>.json`: checked out by, local changes, released), every 5 s the plugin's requests (`request-<key>.<action>.json`, one per revision and action) are picked up, checked (a revision of this working folder, a known action, fresh, small, a regular file) and removed: *open* shows the revision, *check out* asks first, *check in* opens the check-in dialog. Only for a working folder that exists; no secrets in the folder |
Expand All @@ -48,6 +48,7 @@ TeamCraft server – it is a client, not an offline copy.
| Import a CAD folder | the folder icon in the navigator (*Tools → Import CAD Folder…*): scans an existing folder (dry run: items, duplicate file names, skipped lock/backup files), then creates one item per part or assembly with the drawings and exports of the same name, project files in one document item, optional BOM lines from the assembly references, and checks every item in right after its files (assemblies once more after their BOM lines), so an interrupted import never leaves items checked out – a new run of the same folder also releases the check-outs an earlier, interrupted run left behind; a final report lists the new items and files, BOM lines, check-ins and problems (with *Open* for the top assembly); interrupted imports continue where they stopped (remembered per project group, so the same folder can also be imported into another group). Tutorial: *Help → How to Import a CAD Folder* |
| New item | *New* (`Ctrl/Cmd+N`): choose the CAD files first – name and type follow from the first file; they are uploaded right after the item is created. *Folder* (prefilled with the folder last opened in *Files*, or the one of *New item here*) is the item's folder in the group – the files go there, and the item is listed there while it has none – unless the files are in the working folder: then their group and folder are the item's place, taken from where they are, and every file keeps its own folder (#359). Files from elsewhere are copied into the item's folder (never moved, nothing overwritten). Before creating, duplicates are refused: a tracked or added file, a file another item has at the same place (`POST /projects/{code}/file-check`); the same name in another folder of the group needs *Create anyway*, the same content is a warning. The upload asks the server to refuse a clash atomically (`refuse_clash`, `refuse_same_name`), the item is created with an idempotency key from its main file, and the uploaded files are recorded in `state.json` (`new_item_places`, `new_item_copy`, `upload_files` with `track`) |
| New on this computer | Worklist section (#359, editors): the parts and assemblies in the working folder that belong to no item yet, one suggestion per model file with its drawing and exports of the same name in the same folder, newest first, counted on the rail. A click opens *New* prefilled, *Create items…* creates the ticked ones after a summary of what is created and what is refused, *×* ignores a file (`.teamcraft/ignored.json`, *Show ignored*; entries of files that are gone are dropped after a complete scan). The scan (`desktop/src/newfiles.rs`, `new_files_scan`) skips tracked and added files, companions of tracked files, lock/backup/temporary files, `OldVersions` and hidden folders; at most 50 000 entries and 2 000 files per scan, run when the worklist opens or the window gets the focus back (at most every 15 s). Nothing is uploaded without the dialog or the summary |
| Local changes | Worklist section (#416): every file of the working folder that is modified, outdated, in conflict, new (a companion of a tracked file) or missing, grouped by item, counted on the rail – also a file changed without a check-out (read-only flag cleared, *not checked out*). Per row and for the ticked rows: *Check out* (keep my file, `workspace_checkout`), *Get latest* (`workspace_download`, local changes kept), *Check in selected* (`sendLocalChanges` of *Check in all*, conflicts stay checked out; always every changed file of the revision – `revisionCheckin`, the dialog names the unticked ones and offers *Park*), *Merge…* (Workspace tab), *Folder*. The scan (`desktop/src/localchanges.rs`, `local_changes_scan`) first compares `.teamcraft/state.json` with the disk (no network, at most 50 000 entries, unchanged files not read, at most 512 MiB hashed), then runs the Workspace status without side effects (`workspace::status_with(.., false)`: no read-only flags, renames or state writes) of at most 100 revisions one after the other – local changes (and files too big to hash) first, then own check-outs, then a window over the rest that moves on with every scan (`pick`), so outdated files anywhere in the folder are found over successive scans; the first failing call stops that pass. Run when the worklist opens or is refreshed and on window focus (at most every 15 s), at once after check-out, check-in, park, cancelled check-out or Get (`rescanLocalChanges`, concurrent requests folded into one). Rules in `ui/js/local-changes.js` (`scripts/desktop-local-changes.test.mjs`) |
| App version | The version of the app above the logo at the bottom of the rail, always visible (#357) |
| Import BOM | *Import BOM…* in the *Structure* tab (and the *More* menu) of a revision you have checked out, *Tools → Import BOM as New Assembly…* for a new one: a BOM exported by the CAD program (CSV, TSV, Excel, ODS or a STEP assembly, chosen in the native dialog) goes to the server's BOM import as a dry run first – the dialog shows the counts of lines, new and existing items, the notes and the first lines – and *Import* creates the lines and missing items in one transaction (numbers from the file or the group's numbering scheme, reuse of existing items optional) |
| BOM lines | *Add line…* in the *Structure* tab of a revision you have checked out (`js/bom-lines.js`, #419): a component picker searches number, name and file name (`GET /items/suggest`, older servers `GET /items?q=`; preview image, revision, state, group; ↑/↓ + Enter, Esc closes the list), then quantity, find number and notes (`POST /items/{n}/revisions/{c}/bom`); under the own check-out every first-level line has an editable quantity (`PATCH /bom-lines/{id}`) and *Remove* (`DELETE /bom-lines/{id}`, confirmed); the tab reloads after each change |
Expand Down
20 changes: 18 additions & 2 deletions desktop/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use tokio::sync::Notify;
use crate::{
acp, addfiles,
api::{self, Api, ApiError, Transfer},
bomimport, cadexport, cadlaunch, folderimport, layout, localserver, policy, profiles, scbridge,
scprops,
bomimport, cadexport, cadlaunch, folderimport, layout, localchanges, localserver, policy,
profiles, scbridge, scprops,
settings::{self, Settings, TokenStorage},
signin, update, workspace, AppState,
};
Expand Down Expand Up @@ -942,6 +942,22 @@ pub async fn workspace_local_changes(
Ok(layout::local_changes(results))
}

/// *Local changes* (#416): the modified, outdated, conflicting, new and
/// missing files of every revision in the working folder – a local pass over
/// the state, then the Workspace status of at most
/// [`localchanges::MAX_REVISIONS`] revisions (`src/localchanges.rs`). Unlike
/// [`workspace_status`] it writes nothing: no SolidCraft bridge state, no
/// read-only flags, no `state.json` (`workspace::status_with(.., false)`).
#[tauri::command]
pub async fn local_changes_scan(
app: AppHandle,
state: State<'_, AppState>,
) -> CmdResult<localchanges::LocalChangesScan> {
let api = signed_in_api(&state)?;
let root = workspace_root(&app, &state);
localchanges::scan(&api, &root).await
}

/// A fresh cancel switch for the upload that starts now (`cancel_upload`
/// flips the switch of the running one).
fn new_upload(state: &State<'_, AppState>) -> Arc<AtomicBool> {
Expand Down
Loading
Loading