Skip to content

Commit

Permalink
NIFI-13632: Further simplification of content viewer state.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgilman committed Aug 30, 2024
1 parent 06da4a1 commit 5ddd2f4
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { snackBarError } from '../../../state/error/error.actions';
interface SupportedContentViewer {
supportedMimeTypes: SupportedMimeTypes;
contentViewer: ContentViewer;
bundled: boolean;
}

@Component({
Expand All @@ -53,7 +54,6 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
number,
SupportedContentViewer
>();
private mimeTypeIdsSupportedByBundledUis: Set<number> = new Set<number>();

private defaultSupportedMimeTypeId: number | null = null;

Expand All @@ -80,7 +80,6 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
)
.subscribe(([externalViewerOptions, bundledViewerOptions]) => {
this.supportedContentViewerLookup.clear();
this.mimeTypeIdsSupportedByBundledUis.clear();

// maps a given content (by display name) to the supported mime type id
// which can be used to look up the corresponding content viewer
Expand All @@ -98,7 +97,8 @@ export class ContentViewerComponent implements OnInit, OnDestroy {

this.supportedContentViewerLookup.set(supportedMimeTypeId, {
supportedMimeTypes,
contentViewer
contentViewer,
bundled: false
});
});
});
Expand All @@ -117,10 +117,10 @@ export class ContentViewerComponent implements OnInit, OnDestroy {
}
supportedMimeTypeMapping.get(supportedMimeTypes.displayName)?.push(supportedMimeTypeId);

this.mimeTypeIdsSupportedByBundledUis.add(supportedMimeTypeId);
this.supportedContentViewerLookup.set(supportedMimeTypeId, {
supportedMimeTypes,
contentViewer
contentViewer,
bundled: true
});
});
});
Expand Down Expand Up @@ -277,7 +277,7 @@ export class ContentViewerComponent implements OnInit, OnDestroy {

this.viewerSelected = true;

if (this.mimeTypeIdsSupportedByBundledUis.has(value)) {
if (supportedContentViewer.bundled) {
this.store.dispatch(
navigateToBundledContentViewer({
route: viewer.uri
Expand Down

0 comments on commit 5ddd2f4

Please sign in to comment.