Adding Buttons to my custom menu tab


(Sameer Varshney) #1

I’m using OpenNebula v5.2
I have create my custom menu tab ‘FCSupport’. For doing this:

  • I have modified admin.yaml to allow ‘fcsupport-tab’

  • Modified main.js to have tabs/fcsupport-tab under shim: deps: section

  • Created public/app/opennebula/fcsupport.js with basic code as below:
    define(function(require) {
    var RESOURCE = “FCSupport”;
    var FCSupport = {
    “resource”: RESOURCE,
    “create” : function(params) { },
    “del” : function(params) { },
    “list” : function(params) { },
    “getName”: function(id){ return “”; }
    }
    return FCSupport;
    })

  • Created public/app/fcsupport-tab.js with basic code as below:
    define(function(require) {
    var Locale = require(‘utils/locale’);
    var Buttons = require(’./fcsupport-tab/buttons’);
    var TAB_ID = require(’./fcsupport-tab/tabId’);
    var Tab = {
    tabId: TAB_ID,
    title: Locale.tr(“FC Support”),
    listHeader: Locale.tr(“FC Support”),
    infoHeader: Locale.tr(“FC Support”),
    resource: ‘FCSupport’,
    buttons: Buttons
    };
    return Tab;
    });

  • Created /public/app/tabs/fcsupport-tab/buttons.js with following code:
    define(function(require) {
    var Locale = require(‘utils/locale’);
    var Buttons = {
    “FCSupport.About” : {
    type: “action”,
    layout: “main_buttons”, text: Locale.tr(“About”),
    alwaysActive: true
    },
    };
    return Buttons;
    });

  • As output, I do get the menu tab ‘FC Support’. Clicking on which, I do get the page with title as 'FC Support.

BUT, there is no button ‘About’ created. I have tried various things but not able to get button on my custom menu tab page. Please help.


(Juan Jose Montiel Cano) #2

you need to include a new section in admin.yaml with “fcsupport-tab” and you include new action “FCSupport.About” into actions section.

something like this:
fcsupport-tab:
actions:
FCSupport.About: true