Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lists): fix lists functionality that broke due to js-lib changes (DEV-273) #599

Merged
merged 1 commit into from Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -33,7 +33,7 @@
"@angular/platform-browser-dynamic": "^12.2.13",
"@angular/router": "^12.2.13",
"@ckeditor/ckeditor5-angular": "^2.0.2",
"@dasch-swiss/dsp-js": "^4.2.0",
"@dasch-swiss/dsp-js": "^5.0.0",
"@datadog/browser-rum": "^3.7.0",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "5.0.0",
Expand Down
Expand Up @@ -73,15 +73,17 @@ export class EditListItemComponent implements OnInit {
ngOnInit(): void {
this.loading = true;

// get the project data from cache
this._cache.get(this.projectCode).subscribe(
(response: ReadProject) => {
this.projectIri = response.id;
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
}
);
// get the project iri from cache if the project code was provided
if (this.projectCode) {
this._cache.get(this.projectCode).subscribe(
(response: ReadProject) => {
this.projectIri = response.id;
},
(error: ApiResponseError) => {
this._errorHandler.showMessage(error);
}
);
}

// if updating a node, get the existing node info
if (this.mode === 'update') {
Expand Down Expand Up @@ -157,7 +159,7 @@ export class EditListItemComponent implements OnInit {
childNodeUpdateData.projectIri = this.projectIri;
childNodeUpdateData.listIri = this.iri;
childNodeUpdateData.labels = this.labels;
childNodeUpdateData.comments = this.comments.length > 0 ? this.comments : [];
childNodeUpdateData.comments = this.comments.length > 0 ? this.comments : undefined;

this._dspApiConnection.admin.listsEndpoint.updateChildNode(childNodeUpdateData).subscribe(
(response: ApiResponseData<ChildNodeInfoResponse>) => {
Expand All @@ -181,7 +183,7 @@ export class EditListItemComponent implements OnInit {
createChildNodeRequest.name = this.projectCode + '-' + Math.random().toString(36).substr(2) + Math.random().toString(36).substr(2);
createChildNodeRequest.parentNodeIri = this.parentIri;
createChildNodeRequest.labels = this.labels;
createChildNodeRequest.comments = this.comments.length > 0 ? this.comments : [];
createChildNodeRequest.comments = this.comments.length > 0 ? this.comments : undefined;
createChildNodeRequest.projectIri = this.projectIri;
createChildNodeRequest.position = this.position;

Expand Down
Expand Up @@ -157,7 +157,7 @@ export class ListItemFormComponent implements OnInit {
childNode.labels[i].value = l.value;
i++;
}
childNode.comments = []; // --> TODO comments are not yet implemented in the template
// childNode.comments = []; // --> TODO comments are not yet implemented in the template

// init data to emit to parent
const listNodeOperation: ListNodeOperation = new ListNodeOperation();
Expand Down