-
Notifications
You must be signed in to change notification settings - Fork 2.9k
NIFI-13125 - Flow Version Diff View #10473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,6 +22,10 @@ | |||||||
|
|
||||||||
| .listing-table { | ||||||||
| table { | ||||||||
| .mat-column-actions { | ||||||||
| width: 54px; | ||||||||
| } | ||||||||
|
|
||||||||
|
||||||||
| .mat-column-actions { | |
| width: 54px; | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,16 +16,17 @@ | |
| */ | ||
|
|
||
| import { Component, EventEmitter, Output, inject } from '@angular/core'; | ||
| import { MatButton } from '@angular/material/button'; | ||
| import { MatButton, MatIconButton } from '@angular/material/button'; | ||
| import { MatCell, MatCellDef, MatColumnDef, MatTableDataSource, MatTableModule } from '@angular/material/table'; | ||
| import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; | ||
| import { MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog'; | ||
| import { MatSortModule, Sort } from '@angular/material/sort'; | ||
| import { VersionedFlowSnapshotMetadata } from '../../../../../../../state/shared'; | ||
| import { ChangeVersionDialogRequest, VersionControlInformation } from '../../../../../state/flow'; | ||
| import { Store } from '@ngrx/store'; | ||
| import { CanvasState } from '../../../../../state'; | ||
| import { selectTimeOffset } from '../../../../../../../state/flow-configuration/flow-configuration.selectors'; | ||
| import { NiFiCommon, CloseOnEscapeDialog, NifiTooltipDirective, TextTip } from '@nifi/shared'; | ||
| import { NiFiCommon, CloseOnEscapeDialog, NifiTooltipDirective, TextTip, LARGE_DIALOG } from '@nifi/shared'; | ||
| import { FlowDiffDialog, FlowDiffDialogData } from '../flow-diff-dialog/flow-diff-dialog'; | ||
|
|
||
| @Component({ | ||
| selector: 'change-version-dialog', | ||
|
|
@@ -37,7 +38,8 @@ import { NiFiCommon, CloseOnEscapeDialog, NifiTooltipDirective, TextTip } from ' | |
| MatDialogModule, | ||
| MatSortModule, | ||
| MatTableModule, | ||
| NifiTooltipDirective | ||
| NifiTooltipDirective, | ||
| MatIconButton | ||
| ], | ||
| templateUrl: './change-version-dialog.html', | ||
| styleUrl: './change-version-dialog.scss' | ||
|
|
@@ -47,16 +49,18 @@ export class ChangeVersionDialog extends CloseOnEscapeDialog { | |
| private nifiCommon = inject(NiFiCommon); | ||
| private store = inject<Store<CanvasState>>(Store); | ||
|
|
||
| displayedColumns: string[] = ['current', 'version', 'created', 'comments']; | ||
| displayedColumns: string[] = ['actions', 'current', 'version', 'created', 'comments']; | ||
|
||
| dataSource: MatTableDataSource<VersionedFlowSnapshotMetadata> = | ||
| new MatTableDataSource<VersionedFlowSnapshotMetadata>(); | ||
| selectedFlowVersion: VersionedFlowSnapshotMetadata | null = null; | ||
| private allFlowVersions: VersionedFlowSnapshotMetadata[] = []; | ||
| sort: Sort = { | ||
| active: 'created', | ||
| direction: 'desc' | ||
| }; | ||
| versionControlInformation: VersionControlInformation; | ||
| private timeOffset = this.store.selectSignal(selectTimeOffset); | ||
| private dialog = inject(MatDialog); | ||
|
|
||
| @Output() changeVersion: EventEmitter<VersionedFlowSnapshotMetadata> = | ||
| new EventEmitter<VersionedFlowSnapshotMetadata>(); | ||
|
|
@@ -66,6 +70,7 @@ export class ChangeVersionDialog extends CloseOnEscapeDialog { | |
| const dialogRequest = this.dialogRequest; | ||
|
|
||
| const flowVersions = dialogRequest.versions.map((entity) => entity.versionedFlowSnapshotMetadata); | ||
| this.allFlowVersions = flowVersions; | ||
| const sortedFlowVersions = this.sortVersions(flowVersions, this.sort); | ||
| this.selectedFlowVersion = sortedFlowVersions[0]; | ||
| this.dataSource.data = sortedFlowVersions; | ||
|
|
@@ -151,5 +156,27 @@ export class ChangeVersionDialog extends CloseOnEscapeDialog { | |
| return flowVersion.version === this.versionControlInformation.version; | ||
| } | ||
|
|
||
| openFlowDiff(flowVersion: VersionedFlowSnapshotMetadata, event: MouseEvent) { | ||
| event.preventDefault(); | ||
| event.stopPropagation(); | ||
|
|
||
| if (!this.versionControlInformation) { | ||
| return; | ||
| } | ||
|
|
||
| const dialogData: FlowDiffDialogData = { | ||
| versionControlInformation: this.versionControlInformation, | ||
| versions: this.allFlowVersions, | ||
| currentVersion: this.versionControlInformation.version, | ||
| selectedVersion: flowVersion.version | ||
| }; | ||
|
|
||
| this.dialog.open(FlowDiffDialog, { | ||
| ...LARGE_DIALOG, | ||
| data: dialogData, | ||
| autoFocus: false | ||
| }); | ||
| } | ||
|
|
||
| protected readonly TextTip = TextTip; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,123 @@ | ||||||||
| <!-- | ||||||||
| ~ 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. | ||||||||
| --> | ||||||||
|
|
||||||||
| <h2 mat-dialog-title> | ||||||||
| Flow Version Diff - {{ flowName }} | ||||||||
| </h2> | ||||||||
| <div class="flow-diff"> | ||||||||
| <mat-dialog-content> | ||||||||
| <div class="dialog-content flex flex-col gap-y-4"> | ||||||||
| <div | ||||||||
| class="flow-diff-message" | ||||||||
| data-qa="flow-diff-message" | ||||||||
| *ngIf="comparisonSummary.length > 0"> | ||||||||
| <div class="flow-diff-message-title">Comparing versions:</div> | ||||||||
| <ul class="flow-diff-message-list"> | ||||||||
|
||||||||
| <li *ngFor="let summary of comparisonSummary"> | ||||||||
| <span class="flow-diff-version">Version {{ summary.version }}</span> | ||||||||
| <span *ngIf="summary.created" class="flow-diff-created"> | ||||||||
| ({{ summary.created }}) | ||||||||
| </span> | ||||||||
| </li> | ||||||||
| </ul> | ||||||||
| </div> | ||||||||
|
|
||||||||
| <div class="flow-diff-controls flex flex-wrap gap-4"> | ||||||||
| <mat-form-field class="flow-diff-select" appearance="outline"> | ||||||||
| <mat-label>Current Version</mat-label> | ||||||||
| <mat-select [formControl]="currentVersionControl" data-qa="current-version-select"> | ||||||||
| <mat-option *ngFor="let version of versionOptions" [value]="version"> | ||||||||
| {{ formatVersionOption(version) }} | ||||||||
| </mat-option> | ||||||||
| </mat-select> | ||||||||
| </mat-form-field> | ||||||||
|
|
||||||||
| <mat-form-field class="flow-diff-select" appearance="outline"> | ||||||||
| <mat-label>Selected Version</mat-label> | ||||||||
| <mat-select [formControl]="selectedVersionControl" data-qa="selected-version-select"> | ||||||||
| <mat-option *ngFor="let version of versionOptions" [value]="version"> | ||||||||
| {{ formatVersionOption(version) }} | ||||||||
| </mat-option> | ||||||||
| </mat-select> | ||||||||
| </mat-form-field> | ||||||||
|
|
||||||||
| <mat-form-field class="flow-diff-filter" appearance="outline"> | ||||||||
| <mat-label>Filter</mat-label> | ||||||||
| <input | ||||||||
| matInput | ||||||||
| type="text" | ||||||||
| [formControl]="filterControl" | ||||||||
| placeholder="Filter differences" | ||||||||
| data-qa="flow-diff-filter" /> | ||||||||
| </mat-form-field> | ||||||||
| </div> | ||||||||
|
|
||||||||
| <div class="flow-diff-table flex-1"> | ||||||||
| <div class="flow-diff-loading" *ngIf="isLoading"> | ||||||||
| <mat-progress-spinner diameter="36" mode="indeterminate"></mat-progress-spinner> | ||||||||
| </div> | ||||||||
|
||||||||
| <div class="flow-diff-loading" *ngIf="isLoading"> | |
| <mat-progress-spinner diameter="36" mode="indeterminate"></mat-progress-spinner> | |
| </div> |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The listings in nifi do not show errors like this. If there is an error when requesting the diff it should be displayed in a context error banner at the top of the dialog like we do in other cases.
| <div *ngIf="errorMessage" class="flow-diff-error" data-qa="flow-diff-error"> | |
| {{ errorMessage }} | |
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ths styles for this table do not match the style for other listings throughout the app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| *ngIf="dataSource.data.length > 0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actions column should be displayed as the last column in the table listing.