Re: [PR] [NIFI-12437] - Summary [nifi]

2023-12-15 Thread via GitHub


mcgilman merged PR #8143:
URL: https://github.com/apache/nifi/pull/8143


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12437] - Summary [nifi]

2023-12-14 Thread via GitHub


mcgilman commented on code in PR #8143:
URL: https://github.com/apache/nifi/pull/8143#discussion_r1427086417


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/status-history/status-history.component.html:
##
@@ -0,0 +1,157 @@
+
+
+
+Status History
+
+
+
+
+
+
+
+
+
+
+
+
+{{ entry[0] }}
+{{ entry[1] 
}}
+
+
+Start
+{{ minDate 
}}
+
+
+End
+{{ maxDate 
}}
+
+
+NiFi
+
+Min / Max / Mean
+
+{{ clusterStats.min }} / 
{{ clusterStats.max }} /
+{{ clusterStats.mean }}
+
+
+
+
+NiFi
+
+
+
+Nodes
+
+Min / Max / Mean
+
+{{ nodeStats.min }} / {{ 
nodeStats.max }} / {{ nodeStats.mean }}
+
+
+
+
+
+
+{{ node.label 
}}
+
+
+
+
+
+
+
+
+
+
+
+{{ descriptor.label }}
+
+
+
+
+{{ descriptor.label }}
+
+
+
+
+
+
+
+
+
+
+
+
+

Review Comment:
   Are these still needed?



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/nifi-common.service.ts:
##
@@ -316,4 +327,65 @@ export class NiFiCommon {
 return time;
 }
 }
