Files
ProxmoxVE-Local/src/types/script.ts
Michel Roegl-Brunner d819cd79fe feat: Add card/list view toggle with enhanced list view (#101)
* feat: Add card/list view toggle with enhanced list view

- Add ViewToggle component with grid/list icons and active state styling
- Create ScriptCardList component with horizontal layout design
- Add view-mode API endpoint for GET/POST operations to persist view preference
- Update ScriptsGrid and DownloadedScriptsTab with view mode state and conditional rendering
- Enhance list view with additional information:
  - Categories with tag icon
  - Creation date with calendar icon
  - OS and version with computer icon
  - Default port with terminal icon
  - Script ID with info icon
- View preference persists across page reloads
- Same view mode applies to both Available and Downloaded scripts pages
- List view shows same information as card view but in compact horizontal layout

* fix: Resolve TypeScript/ESLint build errors

- Fix unsafe argument type errors in view mode loading
- Use proper type guards for viewMode validation
- Replace logical OR with nullish coalescing operator
- Add explicit type casting for API response validation
2025-10-10 13:04:57 +02:00

78 lines
1.5 KiB
TypeScript

export interface ScriptResources {
cpu: number;
ram: number;
hdd: number;
os: string;
version: string;
}
export interface ScriptInstallMethod {
type: string;
script: string;
resources: ScriptResources;
}
export interface ScriptCredentials {
username: string | null;
password: string | null;
}
export interface ScriptNote {
text: string;
type: string;
}
export interface Script {
name: string;
slug: string;
categories: number[];
date_created: string;
type: string;
updateable: boolean;
privileged: boolean;
interface_port: number | null;
documentation: string | null;
website: string | null;
logo: string | null;
config_path: string;
description: string;
install_methods: ScriptInstallMethod[];
default_credentials: ScriptCredentials;
notes: (ScriptNote | string)[];
}
export interface ScriptCard {
name: string;
slug: string;
description: string;
logo: string | null;
type: string;
updateable: boolean;
website: string | null;
source?: 'github' | 'local';
isDownloaded?: boolean;
isUpToDate?: boolean;
localPath?: string;
// Additional properties added by API
categories?: number[];
categoryNames?: string[];
date_created?: string;
os?: string;
version?: string;
interface_port?: number | null;
}
export interface GitHubFile {
name: string;
path: string;
sha: string;
size: number;
url: string;
html_url: string;
git_url: string;
download_url: string;
type: string;
content?: string;
encoding?: string;
}