<hr *ngIf="idx > 0"/>
<div class="row mb-2">
<div class="col-lg-3 font-weight-bold" i18n>Rule Setup</div>
- <div class="col-lg-3 font-weight-bold" i18n>Data</div>
- <div class="col-lg-6 font-weight-bold" i18n>Help</div>
+ <div class="col-lg-4 font-weight-bold" i18n>Data</div>
+ <div class="col-lg-5 font-weight-bold" i18n>Help</div>
</div>
<div class="row mb-2">
<div class="col-lg-3" i18n>Action (Rule Type)</div>
- <div class="col-lg-3">
+ <div class="col-lg-4">
<select class="form-control" [(ngModel)]="rule.ruleType"
(change)="rulesetToRecord()">
<option value='r' i18n>Replace</option>
<option value='d' i18n>Delete</option>
</select>
</div>
- <div class="col-lg-6" i18n>How to change the existing record.</div>
+ <div class="col-lg-5" i18n>How to change the existing record.</div>
</div>
<div class="row mb-2">
<div class="col-lg-3" i18n>MARC Tag</div>
- <div class="col-lg-3">
- <input type="text" class="form-control"
+ <div class="col-lg-4">
+ <input type="text" class="form-control" maxlength="3"
(change)="rulesetToRecord(true)" [(ngModel)]="rule.marcTag"/>
</div>
- <div class="col-lg-6" i18n>
+ <div class="col-lg-5" i18n>
Three characters, no spaces, no indicators, etc. eg: 245
</div>
</div>
<div class="row mb-2">
<div class="col-lg-3" i18n>Subfields (optional)</div>
- <div class="col-lg-3">
+ <div class="col-lg-4">
<input type="text" class="form-control"
(change)="rulesetToRecord(true)" [(ngModel)]="rule.marcSubfields"/>
</div>
- <div class="col-lg-6" i18n>No spaces, no delimiters, eg: abcnp</div>
+ <div class="col-lg-5" i18n>No spaces, no delimiters, eg: abcnp</div>
</div>
<div class="row mb-2">
<div class="col-lg-3" i18n>MARC Data</div>
- <div class="col-lg-3">
+ <div class="col-lg-4">
<input type="text" class="form-control"
(change)="rulesetToRecord()" [(ngModel)]="rule.marcData"/>
</div>
- <div class="col-lg-6" i18n>
+ <div class="col-lg-5" i18n>
MARC-Breaker formatted data with indicators and subfield delimiters,
eg: 245 04$aThe End
</div>
</div>
<div class="row mb-2">
<div class="col-lg-3" i18n>Subfield</div>
- <div class="col-lg-3">
+ <div class="col-lg-4">
<input type="text" class="form-control"
(change)="rulesetToRecord()" [(ngModel)]="rule.advSubfield"/>
</div>
- <div class="col-lg-6" i18n>
+ <div class="col-lg-5" i18n>
A single subfield code, no delimiters, eg: a
</div>
</div>
<div class="row mb-2">
<div class="col-lg-3" i18n>Expression</div>
- <div class="col-lg-3">
+ <div class="col-lg-4">
<input type="text" class="form-control"
(change)="rulesetToRecord()" [(ngModel)]="rule.advRegex"/>
</div>
- <div class="col-lg-6" i18n>
+ <div class="col-lg-5" i18n>
See the
- <a href="https://perldoc.perl.org/perlre.html#Regular-Expressions">
+ <a target="_blank"
+ href="https://perldoc.perl.org/perlre.html#Regular-Expressions">
Perl documentation
</a> for an explanation of Regular Expressions.
</div>
<div class="col-lg-5">
<div class="row pb-2 pt-2 border">
<div class="col-lg-12">
- <div i18n>Update Template Preview</div>
+ <div class="font-weight-bold" i18n>Template Preview</div>
<div>
<textarea class="form-control" [ngModel]="breaker()"
disabled rows="{{breakerRows()}}"></textarea>
<button class="btn btn-outline-dark" (click)="process()" i18n>Go!</button>
</div>
</div>
- <div class="row mt-2 p-2">
+ <div class="row mt-2 p-2" *ngIf="processing">
+ <div class="col-lg-10 offset-lg-1">
+ <eg-progress-inline [max]="progressMax" [value]="progressValue">
+ </eg-progress-inline>
+ </div>
</div>
</div>
</div>
-import {Component, OnInit, AfterViewInit, ViewChild, Renderer2} from '@angular/core';
+import {Component, OnInit, ViewChild, Renderer2} from '@angular/core';
import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {tap} from 'rxjs/operators';
import {NetService} from '@eg/core/net.service';
@Component({
templateUrl: 'marcbatch.component.html'
})
-export class MarcBatchComponent implements OnInit, AfterViewInit {
+export class MarcBatchComponent implements OnInit {
session: string;
source: 'bucket' | 'csv' | 'id' = 'bucket';
templateRules: TemplateRule[] = [];
record: MarcRecord;
+ processing = false;
+ progressMax: number = null;
+ progressValue: number = null;
+
constructor(
private router: Router,
private route: ActivatedRoute,
let ruleText = rule.marcTag + (rule.marcSubfields || '');
if (rule.advSubfield) {
- ruleText += `[${rule.advSubfield} ~ ${rule.advRegex}]`;
+ ruleText +=
+ `[${rule.advSubfield || ''} ~ ${rule.advRegex || ''}]`;
}
// Merge behavior is encoded in the 905 field.
this.selectedFile = $event.target.files[0];
}
- ngAfterViewInit() {}
+
+ process() {
+ this.processing = true;
+ this.postForm()
+ .then(_ => this.pollProgress())
+ .then(_ => this.processing = false);
+ }
+
+ postForm(): Promise<any> {
+ return Promise.resolve();
+ }
+
+ pollProgress(): Promise<any> {
+ return Promise.resolve();
+ }
}