// Define the RequestsConfig object with the plugin's unique ID const RequestsConfig = { pluginUniqueId: '35562a17-cce6-4d0d-9b8e-0b4c69d1fb9c' // This should match the Guid in your Plugin.cs }; export default class RequestsController { constructor(element, params) { this.element = element; this.params = params; this.initIframe(); window.addEventListener('resize', () => this.adjustIframeSize()); } initIframe() { ApiClient.getPluginConfiguration(RequestsConfig.pluginUniqueId).then(config => { const iframe = document.createElement('iframe'); iframe.src = config.RequestsUrl || "https://example.com"; // Fallback URL iframe.style.width = "100%"; iframe.style.height = "100%"; iframe.frameBorder = "0"; iframe.allow = "fullscreen"; iframe.allowFullscreen = true; this.element.appendChild(iframe); this.adjustIframeSize(); }) .catch(error => { console.error('There was a problem with the fetch operation:', error); }); } adjustIframeSize() { const iframe = this.element.querySelector('iframe'); if (iframe) { iframe.style.height = `${window.innerHeight}px`; iframe.style.width = `${window.innerWidth}px`; } } refreshIframeSrc() { ApiClient.getPluginConfiguration(RequestsConfig.pluginUniqueId).then(config => { const iframe = this.element.querySelector('iframe'); if (iframe && config && config.RequestsUrl) { iframe.src = config.RequestsUrl; // Use the URL from the configuration } else { console.error('Failed to load Requests URL from configuration.'); } }) .catch(error => { console.error('Failed to refresh the iframe URL:', error); }); } onResume(options) { console.log('Requests tab resumed with options:', options); this.refreshIframeSrc(); } onPause() { console.log('Requests tab paused'); } } document.addEventListener('DOMContentLoaded', () => { const element = document.querySelector('#requestsTab'); const params = {}; new RequestsController(element, params); });