Checkpoint source 7 workflows and in-progress diagram authoring redesign
Rust checks / check (ubuntu-latest) (push) Canceled after 0s
Rust checks / check (windows-latest) (push) Canceled after 0s
Rust checks / check (ubuntu-latest) (push) Canceled after 0s
Rust checks / check (windows-latest) (push) Canceled after 0s
Preserve current core, source, REST, desktop, recovery, documentation and validation work, including AGENTS.md and the development summary. This is a work-in-progress checkpoint: the new compact palette has outstanding compilation errors and native acceptance; earlier passing gates retain their documented scope.
This commit is contained in:
@@ -14,6 +14,7 @@ use iced::{
|
||||
use oa_core::*;
|
||||
use serde_json::{Value, json};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
mod context_fields;
|
||||
mod data_fields;
|
||||
mod port_fields;
|
||||
mod view_fields;
|
||||
@@ -44,6 +45,23 @@ pub struct ReferenceBrowser {
|
||||
pub page: usize,
|
||||
}
|
||||
|
||||
pub(crate) fn set_shape_value(record: &mut Value, path: &str, value: Value) -> Result<(), String> {
|
||||
if let Some(target) = record.pointer_mut(path) {
|
||||
*target = value;
|
||||
return Ok(());
|
||||
}
|
||||
// Ordinary messages omit operation=None in source/JSON. Authoring that one
|
||||
// optional field must not require changing the historic record encoding.
|
||||
if let Some(parent) = path.strip_suffix("/operation")
|
||||
&& parent.ends_with("/Occurrence/body/Exchange")
|
||||
&& let Some(fields) = record.pointer_mut(parent).and_then(Value::as_object_mut)
|
||||
{
|
||||
fields.insert("operation".into(), value);
|
||||
return Ok(());
|
||||
}
|
||||
Err("Property no longer exists.".into())
|
||||
}
|
||||
|
||||
pub struct Draft {
|
||||
pub kind: RecordKind,
|
||||
pub original: Id,
|
||||
@@ -323,9 +341,7 @@ impl Draft {
|
||||
} else {
|
||||
value
|
||||
};
|
||||
*candidate
|
||||
.pointer_mut(path)
|
||||
.ok_or("Property no longer exists.")? = value;
|
||||
set_shape_value(&mut candidate, path, value)?;
|
||||
self.value = candidate;
|
||||
self.rebuild();
|
||||
Ok(())
|
||||
@@ -333,10 +349,7 @@ impl Draft {
|
||||
/// Replace a workflow-authorized subtree without parsing unrelated inputs,
|
||||
/// including an invalid value which this replacement deliberately removes.
|
||||
pub fn shape_scoped(&mut self, path: &str, value: Value) -> Result<(), String> {
|
||||
*self
|
||||
.value
|
||||
.pointer_mut(path)
|
||||
.ok_or("Property no longer exists.")? = value;
|
||||
set_shape_value(&mut self.value, path, value)?;
|
||||
self.rebuild_retaining(|old| (!within(old, path)).then(|| old.to_owned()));
|
||||
Ok(())
|
||||
}
|
||||
@@ -355,7 +368,8 @@ impl Draft {
|
||||
|| path.ends_with("/Port/contract")
|
||||
|| path.ends_with("/Occurrence/body")
|
||||
|| path.ends_with("/Event/body")
|
||||
|| path.ends_with("/message_kind");
|
||||
|| path.ends_with("/message_kind")
|
||||
|| path.ends_with("/ContextualLink/purpose");
|
||||
if !constructor {
|
||||
return self.shape_scoped(path, proposed);
|
||||
}
|
||||
@@ -1697,6 +1711,9 @@ pub fn scoped<'a>(
|
||||
) -> View<'a, Message> {
|
||||
match draft.value.pointer(path) {
|
||||
Some(value) => property(draft, project, value, path, label, false),
|
||||
None if path.ends_with("/Occurrence/body/Exchange/operation") => {
|
||||
property(draft, project, &Value::Null, path, label, false)
|
||||
}
|
||||
None => text("This property is not applicable to the current target.")
|
||||
.size(12)
|
||||
.into(),
|
||||
@@ -1711,6 +1728,9 @@ fn property<'a>(
|
||||
label: &str,
|
||||
skip_variant: bool,
|
||||
) -> View<'a, Message> {
|
||||
if let Some(view) = context_fields::property(draft, project, value, path) {
|
||||
return view;
|
||||
}
|
||||
if let Some(view) = view_fields::property(draft, project, value, path) {
|
||||
return view;
|
||||
}
|
||||
@@ -2419,6 +2439,7 @@ mod tests {
|
||||
receiver: Some(receiver),
|
||||
message_kind,
|
||||
reply_to,
|
||||
operation: None,
|
||||
values: vec![],
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user