basic files of the plugin dashboard

this commit contains the basic files of mellanox dashboard, this
dashboard will have panels for Mellanox products

Change-Id: Ic8c8fb6326480d0e2000b31654a8d9e1ddb564b1
This commit is contained in:
Murad Awawdeh 2016-05-02 11:41:03 +03:00
parent ac6fbb1a51
commit fbdbc15460
12 changed files with 126 additions and 6 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
AUTHORS
build/*
build-stamp
ChangeLog
cover/
covhtml/
dist/
doc/build
*.DS_Store
*.pyc
horizon_mellanox.egg-info/
networking_mlnx/versioninfo
pbr*.egg/
setuptools*.egg/
*.log
*.mo
*.sw?
*~
/.*
!/.coveragerc
!/.gitignore
!/.gitreview
!/.mailmap
!/.pylintrc
!/.testr.conf

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Mellanox Technologies, Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _
import horizon
import horizon_mellanox.api.rest
class MlnxDashboard(horizon.Dashboard):
name = _("Mellanox Technologies")
slug = "horizon_mellanox"
panels = ('settingspanel', 'neopanel', 'ufmpanel', 'aboutpanel') # Add your panels here.
default_panel = 'settingspanel' # Specify the slug of the dashboard's default panel.
horizon.register(MlnxDashboard)

View File

@ -0,0 +1,3 @@
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

View File

@ -0,0 +1,55 @@
horizon.horizon_mellanox = {
_getCookie: function(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
},
prepareNEOPanel: function(){
var val = this._getCookie("mellanox_neo_host");
if(val != ""){/*
// neo authentication
var xhttp = new XMLHttpRequest();
var url = "http://" + val + "/neo/login";
var user = this._getCookie("mellanox_neo_host_user");
var password = this._getCookie("mellanox_neo_host_password");
var data = "username=" + user + "&password=" + password;
xhttp.open("POST", url, true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.onreadystatechange = function() {
alert("on");
if (xhttp.readyState == 4 && xhttp.status == 200) {
alert("ready state");
//document.getElementById("neo_iframe").src = "http://" + val + "/neo";
}
};
xhttp.send(data);*/
document.getElementById("neo_iframe").src = "http://" + val + "/neo";
}else{
var msg = "<h5 style='margin:20px;'>NEO hostname/ip is not set, you can set it in Configurations panel</h5>";
document.getElementsByClassName("col-xs-12")[0].innerHTML = msg;
}
},
prepareUFMPanel: function(){
var val = this._getCookie("mellanox_ufm_host");
if(val != "")
document.getElementById("ufm_iframe").src = "http://" + val + "/ufmui";
else{
var msg = "<h5 style='margin:20px;'>UFM hostname/ip is not set, you can set it in Configurations panel</h5>";
document.getElementsByClassName("col-xs-12")[0].innerHTML = msg;
}
},
prepareSettingsPanel: function(){
document.getElementById("id_neo_host").value = this._getCookie("mellanox_neo_host");
document.getElementById("id_neo_host_user").value = this._getCookie("mellanox_neo_host_user");
document.getElementById("id_neo_host_password").value = this._getCookie("mellanox_neo_host_password");
document.getElementById("id_ufm_host").value = this._getCookie("mellanox_ufm_host");
}
};

View File

@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block sidebar %}
{% include 'horizon/common/_sidebar.html' %}
{% endblock %}
{% block main %}
{% include "horizon/_messages.html" %}
{% block neo_dashboard_main %}{% endblock %}
{% endblock %}

View File

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2016 Mellanox Technologies, Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain

View File

@ -1,11 +1,11 @@
[metadata]
name = horizon-mellanox
summary = OpenStack Boilerplate contains all the boilerplate you need to create an OpenStack package.
summary = plugin that view Mellanox products UIs.
description-file =
README.rst
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/
author = Mellanox
author-email = openstack@mellanox.com
home-page = http://www.mellanox.com/
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology