vitrage in admin menu

Change-Id: If133da388c2da15867e1384fbdd0666a4e4eae9a
This commit is contained in:
Omer Etrog 2017-04-26 14:59:29 +03:00
parent f700cc9766
commit 0fe376fa05
37 changed files with 585 additions and 56 deletions

View File

@ -18,4 +18,13 @@ recursive-include vitrageentities/static *
recursive-include vitrageentities/templates *
recursive-include vitragetemplates/static *
recursive-include vitragetemplates/templates *
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 *

View File

@ -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}

View File

@ -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.

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 = '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'

View File

@ -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',
]

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 = '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

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 = '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

View File

@ -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()

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 AlarmsAdminVitrage(horizon.Panel):
name = _("Alarms")
slug = "vitrageadminalarms"

View File

@ -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 %}
<div ng-cloak ng-init='init({{ TOPOLOGY_VITRAGE_SETTINGS }})'>
<ng-include src="'{{STATIC_URL}}dashboard/project/alarmList/alarmList.html'"></ng-include>
</div>
<script src="{{STATIC_URL}}vendor/d3/d3.js"></script>
<script src="{{STATIC_URL}}vendor/lodash/dist/lodash.js"></script>
<script src="{{STATIC_URL}}vendor/graphlib/dist/graphlib.core.js"></script>
<script src="{{STATIC_URL}}vendor/dagre/dist/dagre.core.js"></script>
<script src="{{STATIC_URL}}vendor/dagre-d3/dist/dagre-d3.core.js"></script>
{% endblock %}

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 vitrage_dashboard.admin_alarms 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_alarms_ui')

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 = '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

View File

@ -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()

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 TopologyAdminVitrage(horizon.Panel):
name = _("Topology")
slug = "vitrageadmindashboard"

View File

@ -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") %}
<!--<hz-page-header header="Topology Vitrage" description="Topology Vitrage Desc"></hz-page-header>-->
{% endblock page_header %}
{% block main %}
<div ng-cloak ng-init='init({{ TOPOLOGY_VITRAGE_SETTINGS }})'>
<ng-include src="'{{STATIC_URL}}dashboard/project/layout/main/main.html'"></ng-include>
</div>
<script src="{{STATIC_URL}}vendor/d3/d3.js"></script>
<script src="{{STATIC_URL}}vendor/lodash/dist/lodash.js"></script>
<script src="{{STATIC_URL}}vendor/graphlib/dist/graphlib.core.js"></script>
<script src="{{STATIC_URL}}vendor/dagre/dist/dagre.core.js"></script>
<script src="{{STATIC_URL}}vendor/dagre-d3/dist/dagre-d3.core.js"></script>
{% endblock %}

View File

@ -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'),
)

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_entities_ui')

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 = '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

View File

@ -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()

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 EntitiesAdminVitrage(horizon.Panel):
name = _("Entity Graph")
slug = "vitrageadminentities"

View File

@ -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 %}
<div ng-cloak ng-init='init({{ TOPOLOGY_VITRAGE_SETTINGS }})'>
<ng-include src="'{{STATIC_URL}}dashboard/project/entities/entities.html'"></ng-include>
</div>
<script src="{{STATIC_URL}}vendor/d3/d3.js"></script>
<script src="{{STATIC_URL}}vendor/lodash/dist/lodash.js"></script>
<script src="{{STATIC_URL}}vendor/graphlib/dist/graphlib.core.js"></script>
<script src="{{STATIC_URL}}vendor/dagre/dist/dagre.core.js"></script>
<script src="{{STATIC_URL}}vendor/dagre-d3/dist/dagre-d3.core.js"></script>
<!--<div ng-cloak ng-init='init({{ TOPOLOGY_VITRAGE_SETTINGS }})'>-->
<!--<ng-include src="'{{STATIC_URL}}dashboard/project/layout/system-health.html'"></ng-include>-->
<!--</div>-->
{% endblock %}

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 vitrage_dashboard.admin_entities 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_entities_ui')

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 = '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

View File

@ -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'):

View File

@ -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<vitrage_id>.+|default)/$'
url_regex = r'vitrage/alarm/(?P<vitrage_id>.+|default)/' \
'(?P<all_tenants>.+|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<alarm_id>.+|default)/$'
url_regex = r'vitrage/rca/(?P<alarm_id>.+|default)/' \
'(?P<all_tenants>.+|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

View File

@ -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.'));
});

View File

@ -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,

View File

@ -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;

View File

@ -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();

View File

@ -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;
});

View File

@ -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;
})