(tabName, address, queryString = '')
| 42 | }, |
| 43 | |
| 44 | async addTab(tabName, address, queryString = '') { |
| 45 | // Field manual does not create a tab |
| 46 | if (tabName === 'fieldmanual') { |
| 47 | restRequest('GET', null, (data) => { this.setTabContent({ name: tabName, contentID: `tab-${tabName}`, address: address }, data); }, address); |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | // If tab is already open, jump to it |
| 52 | const existingTabIndex = this.openTabs.findIndex((tab) => tab.name === tabName); |
| 53 | if (existingTabIndex !== -1) { |
| 54 | this.activeTabIndex = existingTabIndex; |
| 55 | this.checkQueryString(queryString); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | // Tab does not exist, create it |
| 60 | const tab = { name: tabName, contentID: `tab-${tabName}`, address: address }; |
| 61 | |
| 62 | this.openTabs.push(tab); |
| 63 | this.activeTabIndex = this.openTabs.length - 1; |
| 64 | try { |
| 65 | this.setTabContent(tab, await apiV2('GET', tab.address)); |
| 66 | this.checkQueryString(queryString); |
| 67 | } catch (error) { |
| 68 | toast('Unable to load page', false); |
| 69 | console.error(error); |
| 70 | } |
| 71 | }, |
| 72 | |
| 73 | checkQueryString(queryString) { |
| 74 | if (history.pushState) { |
nothing calls this directly
no test coverage detected