This commit is contained in:
Yangguang Li 2019-08-24 22:24:19 +08:00
Родитель 254f3f4e90 45f9d3959c
Коммит 6ce5b539e6
16 изменённых файлов: 259 добавлений и 288 удалений

Просмотреть файл

@ -2,192 +2,160 @@ indexes:
# AUTOGENERATED
# This index.yaml is automatically updated whenever the dev_appserver
# detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the above marker line (the line
# saying "# AUTOGENERATED"). If you want to manage some indexes
# manually, move them above the marker line. The index.yaml file is
# automatically uploaded to the admin console when you next deploy
# your application using appcfg.py.
# This index.yaml is automatically updated whenever the Cloud Datastore
# emulator detects that a new type of query is run. If you want to manage the
# index.yaml file manually, remove the "# AUTOGENERATED" marker line above.
# If you want to manage some indexes manually, move them above the marker line.
- kind: AnimatedProperty
- kind: "Feature"
properties:
- name: bucket_id
- name: date
- kind: AnimatedProperty
properties:
- name: bucket_id
- name: date
- name: "impl_status_chrome"
- name: "shipped_milestone"
direction: desc
- kind: AnimatedProperty
- name: "name"
- kind: "Feature"
properties:
- name: date
- name: day_percentage
- name: "impl_status_chrome"
direction: desc
- kind: Feature
properties:
- name: category
- name: updated
- name: "shipped_milestone"
direction: desc
- kind: Feature
- name: "name"
- kind: "AnimatedProperty"
properties:
- name: category
- name: updated
- name: "bucket_id"
- name: "date"
- kind: "AnimatedProperty"
properties:
- name: "bucket_id"
- name: "date"
direction: desc
- name: name
- kind: Feature
- kind: "AnimatedProperty"
properties:
- name: impl_status_chrome
- name: name
- kind: Feature
properties:
- name: impl_status_chrome
- name: name
- name: "date"
- name: "day_percentage"
direction: desc
- kind: Feature
- kind: "Feature"
properties:
- name: impl_status_chrome
- name: shipped_milestone
- name: name
- kind: Feature
properties:
- name: impl_status_chrome
- name: shipped_milestone
- name: "category"
- name: "updated"
direction: desc
- name: name
- kind: Feature
- kind: "Feature"
properties:
- name: impl_status_chrome
- name: shipped_milestone
- name: "category"
- name: "updated"
direction: desc
- name: name
- name: "name"
- kind: "Feature"
properties:
- name: "impl_status_chrome"
- name: "name"
- kind: "Feature"
properties:
- name: "impl_status_chrome"
- name: "name"
direction: desc
- kind: Feature
- kind: "Feature"
properties:
- name: impl_status_chrome
- name: "impl_status_chrome"
- name: "shipped_milestone"
- name: "name"
- kind: "Feature"
properties:
- name: "impl_status_chrome"
- name: "shipped_milestone"
direction: desc
- name: shipped_milestone
- name: "name"
direction: desc
- name: name
- kind: Feature
- kind: "Feature"
properties:
- name: name
- name: updated
- kind: Feature
- name: "name"
- name: "updated"
- kind: "Feature"
properties:
- name: name
- name: updated
- name: "name"
- name: "updated"
direction: desc
- kind: Feature
- kind: "Feature"
properties:
- name: sample_links
- name: updated
- name: "sample_links"
- name: "updated"
direction: desc
- kind: Feature
- kind: "Feature"
properties:
- name: shipped_milestone
- name: name
- kind: Feature
- name: "shipped_milestone"
- name: "name"
- kind: "Feature"
properties:
- name: shipped_milestone
- name: shipped_android_milestone
- name: "shipped_milestone"
- name: "shipped_android_milestone"
direction: desc
- name: name
- kind: Feature
- name: "name"
- kind: "Feature"
properties:
- name: shipped_milestone
- name: "shipped_milestone"
direction: desc
- name: name
- kind: Feature
- name: "name"
- kind: "Feature"
properties:
- name: shipped_milestone
- name: "shipped_milestone"
direction: desc
- name: name
- name: impl_status_chrome
- kind: Feature
- name: "name"
- name: "impl_status_chrome"
- kind: "Feature"
properties:
- name: shipped_milestone
- name: "shipped_milestone"
direction: desc
- name: name
- name: impl_status_chrome
- name: "name"
- name: "impl_status_chrome"
direction: desc
- kind: Feature
- kind: "Feature"
properties:
- name: updated
- name: "updated"
direction: desc
- name: name
- kind: FeatureObserver
- name: "name"
- kind: "FeatureObserver"
properties:
- name: bucket_id
- name: date
- kind: FeatureObserver
- name: "bucket_id"
- name: "date"
- kind: "FeatureObserver"
properties:
- name: bucket_id
- name: date
- name: "bucket_id"
- name: "date"
direction: desc
- kind: FeatureObserver
- kind: "FeatureObserver"
properties:
- name: date
- name: day_percentage
- name: "date"
- name: "day_percentage"
direction: desc
- kind: FeatureOwner
- kind: "FeatureOwner"
properties:
- name: blink_components
- name: name
- kind: FeatureOwner
- name: "blink_components"
- name: "name"
- kind: "FeatureOwner"
properties:
- name: primary_blink_components
- name: name
- kind: StableInstance
- name: "primary_blink_components"
- name: "name"
- kind: "StableInstance"
properties:
- name: bucket_id
- name: date
- kind: StableInstance
- name: "bucket_id"
- name: "date"
- kind: "StableInstance"
properties:
- name: bucket_id
- name: date
- name: "bucket_id"
- name: "date"
direction: desc
- kind: StableInstance
- kind: "StableInstance"
properties:
- name: bucket_id=
- name: date
- name: "bucket_id="
- name: "date"
direction: desc
- kind: StableInstance
- kind: "StableInstance"
properties:
- name: date
- name: day_percentage
- name: "date"
- name: "day_percentage"
direction: desc
- kind: StableInstance
- kind: "StableInstance"
properties:
- name: date
- name: hits
- name: "date"
- name: "hits"
direction: desc

