corporate-frontend-mithril
Version:
Corporate frontend MithrilJS modules
49 lines (38 loc) • 1.26 kB
JavaScript
const AemBoardDataService = require('./../services/aem-board-data-service');
class LandingPageModel {
constructor() {
this._isReady = false;
}
initState() {
return new Promise((resolve, reject)=> {
AemBoardDataService.fetchAllBundles().then((results)=>{
this._isReady = true;
AemBoardDataService.currentServerKey = 'compareTrain';
resolve(results);
}).catch(reject);
});
}
isReady() {
return this._isReady;
}
getServerData(serverName) {
let results = AemBoardDataService.listResults()[serverName];
return results;
}
isCurrentKey(key) {
return Object.is(AemBoardDataService.currentServerKey, key);
}
getComparedData(sourceServer, destinationServer) {
return {
source: {
server: sourceServer,
bundleGroups: AemBoardDataService.listResults()[sourceServer].bundleGroups,
},
destination: {
server: destinationServer,
bundleGroups: AemBoardDataService.listResults()[destinationServer].bundleGroups,
},
};
}
}
module.exports = new LandingPageModel();