-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a pop-up message for Docker if it is not running when the application starts and then exits.
- Loading branch information
1 parent
c8909af
commit 9cdcbd9
Showing
14 changed files
with
122 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use ratatui::prelude::*; | ||
|
||
use crate::component::{widgets::popup::Popup, Frame}; | ||
|
||
pub fn is_docker_running() -> bool { | ||
match std::process::Command::new("docker").arg("version").output() { | ||
Ok(output) => output.stderr.is_empty(), | ||
Err(_) => false, | ||
} | ||
} | ||
|
||
pub fn display_docker_notice<B: Backend>(f: &mut Frame<B>, title: &str, msg: &str) { | ||
let popup_area = Rect { | ||
x: 4, | ||
y: 2, | ||
width: 50, | ||
height: 8, | ||
}; | ||
let popup = Popup::default() | ||
.content(msg) | ||
.style(Style::new().yellow()) | ||
.title(title) | ||
.title_style(Style::new().white().bold()) | ||
.border_style(Style::new().red()); | ||
f.render_widget(popup, popup_area); | ||
} | ||
|
||
pub fn wait_for_keypress() { | ||
use std::io::{stdin, Read}; | ||
let mut stdin = stdin(); | ||
let buf: &mut [u8] = &mut [0; 2]; | ||
let _unused = stdin.read(buf).expect("Error reading keypress"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use derive_setters::Setters; | ||
use ratatui::{ | ||
buffer::Buffer, | ||
layout::Rect, | ||
prelude::{Line, Style, Text}, | ||
widgets::{Block, Borders, Clear, Paragraph, Widget, Wrap}, | ||
}; | ||
|
||
#[derive(Debug, Default, Setters)] | ||
pub struct Popup<'a> { | ||
#[setters(into)] | ||
title: Line<'a>, | ||
#[setters(into)] | ||
content: Text<'a>, | ||
border_style: Style, | ||
title_style: Style, | ||
style: Style, | ||
} | ||
|
||
impl Widget for Popup<'_> { | ||
fn render(self, area: Rect, buf: &mut Buffer) { | ||
// Ensure that all cells under the popup are cleared to avoid leaking content | ||
Clear.render(area, buf); | ||
let block = Block::new() | ||
.title(self.title) | ||
.title_style(self.title_style) | ||
.borders(Borders::ALL) | ||
.border_style(self.border_style); | ||
Paragraph::new(self.content) | ||
.wrap(Wrap { trim: true }) | ||
.style(self.style) | ||
.block(block) | ||
.render(area, buf); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,4 @@ mod node_grpc; | |
pub mod resources; | ||
#[cfg(feature = "tauri")] | ||
pub mod tauri; | ||
|
||
pub use bus::LaunchpadBus; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters