async function loadImport() { await waitForExtAndComponentMgr(); (await waitForCmpByLocalized('TOOLTIP_IMPORT_REGION_BUTTON')).up().add({ xtype:'button', text:'KML', localized:'IMPORT_KML', handler:function() { let iframeName = "importWizar"+Math.floor(Math.random()*1000) const iframeWindow = Ext.create('Ext.window.Window', { title: 'OZmap Import', localized:'OZ_IMPORT_WIZARD', autoShow:true, height: 810, width: 1000, layout: 'fit', items: [{ xtype: 'component', autoEl: { tag: 'iframe', style: 'height: 100%; width: 100%; border: none; margin-left:5px', src: `/resources/ozimporter/index.html?url=${window.location.href.slice(0,-1)}&token=${ISIS.app.authKey}&projectID=${ISIS.app.projectID}`, }, listeners: { afterrender: function () { const iframe = this.getEl(); iframe.on('load', function () { iframe.dom.contentWindow.postMessage({type:'logrocket', data:{...ISIS.app.user,host:ISIS.app.siom.host }}, "*") iframe.dom.contentWindow.addEventListener('message', message => { console.info(message); if(message.data.action === 'close'){ iframeWindow.close(); } }) }); } }, }], }); } }) } loadImport();