From a85d5280af7c04207bfb725e4bae037ba0eac3bf Mon Sep 17 00:00:00 2001 From: zhangab Date: Thu, 8 Nov 2018 12:37:25 +0800 Subject: Fix VNF Alarm Query Bugs Change-Id: I8cc18d8f7bf02002d062e30aa5b5abd13743d6dd Issue-ID: USECASEUI-165 Signed-off-by: zhangab --- .../src/app/alarm/alarm.component.html | 14 ++--- usecaseui-portal/src/app/alarm/alarm.component.ts | 73 +++++++++++----------- .../app/components/details/details.component.ts | 31 +++------ 3 files changed, 53 insertions(+), 65 deletions(-) diff --git a/usecaseui-portal/src/app/alarm/alarm.component.html b/usecaseui-portal/src/app/alarm/alarm.component.html index b1f49949..894cdf5b 100644 --- a/usecaseui-portal/src/app/alarm/alarm.component.html +++ b/usecaseui-portal/src/app/alarm/alarm.component.html @@ -88,12 +88,12 @@ NO - Source Name + Source Name Priority - SpecificProblem - Report Time - Report Time - Status + SpecificProblem + Report Time + Clear Time + Status Action @@ -103,8 +103,8 @@ {{item.sourceName}} {{item.priority}} {{item.specificProblem}} - {{item.startEpochMicrosec}} - {{item.startEpochMicrosecCleared}} + {{item.startEpochMicrosec | date:'yyyy-MM-dd HH:mm:ss'}} + {{item.startEpochMicrosecCleared | date:'yyyy-MM-dd HH:mm:ss'}} {{item.status}} diff --git a/usecaseui-portal/src/app/alarm/alarm.component.ts b/usecaseui-portal/src/app/alarm/alarm.component.ts index e9f7cbdd..9fe870bb 100644 --- a/usecaseui-portal/src/app/alarm/alarm.component.ts +++ b/usecaseui-portal/src/app/alarm/alarm.component.ts @@ -33,8 +33,8 @@ export class AlarmComponent implements OnInit { public pageSize: number = 10; public sourceName: string = ''; public priority: string = ''; - public startTime: string = ''; - public endTime: string = ''; + public startTime: string = this.myhttp.dateformater(Date.now() - 30 * 24 * 60 * 60 * 1000); + public endTime: string = this.datePipe.transform(new Date(), 'yyyy-MM-dd HH:mm:ss'); public vfStatus: string = ''; public sourceNameList: Array = ['---auto---']; list: any; @@ -94,31 +94,29 @@ export class AlarmComponent implements OnInit { // Date screening dateRange = [(new Date(), -30), new Date()]; - onChange(result: Date): void { - this.startTime = this.datePipe.transform(result[0], 'yyyy-MM-dd-HH:mm:ss'); - this.endTime = this.datePipe.transform(result[1], 'yyyy-MM-dd-HH:mm:ss'); + this.startTime = this.datePipe.transform(result[0], 'yyyy-MM-dd HH:mm:ss'); + this.endTime = this.datePipe.transform(result[1], 'yyyy-MM-dd HH:mm:ss'); } - - sort(e) { + sort(e){ } // total alarmList = { - all: 200, + all: 0, closed: 0, activeNum: 0 } // total data - // getstatuscount(){ - // this.myhttp.getstatuscount().subscribe((data)=>{ - // this.alarmList.activeNum = data[0]; - // this.alarmList.closed = data[1]; + getstatuscount() { + this.myhttp.getstatuscount().subscribe((data) => { + this.alarmList.activeNum = data[0]; + this.alarmList.closed = data[1]; + this.alarmList.all = (data[0] - 0) + (data[1] - 0); - // }) - // } + }) + } getAlarmFormData() { - this.myhttp.getAlarmFormData(this.currentPage, this.pageSize, this.sourceName, this.priority, this.startTime, this.endTime, this.vfStatus).subscribe((data) => { this.list = data.alarms; }) @@ -126,15 +124,16 @@ export class AlarmComponent implements OnInit { } getAlarmChartData(event) { let paramsObj = { - alarmSourceName: this.sourceName, + sourceName: this.sourceName, startTime: this.startTime, - endTime: this.endTime + endTime: this.endTime, + format: 'day' } this.myhttp.getHomeAlarmChartData(paramsObj) .subscribe((data) => { this.alarmChartData = { - xAxis:{ - data:data.dataList + xAxis: { + data: data.dateList }, series: [ { data: data.allList }, @@ -149,14 +148,16 @@ export class AlarmComponent implements OnInit { // day alarmchartdata day() { let paramsObj = { - alarmSourceName: this.sourceName, - day: "day" + sourceName: this.sourceName, + startTime: this.startTime, + endTime: this.endTime, + format: "day" } this.myhttp.getHomeAlarmChartData(paramsObj) .subscribe((data) => { this.alarmChartData = { - xAxis:{ - data:data.dataList + xAxis: { + data: data.dateList }, series: [ { data: data.allList }, @@ -170,14 +171,16 @@ export class AlarmComponent implements OnInit { } month() { let paramsObj = { - alarmSourceName: this.sourceName, - day: "month" + sourceName: this.sourceName, + startTime: this.startTime, + endTime: this.endTime, + format: "month" } this.myhttp.getHomeAlarmChartData(paramsObj) .subscribe((data) => { this.alarmChartData = { - xAxis:{ - data:data.dataList + xAxis: { + data: data.dateList }, series: [ { data: data.allList }, @@ -211,10 +214,8 @@ export class AlarmComponent implements OnInit { end: 40 } ], - xAxis:{ - data:["2018-09-10 ","2018-09-11","2018-09-12","2018-09-13","2018-09-14", - "2018-09-15","2018-09-16","2018-09-17","2018-09-18","2018-09-19", - "2018-09-20","2018-09-21","2018-09-22","2018-09-10 ","2018-09-11","2018-09-12","2018-09-13"] + xAxis: { + data: [] }, series: [ { @@ -226,7 +227,7 @@ export class AlarmComponent implements OnInit { opacity: 0.8 }, //timeframe_one - data: [40, 45, 38, 52, 64, 58, 69, 87, 76, 33, 64, 87, 45, 76, 88, 56, 33, 76, 45, 65, 38, 52, 64, 58, 69, 87, 76, 33, 64, 87, 40, 45, 38, 52, 64, 58, 69, 87, 76, 40, 45, 38, 52, 64, 58, 69, 87, 76], + data: [], itemStyle: { color: "#526b75" }, @@ -244,7 +245,7 @@ export class AlarmComponent implements OnInit { opacity: 0.8 }, //timeframe_two - data: [32, 43, 23, 45, 63, 24, 54, 22, 32, 42, 42, 22, 23, 43, 32, 34, 42, 33, 42, 12, 32, 43, 23, 45, 63, 24, 54, 22, 32, 42, 42, 22, 23, 43, 32, 34, 42, 33, 42, 12, 32, 43, 23, 45, 63, 24, 54, 22], + data: [], itemStyle: { color: "#fb6e6e" }, @@ -280,18 +281,16 @@ export class AlarmComponent implements OnInit { // Show hidden animation state = "show"; state2 = "hide"; - detailId: number; + detailId: string; detailShow(item) { this.state = 'hide'; this.state2 = 'show'; this.detailshow = true; - // console.log(item); - this.detailId = item.eventId; + this.detailId = item.id; } detailHide() { this.state = 'show'; this.state2 = 'hide'; this.detailshow = false; } - } diff --git a/usecaseui-portal/src/app/components/details/details.component.ts b/usecaseui-portal/src/app/components/details/details.component.ts index 4965ed70..19da9e66 100644 --- a/usecaseui-portal/src/app/components/details/details.component.ts +++ b/usecaseui-portal/src/app/components/details/details.component.ts @@ -1,18 +1,3 @@ -/* - Copyright (C) 2018 CMCC, Inc. and others. All rights reserved. - - 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 { Component, OnInit, Input } from '@angular/core'; import { slideUpDown } from '../../animates'; import { MyhttpService } from '../../myhttp.service'; @@ -34,14 +19,18 @@ export class DetailsComponent implements OnInit { this.getAlarmDetailData(this.detailId); } - datailheaderdata: any = {}; + datailheaderdata: any = { + + }; dataillistdata: any = []; getAlarmDetailData(id){ - this.myhttp.getAlarmDetailData(id).subscribe((data)=>{ - // console.log(data) - this.datailheaderdata = data.alarmsHeader; - this.dataillistdata = data.list; - }) + if(id){ + this.myhttp.getAlarmDetailData(id).subscribe((data)=>{ + this.datailheaderdata = data.alarmsHeader; + this.dataillistdata = data.list; + }) + } + } // 详情显示 moredetailShow = false; -- cgit 1.2.3-korg