from flask import Blueprint
import flask
from cloudmesh.util.logger import LOGGER
from cloudmesh.util.util import banner
from pprint import pprint
import cloudmesh
log = LOGGER(__file__)

menu_module = Blueprint('menu_module', __name__)

banner("MENU")

super_sidebar_pages = [
    ["Cloudmesh",
        [
            ["Home", "/"],
            ["Status", "/status"],
            ["Profile", "/profile/"],
            ["Keys", "/keys/"],
        ],
    ],
    ["Inventory",
        [
            ["Overview", "/inventory/"],
            ["Table", "/inventory/summary"],
            ["Images", "/inventory/images"],
            ["Rack Diagram", "/inventory/rack"],
        ],
    ],
    ["Provision",
        [
            ["Policy", "/provision/policy"],
            ["Overview", "/provision/summary/"],
            ["Form", "/provision/"],
            ["Workflow", "/provision/workflow"],
        ],
    ],
    ["Clouds",
        [
            ["Register", "/mesh/register/clouds"],
            ["Refresh", "/cm/refresh"],
            ["VMs", "/mesh/servers"],
            ["Images", "/mesh/images"],
            ["Flavors", "/mesh/flavors/"],
            ["Users", "/mesh/users/"],
        ],
    ],
    ["HPC",
        [
            ["Queues", "/mesh/qstat"],
            ["Users", "/users/ldap"],
            ["Admin", "/hpc"]
        ]
    ],
    ["Launcher",
        [
            ["Launcher", "/cm/launch"],
            ["Register", "/cm/register"]
        ]
    ],
]

banner ("JKJLKJ")
pprint (super_sidebar_pages)
banner ("JKJLKJ")

flask.Flask.app_ctx_globals_class.super_sidebar_pages = super_sidebar_pages

app_topbar = [
    ["Home", "/"],
    ["Profile", "/profile/"],
    ["About", "/about/"],
    ["Contact", "/contact/"],
]

app_externalbar = [
    ["FutureGrid", "https://portal.futuregrid.org"],
    ["-- Manual", "http://manual.futuregrid.org"],
    ["Cloudmesh", "https://github.com/cloudmesh/cloudmesh"],
    ["Blog", "http://cloudmesh.blogspot.com"],
]


topbar_pages = []
for page in app_topbar:
    topbar_pages.append({'name': page[0], 'url': page[1]})

# registering topbar into the global g
flask.Flask.app_ctx_globals_class.topbar_pages = topbar_pages


# log.info("{0}".format(str(flask.Flask.app_ctx_globals_class.topbar_pages)))

externalbar_pages = []
for page in app_externalbar:
    externalbar_pages.append({'name': page[0], 'url': page[1]})

# registering externalbar   into the global g
flask.Flask.app_ctx_globals_class.externalbar_pages = externalbar_pages


# log.info("{0}".format(str(flask.Flask.app_ctx_globals_class.externalbar_pages)))


#
# ACTIVATE STRUCTURE
#

# @menu_module.context_processor
# def inject_sidebar():

#    print "OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"

    #    return dict(sidebar_pages=g.sidebar_pages)

@@ -1473,74 +1473,8 @@
 %0A%5D%0A%0A
-banner (%22JKJLKJ%22)%0Apprint (super_sidebar_pages)%0Abanner (%22JKJLKJ%22)%0A%0A
 flas

remove debug msg