Skip to content

Commit

Permalink
feat(launchpad): initial automatic resource allocation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed May 9, 2024
1 parent d141ec8 commit e6f2c2a
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 219 deletions.
7 changes: 3 additions & 4 deletions node-launchpad/.config/config.json5
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"keybindings": {
"Home": {
"<a>": {"HomeActions":"AddNode"}, // Add nodes
"<s>": {"HomeActions":"StartNodes"}, // Start nodes
"<k>": {"HomeActions":"StopNode"}, // Stop nodes
"<r>": {"HomeActions":"RemoveNode"},
"<Ctrl-g>": {"HomeActions":"StartNodes"},
"<Ctrl-x>": {"HomeActions":"StopNodes"},

"up" : {"HomeActions":"PreviousTableItem"},
"down": {"HomeActions":"NextTableItem"},

Expand Down
9 changes: 2 additions & 7 deletions node-launchpad/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,9 @@ pub enum Action {

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Display, Deserialize)]
pub enum HomeActions {
AddNode,
AddNodeCompleted,
StartNodes,
StartNodesCompleted,
StopNode,
StopNodeCompleted,
RemoveNode,
RemoveNodeCompleted,
StopNodes,
ServiceManagerOperationCompleted,

TriggerDiscordUsernameInputBox,
TriggerResourceAllocationInputBox,
Expand Down
5 changes: 3 additions & 2 deletions node-launchpad/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ pub struct App {

impl App {
pub fn new(tick_rate: f64, frame_rate: f64) -> Result<Self> {
let app_data = AppData::load()?;

let tab = Tab::default();
let home = Home::new()?;
let home = Home::new(app_data.allocated_disk_space)?;
let config = Config::new()?;
let app_data = AppData::load()?;
let discord_username_input =
DiscordUsernameInputBox::new(app_data.discord_username.clone());
let resource_allocation_input =
Expand Down
2 changes: 1 addition & 1 deletion node-launchpad/src/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Component for Footer {

let text = match self.current_scene {
Scene::Home => {
"[A]dd node, [S]tart node, [K]ill node, [R]emove node, [D]iscord Username, [Q]uit"
"[Ctrl+g] Start nodes, [Ctrl+x] Stop node, [Ctrl+o] Set Resources, [D]iscord Username, [Q]uit"
}
Scene::Options => "none",
Scene::DiscordUsernameInputBox => "⏎ Accept, [Esc] Cancel",
Expand Down
Loading

0 comments on commit e6f2c2a

Please sign in to comment.