Skip to content

Commit

Permalink
Issues #128, #131
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny committed Aug 8, 2024
1 parent b085d5f commit 5c50c1d
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 31 deletions.
9 changes: 5 additions & 4 deletions src/app/dialogs/run-import/run-import.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ <h2 mat-dialog-title>{{ 'modal.startImport.title' | translate }}</h2>
</mat-select>
</mat-form-field>

<mat-checkbox [disableRipple]="true" [(ngModel)]="scheduleIndexation" color="primary" class="app-mr-4">{{ 'desc.scheduleSubsequentIndexing' | translate }}</mat-checkbox>
<mat-checkbox [disableRipple]="true" [(ngModel)]="scheduleIndexation" (ngModelChange)="onScheduleIndexationChange($event)" color="primary" class="app-mr-4">{{ 'desc.scheduleSubsequentIndexing' | translate }}</mat-checkbox>

<ng-container *ngIf="type == 'ndk'">
<mat-checkbox [disableRipple]="true" *ngIf="type == 'ndk'" [(ngModel)]="ndkIIPServer" color="primary">{{ 'desc.useIipServer' | translate }}</mat-checkbox>
</ng-container>
<mat-checkbox [disableRipple]="true" [(ngModel)]="addCollection" color="primary" class="app-mr-4">{{ 'desc.addToCollections' | translate }}</mat-checkbox>
<mat-checkbox [disableRipple]="true" [(ngModel)]="addCollection" [disabled]="!scheduleIndexation" (ngModelChange)="onSelectCollectionChange($event)" color="primary" class="app-mr-4">{{ 'desc.addToCollections' | translate }}</mat-checkbox>

<mat-form-field *ngIf="addCollection" appearance="fill" class="app-w-100 app-mt-4">
<mat-form-field *ngIf="addCollection && scheduleIndexation" appearance="fill" class="app-w-100 app-mt-4">
<mat-label>{{ 'desc.selectCollection' | translate }}</mat-label>
<mat-select>
<mat-select [(ngModel)]="selectedCollection" >
<mat-option *ngFor="let collection of allCollections" [value]="collection">
{{ name(collection) }}
</mat-option>
Expand Down
35 changes: 16 additions & 19 deletions src/app/dialogs/run-import/run-import.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,9 @@ export class RunImportComponent implements OnInit {



// /** collection prefix search */
// collectionPrefixSearch:string='';

// /** collection table - rows */
// collecitonRows:number = 5;
// /** collection table - page */
// collectionPage:number = 0;
// // searching
// subject: Subject<string> = new Subject();

// displayedColumns: string[] = ['select', 'title'];

// numFound:number = 0;

selectedCollection:Collection;
allCollections:Collection[];

//selection = new SelectionModel<any>(true, []);

/** Selected licences */
selectedLicense:License;
licenses:License[];
Expand Down Expand Up @@ -109,6 +93,20 @@ export class RunImportComponent implements OnInit {
return retval;
}

onScheduleIndexationChange(isChecked: boolean) {
this.scheduleIndexation = isChecked;
if (!isChecked) {
this.addCollection = false;
}
}

onSelectCollectionChange(isChecked: boolean) {
this.addCollection = isChecked;
if (!isChecked) {
this.selectedCollection = null;
}
}

collectionsReload() {
this.clientApi.getCollections(1000, 0, false, '', 'created', 'asc').subscribe((res) => {
this.allCollections = res["docs"].map((d)=> {
Expand Down Expand Up @@ -156,13 +154,12 @@ export class RunImportComponent implements OnInit {

scheduleProcess() {
const data = {
selectedLicense: this.selectedLicense ? this.selectedLicense : "-none-",
selectedLicense: this.selectedLicense,
scheduleIndexation: this.scheduleIndexation,
ndkIIPServer: this.ndkIIPServer,
collections: this.selectedCollection ? [this.selectedCollection?.id] : []
selectedCollection: this.selectedCollection?.id
};
this.dialogRef.close(data);
}


}
20 changes: 13 additions & 7 deletions src/app/pages/import/import.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class ImportComponent implements OnInit {
inputDirError = {};

selectedLicense:License;
selectedCollection:string;
licenses:License[];

errorState: boolean = false;
Expand Down Expand Up @@ -130,6 +131,7 @@ export class ImportComponent implements OnInit {

if (result) {
this.selectedLicense = result.selectedLicense;
this.selectedCollection = result.selectedCollection;
this.scheduleIndexations = result.scheduleIndexation;
this.ndkIIPServer = result.ndkIIPServer;
if (this.type == 'foxml') {
Expand All @@ -146,12 +148,15 @@ export class ImportComponent implements OnInit {
policy: 'PRIVATE',
inputDataDir: this.imports.selectedTree.getFullPath(),
startIndexer: this.scheduleIndexations,
useIIPServer: this.ndkIIPServer
useIIPServer: this.ndkIIPServer,
};

if (this.selectedLicense) {
p['license'] = this.selectedLicense.name;
}
if(this.selectedCollection) {
p['collections'] = this.selectedLicense.name;
}
this.api.scheduleProcess({
defid: 'convert_and_import',
params: p
Expand All @@ -170,14 +175,15 @@ export class ImportComponent implements OnInit {
params: {
inputDataDir: this.imports.selectedTree.getFullPath(),
startIndexer: this.scheduleIndexations,
license: this.selectedLicense?.name
license: this.selectedLicense?.name,
collections: this.selectedCollection
}
}).subscribe(response => {
if (this.selectedLicense) {
this.ui.showInfoSnackBar("scheduleApplyLicenseAndImportProcess");
} else {
this.ui.showInfoSnackBar('snackbar.success.scheduleImportProcess');
}
this.ui.showInfoSnackBar('snackbar.success.scheduleImportProcess');
// if (this.selectedLicense) {
// this.ui.showInfoSnackBar("scheduleApplyLicenseAndImportProcess");
// } else {
// }
}, error => {
this.ui.showInfoSnackBar('snackbar.error.scheduleImportProcess');
console.log(error);
Expand Down
8 changes: 7 additions & 1 deletion src/app/pages/processes/processes.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@
<a *ngIf="!!dateTo" mat-icon-button [matTooltip]="'button.deselect' | translate" (click)="dateTo=undefined;onFiltersChanged()" [disabled]="isLoading()" class="app-clear-filter">
<mat-icon>cancel</mat-icon>
</a>


<!--
<mat-checkbox [(ngModel)]="autoReload" (change)="onAutoReloadChange($event)">Auto Reload</mat-checkbox>
-->

<button mat-icon-button [matTooltip]="'button.reloadProcesses' | translate" (click)="reloadProcesses()" [disabled]="isLoading()">
<mat-icon>refresh</mat-icon>
</button>

<mat-checkbox [(ngModel)]="autoReload" (change)="onAutoReloadChange($event)" [disabled]="isLoading()">{{ 'button.autoRefresProcesses' | translate }}</mat-checkbox>
</div>
<div>
<button mat-flat-button (click)="onCancelScheduledProcesses()" color="primary" [disabled]="isLoading() || batches_planned.length == 0">
Expand Down
Loading

0 comments on commit 5c50c1d

Please sign in to comment.