Show dates on schedule "gap" column. (#1505)

* Show dates on schedule "gap" column.

* Fetch data in a try.
This commit is contained in:
Jason Robbins 2021-09-01 13:19:46 -07:00 коммит произвёл GitHub
Родитель 85cf5271e3
Коммит f5c6542411
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 16 добавлений и 8 удалений

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

@ -9,7 +9,6 @@ const TEMPLATE_CONTENT = {
h1Class: '', h1Class: '',
downloadUrl: 'https://www.google.com/chrome/', downloadUrl: 'https://www.google.com/chrome/',
downloadTitle: 'Download Chrome Stable', downloadTitle: 'Download Chrome Stable',
dateText: 'was',
featureHeader: 'Features in this release', featureHeader: 'Features in this release',
}, },
beta: { beta: {
@ -17,7 +16,6 @@ const TEMPLATE_CONTENT = {
h1Class: 'chrome_version--beta', h1Class: 'chrome_version--beta',
downloadUrl: 'https://www.google.com/chrome/beta/', downloadUrl: 'https://www.google.com/chrome/beta/',
downloadTitle: 'Download Chrome Beta', downloadTitle: 'Download Chrome Beta',
dateText: 'between',
featureHeader: 'Features planned in this release', featureHeader: 'Features planned in this release',
}, },
dev: { dev: {
@ -25,14 +23,12 @@ const TEMPLATE_CONTENT = {
h1Class: 'chrome_version--dev', h1Class: 'chrome_version--dev',
downloadUrl: 'https://www.google.com/chrome/dev', downloadUrl: 'https://www.google.com/chrome/dev',
downloadTitle: 'Download Chrome Dev', downloadTitle: 'Download Chrome Dev',
dateText: 'coming',
featureHeader: 'Features planned in this release', featureHeader: 'Features planned in this release',
}, },
gap: { gap: {
channelLabel: '', channelLabel: '',
h1Class: '', h1Class: '',
downloadUrl: null, downloadUrl: null,
dateText: 'coming',
featureHeader: 'Features planned in this release', featureHeader: 'Features planned in this release',
}, },
}; };
@ -130,7 +126,7 @@ class ChromedashSchedule extends LitElement {
${this.columns.map((type) => html` ${this.columns.map((type) => html`
<section class="release ${this.showBlink ? nothing : 'no-components'}"> <section class="release ${this.showBlink ? nothing : 'no-components'}">
<div class="layout vertical center"> <div class="layout vertical center">
<h1 class="channel_label">${TEMPLATE_CONTENT[type].channelLabel}</h1> <h1 class="channel_label">${TEMPLATE_CONTENT[type].channelLabel || html`&nbsp;`}</h1>
<h1 class="chrome_version layout horizontal center ${TEMPLATE_CONTENT[type].h1Class}"> <h1 class="chrome_version layout horizontal center ${TEMPLATE_CONTENT[type].h1Class}">
<span class="chrome-logo"></span> <span class="chrome-logo"></span>
${TEMPLATE_CONTENT[type].downloadUrl ? html` ${TEMPLATE_CONTENT[type].downloadUrl ? html`
@ -144,7 +140,7 @@ class ChromedashSchedule extends LitElement {
${SHOW_DATES && this.channels[type].earliest_beta ? html` ${SHOW_DATES && this.channels[type].earliest_beta ? html`
<div class="milestone_info layout horizontal center-center"> <div class="milestone_info layout horizontal center-center">
<h3> <h3>
<span class="channel_label">Beta</span> ${TEMPLATE_CONTENT[type].dateText} <span class="channel_label">Beta</span>
<span class="milestone_info-beta">${this._computeDate(this.channels[type].earliest_beta)} - ${this._computeDate(this.channels[type].latest_beta)}</span> <span class="milestone_info-beta">${this._computeDate(this.channels[type].earliest_beta)} - ${this._computeDate(this.channels[type].latest_beta)}</span>
</h3> </h3>
</div> </div>

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

@ -19,14 +19,26 @@ async function init() {
const features = await featuresPromise; const features = await featuresPromise;
let columns = ['stable', 'beta', 'dev']; let columns = ['stable', 'beta', 'dev'];
let gapMilestone = null;
// If there is a gap between stable, beta, or dev then display "gap" column. // If there is a gap between stable, beta, or dev then display "gap" column.
if (CHANNELS['beta'].version > CHANNELS['stable'].version + 1) { if (CHANNELS['beta'].version > CHANNELS['stable'].version + 1) {
CHANNELS['gap'] = {version: CHANNELS['stable'].version + 1}; gapMilestone = CHANNELS['stable'].version + 1;
columns = ['stable', 'gap', 'beta']; columns = ['stable', 'gap', 'beta'];
} else if (CHANNELS['dev'].version > CHANNELS['beta'].version + 1) { } else if (CHANNELS['dev'].version > CHANNELS['beta'].version + 1) {
CHANNELS['gap'] = {version: CHANNELS['beta'].version + 1}; gapMilestone = CHANNELS['beta'].version + 1;
columns = ['stable', 'beta', 'gap']; columns = ['stable', 'beta', 'gap'];
} }
if (gapMilestone) {
try {
const gapInfo = await window.csClient.getSpecifiedChannels(
gapMilestone, gapMilestone);
CHANNELS['gap'] = gapInfo[gapMilestone];
} catch (err) {
throw (new Error('Unable to load schedule for ' + gapMilestone));
}
}
console.log(CHANNELS);
columns.forEach((channel) => { columns.forEach((channel) => {
CHANNELS[channel].components = mapFeaturesToComponents(features.filter(f => CHANNELS[channel].components = mapFeaturesToComponents(features.filter(f =>