Skip to content

Commit 9f08c3f

Browse files
committed
fix:[#875] move output behind button
1 parent 7f1d341 commit 9f08c3f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/view/action_page.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::utils;
1414
use crate::view;
1515

1616
const ACTION_CANCEL: &str = "action-page.cancel";
17+
const ACTION_VIEW_OUTPUT: &str = "action-page.view-output";
1718
const ACTION_VIEW_ARTIFACT: &str = "action-page.view-artifact";
1819
const ACTION_RETRY: &str = "action-page.retry";
1920

@@ -30,6 +31,8 @@ mod imp {
3031
pub(super) show_view_artifact: Cell<bool>,
3132
#[template_child]
3233
pub(super) status_page: TemplateChild<adw::StatusPage>,
34+
#[template_child]
35+
pub(super) output_box: TemplateChild<adw::Clamp>,
3336
}
3437

3538
#[glib::object_subclass]
@@ -41,6 +44,9 @@ mod imp {
4144
fn class_init(klass: &mut Self::Class) {
4245
klass.bind_template();
4346
klass.install_action(ACTION_CANCEL, None, |widget, _, _| widget.cancel());
47+
klass.install_action(ACTION_VIEW_OUTPUT, None, |widget, _, _| {
48+
widget.view_output()
49+
});
4450
klass.install_action(ACTION_VIEW_ARTIFACT, None, |widget, _, _| {
4551
widget.view_artifact();
4652
});
@@ -146,6 +152,7 @@ impl ActionPage {
146152
use model::ActionType::*;
147153

148154
let imp = self.imp();
155+
imp.output_box.set_visible(false);
149156

150157
match action.state() {
151158
model::ActionState::Ongoing => {
@@ -225,6 +232,7 @@ impl ActionPage {
225232
self.set_description(action);
226233

227234
self.action_set_enabled(ACTION_CANCEL, action.state() == Ongoing);
235+
self.action_set_enabled(ACTION_VIEW_OUTPUT, action.state() == Finished);
228236
self.action_set_enabled(
229237
ACTION_VIEW_ARTIFACT,
230238
self.show_view_artifact()
@@ -277,6 +285,14 @@ impl ActionPage {
277285
}
278286
}
279287

288+
fn view_output(&self) {
289+
let imp = self.imp();
290+
imp.status_page.set_icon_name(None);
291+
imp.status_page.set_description(None);
292+
imp.output_box.set_visible(true);
293+
self.action_set_enabled(ACTION_VIEW_OUTPUT, false);
294+
}
295+
280296
fn view_artifact(&self) {
281297
match self.action().as_ref().and_then(model::Action::artifact) {
282298
Some(artifact) => {

src/view/action_page.ui

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<property name="mode">horizontal</property>
66
<widgets>
77
<widget name="abort_button"/>
8+
<widget name="view_output_button"/>
89
<widget name="view_artifact_button"/>
910
</widgets>
1011
</object>
@@ -40,10 +41,12 @@
4041
<child>
4142
<object class="AdwClamp">
4243
<property name="margin-bottom">9</property>
44+
<property name="orientation">vertical</property>
4345

4446
<child>
45-
<object class="AdwClamp">
47+
<object class="AdwClamp" id="output_box">
4648
<property name="orientation">vertical</property>
49+
<property name="height-request">220</property>
4750

4851
<property name="child">
4952
<object class="AdwBin">
@@ -107,6 +110,20 @@
107110
</object>
108111
</child>
109112

113+
<child>
114+
<object class="GtkButton" id="view_output_button">
115+
<style>
116+
<class name="pill"/>
117+
</style>
118+
<property name="action-name">action-page.view-output</property>
119+
<property name="halign">center</property>
120+
<property name="label" translatable="yes">_View Output</property>
121+
<property name="use-underline">True</property>
122+
<property name="visible" bind-source="view_output_button" bind-property="sensitive" bind-flags="sync-create"/>
123+
<property name="width-request">200</property>
124+
</object>
125+
</child>
126+
110127
<child>
111128
<object class="GtkButton" id="view_artifact_button">
112129
<style>

0 commit comments

Comments
 (0)