Skip to content

Commit

Permalink
chore(lists): adds changes required for lists to work due to the chan…
Browse files Browse the repository at this point in the history
…ge in js-lib (#599)
  • Loading branch information
mdelez committed Dec 1, 2021
1 parent faebe3e commit ca83584
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
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

0 comments on commit ca83584

Please sign in to comment.