Fix VNF Alarm Query Bugs 36/72036/1
authorzhangab <zhanganbing@chinamobile.com>
Wed, 7 Nov 2018 04:32:58 +0000 (12:32 +0800)
committerzhangab <zhanganbing@chinamobile.com>
Wed, 7 Nov 2018 04:33:19 +0000 (12:33 +0800)
Change-Id: I52b95605d164d7d72ebfb60732c177bfb40eb200
Issue-ID: USECASEUI-165
Signed-off-by: zhangab <zhanganbing@chinamobile.com>
usecaseui-portal/src/app/alarm/alarm.component.html
usecaseui-portal/src/app/alarm/alarm.component.ts
usecaseui-portal/src/app/myhttp.service.ts

index 7fbbc03..b1f4994 100644 (file)
@@ -83,7 +83,7 @@
     <button class="open-close" [ngClass]="{'open-close-active':alarmShow}" (click)="alarmShow=!alarmShow"></button>
 </div>
 <div class="tablelist">
-    <nz-table #nzTable [nzData]="list" [nzPageSize]="10" nzShowSizeChanger nzShowQuickJumper [nzPageSizeOptions]="[5,10,15,20]"
+    <nz-table #nzTable [nzData]="list" [(nzPageSize)]="pageSize" nzShowSizeChanger nzShowQuickJumper [nzPageSizeOptions]="[5,10,15,20]"
         nzSize="middle">
         <thead (nzSortChange)="sort($event)" nzSingleSort>
             <tr>
@@ -92,6 +92,7 @@
                 <th nzWidth="10%">Priority</th>
                 <th nzWidth="20%">SpecificProblem</th>
                 <th nzWidth="20%">Report Time</th>
+                <th nzWidth="20%">Report Time</th>
                 <th nzWidth="15%">Status</th>
                 <th nzWidth="10%">Action</th>
             </tr>
                 <td>{{item.sourceName}}</td>
                 <td>{{item.priority}}</td>
                 <td>{{item.specificProblem}}</td>
-                <td>{{item.sequence}}</td>
+                <td>{{item.startEpochMicrosec}}</td>
+                <td>{{item.startEpochMicrosecCleared}}</td>
                 <td>{{item.status}}</td>
                 <td class="action"><a (click)="detailShow(item)"><i class="details"></i></a></td>
             </tr>
