fix: update to match new api models
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-02-25 15:04:13 +00:00
parent 8758116520
commit fd1df3ce3d
3 changed files with 8 additions and 24 deletions

View File

@ -18,7 +18,6 @@ export interface AccountDetail {
export interface VmCostPlan {
id: number;
name: string;
created: Date;
amount: number;
currency: "EUR" | "BTC";
interval_amount: number;
@ -28,13 +27,11 @@ export interface VmCostPlan {
export interface VmHostRegion {
id: number;
name: string;
enabled: boolean;
}
export interface VmTemplate {
id: number;
name: string;
enabled: boolean;
created: Date;
expires?: Date;
cpu: number;
@ -42,11 +39,8 @@ export interface VmTemplate {
disk_size: number;
disk_type: string;
disk_interface: string;
cost_plan_id: number;
region_id: number;
cost_plan?: VmCostPlan;
region?: VmHostRegion;
cost_plan: VmCostPlan;
region: VmHostRegion;
}
export interface VmStatus {
@ -63,24 +57,18 @@ export interface VmStatus {
export interface VmIpAssignment {
id: number;
ip: string;
range: string;
}
export interface VmInstance {
id: number;
host_id: number;
user_id: number;
image_id: number;
template_id: number;
ssh_key_id: number;
created: string;
expires: string;
disk_id: number;
status?: VmStatus;
mac_address: string;
template?: VmTemplate;
image?: VmOsImage;
ssh_key?: UserSshKey;
template: VmTemplate;
image: VmOsImage;
ssh_key: UserSshKey;
ip_assignments: Array<VmIpAssignment>;
}

View File

@ -22,10 +22,6 @@ export default function VpsPayButton({ spec }: { spec: VmTemplate }) {
return <div className={`${classNames} bg-red-900`}>{inner}</div>;
}
if (!spec.enabled) {
return placeholder("Unavailable");
}
if (!login) {
return placeholder("Please Login");
}

View File

@ -2,9 +2,9 @@ import { VmInstance, VmTemplate } from "../api";
import BytesSize from "./bytes";
export default function VpsResources({ vm }: { vm: VmInstance | VmTemplate }) {
const diskType = "template_id" in vm ? vm.template?.disk_type : vm.disk_type;
const diskType = "template" in vm ? vm.template?.disk_type : vm.disk_type;
const region =
"region_id" in vm ? vm.region?.name : vm.template?.region?.name;
"region" in vm ? vm.region.name : vm.template?.region?.name;
const status = "status" in vm ? vm.status : undefined;
const template = "template" in vm ? vm.template : vm as VmTemplate;
return (