Hopeful fix for i18n not working in onRendered()

* Remove the i18n initialization code from an `autorun()` block
* Add some console statements to help with debugging production.
* Add functions to `Boards` for label colors and color mapping
This commit is contained in:
John R. Supplee 2021-02-02 17:56:18 +02:00
parent 4fc2d7b935
commit e4f50d4713
4 changed files with 42 additions and 31 deletions

View file

@ -78,12 +78,10 @@ BlazeComponent.extendComponent({
onRendered() {
Meteor.subscribe('setting');
this.colorMap = {};
for (const color of Boards.simpleSchema()._schema['labels.$.color']
.allowedValues) {
this.colorMap[TAPi18n.__(`color-${color}`)] = color;
}
// // eslint-disable-next-line no-console
// eslint-disable-next-line no-console
console.log('lang:', TAPi18n.getLanguage());
this.colorMap = Boards.colorMap();
// eslint-disable-next-line no-console
// console.log('colorMap:', this.colorMap);
if (Session.get('globalQuery')) {
@ -296,13 +294,14 @@ BlazeComponent.extendComponent({
if (m.groups.operator) {
op = m.groups.operator.toLowerCase();
} else {
op = m.groups.abbrev;
op = m.groups.abbrev.toLowerCase();
}
if (operatorMap.hasOwnProperty(op)) {
let value = m.groups.value;
if (operatorMap[op] === 'labels') {
if (value in this.colorMap) {
value = this.colorMap[value];
// console.log('found color:', value);
}
} else if (
['dueAt', 'createdAt', 'modifiedAt'].includes(operatorMap[op])
@ -388,7 +387,7 @@ BlazeComponent.extendComponent({
params.text = text;
// eslint-disable-next-line no-console
// console.log('params:', params);
console.log('params:', params);
this.queryParams = params;