From edca61bfcc192fcf22bda9415de06272445d8e69 Mon Sep 17 00:00:00 2001 From: Omer Etrog Date: Tue, 24 Nov 2015 13:08:42 +0200 Subject: [PATCH] fix typo Change-Id: I26a419b5afc74da9aab43bb30a78846f5a00ac8b --- MANIFEST.in | 6 ++++ README.rst | 12 +++++++ .../_80_project_vitrage_panel_group.py | 18 ++++++++++ .../_90_project_topology_vitrage_panel.py | 27 +++++++++++++++ vitragedashboard/panel.py | 22 +++++++++++++ .../project/topology/main_panel.html | 3 ++ .../topology/vitrage_topology.controller.js | 19 +++++++++++ .../project/topology/vitrage_topology.scss | 0 .../topology/vitrage_topology.service.js | 33 +++++++++++++++++++ .../dashboard/project/vitrage.module.js | 10 ++++++ .../templates/topology/index.html | 15 +++++++++ vitragedashboard/urls.py | 22 +++++++++++++ vitragedashboard/version.py | 15 +++++++++ vitragedashboard/views.py | 32 ++++++++++++++++++ 14 files changed, 234 insertions(+) create mode 100644 vitragedashboard/enabled/_80_project_vitrage_panel_group.py create mode 100644 vitragedashboard/enabled/_90_project_topology_vitrage_panel.py create mode 100644 vitragedashboard/panel.py create mode 100644 vitragedashboard/static/dashboard/project/topology/main_panel.html create mode 100644 vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js create mode 100644 vitragedashboard/static/dashboard/project/topology/vitrage_topology.scss create mode 100644 vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js create mode 100644 vitragedashboard/static/dashboard/project/vitrage.module.js create mode 100644 vitragedashboard/templates/topology/index.html create mode 100644 vitragedashboard/urls.py create mode 100644 vitragedashboard/version.py create mode 100644 vitragedashboard/views.py diff --git a/MANIFEST.in b/MANIFEST.in index c978a52..0b8c048 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 * \ No newline at end of file diff --git a/README.rst b/README.rst index 3380547..0ce1b4c 100644 --- a/README.rst +++ b/README.rst @@ -18,3 +18,15 @@ Project Resources * `Vitrage at Launchpad `_ * `Wiki `_ * `Code Review `_ + +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 \ No newline at end of file diff --git a/vitragedashboard/enabled/_80_project_vitrage_panel_group.py b/vitragedashboard/enabled/_80_project_vitrage_panel_group.py new file mode 100644 index 0000000..c2e4119 --- /dev/null +++ b/vitragedashboard/enabled/_80_project_vitrage_panel_group.py @@ -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' diff --git a/vitragedashboard/enabled/_90_project_topology_vitrage_panel.py b/vitragedashboard/enabled/_90_project_topology_vitrage_panel.py new file mode 100644 index 0000000..e48605d --- /dev/null +++ b/vitragedashboard/enabled/_90_project_topology_vitrage_panel.py @@ -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 diff --git a/vitragedashboard/panel.py b/vitragedashboard/panel.py new file mode 100644 index 0000000..a573f22 --- /dev/null +++ b/vitragedashboard/panel.py @@ -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" diff --git a/vitragedashboard/static/dashboard/project/topology/main_panel.html b/vitragedashboard/static/dashboard/project/topology/main_panel.html new file mode 100644 index 0000000..1e34812 --- /dev/null +++ b/vitragedashboard/static/dashboard/project/topology/main_panel.html @@ -0,0 +1,3 @@ +
+ Hello World +
\ No newline at end of file diff --git a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js new file mode 100644 index 0000000..1b96dac --- /dev/null +++ b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.controller.js @@ -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; + } + +})(); diff --git a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.scss b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.scss new file mode 100644 index 0000000..e69de29 diff --git a/vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js new file mode 100644 index 0000000..c4044cf --- /dev/null +++ b/vitragedashboard/static/dashboard/project/topology/vitrage_topology.service.js @@ -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); + } + ) + } + } + } + +})(); diff --git a/vitragedashboard/static/dashboard/project/vitrage.module.js b/vitragedashboard/static/dashboard/project/vitrage.module.js new file mode 100644 index 0000000..1e413dd --- /dev/null +++ b/vitragedashboard/static/dashboard/project/vitrage.module.js @@ -0,0 +1,10 @@ +/** + * Created by oetrog on 11/17/15. + */ + +(function(){ +'use strict'; + + angular.module('horizon.dashboard.project.vitrage',[]) + +})(); diff --git a/vitragedashboard/templates/topology/index.html b/vitragedashboard/templates/topology/index.html new file mode 100644 index 0000000..1f3e922 --- /dev/null +++ b/vitragedashboard/templates/topology/index.html @@ -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 %} + +
+ +
+{% endblock %} + diff --git a/vitragedashboard/urls.py b/vitragedashboard/urls.py new file mode 100644 index 0000000..0851eb6 --- /dev/null +++ b/vitragedashboard/urls.py @@ -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'), +) diff --git a/vitragedashboard/version.py b/vitragedashboard/version.py new file mode 100644 index 0000000..9c841c4 --- /dev/null +++ b/vitragedashboard/version.py @@ -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') diff --git a/vitragedashboard/views.py b/vitragedashboard/views.py new file mode 100644 index 0000000..de30218 --- /dev/null +++ b/vitragedashboard/views.py @@ -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