class ServicesModal { constructor(coreRest, coreNetwork) { this.coreRest = coreRest; this.coreNetwork = coreNetwork; this.$servicesModal = $('#services-modal'); this.$servicesForm = this.$servicesModal.find('form'); this.$serviceGroup = $('#service-group'); this.$servicesList = $('#services-list'); this.$servicesButton = $('#services-button'); this.defaultServices = { mdr: new Set(["zebra", "OSPFv3MDR", "IPForward"]), PC: new Set(["DefaultRoute"]), prouter: new Set(["zebra", "OSPFv2", "OSPFv3", "IPForward"]), router: new Set(["zebra", "OSPFv2", "OSPFv3", "IPForward"]), host: new Set(["DefaultRoute", "SSH"]) }; this.node = null; this.nodeDefaults = null; this.serviceGroups = null; this.serviceOptions = new Map(); this.$currentGroup = null; this.groupChange(); this.saveClicked(); } async show(nodeId) { this.node = this.coreNetwork.getCoreNode(nodeId); if (this.node.services.length) { this.nodeDefaults = new Set(this.node.services); } else { this.nodeDefaults = this.defaultServices[this.node.model] || new Set(); } this.serviceGroups = await coreRest.getServices(nodeId); // clear data this.$serviceGroup.html(''); this.$servicesList.html(''); this.serviceOptions.clear(); this.$servicesModal.find('.modal-title').text(`Services: ${this.node.name}`); for (let group in this.serviceGroups) { const $option = $('