forked from 1b-agent/fieldcraft-upstream
[IMP] OneCAD Simulation rebrand: OneCAD Simulation wordmark + app bar, no external links (docs/GitHub/updates removed, local report copy), all visible strings OneCAD Simulation, REBRAND.md
This commit is contained in:
1 parent
8201f9a954
commit
f8c0e8500a
11 files changed
+221
-178
No files matched your search
@@ -1,13 +1,13 @@
|
||||
//! Help › Report a Bug, and the question the window asks after a crash ("FieldCraft closed
|
||||
//! unexpectedly — Report it").
|
||||
//! Help › Crash Reports, "Report It…" after a crash ("OneCAD Simulation closed unexpectedly —
|
||||
//! Report it"), and the Report a Bug form they open.
|
||||
//!
|
||||
//! The form shows exactly what the GitHub issue form will be filled with
|
||||
//! ([`fieldcraft_engine::bug_report`]): the version, the OS, what happened (the last error by
|
||||
//! default) and, after a crash, where it happened. **Share my session** adds the commands that
|
||||
//! built the model, **Include the model file** the model as well. Nothing leaves the computer
|
||||
//! until the user clicks **Open GitHub Issue**, which opens the filled form in their browser (they
|
||||
//! submit it there, or not); files too big for the link are saved to a folder to attach from, and
|
||||
//! a long session is also put on the clipboard.
|
||||
// OneBSpace (OneCAD Simulation): upstream opened the filled GitHub issue form in the browser;
|
||||
// the fork's report flow is local-only — the form shows exactly what the draft holds
|
||||
// ([`fieldcraft_engine::bug_report`]): the version, the OS, what happened (the last error by
|
||||
// default) and, after a crash, where it happened. **Share my session** adds the commands that
|
||||
// built the model, **Include the model file** the model as well. **Copy report** puts it all on
|
||||
// the clipboard (nothing opens, nothing is sent); attachments are saved to a local folder to
|
||||
// attach from wherever the user files their reports.
|
||||
|
||||
use egui::RichText;
|
||||
use fieldcraft_engine::bug_report::{self, Draft, Input};
|
||||
@@ -169,37 +169,29 @@ impl ModelApp {
|
||||
}
|
||||
}
|
||||
|
||||
/// Open the draft in the browser: attachments saved to a folder of their own, the session on
|
||||
/// the clipboard when it is too long for the link.
|
||||
fn send_report(&mut self, ctx: &egui::Context, draft: &Draft) {
|
||||
let mut saved = None;
|
||||
if !draft.attachments.is_empty() {
|
||||
// OneBSpace (OneCAD Simulation): the report never leaves the workspace — no GitHub issue
|
||||
// form is opened (upstream opened the draft's ISSUE_URL). The draft's text goes to the
|
||||
// clipboard and any attachments stay in the local bug-reports folder to attach by hand.
|
||||
fn copy_report(&mut self, ctx: &egui::Context, draft: &Draft) {
|
||||
let mut text = draft.title.clone();
|
||||
for (k, v) in &draft.fields {
|
||||
if !v.is_empty() {
|
||||
text.push_str(&format!("\n\n{k}:\n{v}"));
|
||||
}
|
||||
}
|
||||
if let Some(session) = &draft.clipboard {
|
||||
text.push_str(&format!("\n\nsession:\n{session}"));
|
||||
}
|
||||
ctx.copy_text(text);
|
||||
let note = if draft.attachments.is_empty() {
|
||||
"Report copied to the clipboard — paste it into your own issue tracker.".to_string()
|
||||
} else {
|
||||
match bug_report::save_attachments(draft) {
|
||||
Ok(dir) => saved = Some(dir),
|
||||
Err(e) => {
|
||||
self.set_status(format!("Report a Bug: could not save the files to attach: {e}"), true);
|
||||
return;
|
||||
}
|
||||
Ok(dir) => format!("Report copied to the clipboard: attach the files in {}.", dir.display()),
|
||||
Err(e) => format!("Report copied to the clipboard (the files to attach could not be saved: {e})."),
|
||||
}
|
||||
}
|
||||
if let Some(text) = &draft.clipboard {
|
||||
ctx.copy_text(text.clone());
|
||||
}
|
||||
match &self.services.open_url {
|
||||
Some(open) => {
|
||||
if let Err(e) = open(&draft.url) {
|
||||
self.set_status(format!("Report a Bug: could not open the browser: {e}"), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
None => ctx.open_url(egui::OpenUrl::new_tab(draft.url.clone())),
|
||||
}
|
||||
log::info!("bug report opened in the browser ({} bytes, {} attachment(s))", draft.url.len(), draft.attachments.len());
|
||||
let text = match saved {
|
||||
Some(dir) => format!("The issue form opened in your browser: attach the files in {} and submit it there.", dir.display()),
|
||||
None => "The issue form opened in your browser: review it and submit it there.".to_string(),
|
||||
};
|
||||
self.set_status(text, false);
|
||||
self.set_status(note, false);
|
||||
self.prompt = None;
|
||||
self.report = None;
|
||||
}
|
||||
@@ -226,10 +218,11 @@ fn size(bytes: usize) -> String {
|
||||
}
|
||||
|
||||
fn kind_label(kind: &str) -> &'static str {
|
||||
// OneBSpace (OneCAD Simulation): the fork's name in the crash headings.
|
||||
match kind {
|
||||
"unclean_exit" => "FieldCraft closed unexpectedly",
|
||||
"unclean_exit" => "OneCAD Simulation closed unexpectedly",
|
||||
"command_panic" => "A command hit an internal error",
|
||||
_ => "FieldCraft hit an internal error",
|
||||
_ => "OneCAD Simulation hit an internal error",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,8 +238,9 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
let (mut report, mut close) = (false, false);
|
||||
crate::frame::window(ctx, kind_label(&first.kind), crate::frame::Width::Normal).id(egui::Id::new("fc_crashed")).show(ctx, |ui| {
|
||||
ui.label(match first.kind.as_str() {
|
||||
"unclean_exit" => "FieldCraft closed unexpectedly the last time it ran.",
|
||||
_ => "FieldCraft hit an internal error the last time it ran.",
|
||||
// OneBSpace (OneCAD Simulation): the fork's name in the crash question.
|
||||
"unclean_exit" => "OneCAD Simulation closed unexpectedly the last time it ran.",
|
||||
_ => "OneCAD Simulation hit an internal error the last time it ran.",
|
||||
});
|
||||
ui.label(RichText::new(&first.message).color(t.text_dim));
|
||||
if reports.len() > 1 {
|
||||
@@ -254,8 +248,10 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
}
|
||||
ui.add_space(4.0);
|
||||
ui.label(
|
||||
// OneBSpace (OneCAD Simulation): reporting drafts locally — no GitHub issue
|
||||
// is opened; the user copies the report into their own tracker.
|
||||
RichText::new(
|
||||
"A crash report was saved on this computer. Reporting it opens a GitHub issue you review first; nothing is sent until you submit it.",
|
||||
"A crash report was saved on this computer. Reporting it drafts a report that stays in the workspace: copy it into your own issue tracker; nothing is sent anywhere.",
|
||||
)
|
||||
.color(t.text_dim),
|
||||
);
|
||||
@@ -285,7 +281,9 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
ui.label("No crash reports are saved on this computer.");
|
||||
} else {
|
||||
ui.label(
|
||||
RichText::new("Saved on this computer, newest first. Reporting one opens a GitHub issue you review first; nothing is sent until you submit it.")
|
||||
// OneBSpace (OneCAD Simulation): reporting drafts locally — no GitHub
|
||||
// issue is opened; the report is copied out by hand.
|
||||
RichText::new("Saved on this computer, newest first. Reporting one drafts a report that stays in the workspace: copy it into your own issue tracker.")
|
||||
.color(t.text_dim),
|
||||
);
|
||||
ui.add_space(4.0);
|
||||
@@ -344,14 +342,14 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
app.prompt = None;
|
||||
return;
|
||||
};
|
||||
let (mut send, mut close) = (false, false);
|
||||
let (mut copy, mut close) = (false, false);
|
||||
let commands = form.input.commands.len();
|
||||
crate::frame::window(ctx, "Report a Bug", crate::frame::Width::Wide).id(egui::Id::new("fc_report_bug")).show(ctx, |ui| {
|
||||
ui.label(
|
||||
RichText::new(
|
||||
"This opens a GitHub issue in your browser, filled in with what is shown below. Nothing is sent until you submit it there.",
|
||||
)
|
||||
.color(t.text_dim),
|
||||
// OneBSpace (OneCAD Simulation): the report stays in the workspace — it is
|
||||
// copied to the clipboard, never opened as a GitHub issue in the browser.
|
||||
RichText::new("Your report stays in the workspace: copy it and paste it into your own issue tracker. Nothing is sent anywhere.")
|
||||
.color(t.text_dim),
|
||||
);
|
||||
if let Some(p) = &form.problem {
|
||||
ui.label(RichText::new(p).color(t.error));
|
||||
@@ -386,11 +384,12 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
let draft = form.draft().clone();
|
||||
ui.add_space(6.0);
|
||||
ui.horizontal(|ui| {
|
||||
send = ui.button("Open GitHub Issue").clicked();
|
||||
// OneBSpace (OneCAD Simulation): "Copy report" instead of "Open GitHub Issue".
|
||||
copy = ui.button("Copy report").clicked();
|
||||
close = ui.button("Cancel").clicked();
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
egui::CollapsingHeader::new("What is sent").id_salt("fc_report_sent").default_open(true).show(ui, |ui| {
|
||||
egui::CollapsingHeader::new("What is in the report").id_salt("fc_report_sent").default_open(true).show(ui, |ui| {
|
||||
egui::ScrollArea::vertical().max_height(180.0).show(ui, |ui| {
|
||||
ui.label(RichText::new(format!("Title: {}", draft.title)).monospace().size(11.0));
|
||||
for (k, v) in &draft.fields {
|
||||
@@ -403,15 +402,17 @@ pub fn show(app: &mut ModelApp, ctx: &egui::Context) {
|
||||
ui.label(RichText::new(format!("Attach {} ({}): {}", a.name, size(a.bytes.len()), a.what)).size(11.0).color(t.accent));
|
||||
}
|
||||
if draft.clipboard.is_some() {
|
||||
ui.label(RichText::new("The session goes on the clipboard too, to paste.").size(11.0).color(t.text_dim));
|
||||
// OneBSpace (OneCAD Simulation): the session is copied with the report.
|
||||
ui.label(RichText::new("The session is copied with the report.").size(11.0).color(t.text_dim));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
let draft = form.draft().clone();
|
||||
app.report = Some(form);
|
||||
if send {
|
||||
app.send_report(ctx, &draft);
|
||||
// OneBSpace (OneCAD Simulation): the copied report never touches the network.
|
||||
if copy {
|
||||
app.copy_report(ctx, &draft);
|
||||
} else if close || ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
|
||||
app.prompt = None;
|
||||
app.report = None;
|
||||
|
||||
Reference in new issue
Block a user