Files
hmitestWinform/frontend/types.ts
LGram16 27cc2507cf feat: Implement recipe copy and delete functionality
Backend changes (C#):
- Add CopyRecipe method to MachineBridge
  - Generates new GUID for copied recipe
  - Returns new recipe with current timestamp
- Add DeleteRecipe method to MachineBridge
  - Prevents deletion of currently selected recipe
  - Returns success/failure status
- Add COPY_RECIPE and DELETE_RECIPE handlers in WebSocketServer

Frontend changes (React/TypeScript):
- Add CopyRecipe and DeleteRecipe to Window interface types
- Add copyRecipe and deleteRecipe methods to communication layer
- Implement handleCopy in RecipePage
  - Prompts user for new name
  - Adds copied recipe to list
  - Selects newly copied recipe
- Implement handleDelete in RecipePage
  - Shows confirmation dialog
  - Removes recipe from list
  - Selects next available recipe
- Connect Copy and Delete buttons with handlers
- Disable buttons when no recipe is selected

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 23:53:35 +09:00

77 lines
1.7 KiB
TypeScript

export enum SystemState {
IDLE = 'IDLE',
RUNNING = 'RUNNING',
ERROR = 'ERROR',
PAUSED = 'PAUSED',
}
export interface AxisPosition {
id: string;
name: string;
axis: 'X' | 'Y' | 'Z';
value: number;
speed: number;
acc: number;
dec: number;
}
export interface Recipe {
id: string;
name: string;
lastModified: string;
}
export interface IOPoint {
id: number;
name: string;
type: 'input' | 'output';
state: boolean;
}
export interface LogEntry {
id: number;
timestamp: string;
message: string;
type: 'info' | 'warning' | 'error';
}
export interface RobotTarget {
x: number;
y: number;
z: number;
}
// WebView2 Native Bridge Types
export interface ConfigItem {
Key: string;
Value: string;
Group: string;
Type: 'String' | 'Number' | 'Boolean';
Description: string;
}
declare global {
interface Window {
chrome?: {
webview?: {
hostObjects: {
machine: {
MoveAxis(axis: string, value: number): Promise<void>;
SetIO(id: number, isInput: boolean, state: boolean): Promise<void>;
SystemControl(command: string): Promise<void>;
SelectRecipe(recipeId: string): Promise<string>;
CopyRecipe(recipeId: string, newName: string): Promise<string>;
DeleteRecipe(recipeId: string): Promise<string>;
GetConfig(): Promise<string>;
GetIOList(): Promise<string>;
GetRecipeList(): Promise<string>;
SaveConfig(configJson: string): Promise<void>;
}
};
addEventListener(type: string, listener: (event: any) => void): void;
removeEventListener(type: string, listener: (event: any) => void): void;
postMessage(message: any): void;
}
}
}
}