Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] Show task events in the sidebar #15733

Merged
merged 3 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/15733.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Show events alongside logs in the Task sidebar
```
47 changes: 46 additions & 1 deletion ui/app/components/task-context-sidebar.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Portal @target="log-sidebar-portal">
<div
class="sidebar task-context-sidebar has-subnav {{if this.wide "wide"}} {{if this.isSideBarOpen "open"}}"
class="sidebar task-context-sidebar has-subnav {{if this.wide "wide"}} {{if this.isSideBarOpen "open"}} {{if this.isSideBarOpen "open"}}"
{{on-click-outside
@fns.closeSidebar
capture=true
Expand Down Expand Up @@ -31,6 +31,51 @@
{{x-icon "cancel"}}
</button>
</header>
{{#if @task.events.length}}
<div class="boxed-section task-events">
<div class="boxed-section-head">
Recent Events
</div>
<div class="boxed-section-body is-full-bleed">
<ListTable
@source={{reverse @task.events}}
@class="is-striped" as |t|
>
<t.head>
<th class="is-3">
Time
</th>
<th class="is-1">
Type
</th>
<th>
Description
</th>
</t.head>
<t.body as |row|>
<tr data-test-task-event>
<td data-test-task-event-time>
{{format-ts row.model.time}}
</td>
<td data-test-task-event-type>
{{row.model.type}}
</td>
<td data-test-task-event-message>
{{#if row.model.message}}
{{row.model.message}}
{{else}}
<em>
No message
</em>
{{/if}}
</td>
</tr>
</t.body>
</ListTable>
</div>
</div>
<hr />
{{/if}}

<TaskLog
@allocation={{@task.allocation}}
Expand Down
22 changes: 18 additions & 4 deletions ui/app/styles/components/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,30 @@ $subNavOffset: 49px;
}
}

.task-events .boxed-section-body {
height: 250px;
overflow: auto;
table {
height: 100%;
}
}

// Instead of trying to calculate on the fly with JS, let's use vh and offset nav and headers above.
// We can make this a LOT more streamlined when CSS Container Queries are available.
$sidebarTopOffset: 161px;
$sidebarInnerPadding: 48px;
$sidebarHeaderOffset: 74px;
$cliHeaderOffset: 54.5px;
$offsetWithoutEvents: $sidebarTopOffset + $sidebarInnerPadding +
$sidebarHeaderOffset + $cliHeaderOffset;
$sidebarEventsHeight: 250px + 44px + 44px; // table + table header + horizontal rule

.cli-window {
height: calc(
100vh - $sidebarTopOffset - $sidebarInnerPadding - $sidebarHeaderOffset -
$cliHeaderOffset
);
height: calc(100vh - $offsetWithoutEvents);
}
&.has-events {
.cli-window {
height: calc(100vh - $offsetWithoutEvents - $sidebarEventsHeight);
}
}
}