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

List Value Component #37

Merged
merged 24 commits into from
Apr 2, 2020
Merged

List Value Component #37

merged 24 commits into from
Apr 2, 2020

Conversation

SepidehAlassi
Copy link
Contributor

@SepidehAlassi SepidehAlassi commented Mar 3, 2020

To display the value:

  • display list node labels as nested menus

To edit the value:

  • edit list value as a List node

  • display the nodes of the root node in a nested drop-down menu

  • get the list node selected by the user and assign it to the object of list node property

  • edit comment value

  • cancel edit

test:

  • test display

  • test edit

  • test sublist component

closes #15

@SepidehAlassi SepidehAlassi self-assigned this Mar 3, 2020
@SepidehAlassi SepidehAlassi removed the request for review from tobiasschweizer March 12, 2020 17:20
@SepidehAlassi
Copy link
Contributor Author

@tobiasschweizer I just noticed that this PR has problems with the creation of list value. So please do not review it for now.

I vaguely remember that all list nodes of a project were supposed to share a root node, is that correct? I could not find anything in that regard in knora documentation.

I know that from the lists endpoint of api-js-lib one can get a list with its root node IRI.
Now, to create a list value, I need to first find this IRI. That would require a gravsearch for a listnode with (isRootNode == true).

My question is, should I proceed with such a gravsearch or is there a function in api-js-lib that I miss which can already return the root node?

@tobiasschweizer
Copy link
Contributor

@tobiasschweizer I just noticed that this PR has problems with the creation of list value. So please do not review it for now.

I vaguely remember that all list nodes of a project were supposed to share a root node, is that correct? I could not find anything in that regard in knora documentation.

I know that from the lists endpoint of api-js-lib one can get a list with its root node IRI.
Now, to create a list value, I need to first find this IRI. That would require a gravsearch for a listnode with (isRootNode == true).

My question is, should I proceed with such a gravsearch or is there a function in api-js-lib that I miss which can already return the root node?

I think much like in the case of link values, you should find the info in the ontology:

http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem: ResourcePropertyDefinition
id: "http://0.0.0.0:3333/ontology/0001/anything/v2#hasListItem"
subPropertyOf: ["http://api.knora.org/ontology/knora-api/v2#hasValue"]
comment: undefined
label: "Listenelement"
guiElement: "http://api.knora.org/ontology/salsah-gui/v2#List"
subjectType: "http://0.0.0.0:3333/ontology/0001/anything/v2#Thing"
objectType: "http://api.knora.org/ontology/knora-api/v2#ListValue"
isLinkProperty: false
isLinkValueProperty: false
isEditable: true
guiAttributes: ["hlist=http://rdfh.ch/lists/0001/treeList"]

guiAttributes contain the Iri of the root node, so you can the whole list with knora-api-js-lib: v2.list.getList https://dasch-swiss.github.io/knora-api-js-lib/classes/_api_v2_list_lists_endpoint_.listsendpoint.html#getlist

@tobiasschweizer
Copy link
Contributor

I might wanna add a cache for whole lists (currently there is just a cache for list nodes). Actually this should be combined but it is kind of tricky ...

@SepidehAlassi
Copy link
Contributor Author

@tobiasschweizer I believe this PR is ready to be reviewed.

# Resolved Conflicts:
#	projects/knora-ui/src/lib/viewer/operations/display-edit/display-edit.component.html
#	projects/knora-ui/src/lib/viewer/viewer.module.ts
#	src/app/app.component.ts
@SepidehAlassi SepidehAlassi requested a review from flavens March 30, 2020 12:59
Copy link
Collaborator

@flavens flavens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SepidehAlassi I suggest some small changes/updates:

  • in sublist-value.component.ts:
    • the selector name must be prefixed with "kui", e.g. kui-sublist-value (then do not forget to update the tag name in every html or spec files)
    • you should clean up the imports, there is one unused import
  • in list-value.component.ts:
    • l.50 the comment is not up-to-date ('initial link value label')
    • l.58 you should use const instead of let because the identifier 'rootNodeIri' is never reassigned

@SepidehAlassi
Copy link
Contributor Author

@flavens thank you for reviewing this PR Flavie.

@SepidehAlassi
Copy link
Contributor Author

@flavens I've applied your suggestions.

@flavens flavens self-requested a review April 2, 2020 15:08
@SepidehAlassi SepidehAlassi merged commit 3c7930c into master Apr 2, 2020
@SepidehAlassi SepidehAlassi deleted the wip/15-listValueComponent branch April 2, 2020 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Viewer Value Component: ListValueComponent
3 participants