Enhance drawer for alarms and events panel
Enhance the drawer for alarms and events panel to display the entire data set and not just a subset. Remove the link to the details page for alarms and events. Remove the details page for events. The details page for alarms is being used by the “Admin/Platform/Provider Network Topology“ panel. Story: 2004818 Task: 29048 Depends-On: https://review.openstack.org/#/c/633060/ Change-Id: I81ac78416ab52ec2b8942be08ed3e5e12976a97d Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
parent
8569c522fc
commit
ce1a444f1d
@ -1,2 +1,2 @@
|
||||
SRC_DIR="starlingx-dashboard"
|
||||
TIS_PATCH_VER=24
|
||||
TIS_PATCH_VER=25
|
||||
|
@ -107,6 +107,10 @@ def alarm_list(request, search_opts=None):
|
||||
paginate = False
|
||||
include_suppress = False
|
||||
|
||||
# If expand is set to true then all the data of the alarm is returned not
|
||||
# just a subset.
|
||||
expand = False
|
||||
|
||||
if search_opts is None:
|
||||
search_opts = {}
|
||||
|
||||
@ -124,6 +128,9 @@ def alarm_list(request, search_opts=None):
|
||||
elif suppression == FM_SUPPRESS_HIDE:
|
||||
include_suppress = False
|
||||
|
||||
if "expand" in search_opts:
|
||||
expand = True
|
||||
|
||||
if 'paginate' in search_opts:
|
||||
paginate = search_opts.pop('paginate')
|
||||
if paginate:
|
||||
@ -131,7 +138,7 @@ def alarm_list(request, search_opts=None):
|
||||
|
||||
alarms = fmclient(request).alarm.list(
|
||||
limit=limit, marker=marker, sort_key=sort_key, sort_dir=sort_dir,
|
||||
include_suppress=include_suppress)
|
||||
include_suppress=include_suppress, expand=expand)
|
||||
|
||||
has_more_data = False
|
||||
if paginate and len(alarms) > page_size:
|
||||
@ -178,6 +185,11 @@ class EventLog(base.APIResourceWrapper):
|
||||
|
||||
def event_log_list(request, search_opts=None):
|
||||
paginate = False
|
||||
|
||||
# If expand is set to true then all the data of the alarm is returned not
|
||||
# just a subset.
|
||||
expand = False
|
||||
|
||||
if search_opts is None:
|
||||
search_opts = {}
|
||||
|
||||
@ -210,13 +222,17 @@ def event_log_list(request, search_opts=None):
|
||||
elif suppression == FM_SUPPRESS_HIDE:
|
||||
include_suppress = False
|
||||
|
||||
if "expand" in search_opts:
|
||||
expand = True
|
||||
|
||||
logs = fmclient(request)\
|
||||
.event_log.list(q=query,
|
||||
limit=limit,
|
||||
marker=marker,
|
||||
alarms=alarms,
|
||||
logs=logs,
|
||||
include_suppress=include_suppress)
|
||||
include_suppress=include_suppress,
|
||||
expand=expand)
|
||||
|
||||
has_more_data = False
|
||||
if paginate and len(logs) > page_size:
|
||||
|
@ -35,7 +35,8 @@ class Alarms(generic.View):
|
||||
|
||||
@rest_utils.ajax()
|
||||
def get(self, request):
|
||||
search_opts = {'suppression': 'SUPPRESS_SHOW'}
|
||||
search_opts = {'suppression': 'SUPPRESS_SHOW', 'expand': True}
|
||||
|
||||
result = fm.alarm_list(request, search_opts=search_opts)
|
||||
|
||||
return {'items': [sc.to_dict() for sc in result]}
|
||||
@ -59,7 +60,8 @@ class Events(generic.View):
|
||||
|
||||
@rest_utils.ajax()
|
||||
def get(self, request):
|
||||
search_opts = {'suppression': 'SUPPRESS_SHOW'}
|
||||
search_opts = {'suppression': 'SUPPRESS_SHOW', 'expand': True}
|
||||
|
||||
result, _more = fm.event_log_list(request, search_opts=search_opts)
|
||||
|
||||
return {'items': [sc.to_dict() for sc in result]}
|
||||
|
@ -49,7 +49,7 @@
|
||||
}
|
||||
|
||||
function getAlarms() {
|
||||
var results = apiService.get('/api/fm/alarm_list/?include_suppress=True')
|
||||
var results = apiService.get('/api/fm/alarm_list/')
|
||||
return results
|
||||
.error(function () {
|
||||
toastService.clearErrors();
|
||||
|
@ -68,8 +68,7 @@
|
||||
.tableColumns
|
||||
.append({
|
||||
id: 'alarm_id',
|
||||
priority: 1,
|
||||
urlFunction: service.urlFunction
|
||||
priority: 1
|
||||
})
|
||||
.append({
|
||||
id: 'reason_text',
|
||||
|
@ -1,5 +1,7 @@
|
||||
<hz-resource-property-list
|
||||
resource-type-name="OS::StarlingX::ActiveAlarms"
|
||||
item="item"
|
||||
property-groups="[['uuid', 'mgmt_affecting']]">
|
||||
property-groups="[['uuid', 'alarm_state', 'alarm_type', 'entity_type_id'],
|
||||
['service_affecting', 'mgmt_affecting', 'probable_cause'],
|
||||
['proposed_repair_action']]">
|
||||
</hz-resource-property-list>
|
||||
|
@ -1,64 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* Copyright (c) 2019 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @ngname horizon.dashboard.fault_management.events.details
|
||||
*
|
||||
* @description
|
||||
* Provides details features for Event.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.fault_management.events.details', [
|
||||
'horizon.app.core',
|
||||
'horizon.framework.conf'
|
||||
])
|
||||
.run(registerDetails);
|
||||
|
||||
registerDetails.$inject = [
|
||||
'horizon.app.core.openstack-service-api.fm',
|
||||
'horizon.dashboard.fault_management.events.basePath',
|
||||
'horizon.dashboard.fault_management.events.resourceType',
|
||||
'horizon.framework.conf.resource-type-registry.service'
|
||||
];
|
||||
|
||||
function registerDetails(
|
||||
api,
|
||||
basePath,
|
||||
resourceType,
|
||||
registry
|
||||
) {
|
||||
registry.getResourceType(resourceType)
|
||||
.setLoadFunction(loadFunction)
|
||||
.detailsViews.append({
|
||||
id: 'eventsDetailsOverview',
|
||||
name: gettext('Overview'),
|
||||
template: basePath + 'details/overview.html'
|
||||
});
|
||||
|
||||
|
||||
function loadFunction(uuid) {
|
||||
return api.getEvent(uuid);
|
||||
}
|
||||
}
|
||||
})();
|
@ -1,5 +1,8 @@
|
||||
<hz-resource-property-list
|
||||
resource-type-name="OS::StarlingX::Events"
|
||||
item="item"
|
||||
property-groups="[['uuid', 'event_type']]">
|
||||
property-groups="[['uuid', 'event_log_type', 'suppression'],
|
||||
['event_type', 'entity_type_id', 'service_affecting'],
|
||||
['probable_cause', 'proposed_repair_action']]">
|
||||
|
||||
</hz-resource-property-list>
|
||||
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* Copyright (c) 2019 Wind River Systems, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
angular
|
||||
.module('horizon.dashboard.fault_management.events')
|
||||
.controller('horizon.dashboard.fault_management.events.OverviewController', controller);
|
||||
|
||||
controller.$inject = [
|
||||
'$scope',
|
||||
'horizon.dashboard.fault_management.events.service'
|
||||
];
|
||||
|
||||
function controller(
|
||||
$scope, eventService
|
||||
) {
|
||||
var ctrl = this;
|
||||
ctrl.event = {};
|
||||
|
||||
$scope.context.loadPromise.then(onGetEvent);
|
||||
|
||||
function onGetEvent(item) {
|
||||
|
||||
eventService.setEventType(item.data);
|
||||
|
||||
ctrl.event = item.data;
|
||||
}
|
||||
}
|
||||
})();
|
@ -1,17 +0,0 @@
|
||||
<div ng-controller="horizon.dashboard.fault_management.events.OverviewController as ctrl">
|
||||
<div class="row">
|
||||
<div class="col-md-12 detail">
|
||||
<h3> {$ ctrl.event.state $} - {$ ctrl.event.event_log_id $} - {$ctrl.event.reason_text $} </h3>
|
||||
<hr>
|
||||
<hz-resource-property-list
|
||||
resource-type-name="OS::StarlingX::Events"
|
||||
cls="dl-horizontal"
|
||||
item="ctrl.event"
|
||||
property-groups="[['uuid', 'event_log_id', 'severity', 'state', 'event_log_type', 'timestamp',
|
||||
'suppression', 'entity_instance_id', 'entity_type_id',
|
||||
'probable_cause', 'proposed_repair_action', 'service_affecting',
|
||||
'reason_text', 'event_type']]">
|
||||
</hz-resource-property-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -30,8 +30,7 @@
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.fault_management.events', [
|
||||
'ngRoute',
|
||||
'horizon.dashboard.fault_management.events.details'
|
||||
'ngRoute'
|
||||
])
|
||||
.constant('horizon.dashboard.fault_management.events.resourceType', 'OS::StarlingX::Events')
|
||||
.run(run)
|
||||
@ -76,8 +75,7 @@
|
||||
})
|
||||
.append({
|
||||
id: 'event_log_id',
|
||||
priority: 1,
|
||||
urlFunction: service.urlFunction
|
||||
priority: 1
|
||||
})
|
||||
.append({
|
||||
id: 'reason_text',
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
service.$inject = [
|
||||
'$filter',
|
||||
'horizon.app.core.detailRoute',
|
||||
'horizon.app.core.openstack-service-api.fm',
|
||||
'$q',
|
||||
'horizon.framework.conf.resource-type-registry.service',
|
||||
@ -44,13 +43,12 @@
|
||||
* but do not need to be restricted to such use. Each exposed function
|
||||
* is documented below.
|
||||
*/
|
||||
function service($filter, detailRoute, api, $q, registry, resourceType) {
|
||||
function service($filter, api, $q, registry, resourceType) {
|
||||
|
||||
var showSuppressColumn = null;
|
||||
|
||||
return {
|
||||
getPromise: getPromise,
|
||||
urlFunction: urlFunction,
|
||||
suppressColAllowedPromiseFunction: suppressColAllowedPromiseFunction,
|
||||
getSuppressionList: getSuppressionList,
|
||||
setEventType: setEventType
|
||||
@ -83,10 +81,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
function urlFunction(item) {
|
||||
return detailRoute + 'OS::StarlingX::Events/' + item.uuid;
|
||||
}
|
||||
|
||||
function getSuppressionList() {
|
||||
var include_unsuppressed = false;
|
||||
return api.getEventsSuppression(include_unsuppressed).then(modifyResponseSupp);
|
||||
|
@ -46,14 +46,6 @@
|
||||
}));
|
||||
});
|
||||
|
||||
describe('urlFunction', function() {
|
||||
it("get url", inject(function($injector) {
|
||||
var detailRoute = $injector.get('horizon.app.core.detailRoute');
|
||||
var result = service.urlFunction({uuid:"123abc"});
|
||||
expect(result).toBe(detailRoute + "OS::StarlingX::Events/123abc");
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user