Skip to content

Commit

Permalink
Merge pull request #784 from visualize-admin/feat/better-timeformat-e…
Browse files Browse the repository at this point in the history
…rror

feat: Better timeFormat missing error
  • Loading branch information
bprusinowski authored Oct 20, 2022
2 parents 5a098c6 + c12927d commit 57d4b84
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ You can also check the [release page](https://github.com/visualize-admin/visuali
- Map:
- area & symbol layers now use the same approach as for segment field (optional select element), to be more consistent across the app
- it's now possible to use discrete color mapping in symbol layer
- Errors:
- Make missing timeFormat error message more explicit

## [3.9.6] - 2022-10-12

Expand Down
9 changes: 8 additions & 1 deletion app/components/hint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ export const LoadingDataError = ({ message }: { message?: string }) => (
</Link>

{message ? (
<pre style={{ marginTop: "0.5rem", marginLeft: "1rem", marginBottom: 0 }}>
<pre
style={{
marginTop: "0.5rem",
marginLeft: "1rem",
marginBottom: 0,
whiteSpace: "pre-wrap",
}}
>
{message}
</pre>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion app/docs/rdf-to-visualize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ called _Shared dimensions_, and their values will be fetched outside the cube.
| `?dimension cube:meta/dataKind schema:GeoCoordinates` | `dim.dataKind = "GeoCoordinates"` |
| `?dimension cube:meta/dataKind schema:GeoShape` | `dim.dataKind = "GeoShape"` |

ℹ️ Temporal dimensions can be interactively filtered with a _time range slider_
ℹ️ Temporal dimensions can be interactively filtered with a _time range slider_. **Important note**: in order to be able to properly parse temporal dimension, make sure it's scale it set to Interval!

ℹ️ GeoCoordinates dimensions can be shown on a map as _points_

Expand Down
10 changes: 9 additions & 1 deletion app/graphql/resolvers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,15 @@ export const resolvers: Resolvers = {
TemporalDimension: {
...mkDimensionResolvers("TemporalDimension"),
timeUnit: ({ data: { timeUnit } }) => timeUnit!,
timeFormat: ({ data: { timeFormat } }) => timeFormat!,
timeFormat: ({ data }) => {
if (data.timeFormat === undefined) {
throw new Error(
`Time format couldn't be retrieved for ${data.name}. Make sure it's set up properly in the Cube Creator – if it is, make sure that the interval scale is selected for this dimension (or remove time description if it's not a temporal dimension).`
);
}

return data.timeFormat;
},
},
GeoCoordinatesDimension: {
...mkDimensionResolvers("GeoCoordinatesDimension"),
Expand Down

1 comment on commit 57d4b84

@vercel
Copy link

@vercel vercel bot commented on 57d4b84 Oct 20, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.