DataInsights WebApp extend a new menu tab

Feedback


DataInsights WebApp supports extending new menu tabs. Based on a series of interfaces provided, you can also expand the content in the data directory area on the left, the main work area on the right, and the toolbar icon in the upper right corner of the new menu tab.

The menu tab extension steps

Before the menu tabs extension, please read the Datainsights WebApp extension process. This section only introduces the extension steps of menu tabs.

Step 1: In the js files of menu tabs, instantiate iDataInsights.Plugins.MenuTabsExtension, the code is as follows:

const menuTab = [{

    id: "custom-tab-id",

    name: 'sample',

    icon: "supermapol-icons-link"

}, {

    id: "custom-tab-id2",

    name: 'my',

    icon: "supermapol-icons-link"

}]

const menuTabInstance = new iDataInsights.Plugins.MenuTabsExtension(menuTab);

Note: If the user's id uses one of iDataInsights.Plugins.menuTabsExtension.defaultMenuTabsId, the corresponding panel will be displayed in the system default mode. If you want to customize the content of each panel, do not use these three ids.

Step 2: Call initPane to initialize the panel.

const paneId = [{

    id: "custom-tab-id",

    catalogID: "custom-catalog-id11",

    containerID: "custom-container-id",

}, {

    id: "custom-tab-id2",//tabID

    catalogID: "custom-catalog-id22",

    containerID: "custom-container-id22",

}]

menuTabInstance.initPane(paneId)

Step 3: Create customized components.

function creatMyComponents() {

    let catalogDom = document.querySelector("#custom-catalog-id22");

    //Directory panel on the left-adding button

    let btnDom = createButton('custom-btn1', "Add data");

    btnDom.onclick = () => {

       comComponents.openAddDataWindow();

    }

    catalogDom.appendChild(btnDom);

}

// Add customized components to the specified container

menuTabInstance.createComponents(creatMyComponents);

Step 4: Call addCustomToolBarBtn to add buttons and icons in the customized toolbar.

const myToolBarBtn = [{

    id:"custom-my",

    text: 'my',

    func: function () { console.log('my') },

    hasText: true,

    icon: "supermapol-icons-link",

    otherClass:'',

}, {

    id:"custom-btn",

    text: 'sample',

    func: function () { console.log('sample') },

    hasText: true,

    icon: "supermapol-icons-link",

    otherClass:'',

}]

menuTabInstance.addCustomToolBarBtn("custom-tab-id2", myToolBarBtn);

Step 5: Call setDefaultToolBarBtnShow to set the displaying and hiding of toolbar icon buttons.

menuTabInstance.setDefaultToolBarBtnShow(customMenuTabId, [tooBarBtnId1, tooBarBtnId2, tooBarBtnId3,tooBarBtnId4]);

Note: If it is unnecessary to display the icon provided by DataInsights, you do not need to call this interface.

Step 6: Call setDefaultAddDataWindowTabs to set the menu page to be displayed in the add data window

menuTabInstance.setDefaultAddDataWindowTabs([menuTabID1, menuTabID2, menuTabID3]);

 

Reference: