You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by sa...@apache.org on 2019/08/16 14:09:07 UTC

[metron] branch feature/METRON-1856-parser-aggregation updated: METRON-2138 Code clean up (ruffle1986 via sardell) closes apache/metron#1429

This is an automated email from the ASF dual-hosted git repository.

sardell pushed a commit to branch feature/METRON-1856-parser-aggregation
in repository https://gitbox.apache.org/repos/asf/metron.git


The following commit(s) were added to refs/heads/feature/METRON-1856-parser-aggregation by this push:
     new a815a07  METRON-2138 Code clean up (ruffle1986 via sardell) closes apache/metron#1429
a815a07 is described below

commit a815a07cbeb4e817ca3cf6d05b06b0418a579c53
Author: ruffle1986 <ft...@gmail.com>
AuthorDate: Fri Aug 16 16:08:46 2019 +0200

    METRON-2138 Code clean up (ruffle1986 via sardell) closes apache/metron#1429
---
 .../parser.model.ts}                               | 16 ++++++-------
 .../sensor-parser-list.component.spec.ts           | 15 ------------
 .../sensor-parser-list.component.ts                |  4 ++++
 .../sensor-parser-throughput.pipe.ts               | 28 ----------------------
 4 files changed, 11 insertions(+), 52 deletions(-)

diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-latency.pipe.ts b/metron-interface/metron-config/src/app/sensors/models/parser.model.ts
similarity index 68%
rename from metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-latency.pipe.ts
rename to metron-interface/metron-config/src/app/sensors/models/parser.model.ts
index e54e3a3..bc02f0c 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-latency.pipe.ts
+++ b/metron-interface/metron-config/src/app/sensors/models/parser.model.ts
@@ -15,14 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { Pipe, PipeTransform } from '@angular/core';
-import { TopologyStatus } from '../../model/topology-status';
+export interface ParserModel {
+  group?: string,
 
-@Pipe({ name: 'latency' })
-export class SensorParserLatencyPipe implements PipeTransform {
-  transform(status: TopologyStatus): string {
-    return status && status.status === 'ACTIVE' && status.throughput != null
-      ? (status.latency + 'ms')
-      : '-';
-  }
+  setName(value: string)
+
+  getName(): string
+
+  getDescription(): string
 }
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.spec.ts
index 6c685d3..18292bd 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.spec.ts
@@ -544,21 +544,6 @@ describe('Component: SensorParserList', () => {
     let sensor: ParserMetaInfoModel = { config: sensorParserConfig1, status: new TopologyStatus() };
 
     sensor.status.status = 'KILLED';
-    expect(component.isStartable(sensor)).toBe(true);
-
-    sensor.status.status = 'ACTIVE';
-    expect(component.isStartable(sensor)).toBe(false);
-
-    sensor.status.status = 'INACTIVE';
-    expect(component.isStartable(sensor)).toBe(false);
-  }));
-
-  it('isEnableable() should return true only when a parser is ACTIVE', async(() => {
-    const component = Object.create( SensorParserListComponent.prototype );
-    const sensorParserConfig1 = new ParserConfigModel('TestConfigId01');
-    let sensor: ParserMetaInfoModel = { config: sensorParserConfig1, status: new TopologyStatus() };
-
-    sensor.status.status = 'KILLED';
     expect(component.isEnableable(sensor)).toBe(false);
 
     sensor.status.status = 'ACTIVE';
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.ts b/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.ts
index 1c7b345..604e55e 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-list.component.ts
@@ -220,6 +220,10 @@ export class SensorParserListComponent implements OnInit, OnDestroy {
     this.store.dispatch(new fromActions.DisableSensor({
       parser: sensor,
     }));
+
+    if (event !== null) {
+      event.stopPropagation();
+    }
   }
 
   onEnableSensors() {
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-throughput.pipe.ts b/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-throughput.pipe.ts
deleted file mode 100644
index b3f3cf0..0000000
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-list/sensor-parser-throughput.pipe.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 { Pipe, PipeTransform } from '@angular/core';
-import { TopologyStatus } from '../../model/topology-status';
-
-@Pipe({ name: 'throughput' })
-export class SensorParserThroughputPipe implements PipeTransform {
-  transform(status: TopologyStatus): string {
-    return status && status.status === 'ACTIVE' && status.throughput != null
-      ? (Math.round(status.throughput * 100) / 100) + 'kb/s'
-      : '-';
-  }
-}