-
Notifications
You must be signed in to change notification settings - Fork 4
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
DSP-759 Check if a Given Date Can Be Edited / Rename ValueTypeService to ValueService #214
Conversation
@mdelez This PR handles precision and era, but not the calendar. |
@mdelez sorry, too early to review: still missing the logic the prevents the editing button to show up (isReadonly) |
# Conflicts: # projects/dsp-ui/src/lib/viewer/values/date-value/date-value.component.ts
@mdelez Ok, now this PR is ready for review :-) I decided to move the logic to value type service since it is also used there. It seemed weird to me to use logic coming from a component in a service. |
isTextEditable(textValue: ReadTextValueAsXml): boolean { | ||
return textValue.mapping === 'http://rdfh.ch/standoff/mappings/StandardMapping'; | ||
} | ||
|
||
/** | ||
* Equality checks with constants below are TEMPORARY until component is implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdelez Maybe this comment should be adapted since there are also other reasons to make a value read-only. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it's strayed away from its initial purpose so the comment should be updated. Maybe something like "Determines if the editing the given value is supported"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this service can also be renamed? It's becoming more general and is now more of a place to add helpful functions for the value components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just left a few comments to discuss
isTextEditable(textValue: ReadTextValueAsXml): boolean { | ||
return textValue.mapping === 'http://rdfh.ch/standoff/mappings/StandardMapping'; | ||
} | ||
|
||
/** | ||
* Equality checks with constants below are TEMPORARY until component is implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it's strayed away from its initial purpose so the comment should be updated. Maybe something like "Determines if the editing the given value is supported"
isTextEditable(textValue: ReadTextValueAsXml): boolean { | ||
return textValue.mapping === 'http://rdfh.ch/standoff/mappings/StandardMapping'; | ||
} | ||
|
||
/** | ||
* Equality checks with constants below are TEMPORARY until component is implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this service can also be renamed? It's becoming more general and is now more of a place to add helpful functions for the value components
I adapted the comment and renamed the service in b918f64. I renamed the service to Do you know if this service is used directly somewhere (outside the lib)? If yes, usage would break with the next release. |
@@ -324,14 +322,11 @@ describe('DisplayEditComponent', () => { | |||
{ | |||
provide: MatDialogRef, | |||
useValue: {} | |||
}, | |||
ValueService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdelez I think there is no need to provide the service here since it is provided in root anyway.
Importing ReactiveFormsModule
fixes the injector problem with FormBuilder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, I am not really sure what the best way is. Maybe we should spend some time on https://dasch.myjetbrains.com/youtrack/issue/DSP-98
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently writing unit tests for the PR mentioned above and the imports/injections (in test host components) for the FormBuilder are quite confusing. I think we should spend some time on what exactly needs to be imported in the unit tests so that you don't get an injector error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an excellent idea. Maybe we could try to work on https://dasch.myjetbrains.com/youtrack/issue/DSP-98 soon.
* main: Update dependencies (#219) Create user service (#217) DSP-759 Check if a Given Date Can Be Edited (#214) DSP-920 Renaming default github branch to "main" (#216) DSP-881 - Value Component Base Class Changes (#210) chore (package.json): update dsp-js-lib and adapt assertions (#215) DSP-522 Refactor search panel style (#206) Wip/dsp 885 default gravsearch query (#211) # Conflicts: # Makefile ( DSP-987 ) Still a bug in expert search ( DSP-885 ) Expert search default/example Gravsearch query throws a 400 Bad Request error
resolves DSP-759
Note that this PR renames
ValueTypeService
toValueService
.