Skip to content

Commit e981145

Browse files
committed
NIFI-14431 - Checkin initial changes
1 parent c73cc71 commit e981145

17 files changed

Lines changed: 730 additions & 40 deletions

nifi-frontend/src/main/frontend/apps/nifi/proxy.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
const target = {
19-
target: 'https://localhost:8443',
19+
target: 'http://localhost:8443',
2020
secure: false,
2121
logLevel: 'debug',
2222
changeOrigin: true,

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/feature/content-viewer.component.html

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@
5555
</div>
5656
</form>
5757
</div>
58-
<div class="p-2 flex-1 flex border overflow-y-auto">
59-
@if (viewerSelected) {
60-
<router-outlet></router-outlet>
61-
} @else {
62-
<div class="unset">No data reference specified</div>
63-
}
58+
<div class="p-2 flex-1 flex overflow-y-auto">
59+
<div class="p-2 flex-1 flex border overflow-y-auto">
60+
@if (viewerSelected) {
61+
<router-outlet></router-outlet>
62+
} @else {
63+
<div class="unset">No data reference specified</div>
64+
}
65+
</div>
66+
<div *ngIf="flowFile != undefined">
67+
<flowfile-details [flowFile]="flowFile" (downloadContent)="downloadContent()"></flowfile-details>
68+
</div>
6469
</div>
6570
</div>

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/feature/content-viewer.component.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ import { ContentViewer, HEX_VIEWER_URL, SupportedMimeTypes } from '../state/view
2525
import { isDefinedAndNotNull, NiFiCommon, SelectGroup, SelectOption, selectQueryParams, TextTip } from '@nifi/shared';
2626
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
2727
import { concatLatestFrom } from '@ngrx/operators';
28-
import { navigateToBundledContentViewer, resetContent, setRef } from '../state/content/content.actions';
28+
import {
29+
downloadFlowFileContentFromViewer,
30+
loadFlowFile,
31+
navigateToBundledContentViewer,
32+
resetContent,
33+
setRef
34+
} from '../state/content/content.actions';
2935
import { MatSelectChange } from '@angular/material/select';
3036
import { loadAbout } from '../../../state/about/about.actions';
3137
import { selectAbout } from '../../../state/about/about.selectors';
3238
import { filter, map, switchMap, take } from 'rxjs';
3339
import { navigateToExternalViewer } from '../state/external-viewer/external-viewer.actions';
3440
import { snackBarError } from '../../../state/error/error.actions';
41+
import { FlowFile } from '../../queue/state/queue-listing';
42+
import { selectFlowFile } from '../state/content/content.selectors';
3543

3644
interface SupportedContentViewer {
3745
supportedMimeTypes: SupportedMimeTypes;
@@ -49,6 +57,7 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
4957
viewerForm: FormGroup;
5058
viewAsOptions: SelectGroup[] = [];
5159
panelWidth: string | null = 'auto';
60+
flowFile: FlowFile | undefined;
5261

5362
private supportedMimeTypeId = 0;
5463
private supportedContentViewerLookup: Map<number, SupportedContentViewer> = new Map<
@@ -61,6 +70,8 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
6170
viewerSelected: boolean = false;
6271
mimeType: string | undefined;
6372
private clientId: string | undefined;
73+
private uri: string | undefined;
74+
private clusterNodeId: string | undefined;
6475

6576
private queryParamsLoaded = false;
6677
private viewerOptionsLoaded = false;
@@ -72,6 +83,10 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
7283
) {
7384
this.viewerForm = this.formBuilder.group({ viewAs: null });
7485

86+
this.store.select(selectFlowFile).subscribe((flowFile) => {
87+
this.flowFile = flowFile;
88+
});
89+
7590
this.store
7691
.select(selectViewerOptions)
7792
.pipe(
@@ -199,7 +214,8 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
199214
const ref = queryParams['ref'];
200215
this.mimeType = queryParams['mimeType'];
201216
this.clientId = queryParams['clientId'];
202-
217+
this.uri = queryParams['uri'];
218+
this.clusterNodeId = queryParams['clusterNodeId'];
203219
if (ref) {
204220
this.store.dispatch(
205221
setRef({
@@ -219,6 +235,7 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
219235
ngOnInit(): void {
220236
this.store.dispatch(loadContentViewerOptions());
221237
this.store.dispatch(loadAbout());
238+
this.store.dispatch(loadFlowFile());
222239
}
223240

224241
private handleDefaultSelection(): void {
@@ -303,6 +320,19 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
303320
}
304321
}
305322

323+
downloadContent(): void {
324+
if (this.uri) {
325+
this.store.dispatch(
326+
downloadFlowFileContentFromViewer({
327+
request: {
328+
uri: this.uri,
329+
clusterNodeId: this.clusterNodeId
330+
}
331+
})
332+
);
333+
}
334+
}
335+
306336
ngOnDestroy(): void {
307337
this.store.dispatch(resetContent());
308338
this.store.dispatch(resetContentViewerOptions());

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/feature/content-viewer.module.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { ImageViewer } from '../ui/image-viewer/image-viewer.component';
3030
import { ContentEffects } from '../state/content/content.effects';
3131
import { ExternalViewerEffects } from '../state/external-viewer/external-viewer.effects';
3232
import { NifiTooltipDirective } from '@nifi/shared';
33+
import { FlowFileDialog } from '../../queue/ui/queue-listing/flowfile-dialog/flowfile-dialog.component';
34+
import { FlowFileDetails } from '../ui/flowfile-details/flowfile-details.component';
3335

3436
@NgModule({
3537
declarations: [ContentViewerComponent],
@@ -45,7 +47,10 @@ import { NifiTooltipDirective } from '@nifi/shared';
4547
HexViewer,
4648
ImageViewer,
4749
NgOptimizedImage,
48-
NifiTooltipDirective
50+
NifiTooltipDirective,
51+
FlowFileDialog,
52+
FlowFileDetails,
53+
FlowFileDetails
4954
]
5055
})
5156
export class ContentViewerModule {}

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/state/content/content.actions.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717

1818
import { createAction, props } from '@ngrx/store';
19+
import { loadFlowFileRequestSuccess } from './index';
20+
import { DownloadFlowFileContentRequest } from '../../../queue/state/queue-listing';
1921

2022
export const setRef = createAction('[Content] Set Ref', props<{ ref: string }>());
2123

@@ -25,3 +27,15 @@ export const navigateToBundledContentViewer = createAction(
2527
);
2628

2729
export const resetContent = createAction('[Content] Reset Content');
30+
31+
export const loadFlowFile = createAction('[Content] Load FlowFile');
32+
33+
export const loadFlowFileSuccess = createAction(
34+
'[Content] Load FlowFile Success',
35+
props<{ response: loadFlowFileRequestSuccess }>()
36+
);
37+
38+
export const downloadFlowFileContentFromViewer = createAction(
39+
'[Content] Download FlowFile Content',
40+
props<{ request: DownloadFlowFileContentRequest }>()
41+
);

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/state/content/content.effects.ts

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,21 @@
1818
import { Injectable } from '@angular/core';
1919
import { Actions, createEffect, ofType } from '@ngrx/effects';
2020
import * as ContentActions from './content.actions';
21-
import { map, tap } from 'rxjs';
21+
import { catchError, from, map, of, switchMap, tap, withLatestFrom } from 'rxjs';
2222
import { NavigationExtras, Router } from '@angular/router';
23-
import { NiFiCommon } from '@nifi/shared';
23+
import { NiFiCommon, selectQueryParams } from '@nifi/shared';
24+
import { select, Store } from '@ngrx/store';
25+
import { NiFiState } from '../../../../state';
26+
import { QueueService } from '../../../queue/service/queue.service';
2427

2528
@Injectable()
2629
export class ContentEffects {
2730
constructor(
2831
private actions$: Actions,
2932
private router: Router,
30-
private nifiCommon: NiFiCommon
33+
private nifiCommon: NiFiCommon,
34+
private queueService: QueueService,
35+
private store: Store<NiFiState>
3136
) {}
3237

3338
navigateToBundledContentViewer$ = createEffect(
@@ -46,4 +51,53 @@ export class ContentEffects {
4651
),
4752
{ dispatch: false }
4853
);
54+
55+
loadFlowFile$ = createEffect(() =>
56+
this.actions$.pipe(
57+
ofType(ContentActions.loadFlowFile),
58+
withLatestFrom(this.store.pipe(select(selectQueryParams))),
59+
switchMap(([, params]) =>
60+
from(
61+
this.queueService.getFlowFile({
62+
filename: '',
63+
lineageDuration: 0,
64+
penalized: false,
65+
penaltyExpiresIn: 0,
66+
queuedDuration: 0,
67+
size: 0,
68+
uuid: '',
69+
uri: params['uri'],
70+
clusterNodeId: params['clusterNodeId']
71+
})
72+
).pipe(
73+
map((response) => {
74+
return ContentActions.loadFlowFileSuccess({
75+
response: {
76+
flowFile: response.flowFile
77+
}
78+
});
79+
}),
80+
catchError(() =>
81+
of(
82+
ContentActions.loadFlowFileSuccess({
83+
response: {
84+
flowFile: undefined
85+
}
86+
})
87+
)
88+
)
89+
)
90+
)
91+
)
92+
);
93+
94+
downloadFlowFileContentFromViewer$ = createEffect(
95+
() => () =>
96+
this.actions$.pipe(
97+
ofType(ContentActions.downloadFlowFileContentFromViewer),
98+
map((action) => action.request),
99+
tap((request) => this.queueService.downloadContent(request))
100+
),
101+
{ dispatch: false }
102+
);
49103
}

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/state/content/content.reducer.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
import { createReducer, on } from '@ngrx/store';
1919
import { ContentState } from './index';
20-
import { resetContent, setRef } from './content.actions';
20+
import { loadFlowFileSuccess, resetContent, setRef } from './content.actions';
2121

2222
export const initialState: ContentState = {
23-
ref: null
23+
ref: null,
24+
flowFile: undefined
2425
};
2526

2627
export const contentReducer = createReducer(
@@ -31,5 +32,9 @@ export const contentReducer = createReducer(
3132
})),
3233
on(resetContent, () => ({
3334
...initialState
35+
})),
36+
on(loadFlowFileSuccess, (state, { response }) => ({
37+
...state,
38+
flowFile: response.flowFile
3439
}))
3540
);

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/state/content/content.selectors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ export const selectContentState = createSelector(
2525
);
2626

2727
export const selectRef = createSelector(selectContentState, (state: ContentState) => state.ref);
28+
29+
export const selectFlowFile = createSelector(selectContentState, (state: ContentState) => state.flowFile);

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/state/content/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,20 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { FlowFile } from '../../../queue/state/queue-listing';
19+
1820
export const contentFeatureKey = 'content';
1921

2022
export interface ContentState {
2123
ref: string | null;
24+
flowFile: FlowFile | undefined;
25+
}
26+
27+
export interface loadFlowFileRequest {
28+
uri: string;
29+
clusterNodeId: string;
30+
}
31+
32+
export interface loadFlowFileRequestSuccess {
33+
flowFile: FlowFile | undefined;
2234
}

0 commit comments

Comments
 (0)