Skip to content

Commit f4417ac

Browse files
authored
Codec-Compare version 0.4.0 (#22)
Improve navigation.
1 parent c25ef26 commit f4417ac

22 files changed

Lines changed: 545 additions & 1084 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.4.0
4+
5+
- Improve navigation by refactoring the BatchUi, BatchSelectionUi, MatchesUi,
6+
and MatchUi components into a single PanelUi with tabs Metadata, Filtered
7+
rows, and Matches.
8+
39
## v0.3.1
410

511
- Add setting for displaying 10th and 90th percentiles as error bars.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codec_compare",
3-
"version": "0.3.1",
3+
"version": "0.4.0",
44
"description": "Codec performance comparison tool",
55
"publisher": "Google LLC",
66
"author": "Yannis Guyon",

src/batch_selection_actions_ui.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ export class BatchSelectionActionsUi extends LitElement {
4040
'Use'} as reference to compare other codecs with`;
4141

4242
return html`
43-
<mwc-icon-button
44-
class="batchInfo"
45-
icon="info"
46-
title="Show details"
47-
@click=${() => {
48-
dispatch(
49-
EventType.BATCH_INFO_REQUEST, {batchIndex: this.batchSelectionIndex});
50-
}}>
51-
</mwc-icon-button>
5243
<span title="${focusTitle}">
5344
<mwc-icon-button
5445
?disabled=${this.isReference}

src/batch_selection_ui.ts

Lines changed: 7 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import '@material/mwc-fab';
1615
import '@material/mwc-button';
1716
import './filtered_images_ui';
1817
import './filters_ui';
@@ -31,9 +30,7 @@ import {State} from './state';
3130
@customElement('batch-selection-ui')
3231
export class BatchSelectionUi extends LitElement {
3332
@property({attribute: false}) state!: State;
34-
35-
/** The selected batch. */
36-
private batchSelection: BatchSelection|undefined = undefined;
33+
@property({attribute: false}) batchSelection!: BatchSelection;
3734

3835
@query('filtered-images-ui')
3936
private readonly filteredImagesUi: FilteredImagesUi|undefined;
@@ -43,125 +40,36 @@ export class BatchSelectionUi extends LitElement {
4340
listen(EventType.MATCHED_DATA_POINTS_CHANGED, () => {
4441
this.filteredImagesUi?.requestUpdate();
4542
});
46-
listen(EventType.FILTERED_DATA_INFO_REQUEST, (event) => {
47-
this.batchSelection = this.state.batchSelections[event.detail.batchIndex];
48-
this.style.display = 'block';
49-
this.requestUpdate();
50-
});
5143
}
5244

5345
override render() {
54-
if (!this.batchSelection) return html``;
55-
56-
const onClose = () => {
57-
this.batchSelection = undefined;
58-
this.style.display = 'none';
59-
this.requestUpdate();
60-
};
61-
6246
const batchIndex = this.batchSelection.batch.index;
6347
const onBatchInfoRequest = () => {
6448
dispatch(EventType.BATCH_INFO_REQUEST, {batchIndex});
65-
onClose();
6649
};
6750
const onMatchesInfoRequest = () => {
6851
dispatch(EventType.MATCHES_INFO_REQUEST, {batchIndex});
69-
onClose();
7052
};
7153

7254
return html`
73-
<div id="background" @click=${onClose}></div>
74-
<div id="dialog" @click=${(e: Event) => {
75-
e.stopImmediatePropagation();
76-
}}>
77-
<div class="horizontalFlex">
78-
<filters-ui .state=${this.state}
79-
.batchSelection=${this.batchSelection}>
80-
</filters-ui>
81-
<filtered-images-ui .state=${this.state}
82-
.batchSelection=${this.batchSelection}>
83-
</filtered-images-ui>
84-
</div>
85-
86-
<div class="buttons">
87-
<mwc-button
88-
raised
89-
icon="info"
90-
label="Show metadata"
91-
title="Display the details of the batch"
92-
@click=${onBatchInfoRequest}>
93-
</mwc-button>
94-
95-
${
96-
batchIndex === this.state.referenceBatchSelectionIndex ?
97-
// disabled mwc-button title does not appear. Use a div.
98-
html`
99-
<div title="The reference batch cannot be matched with itself">
100-
<mwc-button
101-
raised
102-
icon="join_inner"
103-
label="Show matches"
104-
disabled>
105-
</mwc-button>
106-
</div>
107-
` :
108-
html`
109-
<mwc-button
110-
raised
111-
icon="join_inner"
112-
label="Show matches"
113-
title="Display the matches between this batch and the reference batch"
114-
@click=${onMatchesInfoRequest}>
115-
</mwc-button>
116-
`}
117-
</div>
118-
119-
<mwc-fab id="closeButton" icon="close" title="Close" @click=${onClose}>
120-
</mwc-fab>
55+
<div class="horizontalFlex">
56+
<filters-ui .state=${this.state} .batchSelection=${this.batchSelection}>
57+
</filters-ui>
58+
<filtered-images-ui .state=${this.state}
59+
.batchSelection=${this.batchSelection}>
60+
</filtered-images-ui>
12161
</div>`;
12262
}
12363

12464
static override styles = css`
12565
:host {
126-
display: none;
127-
position: absolute;
128-
z-index: 5;
129-
left: 0;
130-
top: 0;
131-
bottom: 0;
132-
right: 0;
133-
}
134-
135-
#background {
136-
width: 100%;
137-
height: 100%;
138-
background-color: rgba(0, 0, 0, 0.6);
139-
}
140-
141-
#dialog {
142-
background-color: var(--mdc-theme-surface);
143-
position: absolute;
144-
left: 40px;
145-
top: 40px;
146-
bottom: 40px;
147-
right: 40px;
148-
padding: 20px;
149-
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.2);
150-
border-radius: 16px;
15166
display: flex;
15267
flex-direction: column;
153-
/* Rely on margin:auto for distributing the space. */
15468
justify-content: flex-start;
15569
gap: 20px;
15670
overflow: hidden;
15771
}
15872
159-
#closeButton {
160-
position: absolute;
161-
top: 20px;
162-
right: 20px;
163-
}
164-
16573
.horizontalFlex {
16674
display: flex;
16775
flex-direction: row;
@@ -175,11 +83,5 @@ export class BatchSelectionUi extends LitElement {
17583
max-height: 100%;
17684
flex: 1;
17785
}
178-
179-
.buttons {
180-
display: flex;
181-
flex-direction: row;
182-
justify-content: space-evenly;
183-
}
18486
`;
18587
}

src/batch_selections_ui.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import '@material/mwc-icon';
1516
import './batch_selection_actions_ui';
1617

1718
import {css, html, LitElement} from 'lit';
@@ -78,8 +79,8 @@ export class BatchSelectionsUi extends LitElement {
7879
let mean = stats.getAbsoluteMean();
7980
let multiple = '';
8081
const unit = fieldUnit(field.id);
81-
const title = `average ${field.displayName} of ${batch.name} is ${
82-
mean} ${unit}`;
82+
const title =
83+
`average ${field.displayName} of ${batch.name} is ${mean} ${unit}`;
8384

8485
if (mean > 1000000 && unit === 'B') {
8586
mean /= 1000000;
@@ -147,7 +148,10 @@ export class BatchSelectionsUi extends LitElement {
147148
<tr>
148149
<td>
149150
<div class="batchName">
150-
<batch-name-ui .batch=${batch}></batch-name-ui>
151+
<batch-name-ui .batch=${batch} class="batchInfo" @click=${() => {
152+
dispatch(EventType.BATCH_INFO_REQUEST, {batchIndex: batch.index});
153+
}}>
154+
</batch-name-ui>
151155
${this.renderFilterChips(batchSelection)}
152156
</div>
153157
</td>
@@ -234,6 +238,9 @@ export class BatchSelectionsUi extends LitElement {
234238
align-items: center;
235239
gap: 5px;
236240
}
241+
batch-name-ui:hover {
242+
cursor: pointer;
243+
}
237244
.stat {
238245
text-align: right;
239246
/* Keep the table from reshaping itself when percentages vary. */

0 commit comments

Comments
 (0)