const ManagerPage = require("./managerpage"); const ejs = require('ejs') const { logger } = require("./filesystem"); const { showConfirmPopup } = require("./popup"); class MenuPage extends ManagerPage { constructor(manager, options) { super(manager, options); } render(str) { const element = this.getElement(); element.innerHTML = str; element.querySelector(".install").addEventListener("click", (e) => this.onInstallClicked(e)); element.querySelector(".edit").addEventListener("click", (e) => this.onEditClicked(e)); element.querySelector(".uninstall").addEventListener("click", (e) => this.onUninstallClicked(e)); super.render(); } show(previousPage) { ejs.renderFile("./ejs/menu.ejs", {...this.options, ...this.manager.options}, {}, (err, str) => { if (!err) { this.render(str); } else { logger.error(err); } }); super.show(previousPage); } /* When the install button is clicked go the installation page */ onInstallClicked(e) { this.manager.options.install = true; if (this.manager.options.singleInstance) { this.manager.options.activeInstance = this.manager.options.instances[0]; /* Show the connections page */ if (!this.manager.options.activeInstance.installed) { this.hide(); this.manager.typePage.show(this); } else { showConfirmPopup("