'use strict'; const BaseSection = require(__dirname + '/base-section.js'); const DomainUtil = require(__dirname + '/../../utils/domain-util.js'); const ServerInfoForm = require(__dirname + '/server-info-form.js'); class ConnectedOrgSection extends BaseSection { constructor(props) { super(); this.props = props; } template() { return `
Connected organizations
All the connected orgnizations will appear here.
`; } init() { this.initServers(); } initServers() { this.props.$root.innerHTML = ''; const servers = DomainUtil.getDomains(); this.props.$root.innerHTML = this.template(); this.$serverInfoContainer = document.getElementById('server-info-container'); this.$existingServers = document.getElementById('existing-servers'); const noServerText = 'All the connected orgnizations will appear here'; // Show noServerText if no servers are there otherwise hide it this.$existingServers.innerHTML = servers.length === 0 ? noServerText : ''; for (let i = 0; i < servers.length; i++) { new ServerInfoForm({ $root: this.$serverInfoContainer, server: servers[i], index: i, onChange: this.reloadApp }).init(); } } } module.exports = ConnectedOrgSection;