diff --git a/nuxeo-admin-console-web/angular-app/src/app/app-routing.module.ts b/nuxeo-admin-console-web/angular-app/src/app/app-routing.module.ts index d42af0fb..2b4546fb 100644 --- a/nuxeo-admin-console-web/angular-app/src/app/app-routing.module.ts +++ b/nuxeo-admin-console-web/angular-app/src/app/app-routing.module.ts @@ -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), diff --git a/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.interface.ts b/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.interface.ts index 183be775..69179ebd 100644 --- a/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.interface.ts +++ b/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.interface.ts @@ -38,6 +38,7 @@ export interface GenericModalData { export interface labelsList { pageTitle: string; submitBtnLabel: string; + nxqlQueryDefault: string; } export interface FeatureData { diff --git a/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.mapping.ts b/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.mapping.ts index 3c268ad1..e22568c4 100644 --- a/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.mapping.ts +++ b/nuxeo-admin-console-web/angular-app/src/app/features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.mapping.ts @@ -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( @@ -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, diff --git a/nuxeo-admin-console-web/angular-app/src/app/features/thumbnail-generation/thumbnail-generation.constants.ts b/nuxeo-admin-console-web/angular-app/src/app/features/thumbnail-generation/thumbnail-generation.constants.ts new file mode 100644 index 00000000..049cf245 --- /dev/null +++ b/nuxeo-admin-console-web/angular-app/src/app/features/thumbnail-generation/thumbnail-generation.constants.ts @@ -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" + }; \ No newline at end of file diff --git a/nuxeo-admin-console-web/angular-app/src/app/layouts/menu-bar/menu-bar.constants.ts b/nuxeo-admin-console-web/angular-app/src/app/layouts/menu-bar/menu-bar.constants.ts index 30a3f320..81549ca4 100644 --- a/nuxeo-admin-console-web/angular-app/src/app/layouts/menu-bar/menu-bar.constants.ts +++ b/nuxeo-admin-console-web/angular-app/src/app/layouts/menu-bar/menu-bar.constants.ts @@ -25,6 +25,12 @@ export const ADMIN_MENU: Menu[] = [ path: "probes", isSelected: false, }, + { + id: 4, + name: "Thumbnail Generation", + path: "thumbnail-generation", + isSelected: false, + }, ]; export const ROUTES_TITLE = { @@ -32,4 +38,5 @@ export const ROUTES_TITLE = { ELASTICSEARCH_REINDEX: "ElasticSearch Reindex", BULKACTIONMONITORING: "Bulk Action Monitoring", PROBES: "Probes", -}; \ No newline at end of file + THUMBNAIL_GENERATION: "Thumbnail Generation", +}; diff --git a/nuxeo-admin-console-web/angular-app/src/app/shared/constants/rest-end-ponts.constants.ts b/nuxeo-admin-console-web/angular-app/src/app/shared/constants/rest-end-ponts.constants.ts index 5e491c64..2e40c90f 100644 --- a/nuxeo-admin-console-web/angular-app/src/app/shared/constants/rest-end-ponts.constants.ts +++ b/nuxeo-admin-console-web/angular-app/src/app/shared/constants/rest-end-ponts.constants.ts @@ -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; @@ -43,5 +44,9 @@ export const REST_END_POINT_CONFIG: Record BULK_ACTION_MONITORING: { endpoint: "/management/bulk/{id}", method: "GET" + }, + THUMBNAIL_GENERATION: { + endpoint: "/management/thumbnails/recompute", + method: "POST" } -}; \ No newline at end of file +};