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

Premade list of intervals for durations #1473

Merged
merged 22 commits into from
Feb 28, 2025

Conversation

travjenkins
Copy link
Member

@travjenkins travjenkins commented Feb 24, 2025

Issues

#1467

Changes

1467

  • Add a new renderer the shows for items with a type of duration

Tests

Manually tested

  • scenarios you manually tested

Automated tests

  • unit testing covered

Playwright tests ran locally

  • Admin
  • Captures
  • Collections
  • HomePage
  • Login
  • Materialization

Screenshots

Fills in default initially and after clicking clear button

image

image

Default value of something like PT5M will match the option correctly

image

Can enter a full 8601 duration

image

@travjenkins
Copy link
Member Author

travjenkins commented Feb 24, 2025

These were the connectors I found

./install-connector-local.sh ghcr.io/estuary/materialize-s3-parquet dev
./install-connector-local.sh ghcr.io/estuary/source-alpaca dev
./install-connector-local.sh ghcr.io/estuary/source-mongodb dev
./install-connector-local.sh ghcr.io/estuary/source-cosmosdb-mongodb dev
./install-connector-local.sh ghcr.io/estuary/source-bigquery-batch dev
./install-connector-local.sh ghcr.io/estuary/source-oracle-flashback dev
./install-connector-local.sh ghcr.io/estuary/source-postgres-batch dev
./install-connector-local.sh ghcr.io/estuary/source-mysql-batch dev
./install-connector-local.sh ghcr.io/estuary/source-netsuite-v2 dev
./install-connector-local.sh ghcr.io/estuary/source-redshift-batch dev
./install-connector-local.sh ghcr.io/estuary/materialize-s3-csv dev
./install-connector-local.sh ghcr.io/estuary/materialize-gcs-parquet dev
./install-connector-local.sh ghcr.io/estuary/materialize-gcs-csv dev
./install-connector-local.sh ghcr.io/estuary/materialize-s3-iceberg dev
./install-connector-local.sh ghcr.io/estuary/source-singlestore-batch dev
./install-connector-local.sh ghcr.io/estuary/source-amazon-documentdb dev
./install-connector-local.sh ghcr.io/estuary/source-oracle-batch dev

A lot of them did not have type='duration' so the ones I tested are:
source-oracle-flashback
materialize-s3-iceberg

running:

select c.image_name
FROM connectors c JOIN connector_tags ct ON c.id = ct.connector_id
where ct.endpoint_spec_schema::text like '%duration%'

Copy link
Member Author

Choose a reason for hiding this comment

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

Something I noticed - so just calling out so it is not forgotten

Comment on lines 70 to 83
const inputRef = useRef<any | null>(null);
const position = useRef({
beforeStart: 0,
beforeEnd: 0,
});
useLayoutEffect(() => {
// Make sure the cursor stays where we want it
inputRef.current
?.querySelector?.('input')
.setSelectionRange?.(
position.current.beforeStart,
position.current.beforeEnd
);
}, [inputValue]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are uppercasing what is typed in we need to handle the cursor moving to the end of the string while typing lower case letters.

@@ -651,6 +654,8 @@ const generateUISchema = (
addOption(controlObject, Options.format, Formats.date);
} else if (schemaHasFormat('time', jsonSchema)) {
addOption(controlObject, Options.format, Formats.time);
} else if (schemaHasFormat('duration', jsonSchema)) {
jsonSchema.pattern ??= ISO_8601_DURATION_PATTERN;
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to toss on the pattern to get validation working

Copy link
Member Author

Choose a reason for hiding this comment

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

This has a fair amount of weirdness - but I won't call it out with GitHub comments as I worked as much detail into the code comments as I could.

@travjenkins travjenkins changed the title Premade list of intervals for configs Premade list of intervals for durations Feb 26, 2025
@travjenkins travjenkins marked this pull request as ready for review February 26, 2025 17:26
@travjenkins travjenkins requested a review from a team as a code owner February 26, 2025 17:26
@travjenkins travjenkins added the change:planned This is a planned change label Feb 26, 2025
@travjenkins travjenkins merged commit 748effc into main Feb 28, 2025
3 checks passed
@travjenkins travjenkins deleted the travjenkins/feature/add-premade-list-of-time-formats branch February 28, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:planned This is a planned change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants