Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAC-130: Admin Console fulltext reindex #215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export const appRoutes: Route[] = [
"./features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.module"
).then((m) => m.GenericMultiFeatureLayoutModule),
},
{
path: "fulltext-reindex",
loadChildren: () =>
import(
"./features/sub-features/generic-multi-feature-layout/generic-multi-feature-layout.module"
).then((m) => m.GenericMultiFeatureLayoutModule),
},
{ path: "**", redirectTo: "" },
];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const FULLTEXT_REINDEX_LABELS = {
FOLDER_REINDEX_TITLE: "Reindex the fulltext of a document and all of its children",
DOCUMENT_REINDEX_TITLE: "Reindex the fulltext of a single document",
NXQL_QUERY_REINDEX_TITLE: "Reindex the fulltext of the documents returned by a NXQL query",
REINDEX_BUTTON_LABEL: "Reindex",
DOCUMENT_QUERY:
"ecm:path='{query}' AND ecm:mixinType = 'Downloadable' AND ecm:isProxy = 0 AND ecm:mixinType != 'HiddenInNavigation' AND ecm:isVersion = 0 AND ecm:isTrashed = 0",
FOLDER_QUERY:
"(ecm:uuid='{query}' OR ecm:ancestorId='{query}') AND ecm:mixinType = 'Downloadable' AND ecm:isProxy = 0 AND ecm:mixinType != 'HiddenInNavigation' AND ecm:isVersion = 0 AND ecm:isTrashed = 0",
NXQL_QUERY:
"(ecm:uuid='{query}' OR ecm:ancestorId='{query}') AND ecm:mixinType = 'Downloadable' AND ecm:isProxy = 0 AND ecm:mixinType != 'HiddenInNavigation' AND ecm:isVersion = 0 AND ecm:isTrashed = 0",
NXQL_QUERY_DEFAULT_VALUE:
"SELECT * FROM Document WHERE ecm:mixinType != 'HiddenInNavigation' AND ecm:isProxy = 0 AND ecm:isVersion = 0 AND ecm:isTrashed = 0 AND ecm:mixinType = 'Downloadable' AND dc:title = 'A document to reindex'",
FORCE: "force",
FORCE_TITLE: "Empty fulltext index of binaries for excluded documents",
TRUE: "True",
FALSE: "False",
FORCE_HELPER_TEXT: "Use this option if you changed your fulltext configuration to exclude additional documents. This will remove the content of the files they hold from the fulltext index."
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,50 @@
<form [formGroup]="inputForm" (ngSubmit)="onFormSubmit()" class="document-tab-container"
[ngClass]="{'vertical-flex': isFeatureVideoRenditions()}">
<p id="requiredField"> {{ GENERIC_LABELS.REQUIRED_FIELD_INDICATOR }}</p>
[ngClass]="{'vertical-flex': isFeatureVideoRenditions() || isFeatureFullTextReindex()}">
<p id="requiredField">{{ GENERIC_LABELS.REQUIRED_FIELD_INDICATOR }}</p>
<p class="label">{{ GENERIC_LABELS.DOCUMENT_ID_OR_PATH }}<span class="required-indicator">*</span></p>
<mat-form-field appearance="outline" class="input-field">
<input matInput placeholder="{{ GENERIC_LABELS.DOCUMENT_ID_OR_PATH }}" type="text" formControlName="inputIdentifier"
id="inputIdentifier" required />
<mat-error *ngIf="inputForm?.get('inputIdentifier')?.invalid">
{{getErrorMessage()}}</mat-error>
{{ getErrorMessage() }}
</mat-error>
</mat-form-field>

<ng-container
*ngIf="isFeatureVideoRenditions() && inputForm.get(VIDEO_RENDITIONS_LABELS.CONVERSION_NAME_KEY) && inputForm.get(VIDEO_RENDITIONS_LABELS.RECOMPUTE_ALL_VIDEO_INFO_KEY)">
<p class="label">{{VIDEO_RENDITIONS_LABELS.CONVERSION_NAMES}}</p>
<p class="label">{{ VIDEO_RENDITIONS_LABELS.CONVERSION_NAMES }}</p>
<mat-form-field [ngClass]="{'video-renditions': isFeatureVideoRenditions()}" appearance="outline"
class="input-field">
<input matInput placeholder="Conversion Names" type="text" formControlName="conversionNames"
id="conversionNames" />
</mat-form-field>
<p class="conversion-helper-text">{{VIDEO_RENDITIONS_LABELS.CONVERSION_NAMES_HELPER_TEXT}}</p>
<p class="label">{{VIDEO_RENDITIONS_LABELS.RECOMPUTE_VIDEO_INFO}}</p>
<p class="conversion-helper-text">{{ VIDEO_RENDITIONS_LABELS.CONVERSION_NAMES_HELPER_TEXT }}</p>
<p class="label">{{ VIDEO_RENDITIONS_LABELS.RECOMPUTE_VIDEO_INFO }}</p>
<mat-form-field appearance="outline" class="recompute input-field"
[ngClass]="{'video-renditions': isFeatureVideoRenditions()}">
<mat-select matNativeControl formControlName="recomputeAllVideoInfo" id="recomputeAllVideoInfo">
<mat-option value="true" selected>{{VIDEO_RENDITIONS_LABELS.RECOMPUTE_MISSING_ONLY}}</mat-option>
<mat-option value="false">{{VIDEO_RENDITIONS_LABELS.RECOMPUTE_ALL}}</mat-option>
<mat-option value="true" selected>{{ VIDEO_RENDITIONS_LABELS.RECOMPUTE_MISSING_ONLY }}</mat-option>
<mat-option value="false">{{ VIDEO_RENDITIONS_LABELS.RECOMPUTE_ALL }}</mat-option>
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *ngIf="isFeatureFullTextReindex() && inputForm.get(FULLTEXT_REINDEX_LABELS.FORCE)">
<div class="force-checkbox-container">
<mat-checkbox
color="primary"
formControlName="force"
id="force"
[checked]="inputForm.get('force')?.value"
[ngClass]="{'fulltext-reindex': isFeatureFullTextReindex()}"
>
</mat-checkbox>
<span>{{ FULLTEXT_REINDEX_LABELS.FORCE_TITLE }}</span>
</div>
<p class="force-conversion-helper-text">{{ FULLTEXT_REINDEX_LABELS.FORCE_HELPER_TEXT }}</p>
</ng-container>
<button mat-flat-button color="primary" type="submit" class="document-tab-container__button"
[ngClass]="{'video-renditions': isFeatureVideoRenditions()}" [disabled]="isSubmitBtnDisabled">
[ngClass]="{'video-renditions': isFeatureVideoRenditions() || isFeatureFullTextReindex()}"
[disabled]="isSubmitBtnDisabled">
{{ templateLabels.submitBtnLabel }}
</button>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,30 @@
left: 0;
bottom: 0;
}
&.fulltext-reindex {
left: 0;
bottom: 0;
}
}
.conversion-helper-text {
font-size: 14px;
margin-top: -15px;
color: #666666;
}
.force-checkbox-container {
display: flex;
align-items: center;
margin: 0 0 10px;
}

