Skip to content

Commit 70caf90

Browse files
committed
Added combined filter bar for editing android logs filters
Change-Id: I2da124ebcb6d3a093b56aaaccf19adb1f2c64595
1 parent bb6edc2 commit 70caf90

File tree

15 files changed

+934
-138
lines changed

15 files changed

+934
-138
lines changed

ui/src/assets/perfetto.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
@import "widgets/editor";
4747
@import "widgets/empty_state";
4848
@import "widgets/error";
49+
@import "widgets/filter_input";
4950
@import "widgets/flamegraph";
5051
@import "widgets/form";
5152
@import "widgets/grid_layout";

ui/src/assets/theme.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ $border-radius: 2px;
1616
$border-radius-large: 4px;
1717
$anim-timing: 150ms cubic-bezier(0.4, 0, 0.2, 1);
1818

19+
@mixin background-surface {
20+
background-color: var(--pf-color-background);
21+
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.5' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.15'/%3E%3C/svg%3E");
22+
background-size: 100%;
23+
}
24+
25+
$box-shadow-0: 0px 1px 3px var(--pf-color-box-shadow);
1926
$box-shadow-1: 0px 2px 6px var(--pf-color-box-shadow);
2027
$box-shadow-2: 0px 4px 12px var(--pf-color-box-shadow);
2128
$box-shadow-3: 0px 8px 16px var(--pf-color-box-shadow);

ui/src/assets/widgets/details_shell.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
gap: 6px;
2929
padding: 8px 8px 5px 8px;
3030
border-bottom: 1px solid var(--pf-color-border);
31+
background: var(--pf-color-background);
3132

3233
.pf-header-title {
3334
font-size: 18px;
@@ -53,6 +54,19 @@
5354
}
5455
}
5556

