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

'suggest' parameter in combination with 'fformatter' parameter #811

Merged
merged 5 commits into from
Apr 15, 2024

Conversation

wlorenzetti
Copy link
Member

Closes: #810

With this PR now is possible apply suggest parameter for /vector/api/data API REST in combination with 'fformatter' parameter.

The suggest parameter will contain the fformatter field name.

@wlorenzetti wlorenzetti added the feature New feature or request label Apr 12, 2024
@wlorenzetti wlorenzetti added this to the v3.8 milestone Apr 12, 2024
@wlorenzetti wlorenzetti requested a review from Raruto April 12, 2024 13:11
@wlorenzetti wlorenzetti self-assigned this Apr 12, 2024
Copy link
Contributor

@Raruto Raruto left a comment

Choose a reason for hiding this comment

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

KO: 500 internal server error

GET /vector/api/data/qdjango/3/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/?suggest=id_buildings%7Cala&ordering=id_buildings&formatter=1&fformatter=id_buildings
HTTP 500 Internal Server Error
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "result": false,
    "error": {
        "code": "servererror",
        "message": "A error server is occured!",
        "data": "id_buildings doesn't belongs from layer!"
    }
}

docker logs:

2024-04-12 16:06:07 Internal Server Error: /vector/api/data/qdjango/3/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/
2024-04-12 16:06:07 Internal Server Error: /vector/api/data/qdjango/3/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/
2024-04-12 16:06:07 ERROR:django.request:Internal Server Error: /vector/api/data/qdjango/3/buildings_2f43dc1d_6725_42d2_a09b_dd446220104a/

@wlorenzetti
Copy link
Member Author

wlorenzetti commented Apr 12, 2024

#811 (review)

id_buildings doesn't exists inside buildings_2f43dc1d_6725_42d2_a09b_dd446220104a. In this case is the SuggestFilterBackend tha fails. It works with related layers in example buildings_rating_3d535fae_fd04_4df6_b6ff_8cbd13df078f as reported int the issue #810

@Raruto
Copy link
Contributor

Raruto commented Apr 15, 2024

@wlorenzetti I couldn't say why the search widget requested a wrong layer.

Now the building relation search works properly:

image

Can you test the autocomplete address search as well?

It should return something, but instead I get no results:

image

@wlorenzetti
Copy link
Member Author

@Raruto I'm checking this issue, it's very strange, it seems to be due to qgis-server but I have to investigate further.

@wlorenzetti
Copy link
Member Author

@Raruto what version of qgis-server are you using?

@Raruto
Copy link
Contributor

Raruto commented Apr 15, 2024

what version of qgis-server are you using?

@wlorenzetti 3.28.5-Firenze

image

@wlorenzetti
Copy link
Member Author

Ok @Raruto I understand the problem address has a Value Relation widget so suggest param workd on origin address values (A101, A103,...). I think this is is a case not implemented at now.

@Raruto
Copy link
Contributor

Raruto commented Apr 15, 2024

Yes, that case was not handled in v37 either.

Just to remind you, you should test your API changes against the JS code that comes from this PR #787, which depends entirely on the fformatter parameter. *

* ie. that always performs the same kind of HTTP call (regardless of widget type), thus making the overall logic much simpler 😉.

@wlorenzetti
Copy link
Member Author

@Raruto I just speak with @leolami and @volterra79, this feature didn't work at now. So I'll remove the AutoCompleteBox choose when the field has a ValueRelation widget.

@Raruto Raruto marked this pull request as ready for review April 15, 2024 08:31
@Raruto
Copy link
Contributor

Raruto commented Apr 15, 2024

As far as I'm concerned this PR is fine for fix #810 (a RelationReference search).

I'll remove the AutoCompleteBox choose when the field has a ValueRelation widget.

Quite brutal solution, but ok.

@wlorenzetti wlorenzetti changed the title 'suggest' paramter in combination with 'fformatter' parameter 'suggest' parameter in combination with 'fformatter' parameter Apr 15, 2024
@wlorenzetti wlorenzetti merged commit 48c0440 into dev Apr 15, 2024
4 checks passed
@wlorenzetti wlorenzetti deleted the suggested_fformatter branch April 15, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete request for formatted values (suggest + fformatter)
2 participants