X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fcontrol%2Fcontrol.component.ts;fp=webapp-frontend%2Fsrc%2Fapp%2Fcontrol%2Fcontrol.component.ts;h=1520862014ac674268abd5aeb0459d3b6de6bc5e;hb=e2cbc4d0304646febf7e2cbe0dccdf9840189222;hp=0000000000000000000000000000000000000000;hpb=dcf725626b3f7c67dda3655da048370f00b75cc3;p=portal%2Fric-dashboard.git diff --git a/webapp-frontend/src/app/control/control.component.ts b/webapp-frontend/src/app/control/control.component.ts new file mode 100644 index 00000000..15208620 --- /dev/null +++ b/webapp-frontend/src/app/control/control.component.ts @@ -0,0 +1,93 @@ +/*- + * ========================LICENSE_START================================= + * ORAN-OSC + * %% + * Copyright (C) 2019 AT&T Intellectual Property and Nokia + * %% + * 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. + * ========================LICENSE_END=================================== + */ +import { Component, OnInit } from '@angular/core'; +import { LocalDataSource } from 'ng2-smart-table'; +import { ControlService } from '../services/control/control.service'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-control', + templateUrl: './control.component.html', + styleUrls: ['./control.component.css'] +}) +export class ControlComponent { + + settings = { + hideSubHeader: true, + actions: { + columnTitle: 'Actions', + add: false, + edit: false, + delete: false, + custom: [ + { name: 'view', title: 'view', }, + ], + position: 'right' + + }, + columns: { + id: { + title: 'ID', + type: 'number', + }, + xAppName: { + title: 'xApp Name', + type: 'string', + }, + xAppType: { + title: 'xApp Type', + type: 'string', + }, + podId: { + title: 'Pod ID', + type: 'number', + }, + k8Status: { + title: 'k8 Status', + type: 'string', + }, + age: { + title: 'Age', + type: 'string', + }, + }, + }; + + source: LocalDataSource = new LocalDataSource(); + + constructor(private service: ControlService, private router: Router) { + const data = this.service.getData(); + this.source.load(data); + } + + view(event): void { + const url = '/xapp'; + this.router.navigate([url, event]).then( (e) => { + if (e) { + console.log(event.data); + console.log('Navigation is successful!'); + } else { + console.log('Navigation has failed!'); + } + }); + } + + +}