Просмотреть файл

@ -6,8 +6,8 @@ const DEFAULT_MAX = 7;
class ChromedashColorStatus extends LitElement {
static get properties() {
return {
max: {type: Number}, // From attribute
value: {type: Number}, // From attribute
max: {type: Number},
value: {type: Number},
};
}

Просмотреть файл

@ -1,6 +1,7 @@
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import {nothing} from 'https://unpkg.com/lit-html/lit-html.js?module';
import 'https://unpkg.com/@polymer/iron-icon/iron-icon.js?module';
import '/static/elements/chromedash-color-status.js';
import './chromedash-color-status.js';
const MAX_STANDARDS_VAL = 6;
const MAX_VENDOR_VIEW = 7;
@ -13,18 +14,18 @@ const IS_PUSH_NOTIFIER_SUPPORTED = window.PushNotifier.SUPPORTS_NOTIFICATIONS;
class ChromedashFeature extends LitElement {
static get properties() {
return {
feature: {type: Object}, // From attribute
whitelisted: {type: Boolean}, // From attribute
feature: {type: Object},
whitelisted: {type: Boolean},
open: {type: Boolean, reflect: true}, // Attribute used in the parent for styling
// Values used in the template
_interopRisk: {type: Number, attribute: false},
_isDeprecated: {type: Boolean, attribute: false},
_hasDocLinks: {type: Boolean, attribute: false},
_hasSampleLinks: {type: Boolean, attribute: false},
_commentHtml: {type: String, attribute: false},
_crBugNumber: {type: String, attribute: false},
_newBugUrl: {type: String, attribute: false},
_receivePush: {type: Boolean, attribute: false},
_interopRisk: {attribute: false},
_isDeprecated: {attribute: false},
_hasDocLinks: {attribute: false},
_hasSampleLinks: {attribute: false},
_commentHtml: {attribute: false},
_crBugNumber: {attribute: false},
_newBugUrl: {attribute: false},
_receivePush: {attribute: false},
};
}
@ -196,61 +197,56 @@ class ChromedashFeature extends LitElement {
<iron-icon icon="chromestatus:create"></iron-icon>
</a>
</span>
`: ''}
`: nothing}
</h2>
<div class="iconrow
${IS_PUSH_NOTIFIER_SUPPORTED ?
'supports-push-notifications' : ''}">
<span class="tooltip category-tooltip"
title="Filter by category ${this.feature.category}">
<a href="#" class="category"
@click="${this.categoryFilter}">
${this.feature.category}</a>
</span>
'supports-push-notifications' : nothing}">
<button class="category tooltip category-tooltip" @click="${this.categoryFilter}"
title="Filter by category ${this.feature.category}">
${this.feature.category}</button>
<div class="topcorner">
${this.feature.browsers.chrome.status.text === 'Removed' ? html`
<span class="tooltip" title="Removed feature">
<iron-icon icon="chromestatus:cancel"
class="remove" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${this._isDeprecated ? html`
<span class="tooltip" title="Deprecated feature">
<iron-icon icon="chromestatus:warning"
class="deprecated" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.flag ? html`
<span class="tooltip"
title="Experimental feature behind a flag">
<iron-icon icon="chromestatus:flag"
class="experimental"></iron-icon>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.origintrial ? html`
<span class="tooltip" title="Origin trial">
<iron-icon icon="chromestatus:extension"
class="experimental"></iron-icon>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.intervention ? html`
<span class="tooltip" title="Browser intervention">
<iron-icon icon="chromestatus:pan-tool"
class="intervention" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${IS_PUSH_NOTIFIER_SUPPORTED ? html`
<span class="tooltip"
title="Receive a push notification when there are updates">
<a href="#" @click="${this.subscribeToFeature}" data-tooltip>
<iron-icon icon="${this._receivePush ?
'chromestatus:notifications' :
'chromestatus:notifications-off'}"
class="pushicon ${IS_PUSH_NOTIFIER_ENABLED ?
'' : 'disabled'}"></iron-icon>
</a>
</span>
` : ''}
<button @click="${this.subscribeToFeature}" data-tooltip class="tooltip"
title="Receive a push notification when there are updates">
<iron-icon icon="${this._receivePush ?
'chromestatus:notifications' :
'chromestatus:notifications-off'}"
class="pushicon ${IS_PUSH_NOTIFIER_ENABLED ?
nothing : 'disabled'}"></iron-icon>
</button>
` : nothing}
<span class="tooltip" title="File a bug against this feature">
<a href="${this._newBugUrl}" data-tooltip>
<iron-icon icon="chromestatus:bug-report"></iron-icon>
@ -288,7 +284,7 @@ class ChromedashFeature extends LitElement {
</label>
<span>${this.feature.browsers.chrome.desktop}</span>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.android ? html`
<span>
<label class="impl_status_label">
@ -301,7 +297,7 @@ class ChromedashFeature extends LitElement {
</label>
<span>${this.feature.browsers.chrome.android}</span>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.webview ? html`
<span>
<label class="impl_status_label">
@ -313,10 +309,10 @@ class ChromedashFeature extends LitElement {
</label>
<span>${this.feature.browsers.chrome.webview}</span>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.prefixed ? html`
<span><label>Prefixed</label><span>Yes</span></span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.bug ? html`<span>
<span>Tracking bug</span>
<a href="${this.feature.browsers.chrome.bug}"
@ -324,19 +320,19 @@ class ChromedashFeature extends LitElement {
`#${this._crBugNumber}` :
this.feature.browsers.chrome.bug}</a>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.blink_components &&
this.feature.browsers.chrome.blink_components.length ? html`
<span>
<label>Blink component</label>
<span class="tooltip"
title="Filter by component ${this.feature.browsers.chrome.blink_components}">
<a href="#" @click="${this.filterByComponent}">
<button @click="${this.filterByComponent}">
${this.feature.browsers.chrome.blink_components}
</a>
</button>
</span>
</span>
` : ''}
` : nothing}
${this.feature.browsers.chrome.owners &&
this.feature.browsers.chrome.owners.length ? html`
<span class="owner">
@ -344,14 +340,14 @@ class ChromedashFeature extends LitElement {
<span class="owner-list">
${this.feature.browsers.chrome.owners.map((owner) => html`
<span class="tooltip" title="Filter by owner ${owner}">
<a href="#" @click="${this.filterByOwner}">
<button @click="${this.filterByOwner}">
${owner}
</a>
</button>
</span>
`)}
</span>
</span>
` : ''}
` : nothing}
</div>
</div>
<div class="flex">
@ -429,26 +425,26 @@ class ChromedashFeature extends LitElement {
.links="${this.feature.resources.docs}"
title="Link"></chromedash-multi-links>
</div>
` : ''}
` : nothing}
${this._hasDocLinks && this._hasSampleLinks ?
html`<span>,</span>` : ''}
html`<span>,</span>` : nothing}
${this._hasSampleLinks ? html`
<div class="sample_links">
<chromedash-multi-links title="Sample"
.links="${this.feature.resources.samples}"
></chromedash-multi-links>
</div>
` : ''}
` : nothing}
</div>
</section>
` : ''}
` : nothing}
${this.feature.comments ? html`
<section>
<h3>Comments</h3>
<summary class="comments">${this._commentHtml}</summary>
</section>
` : ''}
` : ''}
` : nothing}
` : nothing}
`;
}
}

Просмотреть файл

@ -1,15 +1,15 @@
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import 'https://unpkg.com/lit-virtualizer?module';
import '/static/elements/chromedash-feature.js';
import './chromedash-feature.js';
class ChromedashFeaturelist extends LitElement {
static get properties() {
return {
whitelisted: {type: Boolean}, // From attribute
features: {type: Array, attribute: false}, // Directly edited and accessed in template/features.html
metadataEl: {type: Object}, // The metadata component element. Directly edited in template/features.html
searchEl: {type: Object}, // The search input element. Directly edited in template/features.html
filtered: {type: Array},
whitelisted: {type: Boolean},
features: {attribute: false}, // Directly edited and accessed in template/features.html
metadataEl: {attribute: false}, // The metadata component element. Directly edited in template/features.html
searchEl: {attribute: false}, // The search input element. Directly edited in template/features.html
filtered: {attribute: false},
};
}

Просмотреть файл

@ -1,25 +1,25 @@
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import '/static/elements/chromedash-color-status.js';
import {nothing} from 'https://unpkg.com/lit-html/lit-html.js?module';
import 'https://unpkg.com/@polymer/iron-icon/iron-icon.js?module';
import './chromedash-color-status.js';
class ChromedashLegend extends LitElement {
static get properties() {
return {
opened: {type: Boolean, reflect: true}, // Used to control visibility. See the css
views: {type: Object}, // Assigned in features-page.js, value from Django
opened: {type: Boolean, reflect: true},
views: {attribute: false}, // Assigned in features-page.js, value from Django
};
}
constructor() {
super();
this.views = {};
}
toggle() {
this.opened = !this.opened;
document.body.style.overflow = this.opened ? 'opened' : '';
}
render() {
if (!this.views) {
return nothing;
}
return html`
<link rel="stylesheet" href="/static/css/elements/chromedash-legend.css">
@ -32,8 +32,8 @@ class ChromedashLegend extends LitElement {
added. Features marked "No active development" are being considered or
have yet to be started. Features marked "In development" are currently
being worked on.</p>
<button class="close buttons">
<iron-icon icon="chromestatus:close" @click=${this.toggle}></iron-icon>
<button class="close buttons" @click=${this.toggle}>
<iron-icon icon="chromestatus:close"></iron-icon>
</button>
</section>
<h3>Color legend</h3>
@ -47,7 +47,7 @@ class ChromedashLegend extends LitElement {
standards process.</p>
<section class="views">
<div>
<label>Browser vendors</label>
<p>Browser vendors</p>
<ul>
${this.views.vendors.map((vendor) => html`
<li>
@ -59,7 +59,7 @@ class ChromedashLegend extends LitElement {
</ul>
</div>
<div>
<label>Web developer</label>
<p>Web developer</p>
<ul>
${this.views.webdevs.map((webdev) => html`
<li>
@ -71,7 +71,7 @@ class ChromedashLegend extends LitElement {
</ul>
</div>
<div>
<label>Standards values</label>
<p>Standards values</p>
<ul>
${this.views.standards.map((standard) => html`
<li>
@ -85,7 +85,7 @@ class ChromedashLegend extends LitElement {
</section>
<h3>Search</h3>
<section>
<label>Example search queries</label>
<p>Example search queries</p>
<ul class="queries">
<li>
<span>"browsers.chrome.desktop&lt;30"</span>features that landed before 30

Просмотреть файл

@ -3,13 +3,13 @@ import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/li
class ChromedashMetadata extends LitElement {
static get properties() {
return {
implStatuses: {type: Array}, // From attribute. Read in chromedash-featurelist.
status: {type: Object}, // From attribute. Read in chromedash-featurelist.
selected: {type: String}, // Directly edited in /templates/features.html
_className: {type: String},
_fetchError: {type: Boolean},
_channels: {type: Object},
_versions: {type: Array},
implStatuses: {type: Array}, // Read in chromedash-featurelist.
status: {attribute: false}, // Read in chromedash-featurelist.
selected: {attribute: false}, // Directly edited in /templates/features.html
_className: {attribute: false},
_fetchError: {attribute: false},
_channels: {attribute: false},
_versions: {attribute: false},
};
}

Просмотреть файл

@ -1,17 +1,17 @@
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import 'https://unpkg.com/@polymer/iron-icon/iron-icon.js?module';
import '/static/elements/chromedash-x-meter.js';
import './chromedash-x-meter.js';
class ChromedashMetrics extends LitElement {
static get properties() {
return {
type: {type: String}, // From attribute
view: {type: String}, // From attribute
prod: {type: Boolean}, // From attibute
viewList: {type: Array},
propertyNameSortIcon: {type: String},
percentSortIcon: {type: String},
maxPercentage: {type: Number},
type: {type: String},
view: {type: String},
prod: {type: Boolean},
viewList: {attribute: false},
propertyNameSortIcon: {attribute: false},
percentSortIcon: {attribute: false},
maxPercentage: {attribute: false},
};
}
@ -31,11 +31,11 @@ class ChromedashMetrics extends LitElement {
this.dispatchEvent(event);
}
firstUpdated() {
async firstUpdated() {
const endpoint = `${!this.prod ? 'https://www.chromestatus.com' : ''}/data/${this.type}${this.view}`;
fetch(endpoint).then((res) => res.json()).then((response) => {
this._updateAfterData(response);
});
const res = await fetch(endpoint);
const json = await res.json();
this._updateAfterData(json);
}
_updateAfterData(items) {
@ -86,9 +86,6 @@ class ChromedashMetrics extends LitElement {
if (this.sortOrders[order].reverse) {
this.viewList.reverse();
}
// TODO: remove when github.com/Polymer/polymer/issues/2175 is fixed.
this.viewList = this.viewList.slice(0);
}
showTimeline(e) {
@ -115,21 +112,20 @@ class ChromedashMetrics extends LitElement {
<b>Showing <span>${this.viewList.length}</span> properties</b>
<ol id="stack-rank-list">
<li class="header">
<label @click="${this.sort}" data-order="property_name">
<span @click="${this.sort}" data-order="property_name">
Property name <iron-icon icon="${this.propertyNameSortIcon}"></iron-icon>
</label>
<label @click="${this.sort}" data-order="percentage" class="percent_label">
</span>
<span @click="${this.sort}" data-order="percentage" class="percent_label">
Percentage <iron-icon icon="${this.percentSortIcon}"></iron-icon>
</label>
</span>
</li>
${this.viewList.map((item) => html`
<li id="${item.property_name}"
title="${item.property_name}. Click to deep link to this property." tabindex="0">
<label>
<a href="#${item.property_name}">${item.property_name}</a>
</label>
<chromedash-x-meter value="${item.percentage}" max="${this.maxPercentage}" @click="${this.showTimeline}"
title="Click to see a timeline view of this property"></chromedash-x-meter>
<a href="#${item.property_name}">${item.property_name}</a>
<chromedash-x-meter value="${item.percentage}" max="${this.maxPercentage}"
@click="${this.showTimeline}"
title="Click to see a timeline view of this property"></chromedash-x-meter>
</li>
`)}
</ol>

Просмотреть файл

@ -1,17 +1,18 @@
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import {nothing} from 'https://unpkg.com/lit-html/lit-html.js?module';
import 'https://unpkg.com/@polymer/iron-icon/iron-icon.js?module';
class ChromedashSamplePanel extends LitElement {
static get properties() {
return {
categories: {type: Object}, // Edited in static/js/samples.js
features: {type: Array}, // Edited in static/js/samples.js
filtered: {type: Array}, // Edited in static/js/samples.js
categories: {attribute: false}, // Edited in static/js/samples.js
features: {attribute: false}, // Edited in static/js/samples.js
filtered: {attribute: false}, // Edited in static/js/samples.js
};
}
constructor() {
super();
connectedCallback() {
super.connectedCallback();
this._loadData();
}
@ -24,7 +25,6 @@ class ChromedashSamplePanel extends LitElement {
// Fire of samples.json XHR right away so data can populate faster.
const url = location.hostname == 'localhost' ?
'https://www.chromestatus.com/samples.json' : '/samples.json';
this.features = await (await fetch(url)).json();
this.features.forEach((feature) => {
feature.sample_links = feature.sample_links.map((link) => {
@ -65,7 +65,6 @@ class ChromedashSamplePanel extends LitElement {
});
}
// TODO: move filtering into a behavior. Mostly duped from chromedash-featurelist.html.
filter(query, category) {
let features = this.features;
@ -118,7 +117,7 @@ class ChromedashSamplePanel extends LitElement {
render() {
if (!this.filtered) {
return html``;
return nothing;
}
return html`
<link rel="stylesheet" href="/static/css/elements/chromedash-sample-panel.css">
@ -153,7 +152,6 @@ class ChromedashSamplePanel extends LitElement {
customElements.define('chromedash-sample-panel', ChromedashSamplePanel);
// TODO: move this into a behavior. It's duplicated from chromedash-featurelist.html.
function matchesMilestone_(milestone, operator, version) {
switch (operator) {
case '<':

Просмотреть файл

@ -1,4 +1,5 @@
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import {nothing} from 'https://unpkg.com/lit-html/lit-html.js?module';
import 'https://unpkg.com/@polymer/iron-icon/iron-icon.js?module';
const TEMPLATE_CONTENT = {
@ -36,8 +37,8 @@ const IS_PUSH_NOTIFIER_ENABLED = window.PushNotifier.GRANTED_ACCESS;
class ChromedashSchedule extends LitElement {
static get properties() {
return {
channels: {type: Object}, // Assigned in schedule.js, value from Django
hideBlink: {type: Boolean}, // Edited in schedule.js
channels: {attribute: false}, // Assigned in schedule.js, value from Django
hideBlink: {attribute: false}, // Edited in schedule.js
};
}
@ -103,7 +104,7 @@ class ChromedashSchedule extends LitElement {
<link rel="stylesheet" href="/static/css/elements/chromedash-schedule.css">
${['stable', 'beta', 'dev'].map((type) => html`
<section class="release ${this.hideBlink ? 'no-components' : ''}">
<section class="release ${this.hideBlink ? 'no-components' : nothing}">
<div class="layout vertical center">
<h1 class="channel_label">${TEMPLATE_CONTENT[type].channelLabel}</h1>
<h1 class="chrome_version layout horizontal center ${TEMPLATE_CONTENT[type].h1Class}">
@ -138,31 +139,31 @@ class ChromedashSchedule extends LitElement {
<span class="tooltip" title="Origin Trial">
<iron-icon icon="chromestatus:extension" class="experimental" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${f.browsers.chrome.intervention ? html`
<span class="tooltip" title="Browser intervention">
<iron-icon icon="chromestatus:pan-tool" class="intervention" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${REMOVED_STATUS.includes(f.browsers.chrome.status.text) ? html`
<span class="tooltip" title="Removed">
<iron-icon icon="chromestatus:cancel" class="remove" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${DEPRECATED_STATUS.includes(f.browsers.chrome.status.text) ? html`
<span class="tooltip" title="Deprecated">
<iron-icon icon="chromestatus:warning" class="deprecated" data-tooltip></iron-icon>
</span>
` : ''}
` : nothing}
${IS_PUSH_NOTIFIER_SUPPORTED ? html`
<span class="tooltip" title="Subscribe to notification updates">
<iron-icon icon="chromestatus:notifications-off"
class="pushicon ${IS_PUSH_NOTIFIER_ENABLED ? '' : 'disabled'}"
class="pushicon ${IS_PUSH_NOTIFIER_ENABLED ? nothing : 'disabled'}"
data-feature-id="${f.id}"
@click="${this._subscribeToFeature}"></iron-icon>
</span>
</span>
` : ''}
` : nothing}
</li>
`)}
</ul>

Просмотреть файл

@ -1,16 +1,21 @@
// TODO(yangguang): This component is not tested. Data is not available in devserver, so cannot be tested locally.
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
class ChromedashTimeline extends LitElement {
static get properties() {
return {
selectedBucketId: {type: Number},
showAllHistoricalData: {type: Boolean},
timeline: {type: Object}, // Not used?
title: {type: String},
type: {type: String},
view: {type: String},
props: {type: Array}, // Directly edited from metrics/css/timeline/popularity and metrics/feature/timeline/popularity
useRemoteData: {type: Boolean}, // If true, fetches live data from chromestatus.com instead of localhost.
title: {type: String},
selectedBucketId: {attribute: false},
showAllHistoricalData: {attribute: false},
props: {attribute: false}, // Directly edited from metrics/css/timeline/popularity and metrics/feature/timeline/popularity
useRemoteData: {attribute: false}, // If true, fetches live data from chromestatus.com instead of localhost.
// Listed in the old code, but seems not used in the component:
prod: {type: Boolean},
timeline: {attribute: false},
};
}
@ -46,7 +51,7 @@ class ChromedashTimeline extends LitElement {
this.showAllHistoricalData = !this.showAllHistoricalData;
}
ready() {
firstUpdated() {
window.google.charts.load('current', {'packages': ['corechart']});
window.google.charts.setOnLoadCallback(() => {
// If there's an id in the URL, load the property it.

Просмотреть файл

@ -6,10 +6,10 @@ let _currentToast = null;
class ChromedashToast extends LitElement {
static get properties() {
return {
msg: {type: String}, // The toast's message.
actionLabel: {type: String}, // A label for the call to action of the toast.
duration: {type: Number}, // The duration in milliseconds to show the toast. -1 or `Infinity`, to disable the toast auto-closing.
msg: {type: String},
open: {type: Boolean, reflect: true},
actionLabel: {attribute: false},
duration: {attribute: false}, // The duration in milliseconds to show the toast. -1 or `Infinity`, to disable the toast auto-closing.
};
}

Просмотреть файл

@ -4,7 +4,7 @@ class ChromedashUserlist extends LitElement {
static get properties() {
return {
actionPath: {type: String},
users: {type: Array},
users: {attribute: false},
};
}
@ -23,7 +23,7 @@ class ChromedashUserlist extends LitElement {
this.users = this.users.slice(0); // Refresh the list
}
ajaxSubmit(e) {
async ajaxSubmit(e) {
e.preventDefault();
const formEl = this.shadowRoot.querySelector('form');
@ -32,22 +32,22 @@ class ChromedashUserlist extends LitElement {
const formData = new FormData();
formData.append('email', email);
fetch(this.actionPath, {
const resp = await fetch(this.actionPath, {
method: 'POST',
body: formData,
credentials: 'same-origin', // Needed for admin permissions to be sent.
}).then((resp) => {
if (resp.status === 200) {
alert('Thanks. But that user already exists');
throw new Error('User already added');
} else if (resp.status !== 201) {
throw new Error('Sever error adding new user');
}
return resp.json();
}).then((json) => {
});
if (resp.status === 200) {
alert('Thanks. But that user already exists');
throw new Error('User already added');
} else if (resp.status !== 201) {
throw new Error('Sever error adding new user');
} else {
const json = await resp.json();
this.addUser(json);
formEl.reset();
});
}
}
}

Просмотреть файл

@ -4,8 +4,8 @@ class ChromedashXMeter extends LitElement {
static get properties() {
return {
value: {type: Number},
valueFormatted: {type: Number},
max: {type: Number}, // Normalized, maximum width for the bar
valueFormatted: {attribute: false},
};
}

Просмотреть файл

@ -1,5 +1,5 @@
// Event handler. Used in feature.html template.
const subscribeToFeature = (featureId) => { // eslint-disable-line no-unused-vars
const subscribeToFeature = (featureId) => {
const iconEl = document.querySelector('.pushicon');
if (iconEl.icon === 'chromestatus:notifications') {
iconEl.icon = 'chromestatus:notifications-off';
@ -11,7 +11,7 @@ const subscribeToFeature = (featureId) => { // eslint-disable-line no-unused-var
};
// Event handler. Used in feature.html template.
const shareFeature = () => { // eslint-disable-line no-unused-vars
const shareFeature = () => {
if (navigator.share) {
const url = '/feature/' + FEATURE_ID;
navigator.share({
@ -69,3 +69,5 @@ if (SHOW_TOAST) {
'show up in the main list.', null, null, -1);
}, 500);
}
export {subscribeToFeature, shareFeature};

Просмотреть файл

@ -28,6 +28,12 @@
display: none !important;
}
button {
background: transparent;
border: 0;
padding: 0;
}
h2 {
display: inline-block;
font-size: 25px;

Просмотреть файл

@ -52,7 +52,6 @@ button, .button {
white-space: nowrap;
user-select: none;
cursor: pointer;
// text-shadow: 1px 1px #fff;
font-size: 10pt;
}