diff --git a/MANIFEST.in b/MANIFEST.in index d26bac7..2b19aeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -18,4 +18,13 @@ recursive-include vitrageentities/static * recursive-include vitrageentities/templates * recursive-include vitragetemplates/static * -recursive-include vitragetemplates/templates * \ No newline at end of file +recursive-include vitragetemplates/templates * + +recursive-include vitrageadminalarms/static * +recursive-include vitrageadminalarms/templates * + +recursive-include vitrageadminentities/static * +recursive-include vitrageadminentities/templates * + +recursive-include vitrageadmindashboard/static * +recursive-include vitrageadmindashboard/templates * \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 5077d96..802e5c6 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,7 +22,7 @@ sys.path.insert(0, os.path.abspath('../..')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', - #'sphinx.ext.intersphinx', + # 'sphinx.ext.intersphinx', 'oslosphinx' ] @@ -72,4 +72,4 @@ latex_documents = [ ] # Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} +# intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/enabled/_80_project_vitrage_panel_group.py b/enabled/_4000_project_vitrage_panel_group.py similarity index 100% rename from enabled/_80_project_vitrage_panel_group.py rename to enabled/_4000_project_vitrage_panel_group.py diff --git a/enabled/_90_project_topology_vitrage_panel.py b/enabled/_4010_project_topology_vitrage_panel.py similarity index 100% rename from enabled/_90_project_topology_vitrage_panel.py rename to enabled/_4010_project_topology_vitrage_panel.py diff --git a/enabled/_91_project_alarms_vitrage_panel.py b/enabled/_4020_project_alarms_vitrage_panel.py similarity index 100% rename from enabled/_91_project_alarms_vitrage_panel.py rename to enabled/_4020_project_alarms_vitrage_panel.py diff --git a/enabled/_92_project_entities_vitrage_panel.py b/enabled/_4030_project_entities_vitrage_panel.py similarity index 96% rename from enabled/_92_project_entities_vitrage_panel.py rename to enabled/_4030_project_entities_vitrage_panel.py index e81333a..fc90748 100644 --- a/enabled/_92_project_entities_vitrage_panel.py +++ b/enabled/_4030_project_entities_vitrage_panel.py @@ -11,7 +11,7 @@ # limitations under the License. # The name of the panel to be added to HORIZON_CONFIG. Required. -PANEL = 'alarms_vitrage_panel' +PANEL = 'entities_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. diff --git a/enabled/_93_project_template_vitrage_panel.py b/enabled/_4040_project_template_vitrage_panel.py similarity index 100% rename from enabled/_93_project_template_vitrage_panel.py rename to enabled/_4040_project_template_vitrage_panel.py diff --git a/enabled/_4100_admin_vitrage_panel_group.py b/enabled/_4100_admin_vitrage_panel_group.py new file mode 100644 index 0000000..f93c2f6 --- /dev/null +++ b/enabled/_4100_admin_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 = 'admin_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 = 'admin' diff --git a/enabled/_4110_admin_topology_vitrage_panel.py b/enabled/_4110_admin_topology_vitrage_panel.py new file mode 100644 index 0000000..41bb1bb --- /dev/null +++ b/enabled/_4110_admin_topology_vitrage_panel.py @@ -0,0 +1,31 @@ +# 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 = 'admin' +# The name of the panel group the PANEL is associated with. +PANEL_GROUP = 'admin_vitrage_panel_group' + +# Python panel class of the PANEL to be added. +ADD_PANEL = 'vitrage_dashboard.dashboard.panel.TopologyAdminVitrage' + +ADD_INSTALLED_APPS = ['vitrage_dashboard.admin_dashboard'] + +ADD_ANGULAR_MODULES = ['horizon.dashboard.project.admin_vitrage'] + +AUTO_DISCOVER_STATIC_FILES = True + +ADD_SCSS_FILES = [ + 'dashboard/project/vitrage.scss', +] diff --git a/enabled/_4120_admin_alarms_vitrage_panel.py b/enabled/_4120_admin_alarms_vitrage_panel.py new file mode 100644 index 0000000..8bf76de --- /dev/null +++ b/enabled/_4120_admin_alarms_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 = 'alarms_vitrage_panel' +# The name of the dashboard the PANEL associated with. Required. +PANEL_DASHBOARD = 'admin' +# The name of the panel group the PANEL is associated with. +PANEL_GROUP = 'admin_vitrage_panel_group' + +# Python panel class of the PANEL to be added. +ADD_PANEL = 'vitrage_dashboard.admin_alarms.panel.AlarmsAdminVitrage' + +ADD_INSTALLED_APPS = ['vitrage_dashboard.admin_alarms'] + +ADD_ANGULAR_MODULES = ['horizon.dashboard.project.vitrage'] + +AUTO_DISCOVER_STATIC_FILES = True diff --git a/enabled/_4130_admin_entities_vitrage_panel.py b/enabled/_4130_admin_entities_vitrage_panel.py new file mode 100644 index 0000000..bcb7887 --- /dev/null +++ b/enabled/_4130_admin_entities_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 = 'entities_vitrage_panel' +# The name of the dashboard the PANEL associated with. Required. +PANEL_DASHBOARD = 'admin' +# The name of the panel group the PANEL is associated with. +PANEL_GROUP = 'admin_vitrage_panel_group' + +# Python panel class of the PANEL to be added. +ADD_PANEL = 'vitrage_dashboard.admin_entities.panel.EntitiesAdminVitrage' + +ADD_INSTALLED_APPS = ['vitrage_dashboard.admin_entities'] + +ADD_ANGULAR_MODULES = ['horizon.dashboard.project.vitrage'] + +AUTO_DISCOVER_STATIC_FILES = True diff --git a/vitrage_dashboard/admin_alarms/__init__.py b/vitrage_dashboard/admin_alarms/__init__.py new file mode 100644 index 0000000..4883a95 --- /dev/null +++ b/vitrage_dashboard/admin_alarms/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# 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__ = pbr.version.VersionInfo( + 'vitrage-dashboard').version_string() diff --git a/vitrage_dashboard/admin_alarms/panel.py b/vitrage_dashboard/admin_alarms/panel.py new file mode 100644 index 0000000..71cfbfa --- /dev/null +++ b/vitrage_dashboard/admin_alarms/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 AlarmsAdminVitrage(horizon.Panel): + name = _("Alarms") + slug = "vitrageadminalarms" diff --git a/vitrage_dashboard/admin_alarms/templates/adminalarms/index.html b/vitrage_dashboard/admin_alarms/templates/adminalarms/index.html new file mode 100644 index 0000000..59adbd3 --- /dev/null +++ b/vitrage_dashboard/admin_alarms/templates/adminalarms/index.html @@ -0,0 +1,22 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Alarms Admin Analysis" %}{% endblock %} + +{% block page_header %} +{% include "horizon/common/_page_header.html" with title=_("Alarms Analysis") %} +{% endblock page_header %} + +{% block main %} + +
+ +
+ + + + + + + +{% endblock %} + diff --git a/vitrage_dashboard/admin_alarms/urls.py b/vitrage_dashboard/admin_alarms/urls.py new file mode 100644 index 0000000..ad8421f --- /dev/null +++ b/vitrage_dashboard/admin_alarms/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 vitrage_dashboard.admin_alarms import views + +urlpatterns = urls.patterns( + '', + urls.url(r'^$', views.IndexView.as_view(), name='index'), +) diff --git a/vitrage_dashboard/admin_alarms/version.py b/vitrage_dashboard/admin_alarms/version.py new file mode 100644 index 0000000..44d2235 --- /dev/null +++ b/vitrage_dashboard/admin_alarms/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_alarms_ui') diff --git a/vitrage_dashboard/admin_alarms/views.py b/vitrage_dashboard/admin_alarms/views.py new file mode 100644 index 0000000..fa3f487 --- /dev/null +++ b/vitrage_dashboard/admin_alarms/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 = 'adminalarms/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 diff --git a/vitrage_dashboard/admin_dashboard/__init__.py b/vitrage_dashboard/admin_dashboard/__init__.py new file mode 100644 index 0000000..4883a95 --- /dev/null +++ b/vitrage_dashboard/admin_dashboard/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# 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__ = pbr.version.VersionInfo( + 'vitrage-dashboard').version_string() diff --git a/vitrage_dashboard/admin_dashboard/panel.py b/vitrage_dashboard/admin_dashboard/panel.py new file mode 100644 index 0000000..605184d --- /dev/null +++ b/vitrage_dashboard/admin_dashboard/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 TopologyAdminVitrage(horizon.Panel): + name = _("Topology") + slug = "vitrageadmindashboard" diff --git a/vitrage_dashboard/admin_dashboard/templates/admintopology/index.html b/vitrage_dashboard/admin_dashboard/templates/admintopology/index.html new file mode 100644 index 0000000..15ee0a3 --- /dev/null +++ b/vitrage_dashboard/admin_dashboard/templates/admintopology/index.html @@ -0,0 +1,24 @@ +{% 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/vitrage_dashboard/admin_dashboard/urls.py b/vitrage_dashboard/admin_dashboard/urls.py new file mode 100644 index 0000000..61bda27 --- /dev/null +++ b/vitrage_dashboard/admin_dashboard/urls.py @@ -0,0 +1,23 @@ +# 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 vitrage_dashboard.admin_dashboard import views +import vitrage_dashboard.api.vitrage_rest_api # noqa + +urlpatterns = urls.patterns( + '', + urls.url(r'^$', views.IndexView.as_view(), name='index'), +) diff --git a/vitrage_dashboard/admin_dashboard/version.py b/vitrage_dashboard/admin_dashboard/version.py new file mode 100644 index 0000000..1b61796 --- /dev/null +++ b/vitrage_dashboard/admin_dashboard/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_entities_ui') diff --git a/vitrage_dashboard/admin_dashboard/views.py b/vitrage_dashboard/admin_dashboard/views.py new file mode 100644 index 0000000..b61abf8 --- /dev/null +++ b/vitrage_dashboard/admin_dashboard/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 = 'admintopology/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 diff --git a/vitrage_dashboard/admin_entities/__init__.py b/vitrage_dashboard/admin_entities/__init__.py new file mode 100644 index 0000000..4883a95 --- /dev/null +++ b/vitrage_dashboard/admin_entities/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# 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__ = pbr.version.VersionInfo( + 'vitrage-dashboard').version_string() diff --git a/vitrage_dashboard/admin_entities/panel.py b/vitrage_dashboard/admin_entities/panel.py new file mode 100644 index 0000000..a898be8 --- /dev/null +++ b/vitrage_dashboard/admin_entities/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 EntitiesAdminVitrage(horizon.Panel): + name = _("Entity Graph") + slug = "vitrageadminentities" diff --git a/vitrage_dashboard/admin_entities/templates/adminentities/index.html b/vitrage_dashboard/admin_entities/templates/adminentities/index.html new file mode 100644 index 0000000..9b1ffa4 --- /dev/null +++ b/vitrage_dashboard/admin_entities/templates/adminentities/index.html @@ -0,0 +1,25 @@ +{% extends 'base.html' %} +{% load i18n %} +{% block title %}{% trans "Entity Admin Graph" %}{% endblock %} + +{% block page_header %} +{% include "horizon/common/_page_header.html" with title=_("Entity Graph") %} +{% endblock page_header %} + +{% block main %} + +
+ +
+ + + + + + + + + + +{% endblock %} + diff --git a/vitrage_dashboard/admin_entities/urls.py b/vitrage_dashboard/admin_entities/urls.py new file mode 100644 index 0000000..1510d93 --- /dev/null +++ b/vitrage_dashboard/admin_entities/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 vitrage_dashboard.admin_entities import views + +urlpatterns = urls.patterns( + '', + urls.url(r'^$', views.IndexView.as_view(), name='index'), +) diff --git a/vitrage_dashboard/admin_entities/version.py b/vitrage_dashboard/admin_entities/version.py new file mode 100644 index 0000000..1b61796 --- /dev/null +++ b/vitrage_dashboard/admin_entities/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_entities_ui') diff --git a/vitrage_dashboard/admin_entities/views.py b/vitrage_dashboard/admin_entities/views.py new file mode 100644 index 0000000..778fa95 --- /dev/null +++ b/vitrage_dashboard/admin_entities/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 = 'adminentities/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 diff --git a/vitrage_dashboard/api/vitrage.py b/vitrage_dashboard/api/vitrage.py index 75466be..f7fb424 100644 --- a/vitrage_dashboard/api/vitrage.py +++ b/vitrage_dashboard/api/vitrage.py @@ -30,17 +30,20 @@ def vitrageclient(request, password=None): return vitrage_client.Client('1', session) -def topology(request, query=None, graph_type='tree'): +def topology(request, query=None, graph_type='tree', all_tenants='false'): return vitrageclient(request).topology.get(query=query, - graph_type=graph_type) + graph_type=graph_type, + all_tenants=all_tenants) -def alarms(request, vitrage_id='all'): - return vitrageclient(request).alarm.list(vitrage_id=vitrage_id) +def alarms(request, vitrage_id='all', all_tenants='false'): + return vitrageclient(request).alarm.list(vitrage_id=vitrage_id, + all_tenants=all_tenants) -def rca(request, alarm_id): - return vitrageclient(request).rca.get(alarm_id=alarm_id) +def rca(request, alarm_id, all_tenants='false'): + return vitrageclient(request).rca.get(alarm_id=alarm_id, + all_tenants=all_tenants) def templates(request, template_id='all'): diff --git a/vitrage_dashboard/api/vitrage_rest_api.py b/vitrage_dashboard/api/vitrage_rest_api.py index 3f16976..5cfb62c 100644 --- a/vitrage_dashboard/api/vitrage_rest_api.py +++ b/vitrage_dashboard/api/vitrage_rest_api.py @@ -42,8 +42,11 @@ class Topolgy(generic.View): ''' original default is graph ''' graph_type = 'tree' + all_tenants = 'false' if 'graph_type' in request.GET: graph_type = request.GET.get('graph_type') + if 'all_tenants' in request.GET: + all_tenants = request.GET.get('all_tenants') query = None if 'query' in request.GET: @@ -60,17 +63,19 @@ class Topolgy(generic.View): return vitrage.topology(request=request, query=query, - graph_type=graph_type) + graph_type=graph_type, + all_tenants=all_tenants) @urls.register class Alarms(generic.View): """API for vitrage alarms.""" - url_regex = r'vitrage/alarm/(?P.+|default)/$' + url_regex = r'vitrage/alarm/(?P.+|default)/' \ + '(?P.+|default)/$' @rest_utils.ajax() - def get(self, request, vitrage_id): + def get(self, request, vitrage_id, all_tenants): """Get a single entity's alarm with the vitrage id. The following get alarm may be passed in the GET @@ -80,17 +85,18 @@ class Alarms(generic.View): The result is a alarms object. """ - return vitrage.alarms(request, vitrage_id) + return vitrage.alarms(request, vitrage_id, all_tenants) @urls.register class Rca(generic.View): """API for vitrage rca.""" - url_regex = r'vitrage/rca/(?P.+|default)/$' + url_regex = r'vitrage/rca/(?P.+|default)/' \ + '(?P.+|default)/$' @rest_utils.ajax() - def get(self, request, alarm_id): + def get(self, request, alarm_id, all_tenants): """Get rca graph for an alarm. :param alarm_id the id of the alarm @@ -98,7 +104,7 @@ class Rca(generic.View): The result is an rca graph. """ - return vitrage.rca(request, alarm_id) + return vitrage.rca(request, alarm_id, all_tenants) @urls.register diff --git a/vitrage_dashboard/dashboard/static/app/core/openstack-service-api/vitrage.service.js b/vitrage_dashboard/dashboard/static/app/core/openstack-service-api/vitrage.service.js index bde2934..34d040a 100644 --- a/vitrage_dashboard/dashboard/static/app/core/openstack-service-api/vitrage.service.js +++ b/vitrage_dashboard/dashboard/static/app/core/openstack-service-api/vitrage.service.js @@ -26,12 +26,15 @@ // Topology '/static/dashboard/project/topology/graph.sample.json' - function getTopology(graph_type, config) { + function getTopology(graph_type, config,admin) { config = config || {}; if (graph_type) { config.params = {graph_type: graph_type}; } + if (admin){ + (!config.params) ? config.params = {all_tenants: true} : config.params.all_tenants = true; + } return apiService.get('/api/vitrage/topology/', config) .error(function () { @@ -39,18 +42,25 @@ }); } - function getAlarms(vitrage_id) { + function getAlarms(vitrage_id,adminState) { if (vitrage_id == undefined){ vitrage_id = 'all'; } - return apiService.get('/api/vitrage/alarm/'+vitrage_id) - .error(function () { - toastService.add('error', gettext('Unable to fetch the Vitrage Alarms service.')); - }); + var url = '/api/vitrage/alarm/' + vitrage_id; + if (adminState) { + url += '/true'; + }else { + url += '/false'; + } + return apiService.get(url) + .error(function() { + toastService.add('error', gettext('Unable to fetch the Vitrage Alarms service.')); + }); + } - function getRca(alarm_id) { - return apiService.get('/api/vitrage/rca/'+alarm_id) + function getRca(alarm_id,adminState) { + return apiService.get('/api/vitrage/rca/'+alarm_id+"/"+adminState) .error(function () { toastService.add('error', gettext('Unable to fetch the Vitrage RCA service.')); }); diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js index 8cdd274..1c77cfb 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/alarmList/alarmList.controller.js @@ -5,9 +5,9 @@ .module('horizon.dashboard.project.vitrage') .controller('AlarmListController', AlarmListController); - AlarmListController.$inject = ['$scope', 'modalSrv', 'vitrageTopologySrv','$interval']; + AlarmListController.$inject = ['$scope', 'modalSrv', 'vitrageTopologySrv','$interval','$location']; - function AlarmListController($scope, modalSrv, vitrageTopologySrv,$interval) { + function AlarmListController($scope, modalSrv, vitrageTopologySrv,$interval,$location) { var alarmList = this; alarmList.alarms = []; alarmList.ialarms = []; @@ -45,11 +45,13 @@ }; function getData() { - vitrageTopologySrv.getAlarms('all').then(function(result){ - alarmList.alarms = result.data; - }); + var url = $location.absUrl(); + vitrageTopologySrv.getAlarms('all',url.indexOf('admin') != -1).then(function(result){ + alarmList.alarms = result.data; + }) } + alarmList.onRcaClick = function(alarm) { var modalOptions = { animation: true, diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.controller.js b/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.controller.js index 877db25..4fec7bc 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.controller.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/components/rca/rcaContainer.controller.js @@ -5,9 +5,9 @@ .module('horizon.dashboard.project.vitrage') .controller('RcaContainerController', RcaContainerController); - RcaContainerController.$inject = ['alarm', '$scope', 'modalSrv', 'vitrageTopologySrv']; + RcaContainerController.$inject = ['alarm', '$scope', 'modalSrv', 'vitrageTopologySrv','$location']; - function RcaContainerController(alarm, $scope, modalSrv, vitrageTopologySrv) { + function RcaContainerController(alarm, $scope, modalSrv, vitrageTopologySrv,$location) { var vm = this; $scope.STATIC_URL = STATIC_URL; vm.isLoading = true; @@ -18,7 +18,8 @@ var getData = function() { vm.isLoading = true; - vitrageTopologySrv.getRootCauseAnalysis(alarm.vitrage_id) + var url = $location.absUrl(); + vitrageTopologySrv.getRootCauseAnalysis(alarm.vitrage_id,(url.indexOf('admin') != -1)) .then( function success(result) { $scope.data = result.data; diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/entities/entities.controller.js b/vitrage_dashboard/dashboard/static/dashboard/project/entities/entities.controller.js index 6d3d669..3ff23be 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/entities/entities.controller.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/entities/entities.controller.js @@ -14,12 +14,12 @@ - EntitiesController.$inject = ['$scope', 'vitrageTopologySrv', '$interval']; + EntitiesController.$inject = ['$scope', 'vitrageTopologySrv', '$interval','$location']; - function EntitiesController($scope, vitrageTopologySrv, $interval) { + function EntitiesController($scope, vitrageTopologySrv, $interval,$location) { @@ -70,8 +70,11 @@ function loadData() { + var url = $location.absUrl(); + var admin = false; - vitrageTopologySrv.getTopology('graph') + if (url.indexOf('admin') != -1) admin = true; + vitrageTopologySrv.getTopology('graph',null,admin) .then(function(res) { @@ -79,9 +82,6 @@ links = res.data.links; - - - _.each(links, function(link) { link.source = nodes[link.source]; @@ -90,12 +90,6 @@ }); - - - - - - if (_this.graphData) { mergeData(res.data); @@ -109,8 +103,6 @@ } - - errorCount = 0; nextLoad(); diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/layout/main/compute/compute.directive.js b/vitrage_dashboard/dashboard/static/dashboard/project/layout/main/compute/compute.directive.js index 96ba2c0..1b69eaa 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/layout/main/compute/compute.directive.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/layout/main/compute/compute.directive.js @@ -11,19 +11,20 @@ function hzCompute() { controllerAs: 'computeCtrl' }; - hzComputeController.$inject = ['$scope','vitrageTopologySrv']; + hzComputeController.$inject = ['$scope','vitrageTopologySrv','$location']; return directive; function link(scope, element, attrs) { } - function hzComputeController($scope,vitrageTopologySrv){ + function hzComputeController($scope,vitrageTopologySrv,$location){ var computeCtrl = this; computeCtrl.model = {}; computeCtrl.model.computeTopology = []; computeCtrl.model.selected = {}; - vitrageTopologySrv.getTopology().then(function(result){ + var url = $location.absUrl(); + vitrageTopologySrv.getTopology(null,null,url.indexOf('admin') != -1).then(function(result){ computeCtrl.model.computeTopology = result.data; }); diff --git a/vitrage_dashboard/dashboard/static/dashboard/project/services/vitrage_topology.service.js b/vitrage_dashboard/dashboard/static/dashboard/project/services/vitrage_topology.service.js index 95cf2dc..c3a19fa 100644 --- a/vitrage_dashboard/dashboard/static/dashboard/project/services/vitrage_topology.service.js +++ b/vitrage_dashboard/dashboard/static/dashboard/project/services/vitrage_topology.service.js @@ -14,10 +14,10 @@ vitrageAPI = $injector.get('horizon.app.core.openstack-service-api.vitrage'); } - function getTopology(graph_type) { + function getTopology(graph_type,config,admin) { if (vitrageAPI) { - return vitrageAPI.getTopology(graph_type) + return vitrageAPI.getTopology(graph_type,config,admin) .success(function(data) { return data; }) @@ -28,10 +28,10 @@ } } - function getAlarms(vitrage_id) { + function getAlarms(vitrage_id,admin) { if (vitrageAPI) { - return vitrageAPI.getAlarms(vitrage_id) + return vitrageAPI.getAlarms(vitrage_id,admin) .success(function(data) { return data; }) @@ -57,9 +57,9 @@ } - function getRootCauseAnalysis(alarm_id) { + function getRootCauseAnalysis(alarm_id,adminState) { if (vitrageAPI) { - return vitrageAPI.getRca(alarm_id) + return vitrageAPI.getRca(alarm_id,adminState) .success(function(data) { return data; })