-
Notifications
You must be signed in to change notification settings - Fork 34
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
Editor: Rework update frequency dropdown #1097
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9456587
refactor: update updateFrequency model
fgravin 16e9702
refactor: update updateFrequency mapper for full codelist
fgravin 0be11ad
refactor: change updateFrequency dropdown list
fgravin a539c03
refactor: update wording for frequency planned label
AlitaBernachot 77b1d75
feat(update-frequency): add i18n
AlitaBernachot 779f72d
feat(update-frequency): add continual and periodic in dropdown list
AlitaBernachot 66bf1c7
chore: npm run format
AlitaBernachot 41fb864
fix: e2e first displayed value for frequency is now Continual
AlitaBernachot 41ff2a3
refactor: update i18n
AlitaBernachot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 0 additions & 67 deletions
67
libs/api/metadata-converter/src/lib/dcat-ap/utils/update-frequency.mapper.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 9 additions & 62 deletions
71
libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,14 @@ | ||
import { UpdateFrequency } from '@geonetwork-ui/common/domain/model/record' | ||
import { | ||
UpdateFrequency, | ||
UpdateFrequencyCode, | ||
updateFrequencyCodeValues, | ||
} from '@geonetwork-ui/common/domain/model/record' | ||
|
||
export function getUpdateFrequencyFromFrequencyCode( | ||
frequencyCode: string | ||
): UpdateFrequency { | ||
switch (frequencyCode) { | ||
case 'asNeeded': | ||
return 'asNeeded' | ||
case 'unknown': | ||
return 'unknown' | ||
case 'irregular': | ||
return 'irregular' | ||
case 'notPlanned': | ||
return 'notPlanned' | ||
case 'continual': | ||
return 'continual' | ||
case 'periodic': | ||
return 'periodic' | ||
case 'daily': | ||
return { | ||
updatedTimes: 1, | ||
per: 'day', | ||
} | ||
case 'weekly': | ||
return { | ||
updatedTimes: 1, | ||
per: 'week', | ||
} | ||
case 'fortnightly': | ||
return { | ||
updatedTimes: 0.5, | ||
per: 'week', | ||
} | ||
case 'semimonthly': | ||
return { | ||
updatedTimes: 2, | ||
per: 'month', | ||
} | ||
case 'monthly': | ||
return { | ||
updatedTimes: 1, | ||
per: 'month', | ||
} | ||
case 'quarterly': | ||
return { | ||
updatedTimes: 4, | ||
per: 'year', | ||
} | ||
case 'biannually': | ||
return { | ||
updatedTimes: 2, | ||
per: 'year', | ||
} | ||
case 'annually': | ||
return { | ||
updatedTimes: 1, | ||
per: 'year', | ||
} | ||
case 'biennially': | ||
return { | ||
updatedTimes: 0.5, | ||
per: 'year', | ||
} | ||
default: | ||
return null | ||
} | ||
return frequencyCode && | ||
updateFrequencyCodeValues.includes(frequencyCode as UpdateFrequencyCode) | ||
? (frequencyCode as UpdateFrequencyCode) | ||
: null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 i am missing something but i don't really understand the purpose of this function, is it only to output the frequency as a string? + it is missing the default case returning null.
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.
Yes it seems useless now, maybe because you changed the way frequency code is handled. Dunno
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 didn't change anything regarding the frequency code handling, i have just allowed 2 more options to be displayed in the dropdown list.