Skip to content

Commit

Permalink
Merge pull request #6 from dhlab-basel/ongoing-work
Browse files Browse the repository at this point in the history
Ongoing work
  • Loading branch information
lrosenth authored Nov 21, 2021
2 parents 2ac0542 + af72d2c commit 159c281
Show file tree
Hide file tree
Showing 9 changed files with 319 additions and 326 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "0826-wordweb-app",
"version": "2.10.15",
"version": "2.10.16",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</main>

<footer>
© 2019-2021 WordWeb | Made by WordWeb at DHLab | {{version}}
© 2019-2021 WordWeb | Made by WordWeb at DHLab (VT/LR) | v{{version}}
</footer>

</mat-sidenav-content>
Expand Down
65 changes: 28 additions & 37 deletions src/app/edit/edit-book/edit-book.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ export class EditBookComponent implements OnInit {

addGenre(genre?: { id: string; iri: string }): void {
const genres = this.getGenres();
if (genre?.iri === undefined) {
if (genre === undefined) {
genres.push(this.fb.group({genreIri: this.genreTypes[0].iri}));
this.data.genres.push({genreIri: this.genreTypes[0].iri});
this.valIds.genres.push({id: undefined, changed: false, toBeDeleted: false});
Expand Down Expand Up @@ -902,7 +902,7 @@ export class EditBookComponent implements OnInit {

addSubject(subject?: { id: string; iri: string }): void {
const subjects = this.getSubjects();
if (subject?.iri === undefined) {
if (subject === undefined) {
subjects.push(this.fb.group({subjectIri: this.subjectTypes[0].iri}));
this.data.subjects.push({subjectIri: this.subjectTypes[0].iri});
this.valIds.subjects.push({id: undefined, changed: false, toBeDeleted: false});
Expand Down Expand Up @@ -1139,49 +1139,34 @@ export class EditBookComponent implements OnInit {
case 'writtenBy':
this.form.value.writtenBy[index].writtenByName = res[0].label;
this.form.value.writtenBy[index].writtenByIri = res[0].id;
this.value.writtenBy = this.form.value.writtenBy;
break;
case 'lexias':
this.form.value.lexias[index].lexiaName = res[0].label;
this.form.value.lexias[index].lexiaIri = res[0].id;
this.value.lexias = this.form.value.lexias;
break;
case 'performedBy':
this.form.value.performedBy[index].performedByName = res[0].label;
this.form.value.performedBy[index].performedByIri = res[0].id;
this.value.performedBy = this.form.value.performedBy;
break;
case 'performedByActor':
this.form.value.performedByActor[index].performedByActorName = res[0].label;
this.form.value.performedByActor[index].performedByActorIri = res[0].id;
this.value.performedByActor = this.form.value.performedByActor;
break;
case 'performedIn':
this.form.value.performedIn[index].performedInName = res[0].label;
this.form.value.performedIn[index].performedInIri = res[0].id;
this.value.performedIn = this.form.value.performedIn;
break;
}
this.value = new BookData(
this.form.value.label,
this.form.value.internalId,
this.form.value.title,
this.form.value.creationDate,
this.form.value.edition,
this.form.value.genres,
this.form.value.language,
this.form.value.writtenBy,
this.form.value.comment,
this.form.value.extraInfo,
this.form.value.editionHist,
this.form.value.firstPerformance,
this.form.value.prefixTitle,
this.form.value.pubdate,
this.form.value.subjects,
this.form.value.lexias,
this.form.value.performedBy,
this.form.value.performedByActor,
this.form.value.performedIn
);
this.options = [];
}

_handleInput(what: string, index?: number): void {
console.log('_handleInput', what, index);
this.onChange(this.form.value);
switch (what) {
case 'label':
Expand Down Expand Up @@ -1435,22 +1420,28 @@ export class EditBookComponent implements OnInit {
this.working = true;
console.log('this.value:', this.value);
if (this.inData.bookIri === undefined) {
this.knoraService.createBook(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the passage object!', 'OK');
console.log('EditCompany.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
if (this.form.valid) {
this.knoraService.createBook(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the passage object!', 'OK');
console.log('EditCompany.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
} else {
this.snackBar.open('Invalid/incomplete data in form – Please check!',
'OK',
{duration: 10000});
this.working = false;
}
} else {
const obs: Array<Observable<string>> = [];

if (this.valIds.label.changed) {
const gaga: Observable<string> = this.knoraService.updateLabel(
this.resId,
Expand Down
56 changes: 26 additions & 30 deletions src/app/edit/edit-company/edit-company.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ export class EditCompanyComponent implements OnInit {

onTouched = () => {};

onSubmit() {

}

_handleLinkInput(what: string, index?: number): void {
switch(what) {
case 'members':
Expand Down Expand Up @@ -434,26 +438,12 @@ export class EditCompanyComponent implements OnInit {
case 'members':
this.form.value.members[index].memberName = res[0].label;
this.form.value.members[index].memberIri = res[0].id;
this.value = new CompanyData(
this.form.value.label,
this.form.value.title,
this.form.value.internalId,
this.form.value.extraInfo,
this.form.value.members,
this.form.value.lexias,
);
this.value.members = this.form.value.members;
break;
case 'lexias':
this.form.value.lexias[index].lexiaName = res[0].label;
this.form.value.lexias[index].lexiaIri = res[0].id;
this.value = new CompanyData(
this.form.value.label,
this.form.value.title,
this.form.value.internalId,
this.form.value.extraInfo,
this.form.value.members,
this.form.value.lexias,
);
this.value.lexias = this.form.value.lexias;
break;
}
this.options = [];
Expand Down Expand Up @@ -550,21 +540,27 @@ export class EditCompanyComponent implements OnInit {

save(): void {
this.working = true;
console.log('this.value:', this.value);
if (this.inData.companyIri === undefined) {
this.knoraService.createCompany(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the company object!', 'OK');
console.log('EditCompany.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
if (this.form.valid) {
this.knoraService.createCompany(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the company object!', 'OK');
console.log('EditCompany.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
} else {
this.snackBar.open('Invalid/incomplete data in form – Please check!',
'OK',
{duration: 10000});
this.working = false;
}
} else {
const obs: Array<Observable<string>> = [];

Expand Down
34 changes: 20 additions & 14 deletions src/app/edit/edit-lexia/edit-lexia.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,21 +525,27 @@ export class EditLexiaComponent implements OnInit {

save(): void {
this.working = true;
console.log('this.value:', this.value);
if (this.inData.lexiaIri === undefined) {
this.knoraService.createLexia(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the lexia object!', 'OK');
console.log('EditLexia.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
if (this.form.valid) {
this.knoraService.createLexia(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the lexia object!', 'OK');
console.log('EditLexia.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
} else {
this.snackBar.open('Invalid/incomplete data in form – Please check!',
'OK',
{duration: 10000});
this.working = false;
}
} else {
const obs: Array<Observable<string>> = [];

Expand Down
69 changes: 32 additions & 37 deletions src/app/edit/edit-passage/edit-passage.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ export class EditPassageComponent implements OnInit {

addFunctionVoice(functionVoice?: {id: string; iri: string }): void {
const functionVoices = this.getFunctionVoices();
if (functionVoice.iri === undefined) {
if (functionVoice === undefined) {
functionVoices.push(this.fb.group({functionVoiceIri: this.functionVoiceTypes[0].iri}));
this.data.functionVoices.push({functionVoiceIri: this.functionVoiceTypes[0].iri});
this.valIds.functionVoices.push({id: undefined, changed: false, toBeDeleted: false});
Expand All @@ -823,7 +823,7 @@ export class EditPassageComponent implements OnInit {

addMarking(marking?: {id: string; iri: string }): void {
const markings = this.getMarkings();
if (marking.iri === undefined) {
if (marking === undefined) {
markings.push(this.fb.group({markingIri: this.markingTypes[0].iri}));
this.data.markings.push({markingIri: this.markingTypes[0].iri});
this.valIds.markings.push({id: undefined, changed: false, toBeDeleted: false});
Expand Down Expand Up @@ -973,41 +973,30 @@ export class EditPassageComponent implements OnInit {
case 'occursIn':
this.form.value.occursInName = res[0].label;
this.form.value.occursInIri = res[0].id;
this.value.occursIn = {
occursInName: this.form.value.occursInName,
occursInIri: this.form.value.occursInIri
};
break;
case 'contributedBy':
this.form.value.contributedByName = res[0].label;
this.form.value.contributedByIri = res[0].id;
this.value.contributedBy = {
contributedByName: this.form.value.contributedByName,
contributedByIri: this.form.value.contributedByIri
};
break;
case 'contains':
this.form.value.contains[index].containsName = res[0].label;
this.form.value.contains[index].containsIri = res[0].id;
this.value.contains = this.form.value.contains;
break;
case 'mentionedIn':
this.form.value.mentionedIn[index].mentionedInName = res[0].label;
this.form.value.mentionedIn[index].mentionedInIri = res[0].id;
this.value.mentionedIn = this.form.value.mentionedIn;
break;
}
this.value = new PassageData(
this.form.value.label,
this.form.value.internalId,
this.form.value.displayedTitle,
this.form.value.functionVoices,
this.form.value.markings,
this.form.value.researchField,
this.form.value.status,
this.form.value.text,
{occursInName: this.form.value.occursInName, occursInIri: this.form.value.occursInIri},
{contributedByName: this.form.value.contributedByName, contributedByIri: this.form.value.contributedByIri},
this.form.value.contains,
this.form.value.internalComment,
this.form.value.page,
this.form.value.pageHist,
this.form.value.comment,
this.form.value.extraInfo,
this.form.value.prefixTitle,
this.form.value.textHist,
this.form.value.mentionedIn
);
this.options = [];
}

Expand Down Expand Up @@ -1235,21 +1224,27 @@ export class EditPassageComponent implements OnInit {

save(): void {
this.working = true;
console.log('this.value:', this.value);
if (this.inData.passageIri === undefined) {
this.knoraService.createPassage(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the passage object!', 'OK');
console.log('EditCompany.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
if (this.form.valid) {
this.knoraService.createPassage(this.value).subscribe(
res => {
console.log('CREATE_RESULT:', res);
this.working = false;
this.location.back();
},
error => {
this.snackBar.open('Error storing the passage object!', 'OK');
console.log('EditCompany.save(): ERROR', error);
this.working = false;
this.location.back();
}
);
} else {
this.snackBar.open('Invalid/incomplete data in form – Please check!',
'OK',
{duration: 10000});
this.working = false;
}
} else {
const obs: Array<Observable<string>> = [];

Expand Down
Loading

0 comments on commit 159c281

Please sign in to comment.