diff --git a/lib/develop/heroprompt/heroprompt_workspace.v b/lib/develop/heroprompt/heroprompt_workspace.v index 6b47c5c8..49833b7c 100644 --- a/lib/develop/heroprompt/heroprompt_workspace.v +++ b/lib/develop/heroprompt/heroprompt_workspace.v @@ -220,6 +220,44 @@ pub: typ string @[json: 'type'] } +pub fn (wsp &Workspace) list_dir(rel_path string) ![]ListItem { + mut dir := if rel_path.len > 0 { + if os.is_abs_path(rel_path) { + rel_path + } else { + os.join_path(wsp.base_path, rel_path) + } + } else { + wsp.base_path + } + + if dir.len == 0 { + return error('workspace base_path not set') + } + + if !os.is_abs_path(dir) { + dir = os.join_path(wsp.base_path, dir) + } + + entries := os.ls(dir) or { return error('cannot list directory') } + mut out := []ListItem{} + for e in entries { + full := os.join_path(dir, e) + if os.is_dir(full) { + out << ListItem{ + name: e + typ: 'directory' + } + } else if os.is_file(full) { + out << ListItem{ + name: e + typ: 'file' + } + } + } + return out +} + pub fn (wsp &Workspace) list() ![]ListItem { mut dir := wsp.base_path if dir.len == 0 { diff --git a/lib/threefold/grid4/datamodel/model_node.v b/lib/threefold/grid4/datamodel/model_node.v index 8d2a5e18..165edfee 100644 --- a/lib/threefold/grid4/datamodel/model_node.v +++ b/lib/threefold/grid4/datamodel/model_node.v @@ -3,18 +3,18 @@ module datamodel @[heap] pub struct Node { pub mut: - id int - nodegroupid int - uptime int // 0..100 - computeslices []ComputeSlice - storageslices []StorageSlice - devices DeviceInfo - country string // 2 letter code as specified in lib/data/countries/data/countryInfo.txt, use that library for validation - capacity NodeCapacity // Hardware capacity details - provisiontime u32 // lets keep it simple and compatible - pubkey string - signature_node string //signature done on node to validate pubkey with privkey - signature_farmer string //signature as done by farmers to validate their identity + id int + nodegroupid int + uptime int // 0..100 + computeslices []ComputeSlice + storageslices []StorageSlice + devices DeviceInfo + country string // 2 letter code as specified in lib/data/countries/data/countryInfo.txt, use that library for validation + capacity NodeCapacity // Hardware capacity details + provisiontime u32 // lets keep it simple and compatible + pubkey string + signature_node string // signature done on node to validate pubkey with privkey + signature_farmer string // signature as done by farmers to validate their identity } pub struct DeviceInfo { @@ -78,35 +78,6 @@ pub mut: vcores int // Total virtual cores } -// typically 1GB of memory, but can be adjusted based based on size of machine -pub struct ComputeSlice { -pub mut: - nodeid u32 // the node in the grid, there is an object describing the node - id int // the id of the slice in the node - mem_gb f64 - storage_gb f64 - passmark int - vcores int - cpu_oversubscription int - storage_oversubscription int - price_range []f64 = [0.0, 0.0] - gpus u8 // nr of GPU's see node to know what GPU's are - price_cc f64 // price per slice (even if the grouped one) - pricing_policy PricingPolicy - sla_policy SLAPolicy -} - -// 1GB of storage -pub struct StorageSlice { -pub mut: - nodeid u32 // the node in the grid - id int // the id of the slice in the node, are tracked in the node itself - price_cc f64 // price per slice (even if the grouped one) - pricing_policy PricingPolicy - sla_policy SLAPolicy -} - - fn (mut n Node) check() ! { // todo calculate NodeCapacity out of the devices on the Node } diff --git a/lib/threefold/grid4/datamodel/model_slice_compute.v b/lib/threefold/grid4/datamodel/model_slice_compute.v index b407ecec..46688aee 100644 --- a/lib/threefold/grid4/datamodel/model_slice_compute.v +++ b/lib/threefold/grid4/datamodel/model_slice_compute.v @@ -1,7 +1,5 @@ module datamodel - - // typically 1GB of memory, but can be adjusted based based on size of machine @[heap] pub struct ComputeSlice { diff --git a/lib/threefold/grid4/datamodel/model_slice_storage.v b/lib/threefold/grid4/datamodel/model_slice_storage.v index 24a1d00e..b515b345 100644 --- a/lib/threefold/grid4/datamodel/model_slice_storage.v +++ b/lib/threefold/grid4/datamodel/model_slice_storage.v @@ -1,16 +1,12 @@ module datamodel - // 1GB of storage @[heap] pub struct StorageSlice { pub mut: - nodeid u32 // the node in the grid - id int // the id of the slice in the node, are tracked in the node itself - price_cc f64 // price per slice (even if the grouped one) - pricing_policy PricingPolicy //copied from node which is part of nodegroup + nodeid u32 // the node in the grid + id int // the id of the slice in the node, are tracked in the node itself + price_cc f64 // price per slice (even if the grouped one) + pricing_policy PricingPolicy // copied from node which is part of nodegroup sla_policy SLAPolicy } - - - diff --git a/lib/web/ui/static/css/main.css b/lib/web/ui/static/css/main.css index aa6f03e6..634a2a82 100644 --- a/lib/web/ui/static/css/main.css +++ b/lib/web/ui/static/css/main.css @@ -192,15 +192,15 @@ code { transform: translateX(-100%); transition: transform 0.3s ease; } - + .sidebar.show { transform: translateX(0); } - + .main { margin-left: 0; } - + .mobile-menu-toggle { display: block; position: fixed; @@ -262,17 +262,18 @@ code { /* Print styles */ @media print { + .sidebar, .header, .theme-toggle { display: none !important; } - + .main { margin-left: 0 !important; padding: 0 !important; } - + body { padding-top: 0 !important; }