This is an automated email from the ASF dual-hosted git repository.
rfellows pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 6e308f2cf1 NIFI-13743: Ensuring the mime type is set when navigating
to the content viewer from Provenance. (#9262)
6e308f2cf1 is described below
commit 6e308f2cf1a93633b154b420bafa7a6819ca73fb
Author: Matt Gilman <[email protected]>
AuthorDate: Thu Sep 12 16:41:49 2024 -0400
NIFI-13743: Ensuring the mime type is set when navigating to the content
viewer from Provenance. (#9262)
- Adding a trailing slash when loading the external viewer to eliminate an
unneeded redirection.
This closes #9262
---
.../ui/external-viewer/external-viewer.component.ts | 2 +-
.../pages/flow-designer/state/flow/flow.effects.ts | 4 +++-
.../pages/provenance/service/provenance.service.ts | 7 ++++++-
.../provenance-event-listing.effects.ts | 21 ++++++++++++++++++++-
4 files changed, 30 insertions(+), 4 deletions(-)
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/ui/external-viewer/external-viewer.component.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/ui/external-viewer/external-viewer.component.ts
index e92c5fc468..becfad7347 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/ui/external-viewer/external-viewer.component.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/content-viewer/ui/external-viewer/external-viewer.component.ts
@@ -72,7 +72,7 @@ export class ExternalViewer implements OnDestroy {
queryParams = queryParams.set('clientId',
this.request.clientId);
}
- const urlWithParams =
`${this.request.url}?${queryParams.toString()}`;
+ const urlWithParams =
`${this.request.url}/?${queryParams.toString()}`;
const sanitizedUrl =
this.domSanitizer.sanitize(SecurityContext.URL, urlWithParams);
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
index 122ed415a4..d00be3a7f5 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts
@@ -3673,7 +3673,9 @@ export class FlowEffects {
switchMap((versionControlInfo: VersionControlInformationEntity) =>
{
const vci = versionControlInfo.versionControlInformation;
if (vci) {
- return
from(this.registryService.getFlowVersions(vci.registryId, vci.bucketId,
vci.flowId, vci.branch)).pipe(
+ return from(
+ this.registryService.getFlowVersions(vci.registryId,
vci.bucketId, vci.flowId, vci.branch)
+ ).pipe(
map((versions) =>
FlowActions.openChangeVersionDialog({
request: {
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/service/provenance.service.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/service/provenance.service.ts
index f9f652fbae..f9a97405ea 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/service/provenance.service.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/service/provenance.service.ts
@@ -92,7 +92,8 @@ export class ProvenanceService {
contentViewerUrl: string,
eventId: number,
direction: string,
- clusterNodeId?: string
+ clusterNodeId?: string,
+ mimeType?: string
): void {
// build the uri to the data
let dataUri =
`${nifiUrl}provenance-events/${encodeURIComponent(eventId)}/content/${encodeURIComponent(
@@ -126,6 +127,10 @@ export class ProvenanceService {
clientId: this.client.getClientId()
};
+ if (mimeType) {
+ contentViewerParameters['mimeType'] = mimeType;
+ }
+
// open the content viewer
const contentViewerQuery: string = new
URLSearchParams(contentViewerParameters).toString();
window.open(`${contentViewer}${contentViewerQuery}`);
diff --git
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/state/provenance-event-listing/provenance-event-listing.effects.ts
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/state/provenance-event-listing/provenance-event-listing.effects.ts
index c2385e8ab6..f4aed14302 100644
---
a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/state/provenance-event-listing/provenance-event-listing.effects.ts
+++
b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/provenance/state/provenance-event-listing/provenance-event-listing.effects.ts
@@ -45,6 +45,7 @@ import { isDefinedAndNotNull, NiFiCommon } from
'libs/shared/src';
import { selectClusterSummary } from
'../../../../state/cluster-summary/cluster-summary.selectors';
import { ClusterService } from '../../../../service/cluster.service';
import { LARGE_DIALOG, MEDIUM_DIALOG } from 'libs/shared/src';
+import { Attribute } from '../../../../state/shared';
@Injectable()
export class ProvenanceEventListingEffects {
@@ -358,12 +359,30 @@ export class ProvenanceEventListingEffects {
dialogReference.componentInstance.viewContent
.pipe(takeUntil(dialogReference.afterClosed()))
.subscribe((direction: string) => {
+ let mimeType: string | undefined;
+
+ if
(response.provenanceEvent.attributes) {
+ const mimeTypeAttribute: Attribute
| undefined =
+
response.provenanceEvent.attributes.find(
+ (attribute: Attribute) =>
attribute.name === 'mime.type'
+ );
+
+ if (mimeTypeAttribute) {
+ if (direction === 'input') {
+ mimeType =
mimeTypeAttribute.previousValue;
+ } else if (direction ===
'output') {
+ mimeType =
mimeTypeAttribute.value;
+ }
+ }
+ }
+
this.provenanceService.viewContent(
about.uri,
about.contentViewerUrl,
request.eventId,
direction,
- request.clusterNodeId
+ request.clusterNodeId,
+ mimeType
);
});
}