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:
@@ -51,6 +51,146 @@ pub(super) fn property<'a>(
|
||||
return Some(message_value(draft, project, value, path));
|
||||
}
|
||||
let leaf = path.rsplit('/').next()?;
|
||||
if leaf == "operation" && path.ends_with("/Occurrence/body/Exchange/operation") {
|
||||
let message = element(draft, project)?;
|
||||
let operation = match message.shared()? {
|
||||
SharedBody::Occurrence {
|
||||
body: OccurrenceBody::Exchange { operation, .. },
|
||||
..
|
||||
} => operation.as_ref(),
|
||||
_ => return None,
|
||||
};
|
||||
let choices = crate::data_values::operation_choices(project, &message);
|
||||
let selected = operation
|
||||
.and_then(|o| o.allocation)
|
||||
.map(|id| crate::app::Choice {
|
||||
id,
|
||||
label: crate::data_values::operation_identity(project, id),
|
||||
});
|
||||
let path = path.to_owned();
|
||||
let mut out = column![
|
||||
text("Exact interface operation allocation").size(12),
|
||||
pick_list(choices, selected, {
|
||||
let path = path.clone();
|
||||
move |choice| Message::FieldShape(path.clone(), json!({"allocation":choice.id}))
|
||||
})
|
||||
.placeholder("Choose an eligible allocation…")
|
||||
.text_size(12)
|
||||
.padding(8)
|
||||
.width(Fill),
|
||||
button("Keep operation unresolved").on_press(Message::FieldShape(
|
||||
path.clone(),
|
||||
json!({"allocation":null})
|
||||
)),
|
||||
button("Use ordinary channel semantics")
|
||||
.on_press(Message::FieldShape(path, Value::Null))
|
||||
]
|
||||
.spacing(7);
|
||||
if let Some(label) = crate::data_values::operation_label(project, &message) {
|
||||
out = out.push(text(label).size(11));
|
||||
}
|
||||
return Some(out.into());
|
||||
}
|
||||
if leaf == "Exchange" && path.contains("/Occurrence/") && value.is_object() {
|
||||
let mut out = column![].spacing(7);
|
||||
if let Some(message) = element(draft, project) {
|
||||
let operation_path = format!("{path}/operation");
|
||||
let body = message.shared();
|
||||
if let Some(SharedBody::Occurrence {
|
||||
body:
|
||||
OccurrenceBody::Exchange {
|
||||
message_kind,
|
||||
operation,
|
||||
..
|
||||
},
|
||||
..
|
||||
}) = body
|
||||
{
|
||||
let scenario = validation::ancestor_of_kind(project, message.id, Kind::Scenario);
|
||||
let boundary = scenario
|
||||
.and_then(|id| project.elements.get(&id))
|
||||
.is_some_and(|e| {
|
||||
matches!(
|
||||
e.shared(),
|
||||
Some(SharedBody::Scenario {
|
||||
viewpoint: ScenarioViewpoint::BoundaryInterface,
|
||||
..
|
||||
})
|
||||
)
|
||||
});
|
||||
if message.layer() == Layer::Sa
|
||||
&& boundary
|
||||
&& matches!(message_kind, MessageKind::Call | MessageKind::Asynchronous)
|
||||
{
|
||||
let enabled = operation.is_some();
|
||||
out = out.push(
|
||||
checkbox(enabled)
|
||||
.label("Invoke a specific interface operation")
|
||||
.on_toggle({
|
||||
let path = operation_path.clone();
|
||||
move |enabled| {
|
||||
Message::FieldShape(
|
||||
path.clone(),
|
||||
if enabled {
|
||||
json!({"allocation":null})
|
||||
} else {
|
||||
Value::Null
|
||||
},
|
||||
)
|
||||
}
|
||||
}),
|
||||
);
|
||||
if let Some(operation) = operation {
|
||||
let mut choices = crate::data_values::operation_choices(project, &message);
|
||||
let selected = operation.allocation.map(|id| crate::app::Choice {
|
||||
id,
|
||||
label: crate::data_values::operation_identity(project, id),
|
||||
});
|
||||
if let Some(selected) = &selected
|
||||
&& !choices.iter().any(|c| c.id == selected.id)
|
||||
{
|
||||
choices.push(selected.clone());
|
||||
}
|
||||
out = out
|
||||
.push(
|
||||
pick_list(choices, selected, {
|
||||
let path = operation_path.clone();
|
||||
move |choice| {
|
||||
Message::FieldShape(
|
||||
path.clone(),
|
||||
json!({"allocation":choice.id}),
|
||||
)
|
||||
}
|
||||
})
|
||||
.placeholder("Choose exact interface operation allocation…")
|
||||
.text_size(12)
|
||||
.padding(8)
|
||||
.width(Fill),
|
||||
)
|
||||
.push(button("Keep operation unresolved").on_press(
|
||||
Message::FieldShape(operation_path, json!({"allocation":null})),
|
||||
));
|
||||
}
|
||||
}
|
||||
if let Some(description) = crate::data_values::operation_label(project, &message) {
|
||||
out = out.push(text(description).size(11));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (key, field) in value.as_object()? {
|
||||
if key != "operation" {
|
||||
out = out.push(super::property(
|
||||
draft,
|
||||
project,
|
||||
field,
|
||||
&format!("{path}/{key}"),
|
||||
&friendly(key),
|
||||
false,
|
||||
));
|
||||
}
|
||||
}
|
||||
return Some(out.into());
|
||||
}
|
||||
if leaf == "direction" && path.contains("/DataField/") {
|
||||
let operation = element(draft, project)
|
||||
.and_then(|e| e.parent)
|
||||
@@ -315,21 +455,30 @@ fn message_value<'a>(
|
||||
let row = edited.pointer(path).unwrap_or(value).clone();
|
||||
let current = serde_json::from_value::<MessageValue>(row.clone()).ok();
|
||||
let owner = element(draft, project);
|
||||
let context = owner
|
||||
let signature = owner.as_ref().and_then(|message| {
|
||||
crate::data_values::message_signature(project, message)
|
||||
.ok()
|
||||
.flatten()
|
||||
});
|
||||
let phase = owner
|
||||
.as_ref()
|
||||
.and_then(Element::shared)
|
||||
.and_then(|body| match body {
|
||||
SharedBody::Occurrence {
|
||||
body:
|
||||
OccurrenceBody::Exchange {
|
||||
exchange: Some(id),
|
||||
message_kind,
|
||||
operation,
|
||||
..
|
||||
},
|
||||
..
|
||||
} => project.relations.get(id).map(|r| (r, message_kind)),
|
||||
} => Some(crate::data_values::operation_value_phase(
|
||||
message_kind,
|
||||
operation.as_ref(),
|
||||
)),
|
||||
_ => None,
|
||||
});
|
||||
let context = signature.as_ref().zip(phase.as_ref());
|
||||
let current_key = current
|
||||
.as_ref()
|
||||
.map(|value| crate::data_values::FieldPathKey {
|
||||
@@ -788,6 +937,7 @@ mod tests {
|
||||
.shared_mut()
|
||||
.unwrap() = SharedBody::Occurrence {
|
||||
body: OccurrenceBody::Exchange {
|
||||
operation: None,
|
||||
exchange: Some(f.exchange),
|
||||
sender: None,
|
||||
receiver: None,
|
||||
|
||||
Reference in New Issue
Block a user