better error display
This commit is contained in:
parent
333be4f6ab
commit
e8d6602ae1
|
@ -1 +1 @@
|
||||||
{"categories":[{"name":"to do","content":[{"name":"ability to change token","description":"use a config file to store token so that \n\n1- it is away from github\n\n2- it is configurable if need be","id":1},{"name":"clean up bot code","description":"try to remove unnecessary code\n\nunindent\n\ngive sender to function ?","id":2},{"name":"trayable ?","description":"// Hello there","id":5},{"name":"new message marker","description":"perma if too complicated to detect read","id":2},{"name":"proper links","description":"when there is a link, ability to click it","id":3}]},{"name":"in progress","content":[]},{"name":"done","content":[{"name":"run discord bot","description":"make it so the bot is running","id":1},{"name":"fixed token in github","description":"// Hello there","id":1},{"name":"fetch previous messages","description":"// Hello there","id":4},{"name":"ability to write messages","description":"// Hello there","id":5},{"name":"get incoming messages","description":"read","id":2},{"name":"unread system","description":"add a * when a channel just received a message","id":1},{"name":"remember channel id for dm","description":"and put in config file\n\nmaybe load message ? dm first ?","id":3},{"name":"bug : does not save notification state for dm","description":"// Hello there","id":1},{"name":"handle unknown channel better","description":"when receiving a message from a not yet scanned guild, create the channel and put the message\n\nallow scanning if guild selected\n\ndo not add duplicate channel","id":1},{"name":"guild unread ?","description":"// Hello there","id":2}]},{"name":"bugs","content":[]},{"name":"v1.0","content":[{"name":"better ui error display","description":"handle the error packet for better display","id":1},{"name":"notifications !!!","description":"// Hello there","id":4},{"name":"timestamps","description":"// Hello there","id":1}]},{"name":"+","content":[]}]}
|
{"categories":[{"name":"to do","content":[{"name":"ability to change token","description":"use a config file to store token so that \n\n1- it is away from github\n\n2- it is configurable if need be","id":1},{"name":"clean up bot code","description":"try to remove unnecessary code\n\nunindent\n\ngive sender to function ?","id":2},{"name":"trayable ?","description":"// Hello there","id":5},{"name":"new message marker","description":"perma if too complicated to detect read","id":2},{"name":"proper links","description":"when there is a link, ability to click it","id":3}]},{"name":"in progress","content":[]},{"name":"done","content":[{"name":"run discord bot","description":"make it so the bot is running","id":1},{"name":"fixed token in github","description":"// Hello there","id":1},{"name":"fetch previous messages","description":"// Hello there","id":4},{"name":"ability to write messages","description":"// Hello there","id":5},{"name":"get incoming messages","description":"read","id":2},{"name":"unread system","description":"add a * when a channel just received a message","id":1},{"name":"remember channel id for dm","description":"and put in config file\n\nmaybe load message ? dm first ?","id":3},{"name":"bug : does not save notification state for dm","description":"// Hello there","id":1},{"name":"handle unknown channel better","description":"when receiving a message from a not yet scanned guild, create the channel and put the message\n\nallow scanning if guild selected\n\ndo not add duplicate channel","id":1},{"name":"guild unread ?","description":"// Hello there","id":2},{"name":"timestamps","description":"// Hello there","id":1}]},{"name":"bugs","content":[]},{"name":"v1.0","content":[{"name":"better ui error display","description":"handle the error packet for better display","id":1},{"name":"notifications !!!","description":"// Hello there","id":4}]},{"name":"+","content":[]}]}
|
|
@ -99,6 +99,7 @@ impl Jiji {
|
||||||
}
|
}
|
||||||
postman::Packet::Error(reason) => {
|
postman::Packet::Error(reason) => {
|
||||||
println!("app : error received {}", reason);
|
println!("app : error received {}", reason);
|
||||||
|
self.errors.push(reason);
|
||||||
}
|
}
|
||||||
postman::Packet::FinishedRequest => {
|
postman::Packet::FinishedRequest => {
|
||||||
self.pending_bot_requests = self.pending_bot_requests.checked_sub(1).unwrap_or(0);
|
self.pending_bot_requests = self.pending_bot_requests.checked_sub(1).unwrap_or(0);
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct Jiji {
|
||||||
pending_bot_requests: usize,
|
pending_bot_requests: usize,
|
||||||
current_message: String,
|
current_message: String,
|
||||||
channels_to_notify: Vec<String>,
|
channels_to_notify: Vec<String>,
|
||||||
|
errors: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Jiji {
|
impl Jiji {
|
||||||
|
@ -88,6 +89,7 @@ impl Jiji {
|
||||||
pending_bot_requests: 0,
|
pending_bot_requests: 0,
|
||||||
current_message: "".into(),
|
current_message: "".into(),
|
||||||
channels_to_notify: app_state.channels_to_notify.clone(),
|
channels_to_notify: app_state.channels_to_notify.clone(),
|
||||||
|
errors: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
src/ui.rs
13
src/ui.rs
|
@ -9,6 +9,19 @@ impl Jiji {
|
||||||
egui::TopBottomPanel::top("server_selection")
|
egui::TopBottomPanel::top("server_selection")
|
||||||
.resizable(false)
|
.resizable(false)
|
||||||
.show(ctx, |ui| {
|
.show(ctx, |ui| {
|
||||||
|
let mut delete_error: Option<usize> = None;
|
||||||
|
for i in 0..self.errors.len() {
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
if ui.button("X").clicked() {
|
||||||
|
delete_error = Some(i);
|
||||||
|
}
|
||||||
|
ui.colored_label(hex_str_to_color("#dd5d5a"), &self.errors[i]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(index) = delete_error {
|
||||||
|
self.errors.remove(index);
|
||||||
|
}
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.label("Where do you want to look ? ");
|
ui.label("Where do you want to look ? ");
|
||||||
let selected_guild_text = if let Some(selected_guild_index) = &self.selected_guild {
|
let selected_guild_text = if let Some(selected_guild_index) = &self.selected_guild {
|
||||||
|
|
Loading…
Reference in a new issue