Update get tables feature
This commit is contained in:
parent
4c856671e7
commit
3fa7b364a6
@ -8,17 +8,25 @@
|
||||
{{ 'preferences-screen.form.auto-expand-filters-on-action' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
|
||||
<div class="iqser-input-group">
|
||||
<mat-slide-toggle color="primary" formControlName="displaySuggestionsInPreview">
|
||||
{{ 'preferences-screen.form.show-suggestions-in-preview' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
<div class="iqser-input-group" *allow="roles.getRss">
|
||||
|
||||
<div *allow="roles.getRss" class="iqser-input-group">
|
||||
<mat-slide-toggle color="primary" formControlName="openStructuredComponentManagementDialogByDefault">
|
||||
{{ 'preferences-screen.form.open-structured-view-by-default' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
|
||||
<div *allow="roles.getTables" class="iqser-input-group">
|
||||
<label [translate]="'preferences-screen.form.table-extraction-type'"></label>
|
||||
<input formControlName="tableExtractionType" />
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="currentScreen === screens.WARNING_PREFERENCES">
|
||||
<p class="warnings-subtitle">{{ 'preferences-screen.warnings-subtitle' | translate }}</p>
|
||||
<p class="warnings-description">{{ 'preferences-screen.warnings-description' | translate }}</p>
|
||||
|
||||
@ -11,6 +11,7 @@ interface PreferencesForm {
|
||||
autoExpandFiltersOnActions: boolean;
|
||||
displaySuggestionsInPreview: boolean;
|
||||
openStructuredComponentManagementDialogByDefault: boolean;
|
||||
tableExtractionType: string;
|
||||
// warnings preferences
|
||||
unapprovedSuggestionsWarning: boolean;
|
||||
loadAllAnnotationsWarning: boolean;
|
||||
@ -39,10 +40,10 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
readonly roles = Roles;
|
||||
|
||||
constructor(
|
||||
route: ActivatedRoute,
|
||||
readonly userPreferenceService: UserPreferenceService,
|
||||
private readonly _formBuilder: FormBuilder,
|
||||
private readonly _permissionsService: IqserPermissionsService,
|
||||
private readonly _route: ActivatedRoute,
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
private readonly _loadingService: LoadingService,
|
||||
) {
|
||||
@ -54,6 +55,7 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
openStructuredComponentManagementDialogByDefault: [
|
||||
this.userPreferenceService.getOpenStructuredComponentManagementDialogByDefault(),
|
||||
],
|
||||
tableExtractionType: [this.userPreferenceService.getTableExtractionType()],
|
||||
// warnings preferences
|
||||
unapprovedSuggestionsWarning: [this.userPreferenceService.getUnapprovedSuggestionsWarning()],
|
||||
loadAllAnnotationsWarning: [this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning)],
|
||||
@ -63,8 +65,12 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
this.form.disable();
|
||||
}
|
||||
|
||||
if (!this._permissionsService.has(Roles.getTables)) {
|
||||
this.form.controls.tableExtractionType.disable();
|
||||
}
|
||||
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
this.currentScreen = _route.snapshot.data.screen;
|
||||
this.currentScreen = route.snapshot.data.screen;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -88,6 +94,10 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
await this.userPreferenceService.toggleUnapprovedSuggestionsWarning();
|
||||
}
|
||||
|
||||
if (this.form.controls.tableExtractionType.value !== this.userPreferenceService.getTableExtractionType()) {
|
||||
await this.userPreferenceService.save(PreferencesKeys.tableExtractionType, this.form.controls.tableExtractionType.value);
|
||||
}
|
||||
|
||||
if (
|
||||
this.form.controls.loadAllAnnotationsWarning.value !==
|
||||
this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning)
|
||||
@ -111,6 +121,7 @@ export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
displaySuggestionsInPreview: this.userPreferenceService.getDisplaySuggestionsInPreview(),
|
||||
openStructuredComponentManagementDialogByDefault:
|
||||
this.userPreferenceService.getOpenStructuredComponentManagementDialogByDefault(),
|
||||
tableExtractionType: this.userPreferenceService.getTableExtractionType(),
|
||||
unapprovedSuggestionsWarning: this.userPreferenceService.getUnapprovedSuggestionsWarning(),
|
||||
loadAllAnnotationsWarning: this.userPreferenceService.getBool(PreferencesKeys.loadAllAnnotationsWarning),
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@ import { inject, Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { log } from '@common-ui/utils';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
|
||||
export interface BoundingBox {
|
||||
readonly x: number;
|
||||
@ -32,15 +32,12 @@ export class TablesService {
|
||||
readonly #http = inject(HttpClient);
|
||||
readonly #serviceName = 'table-provider';
|
||||
readonly #defaultUrl = 'tables';
|
||||
readonly #userPreferencesService = inject(UserPreferenceService);
|
||||
|
||||
get(dossierId: string, fileId: string, pageNumber: number) {
|
||||
const url = `/${this.#serviceName}/${encodeURI(this.#defaultUrl)}/${dossierId}/${fileId}`;
|
||||
const request$ = this.#http.post<Response>(url, { pageNumber, tableExtractionType: 'STABLE' });
|
||||
return firstValueFrom(
|
||||
request$.pipe(
|
||||
map(response => response.tables),
|
||||
log('TablesService.get'),
|
||||
),
|
||||
);
|
||||
const body = { pageNumber, tableExtractionType: this.#userPreferencesService.getTableExtractionType() };
|
||||
const request$ = this.#http.post<Response>(url, body);
|
||||
return firstValueFrom(request$.pipe(map(response => response.tables)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ export const PreferencesKeys = {
|
||||
unapprovedSuggestionsWarning: 'Unapproved-Suggestions-Warning',
|
||||
loadAllAnnotationsWarning: 'Load-All-Annotations-Warning',
|
||||
openStructuredComponentManagementDialogByDefault: 'Open-Structured-Component-Management-By-Default',
|
||||
tableExtractionType: 'Table-Extraction-Type',
|
||||
} as const;
|
||||
|
||||
@Injectable({
|
||||
@ -92,4 +93,8 @@ export class UserPreferenceService extends IqserUserPreferenceService {
|
||||
async saveFilesListingMode(listingMode: ListingMode): Promise<void> {
|
||||
await this.save(PreferencesKeys.filesListingMode, listingMode);
|
||||
}
|
||||
|
||||
getTableExtractionType() {
|
||||
return this._getAttribute(PreferencesKeys.tableExtractionType, 'EXPERIMENTAL_IF_MISSING');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"ADMIN_CONTACT_NAME": null,
|
||||
"ADMIN_CONTACT_URL": null,
|
||||
"API_URL": "https://dan.iqser.cloud",
|
||||
"API_URL": "https://dom1.iqser.cloud",
|
||||
"APP_NAME": "RedactManager",
|
||||
"IS_DOCUMINE": false,
|
||||
"AUTO_READ_TIME": 3,
|
||||
@ -12,7 +12,7 @@
|
||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"OAUTH_IDP_HINT": null,
|
||||
"OAUTH_URL": "https://dan.iqser.cloud/auth",
|
||||
"OAUTH_URL": "https://dom1.iqser.cloud/auth",
|
||||
"RECENT_PERIOD_IN_HOURS": 24,
|
||||
"SELECTION_MODE": "structural",
|
||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||
|
||||
@ -1951,6 +1951,7 @@
|
||||
"load-all-annotations-warning": "",
|
||||
"open-structured-view-by-default": "",
|
||||
"show-suggestions-in-preview": "",
|
||||
"table-extraction-type": "",
|
||||
"unapproved-suggestions-warning": ""
|
||||
},
|
||||
"label": "",
|
||||
|
||||
@ -1951,6 +1951,7 @@
|
||||
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
|
||||
"open-structured-view-by-default": "Display structured component management modal by default",
|
||||
"show-suggestions-in-preview": "Display suggestions in document preview",
|
||||
"table-extraction-type": "Table extraction type",
|
||||
"unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode"
|
||||
},
|
||||
"label": "Preferences",
|
||||
|
||||
@ -1951,6 +1951,7 @@
|
||||
"load-all-annotations-warning": "",
|
||||
"open-structured-view-by-default": "",
|
||||
"show-suggestions-in-preview": "",
|
||||
"table-extraction-type": "",
|
||||
"unapproved-suggestions-warning": ""
|
||||
},
|
||||
"label": "",
|
||||
|
||||
@ -1951,6 +1951,7 @@
|
||||
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
|
||||
"open-structured-view-by-default": "Display Component View by default when opening a document",
|
||||
"show-suggestions-in-preview": "Display suggestions in document preview",
|
||||
"table-extraction-type": "Table extraction type",
|
||||
"unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode"
|
||||
},
|
||||
"label": "Preferences",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user