Skip to content
Open
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 @@ -59,6 +59,11 @@
{{ 'button.goToObject' | translate }}
</button>
}
@if (canSwitchToMetacheck(selectedBatch)) {
<button mat-stroked-button (click)="onSwitchToMetacheck()">
{{ 'button.switchToMetacheck' | translate }}
</button>
}
@if (selectedBatch && (selectedBatch.state === 'EXPORT_FAILED' || selectedBatch.state === 'STOPPED') && isExportProfile(selectedBatch.profile)) {
<button mat-stroked-button (click)="onReexport()">
{{ 'button.reexport' | translate }}
Expand Down
26 changes: 26 additions & 0 deletions src/app/pages/process-management/process-management.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,32 @@ export class ProcessManagementComponent {
this.router.navigate(['/repository', this.selectedBatch.parentPid]);
}

canSwitchToMetacheck(batch: Batch) {
return batch && this.totalSelected() === 1 && batch.state === 'EXTERNAL_EDITING' && batch.profile === 'profile.metacheck_import';
}

onSwitchToMetacheck() {
if (!this.canSwitchToMetacheck(this.selectedBatch)) {
return;
}

this.api.getMetaCheckUrl(this.selectedBatch.id).subscribe((response: any) => {
if (response.response.errors) {
this.ui.showErrorDialogFromObject(response.response.errors);
return;
}

const data = response.response.data;
const url = Array.isArray(data) ? (data[0]?.url || data[0]) : (data?.url || data);
if (!url) {
this.ui.showErrorDialogFromString('MetaCheck URL nebyla vrácena.');
return;
}

window.open(url, '_blank');
});
}

onReexport() {
this.api.reExportBatch(this.selectedBatch.id).subscribe((response: any) => {
if (response.response.errors) {
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,10 @@ export class ApiService {
return this.post('import/batchStopped', data);
}

getMetaCheckUrl(id: number): Observable<any> {
return this.get('import/batch/metacheckUrl', { id: id });
}

deleteBatch(id: number): Observable<any> {
return this.delete('import/batch?id=' + id);
}
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/cs-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2687,6 +2687,7 @@
"showLoadingQueue": "Zobrazit frontu načítání",
"reload": "Načíst znovu",
"goToObject": "Přejít na objekt",
"switchToMetacheck": "Do MetaChecku",
"backToTheListOfAllProcesses": "Zpět na seznam všech procesů",
"addReference": "Přidat seznam použité literatury",
"filter": "Filtrovat",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,7 @@
"showLoadingQueue": "Zobrazit frontu načítání",
"reload": "Načíst znovu",
"goToObject": "Přejít na objekt",
"switchToMetacheck": "Do MetaChecku",
"backToTheListOfAllProcesses": "Zpět na seznam všech procesů",
"addReference": "Přidat seznam použité literatury",
"filter": "Filtrovat",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2653,6 +2653,7 @@
"showLoadingQueue": "Show loading queue",
"reload": "Reload",
"goToObject": "Go to object",
"switchToMetacheck": "To MetaCheck",
"backToTheListOfAllProcesses": "Back to the list of all processes",
"addReference": "Add references",
"filter": "Filter",
Expand Down