installer: let user reset the descriptor template
This commit is contained in:
parent
ce8e1f3c3e
commit
a51704fcc6
@ -165,6 +165,7 @@ pub enum DefineDescriptor {
|
||||
AddSafetyNetPath,
|
||||
KeyModal(ImportKeyModal),
|
||||
ThresholdSequenceModal(ThresholdSequenceModal),
|
||||
Reset,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
|
||||
@ -218,6 +218,12 @@ impl Step for DefineDescriptor {
|
||||
self.modal = Some(Box::new(modal));
|
||||
return cmd;
|
||||
}
|
||||
Message::DefineDescriptor(message::DefineDescriptor::Reset) => {
|
||||
self.keys.clear();
|
||||
self.paths.clear();
|
||||
self.load_template(self.descriptor_template);
|
||||
self.modal = None;
|
||||
}
|
||||
Message::DefineDescriptor(message::DefineDescriptor::Path(i, msg)) => {
|
||||
match msg {
|
||||
message::DefinePath::SequenceEdited(seq) => {
|
||||
|
||||
@ -253,12 +253,20 @@ pub fn custom_template<'a>(
|
||||
Message::DefineDescriptor(message::DefineDescriptor::Path(sn_index + 1, msg))
|
||||
})
|
||||
}))
|
||||
.push(Space::with_height(10))
|
||||
.push(
|
||||
Row::new().push(Space::with_width(Length::Fill)).push(
|
||||
button::primary(None, "Continue")
|
||||
.width(Length::Fixed(200.0))
|
||||
.on_press_maybe(if valid { Some(Message::Next) } else { None }),
|
||||
),
|
||||
Row::new()
|
||||
.push(
|
||||
button::secondary(None, "Clear All")
|
||||
.width(Length::Fixed(200.0))
|
||||
.on_press(Message::DefineDescriptor(message::DefineDescriptor::Reset)),
|
||||
)
|
||||
.push(Space::with_width(Length::Fill))
|
||||
.push(
|
||||
button::primary(None, "Continue")
|
||||
.width(Length::Fixed(200.0))
|
||||
.on_press_maybe(if valid { Some(Message::Next) } else { None }),
|
||||
),
|
||||
)
|
||||
.push(Space::with_height(100.0))
|
||||
.spacing(20),
|
||||
|
||||
@ -160,11 +160,18 @@ pub fn inheritance_template<'a>(
|
||||
)
|
||||
.map(|msg| Message::DefineDescriptor(message::DefineDescriptor::Path(1, msg))),
|
||||
)
|
||||
.push(Space::with_height(10))
|
||||
.push(
|
||||
Row::new()
|
||||
.push(
|
||||
button::secondary(None, "Clear All")
|
||||
.width(Length::Fixed(120.0))
|
||||
.on_press(Message::DefineDescriptor(message::DefineDescriptor::Reset)),
|
||||
)
|
||||
.push(Space::with_width(40))
|
||||
.push(
|
||||
button::secondary(None, "Customize")
|
||||
.width(Length::Fixed(200.0))
|
||||
.width(Length::Fixed(120.0))
|
||||
.on_press(Message::DefineDescriptor(
|
||||
message::DefineDescriptor::ChangeTemplate(
|
||||
context::DescriptorTemplate::Custom,
|
||||
|
||||
@ -230,11 +230,18 @@ pub fn multisig_security_template<'a>(
|
||||
}
|
||||
}),
|
||||
)
|
||||
.push(Space::with_height(10))
|
||||
.push(
|
||||
Row::new()
|
||||
.push(
|
||||
button::secondary(None, "Clear All")
|
||||
.width(Length::Fixed(120.0))
|
||||
.on_press(Message::DefineDescriptor(message::DefineDescriptor::Reset)),
|
||||
)
|
||||
.push(Space::with_width(40))
|
||||
.push(
|
||||
button::secondary(None, "Customize")
|
||||
.width(Length::Fixed(200.0))
|
||||
.width(Length::Fixed(120.0))
|
||||
.on_press(Message::DefineDescriptor(
|
||||
message::DefineDescriptor::ChangeTemplate(
|
||||
context::DescriptorTemplate::Custom,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user