57+
&.pf-fill-buttons-space {
58+
.pf-header-bar {
59+
.pf-header-description {
60+
flex-grow: 0;
61+
flex-shrink: 1;
62+
}
63+
64+
.pf-header-buttons {
65+
flex-grow: 1;
66+
}
67+
}
68+
}
69+
5670
.pf-content {
5771
flex-grow: 1;
5872
overflow-x: auto;

ui/src/assets/widgets/empty_state.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
user-select: none;
2323
margin: auto;
2424
justify-content: center;
25+
color: var(--pf-color-text-muted);
2526

2627
&__main-icon {
2728
font-size: 5em; // Size of the icon is relative to the font size.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Copyright (C) 2025 The Android Open Source Project
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
@import "../theme";
16+
17+
.pf-filter-input {
18+
display: flex;
19+
align-items: baseline;
20+
flex-wrap: wrap;
21+
font-size: inherit;
22+
outline: none; // Disable the default outline
23+
border: none; // Disable the default border
24+
border-bottom: solid 1px var(--pf-color-border); // Thin underline
25+
background: none;
26+
transition:
27+
border $anim-timing,
28+
box-shadow $anim-timing,
29+
background $anim-timing;
30+
31+
// Round only the top corners to avoid rounding the edges of the underline
32+
border-radius: $border-radius $border-radius 0 0;
33+
34+
input {
35+
outline: none;
36+
border: none;
37+
background: none;
38+
font-family: inherit;
39+
font-size: inherit;
40+
color: inherit;
41+
flex-grow: 1;
42+
}
43+
44+
i {
45+
cursor: pointer;
46+
font-size: smaller;
47+
margin-left: 2px;
48+
}
49+
50+
&__scroller {
51+
display: flex;
52+
flex-direction: column;
53+
gap: 2px;
54+
overflow-y: auto;
55+
max-height: 300px;
56+
}
57+
58+
&__option-row {
59+
overflow: hidden;
60+
cursor: pointer;
61+
border-radius: 2px;
62+
flex: 0 0 auto;
63+
64+
&--selected {
65+
background: color_active(transparent);
66+
}
67+
}
68+
69+
// The gentle hover effect indicates this component is interactive
70+
&:hover {
71+
background: color_hover(transparent);
72+
}
73+
74+
&:focus-within {
75+
background: color_hover(transparent);
76+
border-bottom: solid 1px var(--pf-color-primary);
77+
78+
// The box-shadow thickens the bottom border, without adding to the height.
79+
// This is the same technique used by materializecss:
80+
// See https://materializecss.com/text-inputs.html
81+
box-shadow: 0 1px 0 var(--pf-color-primary);
82+
}
83+
}

ui/src/assets/widgets/grid.scss

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,16 @@ $border-3: 2px solid var(--pf-color-border);
101101
}
102102

103103
.pf-grid {
104+
display: flex;
105+
flex-direction: column;
106+
104107
font-family: var(--pf-font-compact);
105108
font-size: 14px;
106109
overflow: auto;
107-
align-items: flex-start;
108110
isolation: isolate; // Improves layerization performance.
111+
background-color: var(--pf-color-background);
112+
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.5' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.2'/%3E%3C/svg%3E");
113+
background-size: 100%;
109114

110115
// If fill height is set, the grid should fill the height of its parent, and
111116
// the table content should scroll, otherwise it takes the height of the table
@@ -115,14 +120,16 @@ $border-3: 2px solid var(--pf-color-border);
115120
}
116121

117122
&__header {
123+
flex: 0 0 auto;
124+
118125
display: flex;
119126
flex-direction: column;
120-
background: var(--pf-color-background);
121127
border-bottom: $border-1;
122128
min-width: max-content;
123129
position: sticky;
124130
top: 0;
125131
z-index: 1; // Ensure header is above body rows when scrolling.
132+
background: var(--pf-color-background);
126133
}
127134

128135
&__puck {
@@ -131,6 +138,8 @@ $border-3: 2px solid var(--pf-color-border);
131138

132139
&__body {
133140
min-width: max-content;
141+
background: var(--pf-color-background);
142+
flex: 0 0 auto;
134143

135144
.pf-grid__row {
136145
&:hover {
@@ -140,6 +149,10 @@ $border-3: 2px solid var(--pf-color-border);
140149
}
141150
}
142151

152+
&__empty-state {
153+
margin-block: auto;
154+
}
155+
143156
&__row {
144157
display: flex;
145158
align-items: stretch;
@@ -152,6 +165,10 @@ $border-3: 2px solid var(--pf-color-border);
152165
position: relative; // Positioned element in order to place absolutely positioned children relative to this.
153166
border-right: $border-2;
154167

168+
&:last-child {
169+
margin-right: 10px;
170+
}
171+
155172
&[draggable="true"] {
156173
cursor: grab;
157174

ui/src/components/widgets/data_grid/data_grid.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {Anchor} from '../../../widgets/anchor';
2222
import {Box} from '../../../widgets/box';
2323
import {Button} from '../../../widgets/button';
2424
import {Chip} from '../../../widgets/chip';
25+
import {EmptyState} from '../../../widgets/empty_state';
2526
import {LinearProgress} from '../../../widgets/linear_progress';
2627
import {MenuDivider, MenuItem, MenuTitle} from '../../../widgets/menu';
2728
import {Stack, StackAuto} from '../../../widgets/stack';
@@ -824,6 +825,34 @@ export class DataGrid implements m.ClassComponent<DataGridAttrs> {
824825
onReady: (api) => {
825826
this.gridApi = api;
826827
},
828+
emptyState:
829+
rows?.totalRows === 0
830+
? m(
831+
EmptyState,
832+
{
833+
icon: filters.length > 0 ? 'filter_list_off' : 'database',
834+
title:
835+
filters.length > 0
836+
? 'No results match your filters'
837+
: 'No data available',
838+
fillHeight: true,
839+
},
840+
filters.length > 0 &&
841+
m(Button, {
842+
label: 'Clear all filters',
843+
onclick: () => {
844+
// Clear all filters
845+
filters.forEach((_, index) => {
846+
onFilterRemove(index);
847+
});
848+
// Reset sorting if we have control
849+
if (onSort !== noOp) {
850+
onSort({direction: 'UNSORTED'});
851+
}
852+
},
853+
}),
854+
)
855+
: undefined,
827856
}),
828857
);
829858
}

ui/src/plugins/com.android.AndroidLog/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ const VERSION = 1;
3131
const DEFAULT_STATE: AndroidLogPluginState = {
3232
version: VERSION,
3333
filter: {
34-
// The first two log priorities are ignored.
35-
minimumLevel: 2,
34+
minimumLevel: undefined,
3635
tags: [],
3736
textEntry: '',
3837
hideNonMatching: true,
3938
machineExcludeList: [],
39+
pids: [],
4040
},
4141
};
4242

ui/src/plugins/com.android.AndroidLog/logs_panel.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
font-size: 11px;
2121
font-family: var(--pf-font-monospace);
2222

23+
&__filter {
24+
flex: 1;
25+
}
26+
2327
&__row {
2428
&--debug {
2529
color: log-level-color(hsl(155, 79%, 51%), 30%);

0 commit comments

Comments
 (0)