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

Options defined in CSS style sheets get a plain text field while they should get a dropdown list or number field #246

Open
bertfrees opened this issue Aug 13, 2024 · 5 comments
Labels
bug Something isn't working ready-for-testing An implementation is ready to be tested
Milestone

Comments

@bertfrees
Copy link
Member

This worked fine in 1.5.0-beta.1.

For example:

Screenshot 2024-08-13 at 13 55 03

In the CLI it still looks correct:

Screenshot 2024-08-13 at 14 01 51

@bertfrees bertfrees added the bug Something isn't working label Aug 13, 2024
@marisademeglio marisademeglio added this to the 1.6 milestone Aug 14, 2024
@marisademeglio
Copy link
Member

The type attribute in the data returned by the web service appears to be wrong. For example, here is a request to /stylesheet-parameters where the type of hyphenation is a UID.

curl -X POST -d "@/Users/marisa/dev/request.xml" http://localhost:49152/ws/stylesheet-parameters
<?xml version="1.0" encoding="UTF-8"?>
<parameters xmlns="http://www.daisy.org/ns/pipeline/data">
<parameter 
  default="auto" 
  description="Hyphenation policy.&#xA;&#xA;The following CSS rule is included by default (where `$hyphenation` is the value of this option):&#xA;&#xA;~~~sass&#xA;:root {&#xA;  hyphens: $hyphenation;&#xA;}&#xA;~~~&#xA;&#xA;This means that words are hyphenated according to the specified policy, except where overridden by&#xA;more specific CSS rules. See the CSS specification for more info:&#xA;&#xA;- the [`hyphens`](http://braillespecs.github.io/braille-css/#the-hyphens-property) property&#xA;&#xA;In addition, special rules may apply at page boundaries, see the &#34;Hyphenation at page boundaries&#34;&#xA;option." 
  name="hyphenation" 
  nicename="Hyphenation" 
  ordered="false" 
  required="false" 
  sequence="false" 
  type="fd09145e-b2d1-4402-a89e-11429100b6a8"/>

....

@bertfrees
Copy link
Member Author

This is due to a change that I forgot to mention (or maybe I thought it didn't matter because of certain assumptions I made about the GUI).

Actually the type attribute is not wrong. But while before, the value would always be either a predefined type (string/boolean/integer/etc.), or the ID of a type contained in the static list of data types that you could fetch with a single /datatypes call, now it can also be an ID of a temporary data type.

The data type definition is temporarily made available through /datatypes/fd09145e-b2d1-4402-a89e-11429100b6a8. I think it stays available one minute after the /stylesheet-parameters call.

@marisademeglio
Copy link
Member

Ah ok ...

While we do look up custom datatypes by ID:
https://github.com/daisy/pipeline-ui/blob/main/src/renderer/components/Fields/CustomField.tsx#L42

The actual fetching of all datatypes happens all at once (every 1000ms):
https://github.com/daisy/pipeline-ui/blob/main/src/main/data/middlewares/pipeline.ts#L388

Would this temporary custom datatype be available at the /datatypes endpoint or is it only available at e.g. /datatypes/fd09145e-b2d1-4402-a89e-11429100b6a8?

@bertfrees
Copy link
Member Author

It's not available at the /datatypes endpoint.

marisademeglio added a commit that referenced this issue Oct 11, 2024
marisademeglio added a commit that referenced this issue Oct 11, 2024
Also improve numeric field options to distinguish float vs int, integer vs non-neg integer
@marisademeglio
Copy link
Member

Development note: I wanted to fetch the temp datatype from the main process but the IPC communication is not robust enough to prevent mixed messages on the front end (literally: one component listening for an IPC fetch response will hear the response of the fetch that another component requested, because the events are using the same channel name).

So I used the in-browser fetch, which works because we start the pipeline with CORS disabled, but this is not necessarily always the case, e.g. with hypothetical remote pipeline engine configs.

Not sure if there's a way to use dynamic channel names, @NPavie any ideas?

marisademeglio added a commit that referenced this issue Oct 11, 2024
Seems to not throw lifecycle errors anymore
@marisademeglio marisademeglio added the ready-for-testing An implementation is ready to be tested label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready-for-testing An implementation is ready to be tested
Projects
Status: In Progress
Development

No branches or pull requests

2 participants