Skip to content

Copilot/add snapshot functionality#10

Open
DHPKE wants to merge 4 commits into
3dmedium:masterfrom
DHPKE:copilot/add-snapshot-functionality
Open

Copilot/add snapshot functionality#10
DHPKE wants to merge 4 commits into
3dmedium:masterfrom
DHPKE:copilot/add-snapshot-functionality

Conversation

@DHPKE

@DHPKE DHPKE commented Nov 1, 2025

Copy link
Copy Markdown

No description provided.

Copilot AI and others added 4 commits November 1, 2025 21:18
Co-authored-by: DHPKE <103928654+DHPKE@users.noreply.github.com>
Co-authored-by: DHPKE <103928654+DHPKE@users.noreply.github.com>
Co-authored-by: DHPKE <103928654+DHPKE@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 1, 2025 21:46
@DHPKE

DHPKE commented Nov 1, 2025

Copy link
Copy Markdown
Author

attempt 1

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a snapshot feature for the crosspoint router, allowing users to save and recall connection configurations. The feature uses browser localStorage for persistence and provides UI dialogs for managing snapshots.

Key Changes:

  • Added a new SnapshotService to handle snapshot persistence and retrieval
  • Integrated snapshot save/recall functionality into the crosspoint component with UI buttons and modal dialogs
  • Enabled users to save current connection states and restore them later

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
ui/src/lib/SnapshotService.ts New service implementing snapshot CRUD operations with localStorage persistence
ui/src/routes/crosspoint.svelte Added snapshot UI controls, state management, and functions to save/recall/delete snapshots

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +843 to +844
let srcString = getDevcieNameString(conn.srcDev, conn.src);
let dstString = getDevcieNameString(conn.dstDev, conn.dst);

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'getDevcieNameString' to 'getDeviceNameString'.

Suggested change
let srcString = getDevcieNameString(conn.srcDev, conn.src);
let dstString = getDevcieNameString(conn.dstDev, conn.dst);
let srcString = getDeviceNameString(conn.srcDev, conn.src);
let dstString = getDeviceNameString(conn.dstDev, conn.dst);

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +5
export interface SnapshotConnection {
srcDev: any;
src: any;
dstDev: any;
dst: any;

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The any type removes type safety. Consider defining more specific types for these connection properties based on the actual data structure used in the application.

Suggested change
export interface SnapshotConnection {
srcDev: any;
src: any;
dstDev: any;
dst: any;
export interface Device {
id: string;
name: string;
// Add other relevant properties as needed
}
export interface Source {
id: string;
name: string;
// Add other relevant properties as needed
}
export interface SnapshotConnection {
srcDev: Device;
src: Source;
dstDev: Device;
dst: Source;

Copilot uses AI. Check for mistakes.
type="text"
placeholder="Enter snapshot name"
class="input input-bordered w-full"
on:keypress={(e)=>{if(e.keyCode == 13) saveCurrentSnapshot()}}

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyCode property is deprecated. Use e.key === 'Enter' instead for better browser compatibility and adherence to modern standards.

Suggested change
on:keypress={(e)=>{if(e.keyCode == 13) saveCurrentSnapshot()}}
on:keypress={(e)=>{if(e.key === 'Enter') saveCurrentSnapshot()}}

Copilot uses AI. Check for mistakes.
preparedConnectList = [];

// Recall each connection from the snapshot
let recallPromises: Promise<any>[] = [];

Copilot AI Nov 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Promise<any> type is too broad. Consider using a more specific type to improve type safety and code maintainability.

Copilot uses AI. Check for mistakes.
@lkirc

lkirc commented Nov 2, 2025 via email

Copy link
Copy Markdown

@3dmedium

3dmedium commented Nov 2, 2025

Copy link
Copy Markdown
Owner

Thanks for the pull request. I will not have time to check everything before end of the year.
A sync to the server with a persistent state file would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants