Skip to content

Commit

Permalink
thumbnail generation
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshkumar1019 committed Oct 7, 2024
1 parent 56ca32e commit bdc6be4
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export const appRoutes: Route[] = [
loadChildren: () =>
import("./features/probes/probes.module").then((m) => m.ProbesModule),
},
{
path: "thumbnail-generation",
title: routeTitle.THUMBNAIL_GENERATION,
loadChildren: () =>
import(
"./features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.module"
).then((m) => m.GenericMultiFeatureLayoutModule)
},
{
path: "auth",
loadChildren: () => import("./auth/auth.module").then((m) => m.AuthModule),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface GenericModalData {
export interface labelsList {
pageTitle: string;
submitBtnLabel: string;
nxqlQueryDefault: string;
}

export interface FeatureData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { ELASTIC_SEARCH_LABELS } from "../../elastic-search-reindex/elastic-search-reindex.constants";
import { THUMBNAIL_GENERATION_LABELS } from "../../thumbnail-generation/thumbnail-generation.constants";
import { GENERIC_LABELS } from "./generic-multi-feature-layout.constants";
import { labelsList } from "./generic-multi-feature-layout.interface";

export const FEATURES = {
ELASTIC_SEARCH_REINDEX: "elasticsearch-reindex"
ELASTIC_SEARCH_REINDEX: "elasticsearch-reindex",
THUMBNAIL_GENERATION: "thumbnail-generation"
// Add other features here. Value MUST match route name
} as const;

export let labels: labelsList;
export type FeaturesKey = keyof typeof FEATURES;

export function getFeatureKeyByValue(
Expand Down Expand Up @@ -52,6 +55,44 @@ export const featureMap = () => ({
throw new Error(`Unsupported type: ${tabType}`);
}

return {
requestQuery,
labels,
};
},
[FEATURES.THUMBNAIL_GENERATION]: (tabType: string) => {
let requestQuery: string;
let labels: { pageTitle: string; submitBtnLabel: string };

switch (tabType) {
case GENERIC_LABELS.DOCUMENT:
(requestQuery = `ecm:mixinType = "Thumbnail" AND ecm:path='{queryParam}'`),
(labels = {
pageTitle: THUMBNAIL_GENERATION_LABELS.DOCUMENT_THUMBNAIL_GENERATION_TITLE,
submitBtnLabel: THUMBNAIL_GENERATION_LABELS.THUMBNAIL_GENERATION_BUTTON_LABEL,
});
break;

case GENERIC_LABELS.FOLDER:
(requestQuery = `ecm:mixinType = "Thumbnail" AND ecm:uuid='{queryParam}' OR ecm:ancestorId='{queryParam}' ${GENERIC_LABELS.AND} ${GENERIC_LABELS.SELECT_QUERY_CONDITIONS}`),
(labels = {
pageTitle: THUMBNAIL_GENERATION_LABELS.FOLDER_THUMBNAIL_GENERATION_TITLE,
submitBtnLabel: THUMBNAIL_GENERATION_LABELS.THUMBNAIL_GENERATION_BUTTON_LABEL,
});
break;

case GENERIC_LABELS.NXQL:
(requestQuery = `ecm:uuid='{queryParam}' OR ecm:ancestorId='{queryParam}' ${GENERIC_LABELS.AND} ${GENERIC_LABELS.SELECT_QUERY_CONDITIONS}`),
(labels = {
pageTitle: THUMBNAIL_GENERATION_LABELS.NXQL_QUERY_THUMBNAIL_GENERATION_TITLE,
submitBtnLabel: THUMBNAIL_GENERATION_LABELS.THUMBNAIL_GENERATION_BUTTON_LABEL,
});
break;

default:
throw new Error(`Unsupported type: ${tabType}`);
}

return {
requestQuery,
labels,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const THUMBNAIL_GENERATION_LABELS = {
FOLDER_THUMBNAIL_GENERATION_TITLE: "Generate the thumbnail of a document and all of its children",
DOCUMENT_THUMBNAIL_GENERATION_TITLE: "Generate the thumbnail of a single document",
NXQL_QUERY_THUMBNAIL_GENERATION_TITLE: "Generate the thumbnail of the documents returned by a NXQL query",
THUMBNAIL_GENERATION_BUTTON_LABEL: "Generate"
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ export const ADMIN_MENU: Menu[] = [
path: "probes",
isSelected: false,
},
{
id: 4,
name: "Thumbnail Generation",
path: "thumbnail-generation",
isSelected: false,
},
];

export const ROUTES_TITLE = {
HOME: "Home",
ELASTICSEARCH_REINDEX: "ElasticSearch Reindex",
BULKACTIONMONITORING: "Bulk Action Monitoring",
PROBES: "Probes",
};
THUMBNAIL_GENERATION: "Thumbnail Generation",
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export const REST_END_POINTS = {
CURRENT_USER: "CURRENT_USER",
CAPABILITIES: "CAPABILITIES",
LOGOUT: "LOGOUT",
BULK_ACTION_MONITORING: "BULK_ACTION_MONITORING"
BULK_ACTION_MONITORING: "BULK_ACTION_MONITORING",
THUMBNAIL_GENERATION: "THUMBNAIL_GENERATION"
} as const;

type RestEndpointKey = keyof typeof REST_END_POINTS;
Expand Down Expand Up @@ -43,5 +44,9 @@ export const REST_END_POINT_CONFIG: Record<RestEndpointKey, RestEndpointConfig>
BULK_ACTION_MONITORING: {
endpoint: "/management/bulk/{id}",
method: "GET"
},
THUMBNAIL_GENERATION: {
endpoint: "/management/thumbnails/recompute",
method: "POST"
}
};
};

0 comments on commit bdc6be4

Please sign in to comment.