.force-conversion-helper-text {
max-width: 600px;
white-space: normal;
word-wrap: break-word;
font-size: 13px;
margin-top: -15px;
color: #666666;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { ErrorModalComponent } from "../error-modal/error-modal.component";
import { featureMap, FEATURES } from "../../generic-multi-feature-layout.mapping";
import { PICTURE_RENDITIONS_LABELS } from "../../../../pictures/pictures-renditions.constants";
import { THUMBNAIL_GENERATION_LABELS } from "../../../../thumbnail-generation/thumbnail-generation.constants";
import { FULLTEXT_REINDEX_LABELS } from "../../../../fulltext-reindex/fulltext-reindex.constants";

describe("DocumentTabComponent", () => {
let component: DocumentTabComponent;
Expand Down Expand Up @@ -303,8 +304,14 @@ describe("DocumentTabComponent", () => {
const result = featureMap()[FEATURES.THUMBNAIL_GENERATION](GENERIC_LABELS.DOCUMENT);
expect(result.labels.pageTitle).toBe(THUMBNAIL_GENERATION_LABELS.DOCUMENT_THUMBNAIL_GENERATION_TITLE);
expect(result.labels.submitBtnLabel).toBe(THUMBNAIL_GENERATION_LABELS.THUMBNAIL_GENERATION_BUTTON_LABEL);
expect(result.data.bodyParam.query).toBe(THUMBNAIL_GENERATION_LABELS.DOCUMENT_QUERY);
});
});

describe('FEATURES.FULLTEXT_REINDEX', () => {
it('should return correct labels and data for DOCUMENT tabType', () => {
const result = featureMap()[FEATURES.FULLTEXT_REINDEX](GENERIC_LABELS.DOCUMENT);
expect(result.labels.pageTitle).toBe(FULLTEXT_REINDEX_LABELS.DOCUMENT_REINDEX_TITLE);
expect(result.labels.submitBtnLabel).toBe(FULLTEXT_REINDEX_LABELS.REINDEX_BUTTON_LABEL);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { VIDEO_RENDITIONS_LABELS } from "./../../../../video-renditions-generation/video-renditions-generation.constants";
import { FULLTEXT_REINDEX_LABELS } from "src/app/features/fulltext-reindex/fulltext-reindex.constants";
import { REST_END_POINTS } from "./../../../../../shared/constants/rest-end-ponts.constants";
import { GenericMultiFeatureUtilitiesService } from "./../../services/generic-multi-feature-utilities.service";
import { NuxeoJSClientService } from "./../../../../../shared/services/nuxeo-js-client.service";
Expand Down Expand Up @@ -73,6 +74,7 @@ export class DocumentTabComponent implements OnInit, OnDestroy {
activeFeature: FeaturesKey = {} as FeaturesKey;
requestQuery = "";
VIDEO_RENDITIONS_LABELS = VIDEO_RENDITIONS_LABELS;
FULLTEXT_REINDEX_LABELS = FULLTEXT_REINDEX_LABELS;
FEATURES = FEATURES;
constructor(
public dialogService: MatDialog,
Expand All @@ -83,6 +85,7 @@ export class DocumentTabComponent implements OnInit, OnDestroy {
) {
this.inputForm = this.fb.group({
inputIdentifier: ["", Validators.required],
force: [false],
Nishant0928 marked this conversation as resolved.
Show resolved Hide resolved
});
this.nuxeo = this.nuxeoJSClientService.getNuxeoInstance();
this.documentActionLaunched$ = this.store.pipe(
Expand Down Expand Up @@ -117,6 +120,12 @@ export class DocumentTabComponent implements OnInit, OnDestroy {
new FormControl("true")
);
}
if (this.isFeatureFullTextReindex()) {
this.inputForm.addControl(
FULLTEXT_REINDEX_LABELS.FORCE,
new FormControl("false")
);
}
}

this.documentActionLaunchedSubscription =
Expand Down Expand Up @@ -209,6 +218,10 @@ export class DocumentTabComponent implements OnInit, OnDestroy {
if (this.isFeatureVideoRenditions()) {
this.inputForm?.get("conversionNames")?.reset();
}
if (this.isFeatureFullTextReindex()) {
this.inputForm?.get("force")?.reset();
}

document.getElementById("inputIdentifier")?.focus();
}

Expand Down Expand Up @@ -319,6 +332,13 @@ export class DocumentTabComponent implements OnInit, OnDestroy {
);
}

isFeatureFullTextReindex(): boolean {
return (
this.activeFeature ===
(FEATURES.FULLTEXT_REINDEX as FeaturesKey)
);
}

ngOnDestroy(): void {
this.store.dispatch(FeatureActions.resetDocumentActionState());
this.documentActionLaunchedSubscription?.unsubscribe();
Expand All @@ -329,4 +349,4 @@ export class DocumentTabComponent implements OnInit, OnDestroy {
this.launchedDialogOpenedSubscription?.unsubscribe();
this.errorDialogOpenedSubscription?.unsubscribe();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<form [formGroup]="inputForm" (ngSubmit)="onFormSubmit()" class="folder-tab-container"
[ngClass]="{'vertical-flex': isFeatureVideoRenditions()}">
[ngClass]="{'vertical-flex': isFeatureVideoRenditions() || isFeatureFullTextReindex()}">
<p id="requiredField"> {{ GENERIC_LABELS.REQUIRED_FIELD_INDICATOR }}</p>
<p class="label">{{ isIdAndPathRequired(activeFeature) ? GENERIC_LABELS.DOCUMENT_ID_OR_PATH :
GENERIC_LABELS.DOCUMENT_ID }}<span class="required-indicator">*</span></p>
Expand Down Expand Up @@ -29,9 +29,24 @@
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *ngIf="isFeatureFullTextReindex() && inputForm.get(FULLTEXT_REINDEX_LABELS.FORCE)">
<div class="force-checkbox-container">
<mat-checkbox
color="primary"
formControlName="force"
id="force"
[checked]="inputForm.get('force')?.value"
[ngClass]="{'fulltext-reindex': isFeatureFullTextReindex()}"
>
</mat-checkbox>
<span>{{ FULLTEXT_REINDEX_LABELS.FORCE_TITLE }}</span>
</div>
<p class="force-conversion-helper-text">{{ FULLTEXT_REINDEX_LABELS.FORCE_HELPER_TEXT }}</p>
</ng-container>
<button mat-flat-button color="primary" type="submit" class="folder-tab-container__button"
[ngClass]="{'video-renditions': isFeatureVideoRenditions()}" [disabled]="isSubmitBtnDisabled">
{{ templateLabels.submitBtnLabel }}
[ngClass]="{'video-renditions': isFeatureVideoRenditions() || isFeatureFullTextReindex()}"
[disabled]="isSubmitBtnDisabled">
{{ templateLabels.submitBtnLabel }}
</button>
<div class="spinner-overlay" *ngIf="spinnerVisible">
<mat-progress-spinner class="custom-spinner" mode="indeterminate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,24 @@
.conversion-helper-text {
font-size: 14px;
margin-top: -15px;
color: #666666;
}

.conversion-helper-text {
font-size: 14px;
margin-top: -15px;
}
.force-checkbox-container {
display: flex;
align-items: center;
margin: 0 0 10px;
}

.force-conversion-helper-text {
max-width: 600px; /* Adjust as needed */
white-space: normal;
word-wrap: break-word;
font-size: 13px;
margin-top: -15px;
color: #666666;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { ErrorModalComponent } from "../error-modal/error-modal.component";
import { featureMap, FEATURES } from "../../generic-multi-feature-layout.mapping";
import { PICTURE_RENDITIONS_LABELS } from "../../../../pictures/pictures-renditions.constants";
import { THUMBNAIL_GENERATION_LABELS } from "../../../../thumbnail-generation/thumbnail-generation.constants";
import { FULLTEXT_REINDEX_LABELS } from "../../../../fulltext-reindex/fulltext-reindex.constants";

describe("FolderTabComponent", () => {
let component: FolderTabComponent;
Expand Down Expand Up @@ -295,7 +296,14 @@ describe("FolderTabComponent", () => {
const result = featureMap()[FEATURES.THUMBNAIL_GENERATION](GENERIC_LABELS.FOLDER);
expect(result.labels.pageTitle).toBe(THUMBNAIL_GENERATION_LABELS.FOLDER_THUMBNAIL_GENERATION_TITLE);
expect(result.labels.submitBtnLabel).toBe(THUMBNAIL_GENERATION_LABELS.THUMBNAIL_GENERATION_BUTTON_LABEL);
expect(result.data.bodyParam.query).toBe(THUMBNAIL_GENERATION_LABELS.FOLDER_QUERY);
});
});

describe('FEATURES.FULLTEXT_REINDEX', () => {
it('should return correct labels and data for FOLDER tabType', () => {
const result = featureMap()[FEATURES.FULLTEXT_REINDEX](GENERIC_LABELS.FOLDER);
expect(result.labels.pageTitle).toBe(FULLTEXT_REINDEX_LABELS.FOLDER_REINDEX_TITLE);
expect(result.labels.submitBtnLabel).toBe(FULLTEXT_REINDEX_LABELS.REINDEX_BUTTON_LABEL);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { VIDEO_RENDITIONS_LABELS } from "./../../../../video-renditions-generation/video-renditions-generation.constants";
import { FULLTEXT_REINDEX_LABELS } from "src/app/features/fulltext-reindex/fulltext-reindex.constants";
import { REST_END_POINTS } from "./../../../../../shared/constants/rest-end-ponts.constants";
import { MatDialog } from "@angular/material/dialog";
import { MatDialogRef } from "@angular/material/dialog";
Expand Down Expand Up @@ -76,6 +77,7 @@ export class FolderTabComponent implements OnInit, OnDestroy {
> = {} as MatDialogRef<GenericModalComponent, GenericModalClosedInfo>;
GENERIC_LABELS = GENERIC_LABELS;
VIDEO_RENDITIONS_LABELS = VIDEO_RENDITIONS_LABELS;
FULLTEXT_REINDEX_LABELS = FULLTEXT_REINDEX_LABELS
nuxeo: Nuxeo;
isSubmitBtnDisabled = false;
templateConfigData: FeatureData = {} as FeatureData;
Expand All @@ -92,6 +94,7 @@ export class FolderTabComponent implements OnInit, OnDestroy {
) {
this.inputForm = this.fb.group({
inputIdentifier: ["", Validators.required],
force: [false],
});
this.nuxeo = this.nuxeoJSClientService.getNuxeoInstance();
this.folderActionLaunched$ = this.store.pipe(
Expand Down Expand Up @@ -123,7 +126,12 @@ export class FolderTabComponent implements OnInit, OnDestroy {
this.templateLabels.pageTitle
);
}

if(this.isFeatureFullTextReindex()) {
this.inputForm.addControl(
FULLTEXT_REINDEX_LABELS.FORCE,
new FormControl("false")
);
}
if (this.isFeatureVideoRenditions()) {
this.inputForm.addControl(
VIDEO_RENDITIONS_LABELS.CONVERSION_NAME_KEY,
Expand All @@ -135,6 +143,8 @@ export class FolderTabComponent implements OnInit, OnDestroy {
);
}



this.folderActionLaunchedSubscription =
this.folderActionLaunched$.subscribe((data) => {
if (data?.commandId) {
Expand Down Expand Up @@ -456,6 +466,13 @@ export class FolderTabComponent implements OnInit, OnDestroy {
);
}

isFeatureFullTextReindex(): boolean {
return (
this.activeFeature ===
(FEATURES.FULLTEXT_REINDEX as FeaturesKey)
);
}

ngOnDestroy(): void {
this.store.dispatch(FeatureActions.resetFolderActionState());
this.folderActionLaunchedSubscription?.unsubscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,24 @@
</mat-select>
</mat-form-field>
</ng-container>
<ng-container *ngIf="isFeatureFullTextReindex() && inputForm.get(FULLTEXT_REINDEX_LABELS.FORCE)">
<div class="force-checkbox-container">
<mat-checkbox
color="primary"
formControlName="force"
id="force"
[checked]="inputForm.get('force')?.value"
[ngClass]="{'fulltext-reindex': isFeatureFullTextReindex()}"
>
</mat-checkbox>
<span>{{ FULLTEXT_REINDEX_LABELS.FORCE_TITLE }}</span>
</div>
<p class="force-conversion-helper-text">{{ FULLTEXT_REINDEX_LABELS.FORCE_HELPER_TEXT }}</p>
</ng-container>
<button mat-flat-button color="primary" type="submit" class="nxql-tab-container__button"
[ngClass]="{'video-renditions': isFeatureVideoRenditions()}" [disabled]="isSubmitBtnDisabled">
{{ templateLabels.submitBtnLabel }}
[ngClass]="{'video-renditions': isFeatureVideoRenditions() || isFeatureFullTextReindex()}"
[disabled]="isSubmitBtnDisabled">
{{ templateLabels.submitBtnLabel }}
</button>
<div class="nxql-tab-hint" [innerHTML]="nxqlQueryHintSanitized"></div>
<div class="spinner-overlay" *ngIf="spinnerVisible">
Expand Down
Loading
Loading