+
+/**
+ * Formats the specified number of bytes into a human readable string.
+ *
+ * @param {number} dataSize
+ * @returns {string}
+ */
+public formatDataSize(dataSize: number): string {
+let dataSizeToFormat: number = parseFloat(`${dataSize / 
NiFiCommon.BYTES_IN_TERABYTE}`);
+if (dataSizeToFormat > 1) {
+return dataSizeToFormat.toFixed(2) + ' TB';
+}
+
+// check gigabytes
+

Re: [PR] [NIFI-12437] - Summary [nifi]

2023-12-14 Thread via GitHub


rfellows commented on code in PR #8143:
URL: https://github.com/apache/nifi/pull/8143#discussion_r1426755657


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/status-history/status-history-chart/status-history-chart.component.ts:
##
@@ -0,0 +1,680 @@
+/*
+ *  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 { Component, EventEmitter, Input, Output } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FieldDescriptor } from '../../../../state/status-history';
+import * as d3 from 'd3';
+import { NiFiCommon } from '../../../../service/nifi-common.service';
+import { Instance, NIFI_NODE_CONFIG, Stats, VisibleInstances } from '../index';
+import { debounceTime, Subject } from 'rxjs';
+
+@Component({
+selector: 'status-history-chart',
+standalone: true,
+imports: [CommonModule],
+templateUrl: './status-history-chart.component.html',
+styleUrls: ['./status-history-chart.component.scss']
+})
+export class StatusHistoryChart {
+private svg: any;
+private _instances!: Instance[];
+private _selectedDescriptor: FieldDescriptor | null = null;
+private _visibleInstances: VisibleInstances = {};
+
+@Input() set instances(nodeInstances: Instance[]) {
+this._instances = nodeInstances;
+if (this._selectedDescriptor) {
+this.updateChart(this._selectedDescriptor);
+}
+}
+
+get instances(): Instance[] {
+return this._instances;
+}
+
+@Input() set selectedFieldDescriptor(selected: FieldDescriptor | null) {
+if (this._selectedDescriptor !== selected) {
+// clear the brush selection when the data is changed to view a 
different descriptor
+this.brushSelection = null;
+this._selectedDescriptor = selected;
+if (selected) {
+this.updateChart(selected);
+}
+}
+}
+
+get selectedFieldDescriptor(): FieldDescriptor | null {
+return this._selectedDescriptor;
+}
+
+@Input() set visibleInstances(visibleInstances: VisibleInstances) {
+this._visibleInstances = visibleInstances;
+if (this._selectedDescriptor) {
+this.updateChart(this._selectedDescriptor);
+}
+}
+
+get visibleInstances(): VisibleInstances {
+return this._visibleInstances;
+}
+
+@Output() nodeStats: EventEmitter = new EventEmitter();
+@Output() clusterStats: EventEmitter = new EventEmitter();
+
+private nodeStats$: Subject = new Subject();
+private clusterStats$: Subject = new Subject();
+
+nodes: any[] = [];
+
+constructor(private nifiCommon: NiFiCommon) {
+// don't need constantly fire the stats changing as a result of brush 
drag/move
+this.nodeStats$.pipe(debounceTime(20)).subscribe((stats: Stats) => {
+this.nodeStats.next(stats);
+});
+
+this.clusterStats$.pipe(debounceTime(20)).subscribe((stats: Stats) => {
+this.clusterStats.next(stats);
+});
+}
+
+private formatters: any = {
+DURATION: (d: number) => {
+return this.nifiCommon.formatDuration(d);
+},
+COUNT: (d: number) => {
+// need to handle floating point number since this formatter
+// will also be used for average values
+if (d % 1 === 0) {
+return this.nifiCommon.formatInteger(d);
+} else {
+return this.nifiCommon.formatFloat(d);
+}
+},
+DATA_SIZE: (d: number) => {
+return this.nifiCommon.formatDataSize(d);
+},
+FRACTION: (d: number) => {
+return this.nifiCommon.formatFloat(d / 100);
+}
+};
+private brushSelection: any = null;
+
+// private selectedDescriptor: FieldDescriptor | null = null;
+private updateChart(selectedDescriptor: FieldDescriptor) {
+const margin = {
+top: 15,
+right: 20,
+bottom: 25,
+left: 75
+};
+
+// -
+// prep the data
+// -
+
+

Re: [PR] [NIFI-12437] - Summary [nifi]

2023-12-14 Thread via GitHub


rfellows commented on code in PR #8143:
URL: https://github.com/apache/nifi/pull/8143#discussion_r1426746316


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/nifi-common.service.ts:
##
@@ -171,4 +187,230 @@ export class NiFiCommon {
 }
 return NiFiCommon.LEAD_TRAIL_WHITE_SPACE_REGEX.test(value);
 }
+
+/**
+ * Pads the specified value to the specified width with the specified 
character.
+ * If the specified value is already wider than the specified width, the 
original
+ * value is returned.
+ *
+ * @param {integer} value
+ * @param {integer} width
+ * @param {string} character
+ * @returns {string}
+ */
+pad(value: number, width: number, character: string): string {
+let s: string = value + '';
+
+// pad until wide enough
+while (s.length < width) {
+s = character + s;
+}
+
+return s;
+}
+
+/**
+ * Formats the specified DateTime.
+ *
+ * @param {Date} date
+ * @returns {String}
+ */
+formatDateTime(date: Date): string {
+return (
+this.pad(date.getMonth() + 1, 2, '0') +
+'/' +
+this.pad(date.getDate(), 2, '0') +
+'/' +
+this.pad(date.getFullYear(), 2, '0') +
+' ' +
+this.pad(date.getHours(), 2, '0') +
+':' +
+this.pad(date.getMinutes(), 2, '0') +
+':' +
+this.pad(date.getSeconds(), 2, '0') +
+'.' +
+this.pad(date.getMilliseconds(), 3, '0')
+);
+}
+
+/**
+ * Parses the specified date time into a Date object. The resulting
+ * object does not account for timezone and should only be used for
+ * performing relative comparisons.
+ *
+ * @param {string} rawDateTime
+ * @returns {Date}
+ */
+parseDateTime(rawDateTime: string): Date {
+// handle non date values
+if (!rawDateTime) {
+return new Date();
+}
+
+// parse the date time
+const dateTime: string[] = rawDateTime.split(/ /);
+
+// ensure the correct number of tokens
+if (dateTime.length !== 3) {
+return new Date();
+}
+
+// get the date and time
+const date: string[] = dateTime[0].split(/\//);
+const time: string[] = dateTime[1].split(/:/);
+
+// ensure the correct number of tokens
+if (date.length !== 3 || time.length !== 3) {
+return new Date();
+}
+const year: number = parseInt(date[2], 10);
+const month: number = parseInt(date[0], 10) - 1; // new Date() accepts 
months 0 - 11
+const day: number = parseInt(date[1], 10);
+const hours: number = parseInt(time[0], 10);
+const minutes: number = parseInt(time[1], 10);
+
+// detect if there is millis
+const secondsSpec: string[] = time[2].split(/\./);
+const seconds: number = parseInt(secondsSpec[0], 10);
+let milliseconds: number = 0;
+if (secondsSpec.length === 2) {
+milliseconds = parseInt(secondsSpec[1], 10);
+}
+return new Date(year, month, day, hours, minutes, seconds, 
milliseconds);
+}
+
+/**
+ * Formats the specified duration.
+ *
+ * @param {integer} duration in millis
+ */
+public formatDuration(duration: number): string {
+// don't support sub millisecond resolution
+duration = duration < 1 ? 0 : duration;
+
+// determine the number of days in the specified duration
+let days: number = duration / NiFiCommon.MILLIS_PER_DAY;
+days = days >= 1 ? parseInt(`${days}`, 10) : 0;
+duration %= NiFiCommon.MILLIS_PER_DAY;
+
+// remaining duration should be less than 1 day, get number of hours
+let hours = duration / NiFiCommon.MILLIS_PER_HOUR;
+hours = hours >= 1 ? parseInt(`${hours}`, 10) : 0;
+duration %= NiFiCommon.MILLIS_PER_HOUR;
+
+// remaining duration should be less than 1 hour, get number of minutes
+let minutes = duration / NiFiCommon.MILLIS_PER_MINUTE;
+minutes = minutes >= 1 ? parseInt(`${minutes}`, 10) : 0;
+duration %= NiFiCommon.MILLIS_PER_MINUTE;
+
+// remaining duration should be less than 1 minute, get number of 
seconds
+let seconds = duration / NiFiCommon.MILLIS_PER_SECOND;
+seconds = seconds >= 1 ? parseInt(`${seconds}`, 10) : 0;
+
+// remaining duration is the number millis (don't support sub 
millisecond resolution)
+duration = Math.floor(duration % NiFiCommon.MILLIS_PER_SECOND);
+
+// format the time
+const time =
+this.pad(hours, 2, '0') +
+':' +
+this.pad(minutes, 2, '0') +
+':' +
+this.pad(seconds, 2, '0') +
+'.' +
+

Re: [PR] [NIFI-12437] - Summary [nifi]

2023-12-11 Thread via GitHub


mcgilman commented on code in PR #8143:
URL: https://github.com/apache/nifi/pull/8143#discussion_r1423253506


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/summary/ui/connection-status-listing/connection-status-listing.component.spec.ts:
##
@@ -0,0 +1,38 @@
+/*
+ *  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 { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ConnectionStatusListing } from 
'./connection-status-listing.component';
+
+describe('ConnectionStatusListingComponent', () => {

Review Comment:
   This string does not align with the current component name.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/summary/ui/processor-status-listing/processor-status-table/processor-status-table.component.html:
##
@@ -0,0 +1,231 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Name
+
+{{ formatName(item) }}
+
+
+
+
+
+Type
+
+{{ formatType(item) }}
+
+
+
+
+
+Process Group
+
+{{ formatProcessGroup(item) }}
+
+
+
+
+
+Run 
Status
+
+
+
+{{ formatRunStatus(item) }}
+
+
+
+({{ pg.activeThreadCount }}/{{ 
pg.terminatedThreadCount }})
+
+
+
+({{ pg.activeThreadCount }})
+
+
+
+
+
+
+
+
+
+
+
+
+In
+
+
+(Size)
+
+5 min
+
+
+
+{{ formatIn(item) }}
+
+
+
+
+
+
+
+
+Read
+
+|
+
+Write
+
+5 min
+
+
+
+{{ formatReadWrite(item) }}
+
+
+
+
+
+
+
+
+Out
+
+
+(Size)
+
+5 min
+
+
+
+{{ formatOut(item) }}
+
+
+
+
+
+
+
+
+Tasks
+
+|
+

Re: [PR] [NIFI-12437] - Summary [nifi]

2023-12-11 Thread via GitHub


mcgilman commented on PR #8143:
URL: https://github.com/apache/nifi/pull/8143#issuecomment-1850739779

   Reviewing...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org