index 58c75e7..e9f7cbd 100644 (file)
@@ -30,17 +30,15 @@ export class AlarmComponent implements OnInit {
   size = 'day';
   @HostBinding('@routerAnimate') routerAnimateState; //Routing animation
   public currentPage: number = 1;
-  public pageSize: number = 5;
+  public pageSize: number = 10;
   public sourceName: string = '';
   public priority: string = '';
   public startTime: string = '';
   public endTime: string = '';
   public vfStatus: string = '';
-  public sourceNameList:Array<any> =['---auto---'];
+  public sourceNameList: Array<any> = ['---auto---'];
   list: any;
   sourcenames: any;
-
-
   constructor(
     private datePipe: DatePipe,
     private myhttp: MyhttpService) { }
@@ -61,33 +59,33 @@ export class AlarmComponent implements OnInit {
   statusSelected = this.statusList[0];
 
   choseSourceName(item) {
-    if(item == "---auto---"){
+    if (item == "---auto---") {
       this.sourceName = '';
-    }else{
+    } else {
       this.sourceName = item;
     }
     this.sourceNameSelected = item;
-    
+
   }
   chosePriority(item) {
     this.prioritySelected = item;
-    if(item == "---auto---"){
+    if (item == "---auto---") {
       this.priority = '';
-    }else{
+    } else {
       this.priority = item;
     }
   }
   choseStatus(item) {
     this.statusSelected = item;
-    if(item == "---auto---"){
+    if (item == "---auto---") {
       this.vfStatus = '';
-    }else{
+    } else {
       this.vfStatus = item;
     }
   }
   getSourceNames() {
     this.myhttp.getSourceNames().subscribe((data) => {
-      for(let i=0;i<data.length;i++){
+      for (let i = 0; i < data.length; i++) {
         this.sourceNameList.push(data[i]);
       }
       this.sourceNameSelected = this.sourceNameList[0];
@@ -112,15 +110,15 @@ export class AlarmComponent implements OnInit {
     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];
+
+  //   })
+  // }
+  getAlarmFormData() {
 
-    })
-  }
-  getAlarmFormData() { 
-     
     this.myhttp.getAlarmFormData(this.currentPage, this.pageSize, this.sourceName, this.priority, this.startTime, this.endTime, this.vfStatus).subscribe((data) => {
       this.list = data.alarms;
     })
@@ -138,10 +136,10 @@ export class AlarmComponent implements OnInit {
           xAxis:{
             data:data.dataList
           },
-          series:[
-            {data:data.allList},
-            {data:data.ActiveList},
-            {data:data.closedList}
+          series: [
+            { data: data.allList },
+            { data: data.ActiveList },
+            { data: data.closedList }
           ]
         }
       }, (err) => {
@@ -152,7 +150,7 @@ export class AlarmComponent implements OnInit {
   day() {
     let paramsObj = {
       alarmSourceName: this.sourceName,
-      day:"day"
+      day: "day"
     }
     this.myhttp.getHomeAlarmChartData(paramsObj)
       .subscribe((data) => {
@@ -160,10 +158,10 @@ export class AlarmComponent implements OnInit {
           xAxis:{
             data:data.dataList
           },
-          series:[
-            {data:data.allList},
-            {data:data.ActiveList},
-            {data:data.closedList}
+          series: [
+            { data: data.allList },
+            { data: data.ActiveList },
+            { data: data.closedList }
           ]
         }
       }, (err) => {
@@ -173,7 +171,7 @@ export class AlarmComponent implements OnInit {
   month() {
     let paramsObj = {
       alarmSourceName: this.sourceName,
-      day:"month"
+      day: "month"
     }
     this.myhttp.getHomeAlarmChartData(paramsObj)
       .subscribe((data) => {
@@ -181,10 +179,10 @@ export class AlarmComponent implements OnInit {
           xAxis:{
             data:data.dataList
           },
-          series:[
-            {data:data.allList},
-            {data:data.ActiveList},
-            {data:data.closedList}
+          series: [
+            { data: data.allList },
+            { data: data.ActiveList },
+            { data: data.closedList }
           ]
         }
       }, (err) => {
@@ -208,12 +206,16 @@ export class AlarmComponent implements OnInit {
         {
           type: 'slider',
           show: true,
-          // xAxisIndex: [0],
           start: 1,
           height: 10,
           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"]
+      },
       series: [
         {
           name: 'All',
@@ -236,7 +238,7 @@ export class AlarmComponent implements OnInit {
         {
           name: 'Active',
           type: 'line',
-          smooth: true,//将图变得平缓
+          smooth: true,//
           showSymbol: false,
           areaStyle: {
             opacity: 0.8
index 45cb895..0f5f224 100644 (file)
@@ -24,7 +24,7 @@ import { homeData, homeVmLineData, servicesSelectData, servicesTableData, create
 export class MyhttpService {
 
   constructor(private http: HttpClient) { }
-  
+
   // baseUrl = "./assets/json";
   // url={
   //   home_serviceData:this.baseUrl + "/home_serviceData.json",
@@ -64,23 +64,23 @@ export class MyhttpService {
 
   // baseUrl = 'http://172.19.44.223/api/usecaseui-server/v1';
   baseUrl = '/api/usecaseui-server/v1';
-  url={
-    home_serviceData:this.baseUrl + "/uui-lcm/serviceNumByCustomer",
-    home_performanceData:this.baseUrl + "/performance/queryAllSourceNames",
-    home_alarmData:this.baseUrl + "/alarm/statusCount",
-    home_alarmChartData:this.baseUrl + "/alarm/diagram",
-    sourceNames:this.baseUrl + "/alarm/getSourceNames",
-
-    customers:this.baseUrl + "/uui-lcm/customers",
-    serviceType:this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions",
-    servicesTableData:this.baseUrl + '/uui-sotn/getServiceInstanceList',
-    serviceTemplates:this.baseUrl + "/uui-lcm/service-templates",
-    templateParameters:this.baseUrl + "/uui-lcm/service-templates/" + "*_*" +"?toscaModelPath=",
-    nstemplateParameters:this.baseUrl + "/uui-lcm/fetchNsTemplateData",
-    vimInfo:this.baseUrl + "/uui-lcm/locations/",
-    sdnControllers:this.baseUrl + "/uui-lcm/sdnc-controllers/",
+  url = {
+    home_serviceData: this.baseUrl + "/uui-lcm/serviceNumByCustomer",
+    home_performanceData: this.baseUrl + "/performance/queryAllSourceNames",
+    home_alarmData: this.baseUrl + "/alarm/statusCount",
+    home_alarmChartData: this.baseUrl + "/alarm/diagram",
+    sourceNames: this.baseUrl + "/alarm/getSourceNames",
+
+    customers: this.baseUrl + "/uui-lcm/customers",
+    serviceType: this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions",
+    servicesTableData: this.baseUrl + '/uui-sotn/getServiceInstanceList',
+    serviceTemplates: this.baseUrl + "/uui-lcm/service-templates",
+    templateParameters: this.baseUrl + "/uui-lcm/service-templates/" + "*_*" + "?toscaModelPath=",
+    nstemplateParameters: this.baseUrl + "/uui-lcm/fetchNsTemplateData",
+    vimInfo: this.baseUrl + "/uui-lcm/locations/",
+    sdnControllers: this.baseUrl + "/uui-lcm/sdnc-controllers/",
     addressData: this.baseUrl + "/uui-sotn/getOssInvenory",
-    createService:this.baseUrl + "/uui-lcm/services",
+    createService: this.baseUrl + "/uui-lcm/services",
     ns_createService: this.baseUrl + "/uui-lcm/createNetworkServiceInstance",
     ns_createService2: this.baseUrl + "/uui-lcm/instantiateNetworkServiceInstance",
     inputNamesTransform: "./assets/json/configuration_files/inputNamesTranslate.json?",
@@ -89,56 +89,56 @@ export class MyhttpService {
     ns_stopService: this.baseUrl + "/uui-lcm/terminateNetworkServiceInstance?ns_instance_id=",
     ns_healService: this.baseUrl + "/uui-lcm/healNetworkServiceInstance?ns_instance_id=",
     vnfInfo: this.baseUrl + "/uui-lcm/VnfInfo/",
-    progress:this.baseUrl + "/uui-lcm/services/" + "*_*" + "/operations/",
-    nsProgress:this.baseUrl + "/uui-lcm/jobs/getNsLcmJobStatus/"+ "*_*" + "?responseId=",
+    progress: this.baseUrl + "/uui-lcm/services/" + "*_*" + "/operations/",
+    nsProgress: this.baseUrl + "/uui-lcm/jobs/getNsLcmJobStatus/" + "*_*" + "?responseId=",
     e2eScale: this.baseUrl + "/services/scaleServices/",
     e2e_nsdata: this.baseUrl + "/getServiceInstanceById/customerId/",
 
-    allottedResource:this.baseUrl + "/uui-sotn/getAllottedResources",
-    pnfDetail:this.baseUrl + "/uui-sotn/getPnfInfo/",
-    connectivity:this.baseUrl + "/uui-sotn/getConnectivityInfo/",
-    vpnBinding:this.baseUrl + "/uui-sotn/getPinterfaceByVpnId/",
+    allottedResource: this.baseUrl + "/uui-sotn/getAllottedResources",
+    pnfDetail: this.baseUrl + "/uui-sotn/getPnfInfo/",
+    connectivity: this.baseUrl + "/uui-sotn/getConnectivityInfo/",
+    vpnBinding: this.baseUrl + "/uui-sotn/getPinterfaceByVpnId/",
   }
 
   // home
-  getHomeServiceData(){
+  getHomeServiceData() {
     return this.http.get<any>(this.url.home_serviceData);
   }
-  getHomePerformanceData(){
+  getHomePerformanceData() {
     return this.http.get<String[]>(this.url.home_performanceData);
   }
-  getHomeAlarmData(){
+  getHomeAlarmData() {
     return this.http.get<any>(this.url.home_alarmData);
   }
-  getHomeAlarmChartData(paramsObj){
-    let params = new HttpParams({fromObject:paramsObj});
-    return this.http.get<any>(this.url.home_alarmChartData,{params});
+  getHomeAlarmChartData(paramsObj) {
+    let params = new HttpParams({ fromObject: paramsObj });
+    return this.http.get<any>(this.url.home_alarmChartData, { params });
   }
 
   // serviceTable list
-  getServicesTableData(paramsObj):Observable<HttpResponse<servicesTableData>>{
-    let params = new HttpParams({fromObject:paramsObj});
-    return this.http.get<servicesTableData>(this.url.servicesTableData,{observe:'response',params});
+  getServicesTableData(paramsObj): Observable<HttpResponse<servicesTableData>> {
+    let params = new HttpParams({ fromObject: paramsObj });
+    return this.http.get<servicesTableData>(this.url.servicesTableData, { observe: 'response', params });
   }
 
   //---------------------------------------------------------------------------------
 
   // Get all customers
-  getAllCustomers(){
+  getAllCustomers() {
     return this.http.get<any>(this.url.customers);
   }
 
   // Get relevant serviceType
-  getServiceTypes(customer){
-    let url = this.url.serviceType.replace("*_*",customer.id);
+  getServiceTypes(customer) {
+    let url = this.url.serviceType.replace("*_*", customer.id);
     return this.http.get<any>(url);
   }
 
 
   // Get all template types
-  getAllServiceTemplates(type){
-    if(type=="Network Service"){
-      let nsUrl = this.url.serviceTemplates.replace("service-templates","listNsTemplates").replace("serviceTemplates2","serviceTemplates-ns");
+  getAllServiceTemplates(type) {
+    if (type == "Network Service") {
+      let nsUrl = this.url.serviceTemplates.replace("service-templates", "listNsTemplates").replace("serviceTemplates2", "serviceTemplates-ns");
       console.log(nsUrl);
       return this.http.get<any>(nsUrl);
     }
@@ -147,58 +147,58 @@ export class MyhttpService {
 
 
   //Get template input parameters
-  getTemplateParameters(type,template){
+  getTemplateParameters(type, template) {
     // let url = this.url.templateParameters.replace("*_*",type) + template.toscaModelURL;  //Local simulation
-    if(type == "ns"){
+    if (type == "ns") {
       let body = {
-        csarId:template.id,
-        inputs:""
-      } 
-      return this.http.post<any>(this.url.nstemplateParameters,body);
+        csarId: template.id,
+        inputs: ""
+      }
+      return this.http.post<any>(this.url.nstemplateParameters, body);
     }
-    let url = this.url.templateParameters.replace("*_*",template.uuid) + template.toscaModelURL;
+    let url = this.url.templateParameters.replace("*_*", template.uuid) + template.toscaModelURL;
     return this.http.get<any>(url);
   }
   // siteAddress address
-  getSiteAddress(){
+  getSiteAddress() {
     return this.http.get<any>(this.url.addressData);
   }
 
   getVimInfo() {
     return this.http.get<any>(this.url.vimInfo);
   };
-  getSdnControllers(){
+  getSdnControllers() {
     return this.http.get<any>(this.url.sdnControllers);
   }
 
   // Create interface
-  createInstance(requestBody,createParams){
+  createInstance(requestBody, createParams) {
     // return this.http.get<any>(this.url.createService + createParams);  //Local simulation
-    return this.http.post<any>(this.url.createService,requestBody);
+    return this.http.post<any>(this.url.createService, requestBody);
   }
-  nsCreateInstance(requestBody){
+  nsCreateInstance(requestBody) {
     // return this.http.get<any>(this.url.ns_createService);  //Local simulation
-    return this.http.post<any>(this.url.ns_createService,requestBody);
+    return this.http.post<any>(this.url.ns_createService, requestBody);
   }
-  nsCreateInstance2(params,requestBody){
+  nsCreateInstance2(params, requestBody) {
     // return this.http.get<any>(this.url.ns_createService2 + params);  //Local simulation
-    return this.http.post<any>(this.url.ns_createService + params,requestBody);
+    return this.http.post<any>(this.url.ns_createService + params, requestBody);
   }
 
   // Input parameter name conversion
-  inputNamesTransform(){
+  inputNamesTransform() {
     return this.http.get(this.url.inputNamesTransform);
   }
 
   // Delete interface
-  deleteInstance(obj){
+  deleteInstance(obj) {
     let httpOptions = {
       headers: new HttpHeaders({
-        'Content-Type':  'application/json',
-        'Accept':'application/json',
-        'Authorization':'Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=='
+        'Content-Type': 'application/json',
+        'Accept': 'application/json',
+        'Authorization': 'Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=='
       }),
-      body:{
+      body: {
         'globalSubscriberId': obj.globalSubscriberId,
         'serviceType': obj.serviceType
       }
@@ -206,70 +206,70 @@ export class MyhttpService {
     // return this.http.get<any>(this.url.deleteService);  //Local simulation
     return this.http.delete<any>(this.url.deleteService + obj.serviceInstanceId, httpOptions);
   }
-  nsDeleteInstance(id){
+  nsDeleteInstance(id) {
     // return this.http.get<any>(this.url.ns_deleteService);  //Local simulation
     return this.http.delete<any>(this.url.ns_deleteService + id);
   }
-  stopNsService(id,requestBody){  //You need to terminate before deleting
+  stopNsService(id, requestBody) {  //You need to terminate before deleting
     // return this.http.get<any>(this.url.ns_stopService);  //Local simulation
-    return this.http.post<any>(this.url.ns_stopService + id,requestBody);
+    return this.http.post<any>(this.url.ns_stopService + id, requestBody);
   }
 
-  getVnfInfo(id){
+  getVnfInfo(id) {
     return this.http.get<any>(this.url.vnfInfo + id)
   }
-  healNsService(id,requestBody){
+  healNsService(id, requestBody) {
     // return this.http.get<any>(this.url.ns_healService);  //Local simulation
-    return this.http.post<any>(this.url.ns_healService + id,requestBody);
+    return this.http.post<any>(this.url.ns_healService + id, requestBody);
   }
 
   // scale
-  scaleE2eService(id,requestBody){
+  scaleE2eService(id, requestBody) {
     // return this.http.get<any>(this.url.e2eScale + id);  
-    return this.http.post<any>(this.url.e2eScale + id,requestBody);
+    return this.http.post<any>(this.url.e2eScale + id, requestBody);
   }
-  getE2e_nsData(paramsObj){
-    let params = new HttpParams({fromObject:paramsObj});
-    return this.http.get<any>(this.url.e2e_nsdata,{params});
+  getE2e_nsData(paramsObj) {
+    let params = new HttpParams({ fromObject: paramsObj });
+    return this.http.get<any>(this.url.e2e_nsdata, { params });
   }
 
   // Query progress interface
-  getProgress(obj){
-    let url = this.url.progress.replace("*_*",obj.serviceId) + obj.operationId;
+  getProgress(obj) {
+    let url = this.url.progress.replace("*_*", obj.serviceId) + obj.operationId;
     return this.http.get<any>(url);
   }
-  getNsProgress(jobid,responseId){
-    let url = this.url.nsProgress.replace("*_*",jobid) + responseId;
+  getNsProgress(jobid, responseId) {
+    let url = this.url.nsProgress.replace("*_*", jobid) + responseId;
     return this.http.get<any>(url);
   }
 
   // Get allotted-resource to get tp and pnf values
-  getAllottedResource(obj){
-    let params = new HttpParams({fromObject:obj});
+  getAllottedResource(obj) {
+    let params = new HttpParams({ fromObject: obj });
     let url = this.url.allottedResource;
-    return this.http.get<any>(url,{params});
+    return this.http.get<any>(url, { params });
   }
   //Get the corresponding domain (network-resource) by pnf value
-  getPnfDetail(name){
+  getPnfDetail(name) {
     let url = this.url.pnfDetail + name;
     return this.http.get<any>(url);
   }
   //Get connectivity by sotn, find vpn-id
-  getSotnConnectivity(id){
+  getSotnConnectivity(id) {
     let url = this.url.connectivity + id;
     return this.http.get<any>(url);
   }
   //Find tp and pnf by vpn-id
-  getVpnBinding(id){
+  getVpnBinding(id) {
     let url = this.url.vpnBinding + id;
     return this.http.get<any>(url);
   }
   // Time formatting milliseconds to normal
-  dateformater(vmstime){
-    if(!vmstime){
-        return ''
+  dateformater(vmstime) {
+    if (!vmstime) {
+      return ''
     }
-    let mstime = Number((vmstime + '').slice(0,13));  
+    let mstime = Number((vmstime + '').slice(0, 13));
     let time = new Date(mstime);
     let year = time.getFullYear();
     let month = time.getMonth() + 1;
@@ -281,21 +281,35 @@ export class MyhttpService {
     return formattime;
   }
 
- getAlarmFormData(currentPage:number,pageSize:number,sourceName?:string,priority?:string,startTime?:string,endTime?:string,vfStatus?:string){
-    return this.http.get<any>('/api/usecaseui-server/v1/alarm/'+'/'+currentPage+'/'+pageSize+'/'+sourceName+'/'+priority+'/'+startTime+'/'+endTime+'/'+vfStatus);
-    }
 
-  getSourceNames(){
+// alarm data
+  getAlarmFormData(currentPage: number, pageSize: number, sourceName?: string, priority?: string, startTime?: string, endTime?: string, vfStatus?: string) {
+    return this.http.get<any>('/api/usecaseui-server/v1/alarm/' + '/' + currentPage + '/' + pageSize + '/' + sourceName + '/' + priority + '/' + startTime + '/' + endTime + '/' + vfStatus);
+  }
+
+  getSourceNames() {
     return this.http.get<any>('/api/usecaseui-server/v1/alarm/getSourceNames/');
-  }  
+  }
 
-  getstatuscount(){
+  getstatuscount() {
     let httpurl = '/api/usecaseui-server/v1/alarm/statusCount';
     return this.http.get<any>(httpurl);
   }
-  getAlarmDetailData(id){
-    let httpurl = '/api/usecaseui-server/v1/alarm/getAlarmsHeaderDetail/'+id;
-    console.log(httpurl)
+  getAlarmDetailData(id) {
+    let httpurl = '/api/usecaseui-server/v1/alarm/getAlarmsHeaderDetail/' + id;
     return this.http.get<any>(httpurl);
   }
+
+  // performancevnf data
+  getqueryAllSourceNames() {
+    let httpurl = this.baseUrl + "/api/usecaseui-server/v1/performance/queryAllSourceNames";
+    return this.http.get<any>(httpurl);
+  }
+  getperformanceSsourceNames(currentPage: number, pageSize: number, sourceName: string) {
+    let httpurl = this.baseUrl + "/api/usecaseui-server/v1/performanceSsourceNames" + "/" + currentPage + "/" + pageSize + "/" + sourceName;
+    return this.http.get<any>(httpurl);
+  }
+  getPerformanceFormData(currentPage: number, pageSize: number, sourceName?: string, startTime?: string, endTime?: string) {
+    return this.http.get<any>('/api/usecaseui-server/v1/performance' + '/' + currentPage + '/' + pageSize + '/' + sourceName + '/' + startTime + '/' + endTime);
+  }
 }