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

Add icons to the query builder dropdowns #686

Merged
merged 3 commits into from
Oct 30, 2018
Merged
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
40 changes: 31 additions & 9 deletions webapp/components/test-runs-query-builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../bower_components/paper-input/paper-input.html">
<link rel="import" href="../bower_components/paper-item/paper-icon-item.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">
<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
<link rel="import" href="../bower_components/paper-checkbox/paper-checkbox.html">
Expand Down Expand Up @@ -198,6 +199,9 @@ <h3>
paper-icon-button {
float: right;
}
display-logo[small] {
margin-top: 16px;
}
</style>
<paper-card>
<div class="card-content">
Expand All @@ -211,21 +215,25 @@ <h3>
<br>
<paper-dropdown-menu label="Browser" no-animations>
<paper-listbox slot="dropdown-content" selected="{{ browserName }}" attr-for-selected="value">
<paper-item value="chrome">[[displayName("chrome")]]</paper-item>
<paper-item value="edge">[[displayName("edge")]]</paper-item>
<paper-item value="firefox">[[displayName("firefox")]]</paper-item>
<paper-item value="safari">[[displayName("safari")]]</paper-item>
<template is="dom-repeat" items="[[defaultProducts]]" as="product">
<paper-icon-item value="[[product.browser_name]]">
<display-logo slot="item-icon" product="[[product]]" small></display-logo>
[[displayName(product.browser_name)]]
</paper-icon-item>
</template>
</paper-listbox>
</paper-dropdown-menu>

<br>
<paper-dropdown-menu label="Channel" no-animations>
<paper-listbox slot="dropdown-content" selected="{{ _channel }}" attr-for-selected="value">
<paper-item value="any">Any</paper-item>
<paper-item value="stable">[[displayName("stable")]]</paper-item>
<paper-item value="beta">[[displayName("beta")]]</paper-item>
<paper-item value="dev">[[displayName("dev")]]</paper-item>
<paper-item value="experimental">[[displayName("experimental")]]</paper-item>
<template is="dom-repeat" items="[[channels]]" as="channel">
<paper-icon-item value="[[channel]]">
<display-logo slot="item-icon" product="[[productWithChannel(_product, channel)]]" small></display-logo>
[[displayName(channel)]]
</paper-icon-item>
</template>
</paper-listbox>
</paper-dropdown-menu>

Expand All @@ -248,7 +256,7 @@ <h3>
</paper-card>
</template>
<script>
/* global ProductInfo, CHANNELS, SOURCES, DEFAULT_BROWSER_NAMES */
/* global ProductInfo, CHANNELS, SOURCES, DEFAULT_BROWSER_NAMES, DEFAULT_PRODUCTS */
class ProductBuilder extends ProductInfo(window.Polymer.Element) {
static get is() {
return 'product-builder';
Expand Down Expand Up @@ -301,6 +309,14 @@ <h3>
},
onDelete: Function,
onProductChanged: Function,
defaultProducts: {
type: Array,
value: Array.from(DEFAULT_PRODUCTS),
},
channels: {
type: Array,
value: Array.from(CHANNELS),
},
};
}

Expand Down Expand Up @@ -361,6 +377,12 @@ <h3>
}
this.labels = labels;
}

productWithChannel(product, channel) {
return Object.assign({}, product, {
labels: (product.labels || []).filter(l => !CHANNELS.has(l)).concat(channel)
});
}
}

window.customElements.define(ProductBuilder.is, ProductBuilder);
Expand Down