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

Prepopulate date #2121

Merged
merged 16 commits into from
Mar 25, 2021
Merged

Prepopulate date #2121

merged 16 commits into from
Mar 25, 2021

Conversation

fiskus
Copy link
Member

@fiskus fiskus commented Mar 22, 2021

Treat pre-population of dates as an extension for pre-population of defaults.

When schema has default keyword, its value is used instead of undefined.
When schema has { format: 'date', dateformat: 'yyyy-MM-dd' }, the current date is used instead of undefined.

Implementation:

  • Add visual placeholders for defaults and dates
  • Prepopulate defaults and default dates on metadata submit

Additional work:

  • Convert json-schema.js to Typescript
  • Replace Ajv({ useDefaults: true }) with custom implementation because we need to assign dates too

Besides type conversion I added functions scanSchemaAndPrefillValues, getDefaultValue and replaced makeSchemaDefaultsSetter

  • Unit tests
  • Automated tests (e.g. Preflight)
  • Documentation
    • JavaScript: basic explanation and screenshot of new features
  • Changelog entry

@codecov
Copy link

codecov bot commented Mar 22, 2021

Codecov Report

Merging #2121 (60e67ca) into master (93d30c9) will increase coverage by 0.03%.
The diff coverage is 55.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2121      +/-   ##
==========================================
+ Coverage   46.16%   46.20%   +0.03%     
==========================================
  Files         429      429              
  Lines       20458    20487      +29     
  Branches     2385     2413      +28     
==========================================
+ Hits         9445     9465      +20     
- Misses      10049    10062      +13     
+ Partials      964      960       -4     
Flag Coverage Δ
api-python 89.69% <ø> (ø)
catalog 16.28% <55.85%> (+0.12%) ⬆️
lambda 92.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
catalog/app/utils/json-schema/json-schema.ts 53.00% <53.00%> (ø)
catalog/app/components/JsonEditor/State.js 53.93% <75.00%> (+0.48%) ⬆️
.../containers/Bucket/PackageDialog/PackageDialog.tsx 26.42% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93d30c9...60e67ca. Read the comment docs.

@fiskus fiskus marked this pull request as ready for review March 23, 2021 12:48
@fiskus fiskus requested a review from nl0 March 23, 2021 12:50
Copy link
Member

@nl0 nl0 left a comment

Choose a reason for hiding this comment

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

looks good, some minor comments inline

catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
catalog/app/utils/json-schema/json-schema.ts Outdated Show resolved Hide resolved
@fiskus fiskus merged commit 2dcc5c9 into master Mar 25, 2021
@fiskus fiskus deleted the prepopulate-date branch March 25, 2021 06:01
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.

2 participants