Use standard list format for message area select

This commit is contained in:
Bryan Ashby 2018-06-23 11:17:21 -06:00
parent 812fd28d82
commit 4ef1061fc5
1 changed files with 10 additions and 22 deletions

View File

@ -136,31 +136,20 @@ exports.getModule = class MessageAreaListModule extends MenuModule {
}); });
}, },
function populateAreaListView(callback) { function populateAreaListView(callback) {
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
const areaListView = vc.getView(MciViewIds.AreaList); const areaListView = vc.getView(MciViewIds.AreaList);
if(!areaListView) { if(!areaListView) {
return callback(Errors.MissingMci('A MenuView compatible MCI code is required')); return callback(Errors.MissingMci('A MenuView compatible MCI code is required'));
} }
let i = 1;
areaListView.setItems(_.map(self.messageAreas, v => {
return stringFormat(listFormat, {
index : i++,
areaTag : v.area.areaTag,
name : v.area.name,
desc : v.area.desc,
});
}));
i = 1; let i = 1;
areaListView.setFocusItems(_.map(self.messageAreas, v => { areaListView.setItems(self.messageAreas.map(a => {
return stringFormat(focusListFormat, { return {
index : i++, index : i++,
areaTag : v.area.areaTag, areaTag : a.area.areaTag,
name : v.area.name, text : a.area.name, // standard
desc : v.area.desc, name : a.area.name,
}); desc : a.area.desc,
};
})); }));
areaListView.on('index update', areaIndex => { areaListView.on('index update', areaIndex => {
@ -168,8 +157,7 @@ exports.getModule = class MessageAreaListModule extends MenuModule {
}); });
areaListView.redraw(); areaListView.redraw();
return callback(null);
callback(null);
} }
], ],
function complete(err) { function complete(err) {