Conversation
There was a problem hiding this comment.
Let's send the Enum value from the backend (main/graphql/enums.py) and use that instead of creating a separate enum on the client side. We can then receive and use it in the EnumContext. We should add custom panoramax option to StreetImageProviderNameEnum and only add url field to the custom option.
To summarize, let's change following in the backend
- In StreetImageProvider
- Add PANORAMAX_CUSTOM option
- Add pydantic validation to the StreetImageProvider.url
- Add StreetImageProviderNameEnum to ENUM_TO_STRAWBERRY_ENUMS (main/graphql/enum)
… support - Expose StreetImageProviderNameEnum from backend via GraphQL and consume it in EnumsContext, replacing the hardcoded frontend enum - Remove StreetImageProviderInput/constants.ts (UI enum no longer needed) - Add PANORAMAX_CUSTOM provider option with required URL field - Rename isPano to panoOnly for semantic clarity; move filtering logic to backend (only filters when true) - Simplify StreetImageProviderInput and StreetMapillaryImageFiltersInput by removing unnecessary callback wrappers - Add Panoramax image preview component - Add user-friendly error message when image provider URL is unreachable
2610264 to
7ba77a9
Compare
| /> | ||
| {data.imageProvider?.url && ( | ||
| <TextOutput | ||
| label="Panoramax API URL" |
There was a problem hiding this comment.
Is this label correct? How do we know the url is for Panoramax?
There was a problem hiding this comment.
The url field is only allowed for custom Panoramax API (see https://github.com/mapswipe/mapswipe-backend/blob/3089d827103cc40157930d0ff527ca93d0caa33f/utils/geo/street_image_provider/models.py#L28)
There was a problem hiding this comment.
It's better to check the imageProvider type so that it does not break in the future.
| onChange={setFieldValue} | ||
| disabled={disabled} | ||
| hint="Provide a valid Mapillary organization ID to filter for images belonging to a specific organization. Empty indicates that no filter is set on organization." | ||
| hint="Provide a valid Mapillary organization ID to filter for images belonging to a specific organization. Empty indicates that no filter is set on organization (only Mapillary)." |
There was a problem hiding this comment.
This should be a conditional field if it is only applicable for Mapillary.
| import TextInput from '#components/TextInput'; | ||
|
|
||
| import { PartialStreetMapillaryImageFiltersInputFields } from './schema'; | ||
| import { PartialStreetMapillaryImageFiltersInputFields } from './schema.ts'; |
There was a problem hiding this comment.
We might also need to rename the variables?
e.g. PartialStreetMapillaryImageFiltersInputFields
Depends on mapswipe/mapswipe-backend#236
Changes
This introduces the possibility to create View Streets projects and tutorials with Panoramax as the image provider. Managers can choose to use either the federated Panoramax metacatalog, or a specific Panoramax instance (by providing the API url).
This PR doesn't introduce any:
console.logmeant for debugging