Change-Id: I26a419b5afc74da9aab43bb30a78846f5a00ac8b
This commit is contained in:
Omer Etrog 2015-11-24 13:08:42 +02:00
parent 8f7ed2fd81
commit edca61bfcc
14 changed files with 234 additions and 0 deletions

View File

@ -4,3 +4,9 @@ exclude .gitignore
exclude .gitreview
global-exclude *.pyc
include setup.py
recursive-include vitragedashboard/enabled *
recursive-include vitragedashboard/static *
recursive-include vitragedashboard/templates *

View File

@ -18,3 +18,15 @@ Project Resources
* `Vitrage at Launchpad <http://launchpad.net/vitrage>`_
* `Wiki <https://wiki.openstack.org/wiki/Vitrage>`_
* `Code Review <https://review.openstack.org/>`_
How to use this package
-----------------------
git clone https://github.com/openstack/horizon.git
git clone https://github.com/openstack/vitrage-dashboard.git
cd horizon
./run_tests.sh -f --docs
cp ./openstack_dashboard/local/local_settings.py.example ./openstack_dashboard/local/local_settings.py
pushd ../vitrage-dashboard
../horizon/tools/with_venv.sh pip install --upgrade .
cp -a vitragedashboard/enabled/* ../horizon/openstack_dashboard/enabled/
popd

View File

@ -0,0 +1,18 @@
# 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.
# The name of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'vitrage_panel_group'
# The display name of the PANEL_GROUP. Required.
PANEL_GROUP_NAME = 'Vitrage'
# The name of the dashboard the PANEL_GROUP associated with. Required.
PANEL_GROUP_DASHBOARD = 'project'

View File

@ -0,0 +1,27 @@
# 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.
# The name of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'topology_vitrage_panel'
# The name of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'project'
# The name of the panel group the PANEL is associated with.
PANEL_GROUP = 'vitrage_panel_group'
# Python panel class of the PANEL to be added.
ADD_PANEL = 'vitragedashboard.panel.TopologyVitrage'
ADD_INSTALLED_APPS = ['vitragedashboard']
ADD_ANGULAR_MODULES = ['horizon.dashboard.project.vitrage']
AUTO_DISCOVER_STATIC_FILES = True

22
vitragedashboard/panel.py Normal file
View File

@ -0,0 +1,22 @@
# Copyright 2015 IBM Corp.
#
# 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
class TopologyVitrage(horizon.Panel):
name = _("Topology")
slug = "vitragedashboard"

View File

@ -0,0 +1,3 @@
<div style="margin-bottom: 4px;">
Hello World
</div>

View File

@ -0,0 +1,19 @@
/**
* Created by oetrog on 11/17/15.
*/
(function(){
'use strict';
angular
.module('horizon.dashboard.project.vitrage')
.controller('vitrageTopologyCtrl',VitrageTopologyCtrl);
VitrageTopologyCtrl.$inject = ['$scope','vitrageTopologySrv'];
function VitrageTopologyCtrl($scope,vitrageTopologySrv){
$scope.STATIC_URL = STATIC_URL;
var srv = vitrageTopologySrv;
}
})();

View File

@ -0,0 +1,33 @@
/**
* Created by oetrog on 11/17/15.
*/
(function(){
'use strict';
angular
.module('horizon.dashboard.project.vitrage')
.service('vitrageTopologySrv',VitrageTopologySrv);
VitrageTopologySrv.$inject = ['$http','$injector'];
function VitrageTopologySrv($http,$injector){
var vitrageAPI;
console.log("vitrageTopologySrv");
if ($injector.has('horizon.app.core.openstack-service-api.vitrage')) {
vitrageAPI = $injector.get('horizon.app.core.openstack-service-api.vitrage');
console.log("vitrageAPI "+vitrageAPI.toString());
if (vitrageAPI) {
vitrageAPI.getTopology()
.success(function (data) {
console.log("Success " + data);
})
.error(function (err) {
console.error(err);
}
)
}
}
}
})();

View File

@ -0,0 +1,10 @@
/**
* Created by oetrog on 11/17/15.
*/
(function(){
'use strict';
angular.module('horizon.dashboard.project.vitrage',[])
})();

View File

@ -0,0 +1,15 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Topology" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Topology") %}
{% endblock page_header %}
{% block main %}
<div ng-cloak ng-controller="vitrageTopologyCtrl" ng-init='init({{ TOPOLOGY_VITRAGE_SETTINGS }})'>
<ng-include src="'{{STATIC_URL}}dashboard/project/topology/main_panel.html'"></ng-include>
</div>
{% endblock %}

22
vitragedashboard/urls.py Normal file
View File

@ -0,0 +1,22 @@
# Copyright 2015 IBM Corp.
#
# 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.conf import urls
from vitragedashboard import views
urlpatterns = urls.patterns(
'',
urls.url(r'^$', views.IndexView.as_view(), name='index'),
)

View File

@ -0,0 +1,15 @@
# 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.
import pbr.version
version_info = pbr.version.VersionInfo('vitrage_dashboard_ui')

32
vitragedashboard/views.py Normal file
View File

@ -0,0 +1,32 @@
# Copyright 2012 Alcatel-Lucent, Inc.
#
# 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 horizon import views
import json
class IndexView(views.APIView):
# A very simple class-based view...
template_name = 'topology/index.html'
def get_data(self, request, context, *args, **kwargs):
topology_settings = {
'VITRAGE_VERSION': {
'VER': 1,
'REL': 1
}
}
context['TOPOLOGY_VITRAGE_SETTINGS'] = json.dumps(topology_settings)
return context